diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:20:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:28:57 +0000 |
commit | d17ea114e5ef69ad5d5d7413280a13e6428098aa (patch) | |
tree | 2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/content/common | |
parent | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff) | |
download | qtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz |
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/content/common')
185 files changed, 1645 insertions, 1779 deletions
diff --git a/chromium/content/common/BUILD.gn b/chromium/content/common/BUILD.gn index 6e997330a43..397d9172812 100644 --- a/chromium/content/common/BUILD.gn +++ b/chromium/content/common/BUILD.gn @@ -6,9 +6,10 @@ import("features.gni") import("//build/buildflag_header.gni") import("//build/config/features.gni") import("//build/config/ui.gni") +import("//ipc/features.gni") import("//media/media_options.gni") import("//mojo/public/tools/bindings/mojom.gni") -import("//ppapi/features/features.gni") +import("//ppapi/buildflags/buildflags.gni") import("//sandbox/features.gni") import("//tools/ipc_fuzzer/ipc_fuzzer.gni") if (is_mac) { @@ -17,8 +18,8 @@ if (is_mac) { # For feature flags internal to content. See content/public/common:features # for feature flags that clients of contents need to know about. -buildflag_header("features") { - header = "features.h" +buildflag_header("buildflags") { + header = "buildflags.h" flags = [ "USE_EXTERNAL_POPUP_MENU=$use_external_popup_menu", @@ -36,7 +37,6 @@ source_set("common") { sources = [ "accessibility_messages.h", "all_messages.h", - "android/browser_side_navigation_policy_android.cc", "android/gin_java_bridge_errors.cc", "android/gin_java_bridge_errors.h", "android/gin_java_bridge_value.cc", @@ -65,7 +65,6 @@ source_set("common") { "browser_plugin/browser_plugin_constants.cc", "browser_plugin/browser_plugin_constants.h", "browser_plugin/browser_plugin_messages.h", - "cache_storage/cache_storage_messages.h", "cache_storage/cache_storage_types.cc", "cache_storage/cache_storage_types.h", "child_process_host_impl.cc", @@ -96,8 +95,6 @@ source_set("common") { "content_security_policy_header.h", "content_switches_internal.cc", "content_switches_internal.h", - "cross_site_document_classifier.cc", - "cross_site_document_classifier.h", "cursors/webcursor.cc", "cursors/webcursor.h", "cursors/webcursor_android.cc", @@ -130,6 +127,8 @@ source_set("common") { "font_list_fontconfig.cc", "font_list_mac.mm", "font_list_win.cc", + "font_loader_dispatcher_mac.cc", + "font_loader_dispatcher_mac.h", "frame_message_enums.h", "frame_message_structs.cc", "frame_message_structs.h", @@ -139,6 +138,8 @@ source_set("common") { "frame_owner_properties.h", "frame_replication_state.cc", "frame_replication_state.h", + "frame_resize_params.cc", + "frame_resize_params.h", "gin_java_bridge_messages.h", "in_process_child_thread_params.cc", "in_process_child_thread_params.h", @@ -214,7 +215,6 @@ source_set("common") { "media/media_stream_controls.h", "media/media_stream_param_traits.cc", "media/media_stream_param_traits.h", - "media/media_stream_track_metrics_host_messages.h", "media/midi_messages.h", "media/peer_connection_tracker_messages.h", "media/surface_view_manager_messages_android.h", @@ -267,7 +267,6 @@ source_set("common") { "send_zygote_child_ping_linux.cc", "service_manager/service_manager_connection_impl.cc", "service_manager/service_manager_connection_impl.h", - "service_worker/embedded_worker_messages.h", "service_worker/service_worker_loader_helpers.cc", "service_worker/service_worker_loader_helpers.h", "service_worker/service_worker_messages.h", @@ -300,8 +299,6 @@ source_set("common") { "user_agent.cc", "view_message_enums.h", "view_messages.h", - "weak_wrapper_shared_url_loader_factory.cc", - "weak_wrapper_shared_url_loader_factory.h", "wrapper_shared_url_loader_factory.cc", "wrapper_shared_url_loader_factory.h", "zygote_commands_linux.h", @@ -320,17 +317,18 @@ source_set("common") { "//ipc", "//services/network:network_service", "//services/service_manager/sandbox", - "//third_party/WebKit/public:blink_headers", - "//third_party/WebKit/public/common", + "//third_party/blink/public:blink_headers", + "//third_party/blink/public/common", "//ui/accessibility", ] deps = [ - ":features", + ":buildflags", "//base", "//base/third_party/dynamic_annotations", "//build/util:webkit_version", "//cc/ipc", "//components/discardable_memory/common", + "//components/services/filesystem/public/interfaces", "//components/tracing", "//components/tracing:startup_tracing", "//components/viz/service", @@ -338,7 +336,7 @@ source_set("common") { "//content/app/resources", "//content/public/common:interfaces", "//content/public/common:service_names", - "//content/public/common:zygote_features", + "//content/public/common:zygote_buildflags", "//device/base/synchronization", "//device/bluetooth", "//gpu", @@ -355,17 +353,17 @@ source_set("common") { "//media/base/ipc", "//media/capture", "//media/capture/ipc", - "//media/gpu:features", + "//media/gpu:buildflags", "//media/gpu/ipc/client", "//media/gpu/ipc/common", "//media/midi", "//media/midi:mojo", - "//mojo/common:common_base", - "//mojo/edk/system", + "//mojo/edk", + "//mojo/public/cpp/system", "//net", - "//ppapi/features", + "//ppapi/buildflags", "//sandbox", - "//sandbox:sandbox_features", + "//sandbox:sandbox_buildflags", "//services/network/public/cpp", "//services/network/public/mojom", "//services/resource_coordinator/public/cpp:resource_coordinator_cpp", @@ -532,6 +530,11 @@ mojom("mojo_bindings") { # indexed_db.mojom uses a native typemap that is not available in Java. cpp_only = true + # imports vs deps check is disabled for this target to work around + # windows multiple definitions linker error caused by having + # both a direct and an indirect dependency on the same target + skip_deps_check = true + sources = [ "appcache.mojom", "associated_interfaces.mojom", @@ -589,31 +592,49 @@ mojom("mojo_bindings") { sources += [ "dwrite_font_proxy.mojom" ] } + if (is_mac) { + sources += [ "font_loader_mac.mojom" ] + } + + enabled_features = [] + if (enable_ipc_logging) { + enabled_features += [ "ipc_logging" ] + } + if (is_linux || is_chromeos) { + enabled_features += [ "supports_thread_priorities" ] + } + import_dirs = [ "//mojo/services" ] public_deps = [ - "//components/leveldb/public/interfaces", + "//components/services/leveldb/public/interfaces", "//content/public/common:interfaces", + "//content/public/common:resource_type_bindings", "//ipc:mojom_constants", "//media/mojo/interfaces", - "//mojo/common:common_custom_types", + "//mojo/public/mojom/base", "//services/network/public/mojom", "//services/service_manager/public/mojom", "//services/ui/public/interfaces", + "//services/ui/public/interfaces/ime", "//services/video_capture/public/mojom", "//services/viz/public/interfaces", "//skia/public/interfaces", - "//third_party/WebKit/public:mojo_bindings", - "//third_party/WebKit/public/mojom", + "//third_party/blink/public:mojo_bindings", + "//third_party/blink/public:web_feature_mojo_bindings", + "//third_party/blink/public/mojom:mojom_core", "//ui/base/mojo:mojo_bindings", + "//ui/events/mojo:interfaces", "//ui/gfx/geometry/mojo", "//ui/gfx/mojo", + "//ui/gfx/range/mojo", + "//ui/latency/mojo:interfaces", "//url/mojom:url_mojom_gurl", "//url/mojom:url_mojom_origin", ] - overridden_deps = [ "//third_party/WebKit/public/mojom" ] - component_deps = [ "//third_party/WebKit/public/common" ] + overridden_deps = [ "//third_party/blink/public/mojom:mojom_core" ] + component_deps = [ "//third_party/blink/public/common" ] component_output_prefix = "content_common_mojo_bindings" export_class_attribute = "CONTENT_EXPORT" diff --git a/chromium/content/common/DEPS b/chromium/content/common/DEPS index 66e580071ad..17e3223f618 100644 --- a/chromium/content/common/DEPS +++ b/chromium/content/common/DEPS @@ -12,77 +12,78 @@ include_rules = [ "+services/service_manager/public/cpp", "+services/service_manager/sandbox", "+services/video_capture/public/mojom", + "+services/viz/public/cpp", "+services/viz/public/interfaces", # No inclusion of WebKit from the browser, other than the ones in # WebKit/public/{mojom,common}, or the ones that are strictly enum/POD, # header-only types, and some selected common code. - "-third_party/WebKit", - "+third_party/WebKit/public/common", - "+third_party/WebKit/public/mojom", - "+third_party/WebKit/public/platform/WebAddressSpace.h", - "+third_party/WebKit/public/platform/WebContentSecurityPolicy.h", - "+third_party/WebKit/public/platform/WebDisplayMode.h", - "+third_party/WebKit/public/platform/WebDragOperation.h", - "+third_party/WebKit/public/platform/WebFloatPoint.h", - "+third_party/WebKit/public/platform/WebFloatRect.h", - "+third_party/WebKit/public/platform/WebFocusType.h", - "+third_party/WebKit/public/platform/WebFullscreenVideoStatus.h", - "+third_party/WebKit/public/platform/WebGestureEvent.h", - "+third_party/WebKit/public/platform/WebHTTPBody.h", - "+third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h", - "+third_party/WebKit/public/platform/WebInputEvent.h", - "+third_party/WebKit/public/platform/WebInsecureRequestPolicy.h", - "+third_party/WebKit/public/platform/WebIntrinsicSizingInfo.h", - "+third_party/WebKit/public/platform/WebKeyboardEvent.h", - "+third_party/WebKit/public/platform/WebMixedContentContextType.h", - "+third_party/WebKit/public/platform/WebMouseWheelEvent.h", - "+third_party/WebKit/public/platform/WebPointerProperties.h", - "+third_party/WebKit/public/platform/WebOriginTrialTokenStatus.h", - "+third_party/WebKit/public/platform/WebPageVisibilityState.h", - "+third_party/WebKit/public/platform/WebReferrerPolicy.h", - "+third_party/WebKit/public/platform/WebScreenInfo.h", - "+third_party/WebKit/public/platform/WebScrollbarButtonsPlacement.h", - "+third_party/WebKit/public/platform/WebScrollIntoViewParams.h", - "+third_party/WebKit/public/platform/WebStorageArea.h", - "+third_party/WebKit/public/platform/WebSuddenTerminationDisablerType.h", - "+third_party/WebKit/public/platform/WebTouchEvent.h", - "+third_party/WebKit/public/platform/linux/WebFallbackFont.h", - "+third_party/WebKit/public/platform/mac/WebScrollbarTheme.h", - "+third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom.h", - "+third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h", - "+third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h", - "+third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h", - "+third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom.h", - "+third_party/WebKit/public/platform/modules/fetch/fetch_api_response.mojom.h", - "+third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h", - "+third_party/WebKit/public/platform/modules/mediasession/media_session.mojom.h", - "+third_party/WebKit/public/platform/modules/mediastream/media_devices.mojom.h", - "+third_party/WebKit/public/platform/modules/permissions/permission.mojom.h", - "+third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h", - "+third_party/WebKit/public/platform/modules/presentation/presentation.mojom.h", - "+third_party/WebKit/public/platform/modules/push_messaging/WebPushError.h", - "+third_party/WebKit/public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h", - "+third_party/WebKit/public/platform/modules/screen_orientation/WebLockOrientationError.h", - "+third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h", - "+third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h", - "+third_party/WebKit/public/platform/modules/payments/WebPaymentAppRequest.h", - "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerClientType.h", - "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h", - "+third_party/WebKit/public/web/WebAXEnums.h", - "+third_party/WebKit/public/web/WebDeviceEmulationParams.h", - "+third_party/WebKit/public/web/WebDragStatus.h", - "+third_party/WebKit/public/web/WebFindOptions.h", - "+third_party/WebKit/public/web/WebFrameOwnerProperties.h", - "+third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h", - "+third_party/WebKit/public/web/WebImeTextSpan.h", - "+third_party/WebKit/public/web/WebMediaPlayerAction.h", - "+third_party/WebKit/public/web/WebPluginAction.h", - "+third_party/WebKit/public/web/WebPopupType.h", - "+third_party/WebKit/public/web/WebSharedWorkerCreationContextType.h", - "+third_party/WebKit/public/web/WebSharedWorkerCreationErrors.h", - "+third_party/WebKit/public/web/WebTextDirection.h", - "+third_party/WebKit/public/web/WebTreeScopeType.h", - "+third_party/WebKit/public/web/WebTriggeringEventInfo.h", - "+third_party/WebKit/public/web/win/WebFontRendering.h", + "-third_party/blink", + "+third_party/blink/public/common", + "+third_party/blink/public/mojom", + "+third_party/blink/public/platform/WebAddressSpace.h", + "+third_party/blink/public/platform/web_content_security_policy.h", + "+third_party/blink/public/platform/web_display_mode.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_referrer_policy.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_storage_area.h", + "+third_party/blink/public/platform/web_sudden_termination_disabler_type.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/bluetooth/web_bluetooth.mojom.h", + "+third_party/blink/public/platform/modules/cache_storage/cache_storage.mojom.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/fetch/fetch_api_request.mojom.h", + "+third_party/blink/public/platform/modules/fetch/fetch_api_response.mojom.h", + "+third_party/blink/public/platform/modules/indexeddb/web_idb_types.h", + "+third_party/blink/public/platform/modules/mediasession/media_session.mojom.h", + "+third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h", + "+third_party/blink/public/platform/modules/permissions/permission.mojom.h", + "+third_party/blink/public/platform/modules/permissions/permission_status.mojom.h", + "+third_party/blink/public/platform/modules/presentation/presentation.mojom.h", + "+third_party/blink/public/platform/modules/push_messaging/web_push_error.h", + "+third_party/blink/public/platform/modules/remoteplayback/web_remote_playback_availability.h", + "+third_party/blink/public/platform/modules/screen_orientation/web_lock_orientation_error.h", + "+third_party/blink/public/platform/modules/screen_orientation/web_screen_orientation_lock_type.h", + "+third_party/blink/public/platform/modules/screen_orientation/web_screen_orientation_type.h", + "+third_party/blink/public/platform/modules/payments/WebPaymentAppRequest.h", + "+third_party/blink/public/platform/modules/serviceworker/WebServiceWorkerClientType.h", + "+third_party/blink/public/platform/modules/serviceworker/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_find_options.h", + "+third_party/blink/public/web/web_frame_owner_properties.h", + "+third_party/blink/public/web/web_frame_serializer_cache_control_policy.h", + "+third_party/blink/public/web/web_ime_text_span.h", + "+third_party/blink/public/web/web_media_player_action.h", + "+third_party/blink/public/web/web_plugin_action.h", + "+third_party/blink/public/web/web_popup_type.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/web_triggering_event_info.h", + "+third_party/blink/public/web/win/web_font_rendering.h", ] diff --git a/chromium/content/common/accessibility_messages.h b/chromium/content/common/accessibility_messages.h index 2fa64a2fdfb..c97b2ae083f 100644 --- a/chromium/content/common/accessibility_messages.h +++ b/chromium/content/common/accessibility_messages.h @@ -9,12 +9,13 @@ #include "content/common/ax_content_node_data.h" #include "content/common/content_export.h" +#include "content/common/content_param_traits.h" #include "content/common/view_message_enums.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/WebKit/public/web/WebAXEnums.h" +#include "third_party/blink/public/web/web_ax_enums.h" #include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_relative_bounds.h" @@ -28,7 +29,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::AXContentIntAttribute, content::AX_CONTENT_INT_ATTRIBUTE_LAST) -IPC_ENUM_TRAITS_MAX_VALUE(ax::mojom::Action, ax::mojom::Action::kLast) +IPC_ENUM_TRAITS_MAX_VALUE(ax::mojom::Action, ax::mojom::Action::kMaxValue) IPC_STRUCT_TRAITS_BEGIN(ui::AXActionData) IPC_STRUCT_TRAITS_MEMBER(action) @@ -182,8 +183,9 @@ 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_ROUTED1(AccessibilityMsg_SnapshotTree, - int /* callback id */) +IPC_MESSAGE_ROUTED2(AccessibilityMsg_SnapshotTree, + int /* callback id */, + ui::AXMode /* ax_mode */) // Messages sent from the renderer to the browser. diff --git a/chromium/content/common/all_messages.h b/chromium/content/common/all_messages.h index 31cc3abb117..be7d1f42c70 100644 --- a/chromium/content/common/all_messages.h +++ b/chromium/content/common/all_messages.h @@ -8,7 +8,7 @@ // ipc/ipc_message_start.h to ensure the corresponding message file is // included here. // -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "content/common/content_message_generator.h" #if BUILDFLAG(ENABLE_PLUGINS) diff --git a/chromium/content/common/android/browser_side_navigation_policy_android.cc b/chromium/content/common/android/browser_side_navigation_policy_android.cc deleted file mode 100644 index a14dddd40f9..00000000000 --- a/chromium/content/common/android/browser_side_navigation_policy_android.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 <jni.h> - -#include "base/android/scoped_java_ref.h" -#include "content/public/common/browser_side_navigation_policy.h" -#include "jni/BrowserSideNavigationPolicy_jni.h" - -using base::android::JavaParamRef; - -namespace content { - -jboolean JNI_BrowserSideNavigationPolicy_IsBrowserSideNavigationEnabled( - JNIEnv* env, - const JavaParamRef<jclass>& clazz) { - return IsBrowserSideNavigationEnabled(); -} - -} // namespace content diff --git a/chromium/content/common/associated_interface_provider_impl.cc b/chromium/content/common/associated_interface_provider_impl.cc index d58763218d8..ba5ef4044e0 100644 --- a/chromium/content/common/associated_interface_provider_impl.cc +++ b/chromium/content/common/associated_interface_provider_impl.cc @@ -12,10 +12,12 @@ namespace content { class AssociatedInterfaceProviderImpl::LocalProvider : public mojom::AssociatedInterfaceProvider { public: - explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) + LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) : associated_interface_provider_binding_(this) { associated_interface_provider_binding_.Bind( - mojo::MakeRequestAssociatedWithDedicatedPipe(proxy)); + mojo::MakeRequestAssociatedWithDedicatedPipe(proxy), + std::move(task_runner)); } ~LocalProvider() override {} @@ -46,13 +48,16 @@ class AssociatedInterfaceProviderImpl::LocalProvider }; AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl( - mojom::AssociatedInterfaceProviderAssociatedPtr proxy) - : proxy_(std::move(proxy)) { + mojom::AssociatedInterfaceProviderAssociatedPtr proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : proxy_(std::move(proxy)), task_runner_(std::move(task_runner)) { DCHECK(proxy_.is_bound()); } -AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl() - : local_provider_(std::make_unique<LocalProvider>(&proxy_)) {} +AssociatedInterfaceProviderImpl::AssociatedInterfaceProviderImpl( + scoped_refptr<base::SingleThreadTaskRunner> task_runner) + : local_provider_(std::make_unique<LocalProvider>(&proxy_, task_runner)), + task_runner_(std::move(task_runner)) {} AssociatedInterfaceProviderImpl::~AssociatedInterfaceProviderImpl() {} @@ -69,7 +74,7 @@ void AssociatedInterfaceProviderImpl::OverrideBinderForTesting( if (!local_provider_) { DCHECK(proxy_.is_bound()); proxy_.reset(); - local_provider_ = std::make_unique<LocalProvider>(&proxy_); + local_provider_ = std::make_unique<LocalProvider>(&proxy_, task_runner_); } local_provider_->SetBinderForName(name, binder); } diff --git a/chromium/content/common/associated_interface_provider_impl.h b/chromium/content/common/associated_interface_provider_impl.h index b1fca4422ee..91d196c4c90 100644 --- a/chromium/content/common/associated_interface_provider_impl.h +++ b/chromium/content/common/associated_interface_provider_impl.h @@ -5,7 +5,7 @@ #ifndef CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_ #define CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_ -#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_provider.h" +#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h" #include <stdint.h> #include <memory> @@ -19,12 +19,21 @@ class AssociatedInterfaceProviderImpl : public blink::AssociatedInterfaceProvider { public: // Binds this to a remote mojom::AssociatedInterfaceProvider. + // + // |task_runner| must belong to the same thread. It will be used to dispatch + // all callbacks and connection error notification. explicit AssociatedInterfaceProviderImpl( - mojom::AssociatedInterfaceProviderAssociatedPtr proxy); + mojom::AssociatedInterfaceProviderAssociatedPtr proxy, + scoped_refptr<base::SingleThreadTaskRunner> task_runner = nullptr); + // Constructs a local provider with no remote interfaces. This is useful in // conjunction with OverrideBinderForTesting(), in test environments where // there may not be a remote |mojom::AssociatedInterfaceProvider| available. - AssociatedInterfaceProviderImpl(); + // + // |task_runner| must belong to the same thread. It will be used to dispatch + // all callbacks and connection error notification. + explicit AssociatedInterfaceProviderImpl( + scoped_refptr<base::SingleThreadTaskRunner> task_runner); ~AssociatedInterfaceProviderImpl() override; // AssociatedInterfaceProvider: @@ -41,6 +50,7 @@ class AssociatedInterfaceProviderImpl mojom::AssociatedInterfaceProviderAssociatedPtr proxy_; std::unique_ptr<LocalProvider> local_provider_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; DISALLOW_COPY_AND_ASSIGN(AssociatedInterfaceProviderImpl); }; diff --git a/chromium/content/common/associated_interface_registry_impl.h b/chromium/content/common/associated_interface_registry_impl.h index ae28f1994ed..4ee97c1bec4 100644 --- a/chromium/content/common/associated_interface_registry_impl.h +++ b/chromium/content/common/associated_interface_registry_impl.h @@ -11,7 +11,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" -#include "third_party/WebKit/public/common/associated_interfaces/associated_interface_registry.h" +#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" namespace content { diff --git a/chromium/content/common/background_fetch/DEPS b/chromium/content/common/background_fetch/DEPS index c0c3af0fbea..0cf92f853e8 100644 --- a/chromium/content/common/background_fetch/DEPS +++ b/chromium/content/common/background_fetch/DEPS @@ -1,3 +1,3 @@ include_rules = [ - "+third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom.h", + "+third_party/blink/public/platform/modules/background_fetch/background_fetch.mojom.h", ] diff --git a/chromium/content/common/background_fetch/background_fetch_struct_traits.h b/chromium/content/common/background_fetch/background_fetch_struct_traits.h index 22ccecbc9fc..aaf094ed9c2 100644 --- a/chromium/content/common/background_fetch/background_fetch_struct_traits.h +++ b/chromium/content/common/background_fetch/background_fetch_struct_traits.h @@ -11,7 +11,7 @@ #include "content/common/background_fetch/background_fetch_types.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/struct_traits.h" -#include "third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom.h" +#include "third_party/blink/public/platform/modules/background_fetch/background_fetch.mojom.h" namespace content { namespace mojom { diff --git a/chromium/content/common/background_fetch/background_fetch_types.typemap b/chromium/content/common/background_fetch/background_fetch_types.typemap index 9fce85f3b10..57d741b2848 100644 --- a/chromium/content/common/background_fetch/background_fetch_types.typemap +++ b/chromium/content/common/background_fetch/background_fetch_types.typemap @@ -2,14 +2,14 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom" +mojom = "//third_party/blink/public/platform/modules/background_fetch/background_fetch.mojom" public_headers = [ "//content/common/background_fetch/background_fetch_types.h" ] traits_headers = [ "//content/common/background_fetch/background_fetch_struct_traits.h" ] deps = [ "//mojo/public/cpp/bindings", - "//third_party/WebKit/public:blink_headers", + "//third_party/blink/public:blink_headers", ] type_mappings = [ "blink.mojom.BackgroundFetchOptions=content::BackgroundFetchOptions", diff --git a/chromium/content/common/bluetooth/web_bluetooth_device_id.typemap b/chromium/content/common/bluetooth/web_bluetooth_device_id.typemap index 7f07b52b538..59ed7ecc31c 100644 --- a/chromium/content/common/bluetooth/web_bluetooth_device_id.typemap +++ b/chromium/content/common/bluetooth/web_bluetooth_device_id.typemap @@ -3,7 +3,7 @@ # found in the LICENSE file. mojom = - "//third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom" + "//third_party/blink/public/platform/modules/bluetooth/web_bluetooth.mojom" public_headers = [ "//content/common/bluetooth/web_bluetooth_device_id.h" ] traits_headers = [ "//content/common/bluetooth/web_bluetooth_device_id_struct_traits.h" ] diff --git a/chromium/content/common/bluetooth/web_bluetooth_device_id_struct_traits.h b/chromium/content/common/bluetooth/web_bluetooth_device_id_struct_traits.h index 08b9f11edbf..1ce512bff0a 100644 --- a/chromium/content/common/bluetooth/web_bluetooth_device_id_struct_traits.h +++ b/chromium/content/common/bluetooth/web_bluetooth_device_id_struct_traits.h @@ -8,7 +8,7 @@ #include <string> #include "content/common/bluetooth/web_bluetooth_device_id.h" -#include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.mojom.h" +#include "third_party/blink/public/platform/modules/bluetooth/web_bluetooth.mojom.h" namespace mojo { diff --git a/chromium/content/common/browser_plugin/browser_plugin_messages.h b/chromium/content/common/browser_plugin/browser_plugin_messages.h index 80b3ab8b8a0..87991910cd3 100644 --- a/chromium/content/common/browser_plugin/browser_plugin_messages.h +++ b/chromium/content/common/browser_plugin/browser_plugin_messages.h @@ -15,15 +15,16 @@ #include "content/common/content_param_traits.h" #include "content/common/cursors/webcursor.h" #include "content/common/edit_command.h" +#include "content/common/frame_resize_params.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/WebKit/public/platform/WebDragOperation.h" -#include "third_party/WebKit/public/platform/WebFocusType.h" -#include "third_party/WebKit/public/web/WebDragStatus.h" -#include "third_party/WebKit/public/web/WebImeTextSpan.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" @@ -155,12 +156,10 @@ IPC_MESSAGE_CONTROL1(BrowserPluginHostMsg_UnlockMouse_ACK, int /* browser_plugin_instance_id */) // Sent when plugin's position has changed. -IPC_MESSAGE_CONTROL5(BrowserPluginHostMsg_UpdateResizeParams, +IPC_MESSAGE_CONTROL3(BrowserPluginHostMsg_UpdateResizeParams, int /* browser_plugin_instance_id */, - gfx::Rect /* frame_rect */, - content::ScreenInfo /* screen_info */, - uint64_t /* sequence_number */, - viz::LocalSurfaceId /* local_surface_id */) + viz::LocalSurfaceId /* local_surface_id */, + content::FrameResizeParams /* resize_params */) // ----------------------------------------------------------------------------- // These messages are from the browser process to the embedder. @@ -194,6 +193,18 @@ IPC_MESSAGE_CONTROL2(BrowserPluginMsg_ResizeDueToAutoResize, int /* browser_plugin_instance_id */, uint64_t /* sequence_number */) +// 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, diff --git a/chromium/content/common/cache_storage/cache_storage.typemap b/chromium/content/common/cache_storage/cache_storage.typemap index 85db1bb1fb7..b04b8896324 100644 --- a/chromium/content/common/cache_storage/cache_storage.typemap +++ b/chromium/content/common/cache_storage/cache_storage.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom" +mojom = "//third_party/blink/public/platform/modules/cache_storage/cache_storage.mojom" public_headers = [ "//content/common/cache_storage/cache_storage_types.h", "//content/common/service_worker/service_worker_types.h", diff --git a/chromium/content/common/cache_storage/cache_storage_messages.h b/chromium/content/common/cache_storage/cache_storage_messages.h deleted file mode 100644 index f739e4bbd75..00000000000 --- a/chromium/content/common/cache_storage/cache_storage_messages.h +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_ -#define CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_ - -#include <string> -#include <vector> - -#include "base/strings/string16.h" -#include "content/common/cache_storage/cache_storage_types.h" -#include "content/common/service_worker/service_worker_types.h" -#include "ipc/ipc_message_macros.h" -#include "ipc/ipc_param_traits.h" -#include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h" -#include "url/origin.h" - -#undef IPC_MESSAGE_EXPORT -#define IPC_MESSAGE_EXPORT CONTENT_EXPORT - -#define IPC_MESSAGE_START CacheStorageMsgStart - -// TODO(jsbell): This depends on traits for content::ServiceWorkerResponse -// which are defined in service_worker_messages.h - correct this implicit -// cross-dependency. - -IPC_STRUCT_TRAITS_BEGIN(content::CacheStorageCacheQueryParams) - IPC_STRUCT_TRAITS_MEMBER(ignore_search) - IPC_STRUCT_TRAITS_MEMBER(ignore_method) - IPC_STRUCT_TRAITS_MEMBER(ignore_vary) - IPC_STRUCT_TRAITS_MEMBER(cache_name) -IPC_STRUCT_TRAITS_END() - -IPC_ENUM_TRAITS_MAX_VALUE(content::CacheStorageCacheOperationType, - content::CACHE_STORAGE_CACHE_OPERATION_TYPE_LAST) - -IPC_STRUCT_TRAITS_BEGIN(content::CacheStorageBatchOperation) - IPC_STRUCT_TRAITS_MEMBER(operation_type) - IPC_STRUCT_TRAITS_MEMBER(request) - IPC_STRUCT_TRAITS_MEMBER(response) - IPC_STRUCT_TRAITS_MEMBER(match_params) -IPC_STRUCT_TRAITS_END() - -IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::CacheStorageError, - blink::mojom::CacheStorageError::kLast) - -//--------------------------------------------------------------------------- -// Messages sent from the child process to the browser. - -// CacheStorage operations in the browser. -IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageHas, - int /* thread_id */, - int /* request_id */, - url::Origin /* origin */, - base::string16 /* fetch_store_name */) - -IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageOpen, - int /* thread_id */, - int /* request_id */, - url::Origin /* origin */, - base::string16 /* fetch_store_name */) - -IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageDelete, - int /* thread_id */, - int /* request_id */, - url::Origin /* origin */, - base::string16 /* fetch_store_name */) - -IPC_MESSAGE_CONTROL3(CacheStorageHostMsg_CacheStorageKeys, - int /* thread_id */, - int /* request_id */, - url::Origin /* origin */) - -IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheStorageMatch, - int /* thread_id */, - int /* request_id */, - url::Origin /* origin */, - content::ServiceWorkerFetchRequest, - content::CacheStorageCacheQueryParams) - -// Cache operations in the browser. -IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheMatch, - int /* thread_id */, - int /* request_id */, - int /* cache_id */, - content::ServiceWorkerFetchRequest, - content::CacheStorageCacheQueryParams) - -IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheMatchAll, - int /* thread_id */, - int /* request_id */, - int /* cache_id */, - content::ServiceWorkerFetchRequest, - content::CacheStorageCacheQueryParams) - -IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheKeys, - int /* thread_id */, - int /* request_id */, - int /* cache_id */, - content::ServiceWorkerFetchRequest, - content::CacheStorageCacheQueryParams) - -IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheBatch, - int /* thread_id */, - int /* request_id */, - int /* cache_id */, - std::vector<content::CacheStorageBatchOperation>) - -IPC_MESSAGE_CONTROL1(CacheStorageHostMsg_CacheClosed, - int /* cache_id */) - -IPC_MESSAGE_CONTROL1(CacheStorageHostMsg_BlobDataHandled, - std::string /* uuid */) - -//--------------------------------------------------------------------------- -// Messages sent from the browser to the child process. -// -// All such messages must includes thread_id as the first int; it is read off -// by CacheStorageMessageFilter::GetWorkerThreadIdForMessage to route delivery -// to the appropriate thread. - -// Sent at successful completion of CacheStorage operations. -IPC_MESSAGE_CONTROL2(CacheStorageMsg_CacheStorageHasSuccess, - int /* thread_id */, - int /* request_id */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageOpenSuccess, - int /* thread_id */, - int /* request_id */, - int /* fetch_store_id */) -IPC_MESSAGE_CONTROL2(CacheStorageMsg_CacheStorageDeleteSuccess, - int /* thread_id */, - int /* request_id */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageKeysSuccess, - int /* thread_id */, - int /* request_id */, - std::vector<base::string16> /* keys */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageMatchSuccess, - int /* thread_id */, - int /* request_id */, - content::ServiceWorkerResponse) - -// Sent at erroneous completion of CacheStorage operations. -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageHasError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError /* reason */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageOpenError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError /* reason */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageDeleteError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError /* reason */) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageMatchError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError) - -// Sent at successful completion of Cache operations. -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchSuccess, - int /* thread_id */, - int /* request_id */, - content::ServiceWorkerResponse) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchAllSuccess, - int /* thread_id */, - int /* request_id */, - std::vector<content::ServiceWorkerResponse>) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheKeysSuccess, - int /* thread_id */, - int /* request_id */, - std::vector<content::ServiceWorkerFetchRequest>) -IPC_MESSAGE_CONTROL2(CacheStorageMsg_CacheBatchSuccess, - int /* thread_id */, - int /* request_id */) - -// Sent at erroneous completion of CacheStorage operations. -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchAllError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheKeysError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError) -IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheBatchError, - int /* thread_id */, - int /* request_id */, - blink::mojom::CacheStorageError) - -#endif // CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_ diff --git a/chromium/content/common/cache_storage/cache_storage_mojom_traits.h b/chromium/content/common/cache_storage/cache_storage_mojom_traits.h index bf4d98cbc1a..764b68d4b7d 100644 --- a/chromium/content/common/cache_storage/cache_storage_mojom_traits.h +++ b/chromium/content/common/cache_storage/cache_storage_mojom_traits.h @@ -15,7 +15,7 @@ #include "content/common/service_worker/service_worker_fetch_response_mojom_traits.h" #include "content/common/service_worker/service_worker_types.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" -#include "third_party/WebKit/public/platform/modules/cache_storage/cache_storage.mojom.h" +#include "third_party/blink/public/platform/modules/cache_storage/cache_storage.mojom.h" #include "url/gurl.h" namespace mojo { diff --git a/chromium/content/common/child_control.mojom b/chromium/content/common/child_control.mojom index a73a317a3fe..733c85c3df3 100644 --- a/chromium/content/common/child_control.mojom +++ b/chromium/content/common/child_control.mojom @@ -9,5 +9,6 @@ interface ChildControl { ProcessShutdown(); // Tell the child process to begin or end IPC message logging. + [EnableIf=ipc_logging] SetIPCLoggingEnabled(bool on); }; diff --git a/chromium/content/common/common_param_traits_unittest.cc b/chromium/content/common/common_param_traits_unittest.cc index 915ca4240df..71b30f65c4d 100644 --- a/chromium/content/common/common_param_traits_unittest.cc +++ b/chromium/content/common/common_param_traits_unittest.cc @@ -11,7 +11,6 @@ #include <utility> #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/values.h" #include "content/common/resource_messages.h" #include "content/public/common/content_constants.h" @@ -208,8 +207,9 @@ TEST(IPCMessageTest, SSLInfo) { EXPECT_TRUE(IPC::ParamTraits<net::SSLInfo>::Read(&msg, &iter, &out)); // Now verify they're equal. - ASSERT_TRUE(in.cert->Equals(out.cert.get())); - ASSERT_TRUE(in.unverified_cert->Equals(out.unverified_cert.get())); + ASSERT_TRUE(in.cert->EqualsIncludingChain(out.cert.get())); + ASSERT_TRUE( + in.unverified_cert->EqualsIncludingChain(out.unverified_cert.get())); ASSERT_EQ(in.security_bits, out.security_bits); ASSERT_EQ(in.key_exchange_group, out.key_exchange_group); ASSERT_EQ(in.connection_status, out.connection_status); diff --git a/chromium/content/common/content_constants_internal.cc b/chromium/content/common/content_constants_internal.cc index d592169a566..5cd58371095 100644 --- a/chromium/content/common/content_constants_internal.cc +++ b/chromium/content/common/content_constants_internal.cc @@ -31,4 +31,6 @@ const int kTraceEventGpuProcessSortIndex = -1; const int kTraceEventRendererMainThreadSortIndex = -1; +const char kDoNotTrackHeader[] = "DNT"; + } // namespace content diff --git a/chromium/content/common/content_constants_internal.h b/chromium/content/common/content_constants_internal.h index ea7461ae5fc..efd36e67724 100644 --- a/chromium/content/common/content_constants_internal.h +++ b/chromium/content/common/content_constants_internal.h @@ -36,6 +36,9 @@ CONTENT_EXPORT extern const int kTraceEventGpuProcessSortIndex; // Constants used to organize content threads in about:tracing. CONTENT_EXPORT extern const int kTraceEventRendererMainThreadSortIndex; +// HTTP header set in requests to indicate they should be marked DoNotTrack. +extern const char kDoNotTrackHeader[]; + } // namespace content #endif // CONTENT_COMMON_CONTENT_CONSTANTS_INTERNAL_H_ diff --git a/chromium/content/common/content_ipc_logging.cc b/chromium/content/common/content_ipc_logging.cc index 6c5f4c92d17..9d2a27de33e 100644 --- a/chromium/content/common/content_ipc_logging.cc +++ b/chromium/content/common/content_ipc_logging.cc @@ -4,7 +4,7 @@ #include <stdint.h> -#include "ipc/ipc_features.h" +#include "ipc/ipc_buildflags.h" #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) #define IPC_MESSAGE_MACROS_LOG_ENABLED diff --git a/chromium/content/common/content_message_generator.h b/chromium/content/common/content_message_generator.h index 604f1a987df..ab5609447eb 100644 --- a/chromium/content/common/content_message_generator.h +++ b/chromium/content/common/content_message_generator.h @@ -16,11 +16,6 @@ #error \ "Failed to include content/common/browser_plugin/browser_plugin_messages.h" #endif -#undef CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_ -#include "content/common/cache_storage/cache_storage_messages.h" -#ifndef CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_ -#error "Failed to include content/common/cache_storage/cache_storage_messages.h" -#endif #undef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MESSAGES_H_ #include "content/common/dom_storage/dom_storage_messages.h" #ifndef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MESSAGES_H_ @@ -67,12 +62,6 @@ #ifndef CONTENT_COMMON_MEDIA_MEDIA_PLAYER_DELEGATE_MESSAGES_H_ #error "Failed to include content/common/media/media_player_delegate_messages.h" #endif -#undef CONTENT_COMMON_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_MESSAGES_H_ -#include "content/common/media/media_stream_track_metrics_host_messages.h" -#ifndef CONTENT_COMMON_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_MESSAGES_H_ -#error \ - "Failed to include content/common/media/media_stream_track_metrics_host_messages.h" -#endif #undef CONTENT_COMMON_MEDIA_MIDI_MESSAGES_H_ #include "content/common/media/midi_messages.h" #ifndef CONTENT_COMMON_MEDIA_MIDI_MESSAGES_H_ @@ -99,12 +88,6 @@ #ifndef CONTENT_COMMON_RESOURCE_MESSAGES_H_ #error "Failed to include content/common/resource_messages.h" #endif -#undef CONTENT_COMMON_SERVICE_WORKER_EMBEDDED_WORKER_MESSAGES_H_ -#include "content/common/service_worker/embedded_worker_messages.h" -#ifndef CONTENT_COMMON_SERVICE_WORKER_EMBEDDED_WORKER_MESSAGES_H_ -#error \ - "Failed to include content/common/service_worker/embedded_worker_messages.h" -#endif #undef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_MESSAGES_H_ #include "content/common/service_worker/service_worker_messages.h" #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_MESSAGES_H_ @@ -126,7 +109,7 @@ #ifndef CONTENT_COMMON_VIEW_MESSAGES_H_ #error "Failed to include content/common/view_messages.h" #endif -#include "media/media_features.h" +#include "media/media_buildflags.h" #undef CONTENT_COMMON_SYNC_COMPOSITOR_MESSAGES_H_ #include "content/common/input/sync_compositor_messages.h" diff --git a/chromium/content/common/content_param_traits.cc b/chromium/content/common/content_param_traits.cc index 038d4fc32ac..be32e05f410 100644 --- a/chromium/content/common/content_param_traits.cc +++ b/chromium/content/common/content_param_traits.cc @@ -11,9 +11,9 @@ #include "ipc/ipc_mojo_message_helper.h" #include "ipc/ipc_mojo_param_traits.h" #include "net/base/ip_endpoint.h" -#include "third_party/WebKit/public/common/message_port/message_port_channel.h" -#include "third_party/WebKit/public/common/message_port/transferable_message.h" -#include "third_party/WebKit/public/mojom/message_port/message_port.mojom.h" +#include "third_party/blink/public/common/message_port/message_port_channel.h" +#include "third_party/blink/public/common/message_port/transferable_message.h" +#include "third_party/blink/public/mojom/message_port/message_port.mojom.h" #include "ui/accessibility/ax_modes.h" #include "ui/base/ui_base_features.h" #include "ui/events/blink/web_input_event_traits.h" @@ -198,7 +198,7 @@ struct ParamTraits<blink::mojom::SerializedBlobPtr> { void ParamTraits<scoped_refptr<base::RefCountedData< blink::TransferableMessage>>>::Write(base::Pickle* m, const param_type& p) { m->WriteData(reinterpret_cast<const char*>(p->data.encoded_message.data()), - p->data.encoded_message.length()); + p->data.encoded_message.size()); WriteParam(m, p->data.blobs); WriteParam(m, p->data.stack_trace_id); WriteParam(m, p->data.stack_trace_debugger_id_first); diff --git a/chromium/content/common/content_param_traits.h b/chromium/content/common/content_param_traits.h index 0c7396db53e..ffe7fc9edc1 100644 --- a/chromium/content/common/content_param_traits.h +++ b/chromium/content/common/content_param_traits.h @@ -18,7 +18,7 @@ #include "content/common/cursors/webcursor.h" #include "ipc/ipc_mojo_param_traits.h" #include "storage/common/blob_storage/blob_handle.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_input_event.h" #include "ui/accessibility/ax_modes.h" namespace blink { diff --git a/chromium/content/common/content_param_traits_macros.h b/chromium/content/common/content_param_traits_macros.h index 6ccdc68d8ec..9dd58cf6618 100644 --- a/chromium/content/common/content_param_traits_macros.h +++ b/chromium/content/common/content_param_traits_macros.h @@ -16,10 +16,10 @@ #include "content/public/common/request_context_type.h" #include "content/public/common/resource_type.h" #include "ipc/ipc_message_macros.h" -#include "third_party/WebKit/public/mojom/page/page_visibility_state.mojom.h" -#include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" -#include "third_party/WebKit/public/web/WebImeTextSpan.h" +#include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" +#include "third_party/blink/public/platform/web_content_security_policy.h" +#include "third_party/blink/public/platform/web_input_event.h" +#include "third_party/blink/public/web/web_ime_text_span.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/ipc/geometry/gfx_param_traits.h" @@ -42,16 +42,18 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(blink::WebInputEvent::Type, blink::WebInputEvent::kTypeFirst, blink::WebInputEvent::kTypeLast) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::PageVisibilityState, - blink::mojom::PageVisibilityState::kLast) + blink::mojom::PageVisibilityState::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::WebImeTextSpan::Type, blink::WebImeTextSpan::Type::kMisspellingSuggestion) +IPC_ENUM_TRAITS_MAX_VALUE(ui::mojom::ImeTextSpanThickness, + ui::mojom::ImeTextSpanThickness::kThick) IPC_STRUCT_TRAITS_BEGIN(blink::WebImeTextSpan) IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_MEMBER(start_offset) IPC_STRUCT_TRAITS_MEMBER(end_offset) IPC_STRUCT_TRAITS_MEMBER(underline_color) - IPC_STRUCT_TRAITS_MEMBER(thick) + IPC_STRUCT_TRAITS_MEMBER(thickness) IPC_STRUCT_TRAITS_MEMBER(background_color) IPC_STRUCT_TRAITS_MEMBER(suggestion_highlight_color) IPC_STRUCT_TRAITS_MEMBER(suggestions) 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 index 575eed44eb3..2e0838d298c 100644 --- a/chromium/content/common/content_security_policy/csp_source_list_unittest.cc +++ b/chromium/content/common/content_security_policy/csp_source_list_unittest.cc @@ -94,10 +94,10 @@ TEST(CSPSourceList, AllowSelfWithUnspecifiedPort) { false, // allow_star: std::vector<CSPSource>()); // source_list - EXPECT_TRUE(Allow( - source_list, - GURL("chrome://print/pdf_preview.html?chrome://print/1/0/print.pdf"), - &context)); + EXPECT_TRUE( + Allow(source_list, + GURL("chrome://print/pdf/index.html?chrome://print/1/0/print.pdf"), + &context)); } TEST(CSPSourceList, AllowNone) { diff --git a/chromium/content/common/content_security_policy_header.h b/chromium/content/common/content_security_policy_header.h index e4b65d38c88..0184bda4821 100644 --- a/chromium/content/common/content_security_policy_header.h +++ b/chromium/content/common/content_security_policy_header.h @@ -8,7 +8,7 @@ #include <string> #include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h" +#include "third_party/blink/public/platform/web_content_security_policy.h" namespace content { diff --git a/chromium/content/common/cross_site_document_classifier.cc b/chromium/content/common/cross_site_document_classifier.cc deleted file mode 100644 index bcb00039346..00000000000 --- a/chromium/content/common/cross_site_document_classifier.cc +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/common/cross_site_document_classifier.h" - -#include <stddef.h> -#include <string> - -#include "base/command_line.h" -#include "base/lazy_instance.h" -#include "base/logging.h" -#include "base/macros.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/string_piece.h" -#include "base/strings/string_util.h" -#include "content/public/common/content_switches.h" -#include "net/base/registry_controlled_domains/registry_controlled_domain.h" -#include "net/http/http_response_headers.h" -#include "services/network/public/cpp/resource_response_info.h" - -using base::StringPiece; - -namespace content { - -namespace { - -// MIME types -const char kTextHtml[] = "text/html"; -const char kTextXml[] = "text/xml"; -const char kAppXml[] = "application/xml"; -const char kAppJson[] = "application/json"; -const char kImageSvg[] = "image/svg+xml"; -const char kTextJson[] = "text/json"; -const char kTextXjson[] = "text/x-json"; -const char kTextPlain[] = "text/plain"; - -// MIME type suffixes -const char kJsonSuffix[] = "+json"; -const char kXmlSuffix[] = "+xml"; - -void AdvancePastWhitespace(StringPiece* data) { - size_t offset = data->find_first_not_of(" \t\r\n"); - if (offset == base::StringPiece::npos) { - // |data| was entirely whitespace. - data->clear(); - } else { - data->remove_prefix(offset); - } -} - -// Returns kYes if |data| starts with one of the string patterns in -// |signatures|, kMaybe if |data| is a prefix of one of the patterns in -// |signatures|, and kNo otherwise. -// -// When kYes is returned, the matching prefix is erased from |data|. -CrossSiteDocumentClassifier::Result MatchesSignature( - StringPiece* data, - const StringPiece signatures[], - size_t arr_size, - base::CompareCase compare_case) { - for (size_t i = 0; i < arr_size; ++i) { - if (signatures[i].length() <= data->length()) { - if (base::StartsWith(*data, signatures[i], compare_case)) { - // When |signatures[i]| is a prefix of |data|, it constitutes a match. - // Strip the matching characters, and return. - data->remove_prefix(signatures[i].length()); - return CrossSiteDocumentClassifier::kYes; - } - } else { - if (base::StartsWith(signatures[i], *data, compare_case)) { - // When |data| is a prefix of |signatures[i]|, that means that - // subsequent bytes in the stream could cause a match to occur. - return CrossSiteDocumentClassifier::kMaybe; - } - } - } - return CrossSiteDocumentClassifier::kNo; -} - -// Returns true if |mime_type == prefix| or if |mime_type| starts with -// |prefix + '+'|. Returns false otherwise. -// -// For example: -// - MatchesMimeTypePrefix("application/json", "application/json") -> true -// - MatchesMimeTypePrefix("application/json+foo", "application/json") -> true -// - MatchesMimeTypePrefix("application/jsonp", "application/json") -> false -// - MatchesMimeTypePrefix("application/foo", "application/json") -> false -bool MatchesMimeTypePrefix(base::StringPiece mime_type, - base::StringPiece prefix) { - constexpr auto kCaseInsensitive = base::CompareCase::INSENSITIVE_ASCII; - if (!base::StartsWith(mime_type, prefix, kCaseInsensitive)) - return false; - DCHECK_GE(mime_type.length(), prefix.length()); - - if (mime_type.length() == prefix.length()) { - // Given StartsWith results above, the above condition is our O(1) check if - // |base::LowerCaseEqualsASCII(mime_type, prefix)|. - DCHECK(base::LowerCaseEqualsASCII(mime_type, prefix)); - return true; - } - - if (mime_type[prefix.length()] == '+') { - // Given StartsWith results above, the above condition is our O(1) check if - // |base::StartsWith(mime_type, prefix + '+', kCaseInsensitive)|. - DCHECK(base::StartsWith(mime_type, prefix.as_string() + '+', - kCaseInsensitive)); - return true; - } - - return false; -} - -} // namespace - -CrossSiteDocumentMimeType CrossSiteDocumentClassifier::GetCanonicalMimeType( - base::StringPiece mime_type) { - // Checking for image/svg+xml early ensures that it won't get classified as - // CROSS_SITE_DOCUMENT_MIME_TYPE_XML by the presence of the "+xml" suffix. - if (base::LowerCaseEqualsASCII(mime_type, kImageSvg)) - return CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS; - - if (base::LowerCaseEqualsASCII(mime_type, kTextHtml)) - return CROSS_SITE_DOCUMENT_MIME_TYPE_HTML; - - if (base::LowerCaseEqualsASCII(mime_type, kTextPlain)) - return CROSS_SITE_DOCUMENT_MIME_TYPE_PLAIN; - - // StartsWith rather than LowerCaseEqualsASCII is used to account both for - // mime types similar to 1) application/json and to 2) - // application/json+protobuf. - constexpr auto kCaseInsensitive = base::CompareCase::INSENSITIVE_ASCII; - if (MatchesMimeTypePrefix(mime_type, kAppJson) || - MatchesMimeTypePrefix(mime_type, kTextJson) || - MatchesMimeTypePrefix(mime_type, kTextXjson) || - base::EndsWith(mime_type, kJsonSuffix, kCaseInsensitive)) { - return CROSS_SITE_DOCUMENT_MIME_TYPE_JSON; - } - - if (MatchesMimeTypePrefix(mime_type, kAppXml) || - MatchesMimeTypePrefix(mime_type, kTextXml) || - base::EndsWith(mime_type, kXmlSuffix, kCaseInsensitive)) { - return CROSS_SITE_DOCUMENT_MIME_TYPE_XML; - } - - return CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS; -} - -bool CrossSiteDocumentClassifier::IsBlockableScheme(const GURL& url) { - // We exclude ftp:// from here. FTP doesn't provide a Content-Type - // header which our policy depends on, so we cannot protect any - // document from FTP servers. - return url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme); -} - -// We don't use Webkit's existing CORS policy implementation since -// their policy works in terms of origins, not sites. For example, -// when frame is sub.a.com and it is not allowed to access a document -// with sub1.a.com. But under Site Isolation, it's allowed. -bool CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - const url::Origin& frame_origin, - const std::string& access_control_origin) { - // Many websites are sending back "\"*\"" instead of "*". This is - // non-standard practice, and not supported by Chrome. Refer to - // CrossOriginAccessControl::passesAccessControlCheck(). - - // Note that "null" offers no more protection than "*" because it matches any - // unique origin, such as data URLs. Any origin can thus access it, so don't - // bother trying to block this case. - - // TODO(dsjang): * is not allowed for the response from a request - // with cookies. This allows for more than what the renderer will - // eventually be able to receive, so we won't see illegal cross-site - // documents allowed by this. We have to find a way to see if this - // response is from a cookie-tagged request or not in the future. - if (access_control_origin == "*" || access_control_origin == "null") - return true; - - return frame_origin.IsSameOriginWith( - url::Origin::Create(GURL(access_control_origin))); -} - -// This function is a slight modification of |net::SniffForHTML|. -CrossSiteDocumentClassifier::Result CrossSiteDocumentClassifier::SniffForHTML( - StringPiece data) { - // The content sniffers used by Chrome and Firefox are using "<!--" as one of - // the HTML signatures, but it also appears in valid JavaScript, considered as - // well-formed JS by the browser. Since we do not want to block any JS, we - // exclude it from our HTML signatures. This can weaken our document block - // policy, but we can break less websites. - // - // Note that <body> and <br> are not included below, since <b is a prefix of - // them. - // - // TODO(dsjang): parameterize |net::SniffForHTML| with an option that decides - // whether to include <!-- or not, so that we can remove this function. - // TODO(dsjang): Once CrossSiteDocumentClassifier is moved into the browser - // process, we should do single-thread checking here for the static - // initializer. - static const StringPiece kHtmlSignatures[] = { - StringPiece("<!doctype html"), // HTML5 spec - StringPiece("<script"), // HTML5 spec, Mozilla - StringPiece("<html"), // HTML5 spec, Mozilla - StringPiece("<head"), // HTML5 spec, Mozilla - StringPiece("<iframe"), // Mozilla - StringPiece("<h1"), // Mozilla - StringPiece("<div"), // Mozilla - StringPiece("<font"), // Mozilla - StringPiece("<table"), // Mozilla - StringPiece("<a"), // Mozilla - StringPiece("<style"), // Mozilla - StringPiece("<title"), // Mozilla - StringPiece("<b"), // Mozilla (note: subsumes <body>, <br>) - StringPiece("<p") // Mozilla - }; - - while (data.length() > 0) { - AdvancePastWhitespace(&data); - - Result signature_match = - MatchesSignature(&data, kHtmlSignatures, arraysize(kHtmlSignatures), - base::CompareCase::INSENSITIVE_ASCII); - if (signature_match != kNo) - return signature_match; - - // "<!--" (the HTML comment syntax) is a special case, since it's valid JS - // as well. Skip over them. - static const StringPiece kBeginCommentSignature[] = {"<!--"}; - Result comment_match = MatchesSignature(&data, kBeginCommentSignature, - arraysize(kBeginCommentSignature), - base::CompareCase::SENSITIVE); - if (comment_match != kYes) - return comment_match; - - // Look for an end comment. - static const StringPiece kEndComment = "-->"; - size_t comment_end = data.find(kEndComment); - if (comment_end == base::StringPiece::npos) - return kMaybe; // Hit end of data with open comment. - data.remove_prefix(comment_end + kEndComment.length()); - } - - // All of |data| was consumed, without a clear determination. - return kMaybe; -} - -CrossSiteDocumentClassifier::Result CrossSiteDocumentClassifier::SniffForXML( - base::StringPiece data) { - // TODO(dsjang): Once CrossSiteDocumentClassifier is moved into the browser - // process, we should do single-thread checking here for the static - // initializer. - AdvancePastWhitespace(&data); - static const StringPiece kXmlSignatures[] = {StringPiece("<?xml")}; - return MatchesSignature(&data, kXmlSignatures, arraysize(kXmlSignatures), - base::CompareCase::SENSITIVE); -} - -CrossSiteDocumentClassifier::Result CrossSiteDocumentClassifier::SniffForJSON( - base::StringPiece data) { - // Currently this function looks for an opening brace ('{'), followed by a - // double-quoted string literal, followed by a colon. Importantly, such a - // sequence is a Javascript syntax error: although the JSON object syntax is - // exactly Javascript's object-initializer syntax, a Javascript object- - // initializer expression is not valid as a standalone Javascript statement. - // - // TODO(nick): We have to come up with a better way to sniff JSON. The - // following are known limitations of this function: - // https://crbug.com/795470/ Support non-dictionary values (e.g. lists) - enum { - kStartState, - kLeftBraceState, - kLeftQuoteState, - kEscapeState, - kRightQuoteState, - } state = kStartState; - - for (size_t i = 0; i < data.length(); ++i) { - const char c = data[i]; - if (state != kLeftQuoteState && state != kEscapeState) { - // Whitespace is ignored (outside of string literals) - if (c == ' ' || c == '\t' || c == '\r' || c == '\n') - continue; - } else { - // Inside string literals, control characters should result in rejection. - if ((c >= 0 && c < 32) || c == 127) - return kNo; - } - - switch (state) { - case kStartState: - if (c == '{') - state = kLeftBraceState; - else - return kNo; - break; - case kLeftBraceState: - if (c == '"') - state = kLeftQuoteState; - else - return kNo; - break; - case kLeftQuoteState: - if (c == '"') - state = kRightQuoteState; - else if (c == '\\') - state = kEscapeState; - break; - case kEscapeState: - // Simplification: don't bother rejecting hex escapes. - state = kLeftQuoteState; - break; - case kRightQuoteState: - if (c == ':') - return kYes; - else - return kNo; - break; - } - } - return kMaybe; -} - -CrossSiteDocumentClassifier::Result -CrossSiteDocumentClassifier::SniffForFetchOnlyResource(base::StringPiece data) { - // kScriptBreakingPrefixes contains prefixes that are conventionally used to - // prevent a JSON response from becoming a valid Javascript program (an attack - // vector known as XSSI). The presence of such a prefix is a strong signal - // that the resource is meant to be consumed only by the fetch API or - // XMLHttpRequest, and is meant to be protected from use in non-CORS, cross- - // origin contexts like <script>, <img>, etc. - // - // These prefixes work either by inducing a syntax error, or inducing an - // infinite loop. In either case, the prefix must create a guarantee that no - // matter what bytes follow it, the entire response would be worthless to - // execute as a <script>. - static const StringPiece kScriptBreakingPrefixes[] = { - // Parser breaker prefix. - // - // Built into angular.js (followed by a comma and a newline): - // https://docs.angularjs.org/api/ng/service/$http - // - // Built into the Java Spring framework (followed by a comma and a space): - // https://goo.gl/xP7FWn - // - // Observed on google.com (without a comma, followed by a newline). - StringPiece(")]}'"), - - // Apache struts: https://struts.apache.org/plugins/json/#prefix - StringPiece("{}&&"), - - // Spring framework (historically): https://goo.gl/JYPFAv - StringPiece("{} &&"), - - // Infinite loops. - StringPiece("for(;;);"), // observed on facebook.com - StringPiece("while(1);"), StringPiece("for (;;);"), - StringPiece("while (1);"), - }; - Result has_parser_breaker = MatchesSignature( - &data, kScriptBreakingPrefixes, arraysize(kScriptBreakingPrefixes), - base::CompareCase::SENSITIVE); - if (has_parser_breaker != kNo) - return has_parser_breaker; - - // A non-empty JSON object also effectively introduces a JS syntax error. - return SniffForJSON(data); -} - -} // namespace content diff --git a/chromium/content/common/cross_site_document_classifier.h b/chromium/content/common/cross_site_document_classifier.h deleted file mode 100644 index b86769a8bca..00000000000 --- a/chromium/content/common/cross_site_document_classifier.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_CROSS_SITE_DOCUMENT_CLASSIFIER_H_ -#define CONTENT_COMMON_CROSS_SITE_DOCUMENT_CLASSIFIER_H_ - -#include <string> - -#include "base/macros.h" -#include "base/strings/string_piece_forward.h" -#include "content/common/content_export.h" -#include "url/gurl.h" -#include "url/origin.h" - -namespace content { - -// CrossSiteDocumentClassifier implements the cross-site document blocking -// policy (XSDP) for Site Isolation. XSDP will monitor network responses to a -// renderer and block illegal responses so that a compromised renderer cannot -// steal private information from other sites. - -enum CrossSiteDocumentMimeType { - // Note that these values are used in histograms, and must not change. - CROSS_SITE_DOCUMENT_MIME_TYPE_HTML = 0, - CROSS_SITE_DOCUMENT_MIME_TYPE_XML = 1, - CROSS_SITE_DOCUMENT_MIME_TYPE_JSON = 2, - CROSS_SITE_DOCUMENT_MIME_TYPE_PLAIN = 3, - CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS = 4, - CROSS_SITE_DOCUMENT_MIME_TYPE_MAX, -}; - -class CONTENT_EXPORT CrossSiteDocumentClassifier { - public: - // Three conclusions are possible from sniffing a byte sequence: - // - No: meaning that the data definitively doesn't match the indicated type. - // - Yes: meaning that the data definitive does match the indicated type. - // - Maybe: meaning that if more bytes are appended to the stream, it's - // possible to get a Yes result. For example, if we are sniffing for a tag - // like "<html", a kMaybe result would occur if the data contains just - // "<ht". - enum Result { - kNo, - kMaybe, - kYes, - }; - - // Returns the representative mime type enum value of the mime type of - // response. For example, this returns the same value for all text/xml mime - // type families such as application/xml, application/rss+xml. - static CrossSiteDocumentMimeType GetCanonicalMimeType( - base::StringPiece mime_type); - - // Returns whether this scheme is a target of cross-site document - // policy(XSDP). This returns true only for http://* and https://* urls. - static bool IsBlockableScheme(const GURL& frame_origin); - - // Returns whether there's a valid CORS header for frame_origin. This is - // simliar to CrossOriginAccessControl::passesAccessControlCheck(), but we use - // sites as our security domain, not origins. - // TODO(dsjang): this must be improved to be more accurate to the actual CORS - // specification. For now, this works conservatively, allowing XSDs that are - // not allowed by actual CORS rules by ignoring 1) credentials and 2) - // methods. Preflight requests don't matter here since they are not used to - // decide whether to block a document or not on the client side. - static bool IsValidCorsHeaderSet(const url::Origin& frame_origin, - const std::string& access_control_origin); - - static Result SniffForHTML(base::StringPiece data); - static Result SniffForXML(base::StringPiece data); - static Result SniffForJSON(base::StringPiece data); - - // Sniff for patterns that indicate |data| only ought to be consumed by XHR() - // or fetch(). This detects Javascript parser-breaker and particular JS - // infinite-loop patterns, which are used conventionally as a defense against - // JSON data exfiltration by means of a <script> tag. - static Result SniffForFetchOnlyResource(base::StringPiece data); - - private: - CrossSiteDocumentClassifier(); // Not instantiable. - - DISALLOW_COPY_AND_ASSIGN(CrossSiteDocumentClassifier); -}; - -} // namespace content - -#endif // CONTENT_COMMON_CROSS_SITE_DOCUMENT_CLASSIFIER_H_ diff --git a/chromium/content/common/cross_site_document_classifier_unittest.cc b/chromium/content/common/cross_site_document_classifier_unittest.cc deleted file mode 100644 index 290614b1da5..00000000000 --- a/chromium/content/common/cross_site_document_classifier_unittest.cc +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include <utility> -#include <vector> - -#include "base/strings/string_piece.h" -#include "content/common/cross_site_document_classifier.h" -#include "testing/gtest/include/gtest/gtest.h" - -using base::StringPiece; -using Result = content::CrossSiteDocumentClassifier::Result; - -namespace content { - -TEST(CrossSiteDocumentClassifierTest, IsBlockableScheme) { - GURL data_url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA=="); - GURL ftp_url("ftp://google.com"); - GURL mailto_url("mailto:google@google.com"); - GURL about_url("about:chrome"); - GURL http_url("http://google.com"); - GURL https_url("https://google.com"); - - EXPECT_FALSE(CrossSiteDocumentClassifier::IsBlockableScheme(data_url)); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsBlockableScheme(ftp_url)); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsBlockableScheme(mailto_url)); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsBlockableScheme(about_url)); - EXPECT_TRUE(CrossSiteDocumentClassifier::IsBlockableScheme(http_url)); - EXPECT_TRUE(CrossSiteDocumentClassifier::IsBlockableScheme(https_url)); -} - -TEST(CrossSiteDocumentClassifierTest, IsValidCorsHeaderSet) { - url::Origin frame_origin = url::Origin::Create(GURL("http://www.google.com")); - - EXPECT_TRUE( - CrossSiteDocumentClassifier::IsValidCorsHeaderSet(frame_origin, "*")); - EXPECT_FALSE( - CrossSiteDocumentClassifier::IsValidCorsHeaderSet(frame_origin, "\"*\"")); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - frame_origin, "http://mail.google.com")); - EXPECT_TRUE(CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - frame_origin, "http://www.google.com")); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - frame_origin, "https://www.google.com")); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - frame_origin, "http://yahoo.com")); - EXPECT_FALSE(CrossSiteDocumentClassifier::IsValidCorsHeaderSet( - frame_origin, "www.google.com")); -} - -TEST(CrossSiteDocumentClassifierTest, SniffForHTML) { - StringPiece html_data(" \t\r\n <HtMladfokadfkado"); - StringPiece comment_html_data(" <!-- this is comment --> <html><body>"); - StringPiece two_comments_html_data( - "<!-- this is comment -->\n<!-- this is comment --><html><body>"); - StringPiece commented_out_html_tag_data("<!-- <html> <?xml> \n<html>--><b"); - StringPiece mixed_comments_html_data( - "<!-- this is comment <!-- --> <script></script>"); - StringPiece non_html_data(" var name=window.location;\nadfadf"); - StringPiece comment_js_data( - " <!-- this is comment\n document.write(1);\n// -->window.open()"); - StringPiece empty_data(""); - - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForHTML(html_data)); - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForHTML(comment_html_data)); - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForHTML(two_comments_html_data)); - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForHTML( - commented_out_html_tag_data)); - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForHTML( - mixed_comments_html_data)); - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForHTML(non_html_data)); - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForHTML(comment_js_data)); - - // Prefixes of |commented_out_html_tag_data| should be indeterminate. - StringPiece almost_html = commented_out_html_tag_data; - while (!almost_html.empty()) { - almost_html.remove_suffix(1); - EXPECT_EQ(Result::kMaybe, - CrossSiteDocumentClassifier::SniffForHTML(almost_html)) - << almost_html; - } -} - -TEST(CrossSiteDocumentClassifierTest, SniffForXML) { - StringPiece xml_data(" \t \r \n <?xml version=\"1.0\"?>\n <catalog"); - StringPiece non_xml_data(" var name=window.location;\nadfadf"); - StringPiece empty_data(""); - - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForXML(xml_data)); - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForXML(non_xml_data)); - - // Empty string should be indeterminate. - EXPECT_EQ(Result::kMaybe, - CrossSiteDocumentClassifier::SniffForXML(empty_data)); -} - -TEST(CrossSiteDocumentClassifierTest, SniffForJSON) { - StringPiece json_data("\t\t\r\n { \"name\" : \"chrome\", "); - StringPiece json_corrupt_after_first_key( - "\t\t\r\n { \"name\" :^^^^!!@#\1\", "); - StringPiece json_data2("{ \"key \\\" \" \t\t\r\n:"); - StringPiece non_json_data0("\t\t\r\n { name : \"chrome\", "); - StringPiece non_json_data1("\t\t\r\n foo({ \"name\" : \"chrome\", "); - StringPiece empty_data(""); - - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForJSON(json_data)); - EXPECT_EQ(Result::kYes, CrossSiteDocumentClassifier::SniffForJSON( - json_corrupt_after_first_key)); - - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForJSON(json_data2)); - - // All prefixes prefixes of |json_data2| ought to be indeterminate. - StringPiece almost_json = json_data2; - while (!almost_json.empty()) { - almost_json.remove_suffix(1); - EXPECT_EQ(Result::kMaybe, - CrossSiteDocumentClassifier::SniffForJSON(almost_json)) - << almost_json; - } - - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForJSON(non_json_data0)); - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForJSON(non_json_data1)); - - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForJSON(R"({"" : 1})")) - << "Empty strings are accepted"; - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForJSON(R"({'' : 1})")) - << "Single quotes are not accepted"; - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForJSON("{\"\\\"\" : 1}")) - << "Escaped quotes are recognized"; - EXPECT_EQ(Result::kYes, - CrossSiteDocumentClassifier::SniffForJSON(R"({"\\\u000a" : 1})")) - << "Escaped control characters are recognized"; - EXPECT_EQ(Result::kMaybe, - CrossSiteDocumentClassifier::SniffForJSON(R"({"\\\u00)")) - << "Incomplete escape results in maybe"; - EXPECT_EQ(Result::kMaybe, CrossSiteDocumentClassifier::SniffForJSON("{\"\\")) - << "Incomplete escape results in maybe"; - EXPECT_EQ(Result::kMaybe, - CrossSiteDocumentClassifier::SniffForJSON("{\"\\\"")) - << "Incomplete escape results in maybe"; - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForJSON("{\"\n\" : true}")) - << "Unescaped control characters are rejected"; - EXPECT_EQ(Result::kNo, CrossSiteDocumentClassifier::SniffForJSON("{}")) - << "Empty dictionary is not recognized (since it's valid JS too)"; - EXPECT_EQ(Result::kNo, - CrossSiteDocumentClassifier::SniffForJSON("[true, false, 1, 2]")) - << "Lists dictionary are not recognized (since they're valid JS too)"; - EXPECT_EQ(Result::kNo, CrossSiteDocumentClassifier::SniffForJSON(R"({":"})")) - << "A colon character inside a string does not trigger a match"; -} - -TEST(CrossSiteDocumentClassifierTest, GetCanonicalMimeType) { - std::vector<std::pair<const char*, CrossSiteDocumentMimeType>> tests = { - // Basic tests for things in the original implementation: - {"text/html", CROSS_SITE_DOCUMENT_MIME_TYPE_HTML}, - {"text/xml", CROSS_SITE_DOCUMENT_MIME_TYPE_XML}, - {"application/rss+xml", CROSS_SITE_DOCUMENT_MIME_TYPE_XML}, - {"application/xml", CROSS_SITE_DOCUMENT_MIME_TYPE_XML}, - {"application/json", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"text/json", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"text/x-json", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"text/plain", CROSS_SITE_DOCUMENT_MIME_TYPE_PLAIN}, - - // Other mime types: - {"application/foobar", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - - // Regression tests for https://crbug.com/799155 (prefix/suffix matching): - {"application/json+protobuf", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"text/json+protobuf", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"application/activity+json", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"text/foobar+xml", CROSS_SITE_DOCUMENT_MIME_TYPE_XML}, - // No match without a '+' character: - {"application/jsonfoobar", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - {"application/foobarjson", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - {"application/xmlfoobar", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - {"application/foobarxml", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - - // Case-insensitive comparison: - {"APPLICATION/JSON", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"APPLICATION/JSON+PROTOBUF", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - {"APPLICATION/ACTIVITY+JSON", CROSS_SITE_DOCUMENT_MIME_TYPE_JSON}, - - // Images are allowed cross-site, and SVG is an image, so we should - // classify SVG as "other" instead of "xml" (even though it technically is - // an xml document). - {"image/svg+xml", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - - // Javascript should not be blocked. - {"application/javascript", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - {"application/jsonp", CROSS_SITE_DOCUMENT_MIME_TYPE_OTHERS}, - }; - - for (const auto& test : tests) { - const char* input = test.first; // e.g. "text/html" - CrossSiteDocumentMimeType expected = test.second; - CrossSiteDocumentMimeType actual = - CrossSiteDocumentClassifier::GetCanonicalMimeType(input); - EXPECT_EQ(expected, actual) - << "when testing with the following input: " << input; - } -} - -} // namespace content diff --git a/chromium/content/common/cursors/DEPS b/chromium/content/common/cursors/DEPS index 240aa48d31c..b2f32dda35c 100644 --- a/chromium/content/common/cursors/DEPS +++ b/chromium/content/common/cursors/DEPS @@ -1,5 +1,5 @@ include_rules = [ - "+third_party/WebKit/public/platform", + "+third_party/blink/public/platform", ] specific_include_rules = { diff --git a/chromium/content/common/cursors/webcursor.cc b/chromium/content/common/cursors/webcursor.cc index 42584ef2fd3..5d194adf345 100644 --- a/chromium/content/common/cursors/webcursor.cc +++ b/chromium/content/common/cursors/webcursor.cc @@ -9,7 +9,7 @@ #include "base/logging.h" #include "base/pickle.h" #include "build/build_config.h" -#include "third_party/WebKit/public/platform/WebImage.h" +#include "third_party/blink/public/platform/web_image.h" using blink::WebCursorInfo; diff --git a/chromium/content/common/cursors/webcursor_android.cc b/chromium/content/common/cursors/webcursor_android.cc index fc1f67f070e..5d2db8c97b4 100644 --- a/chromium/content/common/cursors/webcursor_android.cc +++ b/chromium/content/common/cursors/webcursor_android.cc @@ -5,7 +5,7 @@ #include "content/common/cursors/webcursor.h" #include "base/logging.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.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 f198bad53b4..9a3939ecfc7 100644 --- a/chromium/content/common/cursors/webcursor_aura.cc +++ b/chromium/content/common/cursors/webcursor_aura.cc @@ -5,7 +5,7 @@ #include "content/common/cursors/webcursor.h" #include "base/logging.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.h" +#include "third_party/blink/public/platform/web_cursor_info.h" #include "ui/base/cursor/cursor.h" #include "ui/base/cursor/cursor_util.h" diff --git a/chromium/content/common/cursors/webcursor_aurawin.cc b/chromium/content/common/cursors/webcursor_aurawin.cc index 5b320648039..03bf448e054 100644 --- a/chromium/content/common/cursors/webcursor_aurawin.cc +++ b/chromium/content/common/cursors/webcursor_aurawin.cc @@ -6,7 +6,7 @@ #include <windows.h> -#include "third_party/WebKit/public/platform/WebCursorInfo.h" +#include "third_party/blink/public/platform/web_cursor_info.h" #include "ui/gfx/icon_util.h" namespace content { diff --git a/chromium/content/common/cursors/webcursor_aurax11.cc b/chromium/content/common/cursors/webcursor_aurax11.cc index 00cc3ae46a0..a856b35368e 100644 --- a/chromium/content/common/cursors/webcursor_aurax11.cc +++ b/chromium/content/common/cursors/webcursor_aurax11.cc @@ -6,7 +6,7 @@ #include "base/logging.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.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/x/x11_util.h" diff --git a/chromium/content/common/cursors/webcursor_mac.mm b/chromium/content/common/cursors/webcursor_mac.mm index a55335de75a..972ed72c97a 100644 --- a/chromium/content/common/cursors/webcursor_mac.mm +++ b/chromium/content/common/cursors/webcursor_mac.mm @@ -13,8 +13,8 @@ #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/WebKit/public/platform/WebCursorInfo.h" -#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/blink/public/platform/web_cursor_info.h" +#include "third_party/blink/public/platform/web_size.h" #include "ui/gfx/geometry/point_conversions.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image.h" diff --git a/chromium/content/common/cursors/webcursor_ozone.cc b/chromium/content/common/cursors/webcursor_ozone.cc index 101af76cda1..811d56dcdd2 100644 --- a/chromium/content/common/cursors/webcursor_ozone.cc +++ b/chromium/content/common/cursors/webcursor_ozone.cc @@ -4,7 +4,7 @@ #include "content/common/cursors/webcursor.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.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/ozone/public/cursor_factory_ozone.h" diff --git a/chromium/content/common/cursors/webcursor_unittest.cc b/chromium/content/common/cursors/webcursor_unittest.cc index 6d4afe0922d..5f3d18c85ef 100644 --- a/chromium/content/common/cursors/webcursor_unittest.cc +++ b/chromium/content/common/cursors/webcursor_unittest.cc @@ -8,7 +8,7 @@ #include "build/build_config.h" #include "content/common/cursors/webcursor.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/WebCursorInfo.h" +#include "third_party/blink/public/platform/web_cursor_info.h" #include "third_party/skia/include/core/SkImageInfo.h" #if defined(OS_WIN) diff --git a/chromium/content/common/dom_storage/dom_storage_messages.h b/chromium/content/common/dom_storage/dom_storage_messages.h index 7ed1fbf1c87..ca95369933c 100644 --- a/chromium/content/common/dom_storage/dom_storage_messages.h +++ b/chromium/content/common/dom_storage/dom_storage_messages.h @@ -10,7 +10,7 @@ #include "content/common/dom_storage/dom_storage_types.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" -#include "third_party/WebKit/public/platform/WebStorageArea.h" +#include "third_party/blink/public/platform/web_storage_area.h" #include "url/gurl.h" #include "url/ipc/url_param_traits.h" diff --git a/chromium/content/common/drag_messages.h b/chromium/content/common/drag_messages.h index 875c7ee1aa0..3f0bb169297 100644 --- a/chromium/content/common/drag_messages.h +++ b/chromium/content/common/drag_messages.h @@ -12,7 +12,7 @@ #include "content/common/drag_event_source_info.h" #include "content/public/common/drop_data.h" #include "ipc/ipc_message_macros.h" -#include "third_party/WebKit/public/platform/WebDragOperation.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/vector2d.h" diff --git a/chromium/content/common/drag_traits.h b/chromium/content/common/drag_traits.h index 16ea9b1e8fa..3dbe095b665 100644 --- a/chromium/content/common/drag_traits.h +++ b/chromium/content/common/drag_traits.h @@ -6,7 +6,7 @@ #include "content/public/common/common_param_traits.h" #include "content/public/common/drop_data.h" #include "ipc/ipc_message_macros.h" -#include "third_party/WebKit/public/platform/WebDragOperation.h" +#include "third_party/blink/public/platform/web_drag_operation.h" #include "ui/gfx/geometry/point.h" #define IPC_MESSAGE_START DragMsgStart diff --git a/chromium/content/common/dwrite_font_proxy.mojom b/chromium/content/common/dwrite_font_proxy.mojom index e8605c402a4..1d04c9be888 100644 --- a/chromium/content/common/dwrite_font_proxy.mojom +++ b/chromium/content/common/dwrite_font_proxy.mojom @@ -4,8 +4,8 @@ module content.mojom; -import "mojo/common/file.mojom"; -import "mojo/common/file_path.mojom"; +import "mojo/public/mojom/base/file.mojom"; +import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/string16.mojom"; struct DWriteStringPair { @@ -47,8 +47,8 @@ interface DWriteFontProxy { // contain font data for the font family at the specified index. [Sync] GetFontFiles(uint32 family_index) - => (array<mojo.common.mojom.FilePath> file_paths, - array<mojo.common.mojom.File> file_handles); + => (array<mojo_base.mojom.FilePath> file_paths, + array<mojo_base.mojom.File> file_handles); // Locates a font family that is able to render the specified text using the // specified style. If successful, the family_index and family_name will diff --git a/chromium/content/common/file_utilities.mojom b/chromium/content/common/file_utilities.mojom index 6380261f935..7ab8354141b 100644 --- a/chromium/content/common/file_utilities.mojom +++ b/chromium/content/common/file_utilities.mojom @@ -4,12 +4,12 @@ module content.mojom; -import "mojo/common/file_info.mojom"; -import "mojo/common/file_path.mojom"; +import "mojo/public/mojom/base/file_info.mojom"; +import "mojo/public/mojom/base/file_path.mojom"; // File utilities messages sent from the renderer to the browser. interface FileUtilitiesHost { [Sync] - GetFileInfo(mojo.common.mojom.FilePath path) => ( - mojo.common.mojom.FileInfo? result); + GetFileInfo(mojo_base.mojom.FilePath path) => ( + mojo_base.mojom.FileInfo? result); }; diff --git a/chromium/content/common/fileapi/file_system_messages.h b/chromium/content/common/fileapi/file_system_messages.h index dfd43e63c60..9edd48cf161 100644 --- a/chromium/content/common/fileapi/file_system_messages.h +++ b/chromium/content/common/fileapi/file_system_messages.h @@ -9,9 +9,12 @@ #include <stdint.h> +#include <string> +#include <vector> + +#include "components/services/filesystem/public/interfaces/types.mojom.h" #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" -#include "storage/common/fileapi/directory_entry.h" #include "storage/common/fileapi/file_system_info.h" #include "storage/common/fileapi/file_system_types.h" #include "storage/common/quota/quota_limit_type.h" @@ -21,9 +24,9 @@ #define IPC_MESSAGE_EXPORT CONTENT_EXPORT #define IPC_MESSAGE_START FileSystemMsgStart -IPC_STRUCT_TRAITS_BEGIN(storage::DirectoryEntry) +IPC_STRUCT_TRAITS_BEGIN(filesystem::mojom::DirectoryEntry) IPC_STRUCT_TRAITS_MEMBER(name) - IPC_STRUCT_TRAITS_MEMBER(is_directory) + IPC_STRUCT_TRAITS_MEMBER(type) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(storage::FileSystemInfo) @@ -32,6 +35,8 @@ IPC_STRUCT_TRAITS_BEGIN(storage::FileSystemInfo) IPC_STRUCT_TRAITS_MEMBER(mount_type) IPC_STRUCT_TRAITS_END() +IPC_ENUM_TRAITS_MAX_VALUE(filesystem::mojom::FsFileType, + filesystem::mojom::FsFileType::DIRECTORY) IPC_ENUM_TRAITS_MAX_VALUE(storage::FileSystemType, storage::FileSystemType::kFileSystemTypeLast) IPC_ENUM_TRAITS_MAX_VALUE(storage::QuotaLimitType, storage::kQuotaLimitTypeLast) @@ -59,10 +64,11 @@ IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile, int /* request_id */, base::File::Info, base::FilePath /* true platform path */) -IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory, - int /* request_id */, - std::vector<storage::DirectoryEntry> /* entries */, - bool /* has_more */) +IPC_MESSAGE_CONTROL3( + FileSystemMsg_DidReadDirectory, + int /* request_id */, + std::vector<filesystem::mojom::DirectoryEntry> /* entries */, + bool /* has_more */) IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite, int /* request_id */, int64_t /* byte count */, diff --git a/chromium/content/common/font_list_mac.mm b/chromium/content/common/font_list_mac.mm index 67d3d856609..64d2210bcb4 100644 --- a/chromium/content/common/font_list_mac.mm +++ b/chromium/content/common/font_list_mac.mm @@ -9,7 +9,6 @@ #include <utility> #include "base/mac/scoped_nsautorelease_pool.h" -#include "base/memory/ptr_util.h" #include "base/strings/sys_string_conversions.h" #include "base/values.h" diff --git a/chromium/content/common/font_list_win.cc b/chromium/content/common/font_list_win.cc index 07ecc125142..a05a3bc8112 100644 --- a/chromium/content/common/font_list_win.cc +++ b/chromium/content/common/font_list_win.cc @@ -10,7 +10,6 @@ #include <set> #include <utility> -#include "base/memory/ptr_util.h" #include "base/strings/string16.h" #include "base/values.h" diff --git a/chromium/content/common/font_loader_dispatcher_mac.cc b/chromium/content/common/font_loader_dispatcher_mac.cc new file mode 100644 index 00000000000..b91d98f825f --- /dev/null +++ b/chromium/content/common/font_loader_dispatcher_mac.cc @@ -0,0 +1,36 @@ +// 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/font_loader_dispatcher_mac.h" + +#include <memory> +#include <utility> + +#include "base/strings/string16.h" +#include "content/common/mac/font_loader.h" +#include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/service_manager/public/cpp/bind_source_info.h" + +namespace content { + +FontLoaderDispatcher::FontLoaderDispatcher() {} + +FontLoaderDispatcher::~FontLoaderDispatcher() {} + +// static +void FontLoaderDispatcher::Create( + mojom::FontLoaderMacRequest request, + const service_manager::BindSourceInfo& source_info) { + mojo::MakeStrongBinding(std::make_unique<FontLoaderDispatcher>(), + std::move(request)); +} + +void FontLoaderDispatcher::LoadFont( + const base::string16& font_name, + float font_point_size, + mojom::FontLoaderMac::LoadFontCallback callback) { + FontLoader::LoadFont(font_name, font_point_size, std::move(callback)); +} + +} // namespace content diff --git a/chromium/content/common/font_loader_dispatcher_mac.h b/chromium/content/common/font_loader_dispatcher_mac.h new file mode 100644 index 00000000000..0c2d8ba81af --- /dev/null +++ b/chromium/content/common/font_loader_dispatcher_mac.h @@ -0,0 +1,39 @@ +// 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_FONT_LOADER_DISPATCHER_MAC_H_ +#define CONTENT_COMMON_FONT_LOADER_DISPATCHER_MAC_H_ + +#include "content/common/font_loader_mac.mojom.h" + +namespace service_manager { +struct BindSourceInfo; +} + +namespace content { + +// Dispatches message used for font loading on Mac. This is needed because +// Mac can't load fonts outside its conventional font locations in sandboxed +// processes. So the sandboxed process asks the browser process to do this +// for it. +class FontLoaderDispatcher : public mojom::FontLoaderMac { + public: + FontLoaderDispatcher(); + ~FontLoaderDispatcher() override; + + static void Create(mojom::FontLoaderMacRequest request, + const service_manager::BindSourceInfo& source_info); + + private: + // mojom::FontLoaderMac + void LoadFont(const base::string16& font_name, + float font_point_size, + mojom::FontLoaderMac::LoadFontCallback callback) override; + + DISALLOW_COPY_AND_ASSIGN(FontLoaderDispatcher); +}; + +} // namespace content + +#endif // CONTENT_COMMON_FONT_LOADER_DISPATCHER_MAC_H_ diff --git a/chromium/content/common/font_loader_mac.mojom b/chromium/content/common/font_loader_mac.mojom new file mode 100644 index 00000000000..d14c1f16693 --- /dev/null +++ b/chromium/content/common/font_loader_mac.mojom @@ -0,0 +1,14 @@ +// 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. + +module content.mojom; + +import "mojo/public/mojom/base/string16.mojom"; + +interface FontLoaderMac { + // Request the browser to load a font into shared memory for us. + [Sync] + LoadFont(mojo_base.mojom.String16 font_name, float font_point_size) + => (handle<shared_buffer>? font_data, uint32 font_id); +}; diff --git a/chromium/content/common/frame.mojom b/chromium/content/common/frame.mojom index e5fbf20747e..99ec7e8d799 100644 --- a/chromium/content/common/frame.mojom +++ b/chromium/content/common/frame.mojom @@ -8,16 +8,19 @@ import "content/common/navigation_params.mojom"; import "content/common/service_worker/controller_service_worker.mojom"; import "content/common/url_loader_factory_bundle.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/common/unguessable_token.mojom"; import "mojo/public/mojom/base/string16.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/url_loader.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; import "services/viz/public/interfaces/compositing/surface_id.mojom"; -import "third_party/WebKit/public/mojom/feature_policy/feature_policy.mojom"; -import "third_party/WebKit/public/platform/referrer.mojom"; -import "third_party/WebKit/public/web/commit_result.mojom"; -import "third_party/WebKit/public/web/window_features.mojom"; +import "third_party/blink/public/mojom/blob/blob_url_store.mojom"; +import "third_party/blink/public/mojom/feature_policy/feature_policy.mojom"; +import "third_party/blink/public/platform/referrer.mojom"; +import "third_party/blink/public/web/commit_result.mojom"; +import "third_party/blink/public/web/window_features.mojom"; import "ui/base/mojo/window_open_disposition.mojom"; import "url/mojom/url.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; @@ -86,8 +89,9 @@ interface FrameNavigationControl { RequestNavigationParams request_params, network.mojom.URLLoaderClientEndpoints? url_loader_client_endpoints, URLLoaderFactoryBundle? subresource_loader_factories, + array<TransferrableURLLoader>? subresource_overrides, ControllerServiceWorkerInfo? controller_service_worker_info, - mojo.common.mojom.UnguessableToken devtools_navigation_token); + mojo_base.mojom.UnguessableToken devtools_navigation_token); // Tells the renderer that a failed navigation is ready to commit. // @@ -96,7 +100,7 @@ interface FrameNavigationControl { // (i.e. flattened HTML, JS, CSS). // // When the Network Service is enabled, |subresource_loader_factories| may - // also be provided by the browser as a a means for the renderer to load + // also be provided by the browser as a means for the renderer to load // subresources where applicable. CommitFailedNavigation( CommonNavigationParams common_params, @@ -219,7 +223,7 @@ struct CreateNewWindowReply { // attribute them to the context frame. // |devtools_frame_token| is only defined by the browser and is never // sent back from the renderer in the control calls. - mojo.common.mojom.UnguessableToken devtools_main_frame_token; + mojo_base.mojom.UnguessableToken devtools_main_frame_token; }; // An opaque handle that keeps alive the associated render process even after @@ -264,18 +268,26 @@ interface FrameHost { DidCommitProvisionalLoadParams params); // Sent by the renderer to request a navigation. + // |blob_url_token| should be non-null when this is a navigation to a blob: + // URL. The token will then be used to look up the blob associated with the + // blob URL. Without this by the time the navigation code starts fetching + // the URL the blob URL might no longer be valid. |blob_url_token| is + // not part of BeginNavigationParams because that struct needs to be + // cloneable, and thus can't contain mojo interfaces. + // If an invalid BlobURLToken is passed in, or if the token doesn't match the + // url in |common_params|, the navigation will result in a network error. BeginNavigation( CommonNavigationParams common_params, - BeginNavigationParams begin_params); + BeginNavigationParams begin_params, + blink.mojom.BlobURLToken? blob_url_token); // Sent when a subresource response has started. - SubresourceResponseStarted( - url.mojom.Url url, - url.mojom.Url referrer, - string method, - ResourceType resource_type, - string ip, - uint32 cert_status); + // |cert_status| is the bitmask of status info of the SSL certificate. (see + // net/cert/cert_status_flags.h). + SubresourceResponseStarted(url.mojom.Url url, uint32 cert_status); + + // Sent when a resource load finished, successfully or not. + ResourceLoadComplete(ResourceLoadInfo url_load_info); // Sent when the frame changes its window.name. DidChangeName(string name, string unique_name); @@ -316,7 +328,12 @@ interface FrameHost { // navigation. FrameSizeChanged(gfx.mojom.Size size); - // Sent by the renderer to update Picture-in-Picture with SurfaceId information - // to be used to show content in the Picture-in-Picture window. - OnUpdatePictureInPictureSurfaceId(viz.mojom.SurfaceId surface_id); + // Sent by the renderer to update Picture-in-Picture with SurfaceId and video + // size to be used to show content in the Picture-in-Picture window. + OnUpdatePictureInPictureSurfaceId( + viz.mojom.SurfaceId surface_id, + gfx.mojom.Size natural_size); + + // Sent by the renderer to signal that Picture-in-Picture mode has ended. + OnExitPictureInPicture(); }; diff --git a/chromium/content/common/frame_messages.h b/chromium/content/common/frame_messages.h index c06c9d132a3..cf96a19a4e0 100644 --- a/chromium/content/common/frame_messages.h +++ b/chromium/content/common/frame_messages.h @@ -19,16 +19,17 @@ #include "build/build_config.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/download/mhtml_save_status.h" -#include "content/common/features.h" #include "content/common/frame_message_enums.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_resize_params.h" #include "content/common/navigation_gesture.h" #include "content/common/navigation_params.h" #include "content/common/resource_timing_info.h" @@ -52,21 +53,21 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_platform_file.h" #include "mojo/public/cpp/system/message_pipe.h" -#include "ppapi/features/features.h" -#include "third_party/WebKit/public/common/feature_policy/feature_policy.h" -#include "third_party/WebKit/public/common/frame/frame_policy.h" -#include "third_party/WebKit/public/common/message_port/message_port_channel.h" -#include "third_party/WebKit/public/common/message_port/transferable_message.h" -#include "third_party/WebKit/public/platform/WebFocusType.h" -#include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" -#include "third_party/WebKit/public/platform/WebIntrinsicSizingInfo.h" -#include "third_party/WebKit/public/platform/WebScrollIntoViewParams.h" -#include "third_party/WebKit/public/platform/WebSuddenTerminationDisablerType.h" -#include "third_party/WebKit/public/web/WebFindOptions.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h" -#include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h" -#include "third_party/WebKit/public/web/WebTreeScopeType.h" -#include "third_party/WebKit/public/web/WebTriggeringEventInfo.h" +#include "ppapi/buildflags/buildflags.h" +#include "third_party/blink/public/common/feature_policy/feature_policy.h" +#include "third_party/blink/public/common/frame/frame_policy.h" +#include "third_party/blink/public/common/message_port/message_port_channel.h" +#include "third_party/blink/public/common/message_port/transferable_message.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_sudden_termination_disabler_type.h" +#include "third_party/blink/public/web/web_find_options.h" +#include "third_party/blink/public/web/web_frame_owner_properties.h" +#include "third_party/blink/public/web/web_frame_serializer_cache_control_policy.h" +#include "third_party/blink/public/web/web_tree_scope_type.h" +#include "third_party/blink/public/web/web_triggering_event_info.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/ipc/gfx_param_traits.h" @@ -88,9 +89,6 @@ using FrameMsg_GetSerializedHtmlWithLocalLinks_UrlMap = using FrameMsg_GetSerializedHtmlWithLocalLinks_FrameRoutingIdMap = std::map<int, base::FilePath>; -using FrameMsg_SerializeAsMHTML_FrameRoutingIdToContentIdMap = - std::map<int, std::string>; - #endif // INTERNAL_CONTENT_COMMON_FRAME_MESSAGES_H_ #undef IPC_MESSAGE_EXPORT @@ -131,7 +129,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::FileChooserParams::Mode, IPC_ENUM_TRAITS_MAX_VALUE(content::CSPDirective::Name, content::CSPDirective::NameLast) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::FeaturePolicyFeature, - blink::mojom::FeaturePolicyFeature::kLastFeature) + blink::mojom::FeaturePolicyFeature::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(content::CSPDisposition, content::CSPDisposition::LAST) IPC_ENUM_TRAITS_MAX_VALUE(blink::WebTriggeringEventInfo, @@ -169,6 +167,9 @@ IPC_STRUCT_TRAITS_BEGIN(blink::WebScrollIntoViewParams) 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) @@ -229,6 +230,16 @@ IPC_STRUCT_TRAITS_BEGIN(content::FrameOwnerProperties) IPC_STRUCT_TRAITS_MEMBER(required_csp) IPC_STRUCT_TRAITS_END() +IPC_STRUCT_TRAITS_BEGIN(content::FrameResizeParams) + IPC_STRUCT_TRAITS_MEMBER(screen_info) + IPC_STRUCT_TRAITS_MEMBER(auto_resize_enabled) + IPC_STRUCT_TRAITS_MEMBER(min_size_for_auto_resize) + IPC_STRUCT_TRAITS_MEMBER(max_size_for_auto_resize) + IPC_STRUCT_TRAITS_MEMBER(auto_resize_sequence_number) + IPC_STRUCT_TRAITS_MEMBER(screen_space_rect) + IPC_STRUCT_TRAITS_MEMBER(local_frame_size) +IPC_STRUCT_TRAITS_END() + IPC_STRUCT_TRAITS_BEGIN(blink::FramePolicy) IPC_STRUCT_TRAITS_MEMBER(sandbox_flags) IPC_STRUCT_TRAITS_MEMBER(container_policy) @@ -370,14 +381,14 @@ IPC_STRUCT_BEGIN_WITH_PARENT(FrameHostMsg_DidCommitProvisionalLoad_Params, // successfully cleared. IPC_STRUCT_MEMBER(bool, history_list_was_cleared) - // The routing_id of the render view associated with the navigation. - // We need to track the RenderViewHost routing_id because of downstream - // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager, - // ResourceDispatcherHostImpl, MediaStreamUIProxy, - // SpeechRecognitionDispatcherHost and possibly others). They look up the view - // based on the ID stored in the resource requests. Once those dependencies - // are unwound or moved to RenderFrameHost (crbug.com/304341) we can move the - // client to be based on the routing_id of the RenderFrameHost. + // The routing_id of the render view associated with the navigation. We need + // to track the RenderViewHost routing_id because of downstream dependencies + // (https://crbug.com/392171 DownloadRequestHandle, SaveFileManager, + // ResourceDispatcherHostImpl, MediaStreamUIProxy and possibly others). They + // look up the view based on the ID stored in the resource requests. Once + // those dependencies are unwound or moved to RenderFrameHost + // (https://crbug.com/304341) we can move the client to be based on the + // routing_id of the RenderFrameHost. IPC_STRUCT_MEMBER(int, render_view_routing_id) // Origin of the frame. This will be replicated to any associated @@ -488,6 +499,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::RequestNavigationParams) IPC_STRUCT_TRAITS_MEMBER(pending_history_list_offset) IPC_STRUCT_TRAITS_MEMBER(current_history_list_offset) IPC_STRUCT_TRAITS_MEMBER(current_history_list_length) + IPC_STRUCT_TRAITS_MEMBER(was_discarded) IPC_STRUCT_TRAITS_MEMBER(is_view_source) IPC_STRUCT_TRAITS_MEMBER(should_clear_history_list) IPC_STRUCT_TRAITS_MEMBER(should_create_service_worker) @@ -503,6 +515,7 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(blink::ParsedFeaturePolicyDeclaration) IPC_STRUCT_TRAITS_MEMBER(feature) IPC_STRUCT_TRAITS_MEMBER(matches_all_origins) + IPC_STRUCT_TRAITS_MEMBER(matches_opaque_src) IPC_STRUCT_TRAITS_MEMBER(origins) IPC_STRUCT_TRAITS_END() @@ -605,12 +618,6 @@ IPC_STRUCT_BEGIN(FrameMsg_SerializeAsMHTML_Params) // Whether to detect problems while serializing. IPC_STRUCT_MEMBER(bool, mhtml_problem_detection) - // Frame to content-id map. - // Keys are routing ids of either RenderFrames or RenderFrameProxies. - // Values are MHTML content-ids - see WebFrameSerializer::generateMHTMLParts. - IPC_STRUCT_MEMBER(FrameMsg_SerializeAsMHTML_FrameRoutingIdToContentIdMap, - frame_routing_id_to_content_id) - // |digests_of_uris_to_skip| contains digests of uris of MHTML parts that // should be skipped. This helps deduplicate mhtml parts across frames. // SECURITY NOTE: Sha256 digests (rather than uris) are used to prevent @@ -988,6 +995,16 @@ IPC_MESSAGE_ROUTED0(FrameMsg_ClearFocusedElement) IPC_MESSAGE_ROUTED1(FrameMsg_ResizeDueToAutoResize, uint64_t /* sequence_number */) +// 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 defined(OS_ANDROID) // Request the distance to the nearest find result in a frame from the point at // (x, y), defined in fractions of the content document's width and height. The @@ -1122,8 +1139,11 @@ IPC_MESSAGE_ROUTED0(FrameMsg_EnableViewSourceMode) // ScopedPageLoadDeferrer is on the stack for SwapOut. IPC_MESSAGE_ROUTED0(FrameMsg_SuppressFurtherDialogs) +// Notifies the RenderFrame about a user activation from the browser side. +IPC_MESSAGE_ROUTED0(FrameMsg_NotifyUserActivation) + // Tells the frame to consider itself to have received a user gesture (based -// on a user gesture processed in a different process). +// on a user gesture processed in a different renderer process). IPC_MESSAGE_ROUTED0(FrameMsg_SetHasReceivedUserGesture) // Tells the frame to mark that the previous document on that frame had received @@ -1403,8 +1423,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PluginContentOriginAllowed, // plugin is hung. // // On error an empty string and null handles are returned. -IPC_SYNC_MESSAGE_CONTROL1_3(FrameHostMsg_OpenChannelToPepperPlugin, +IPC_SYNC_MESSAGE_CONTROL2_3(FrameHostMsg_OpenChannelToPepperPlugin, base::FilePath /* path */, + base::Optional<url::Origin>, /* origin_lock */ IPC::ChannelHandle /* handle to channel */, base::ProcessId /* plugin_pid */, int /* plugin_child_id */) @@ -1477,17 +1498,17 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_BeforeUnload_ACK, IPC_MESSAGE_ROUTED0(FrameHostMsg_SwapOut_ACK) // Tells the browser that a child's resize parameters have changed. -IPC_MESSAGE_ROUTED5(FrameHostMsg_UpdateResizeParams, - gfx::Rect /* screen_space_rect */, - gfx::Size /* local_frame_size */, - content::ScreenInfo /* screen_info */, - uint64_t /* sequence_number */, - viz::SurfaceId /* surface_id */) +IPC_MESSAGE_ROUTED2(FrameHostMsg_UpdateResizeParams, + viz::SurfaceId /* surface_id */, + content::FrameResizeParams) // Sent by a parent frame to update its child's viewport intersection rect for // use by the IntersectionObserver API. -IPC_MESSAGE_ROUTED1(FrameHostMsg_UpdateViewportIntersection, - gfx::Rect /* viewport_intersection */) +// compositor_rect is dependent on the intersection rect and indicates the +// area of the child frame that needs to be rastered. It is in physical pixels. +IPC_MESSAGE_ROUTED2(FrameHostMsg_UpdateViewportIntersection, + gfx::Rect /* viewport_intersection */, + gfx::Rect /* compositor_visible_rect */) // Informs the child that the frame has changed visibility. IPC_MESSAGE_ROUTED1(FrameHostMsg_VisibilityChanged, bool /* visible */) @@ -1536,22 +1557,21 @@ IPC_MESSAGE_ROUTED2(FrameHostMsg_JavaScriptExecuteResponse, base::ListValue /* result */) // A request to run a JavaScript dialog. -IPC_SYNC_MESSAGE_ROUTED4_2(FrameHostMsg_RunJavaScriptDialog, +IPC_SYNC_MESSAGE_ROUTED3_2(FrameHostMsg_RunJavaScriptDialog, base::string16 /* in - alert message */, base::string16 /* in - default prompt */, - GURL /* in - originating page URL */, 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 OnJavaScriptMessageBoxClosed. -IPC_SYNC_MESSAGE_ROUTED2_2(FrameHostMsg_RunBeforeUnloadConfirm, - GURL, /* in - originating frame URL */ - bool /* in - is a reload */, - bool /* out - success */, - base::string16 /* out - This is ignored.*/) +// but is included so that we can use +// RenderFrameHostImpl::SendJavaScriptDialogReply. +IPC_SYNC_MESSAGE_ROUTED1_2(FrameHostMsg_RunBeforeUnloadConfirm, + bool /* in - is a reload */, + bool /* out - success */, + base::string16 /* out - This is ignored.*/) // Notify browser the theme color has been changed. IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeThemeColor, diff --git a/chromium/content/common/frame_owner_properties.h b/chromium/content/common/frame_owner_properties.h index 8e9a47cbe12..74ed5d59428 100644 --- a/chromium/content/common/frame_owner_properties.h +++ b/chromium/content/common/frame_owner_properties.h @@ -8,8 +8,8 @@ #include <vector> #include "content/common/content_export.h" -#include "third_party/WebKit/public/common/feature_policy/feature_policy.h" -#include "third_party/WebKit/public/web/WebFrameOwnerProperties.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 { diff --git a/chromium/content/common/frame_replication_state.cc b/chromium/content/common/frame_replication_state.cc index 562523614e8..ec6087d92fa 100644 --- a/chromium/content/common/frame_replication_state.cc +++ b/chromium/content/common/frame_replication_state.cc @@ -4,8 +4,8 @@ #include "content/common/frame_replication_state.h" -#include "third_party/WebKit/public/common/frame/sandbox_flags.h" -#include "third_party/WebKit/public/web/WebTreeScopeType.h" +#include "third_party/blink/public/common/frame/sandbox_flags.h" +#include "third_party/blink/public/web/web_tree_scope_type.h" namespace content { diff --git a/chromium/content/common/frame_replication_state.h b/chromium/content/common/frame_replication_state.h index f90c925cb5b..a3e930bfd3f 100644 --- a/chromium/content/common/frame_replication_state.h +++ b/chromium/content/common/frame_replication_state.h @@ -10,9 +10,9 @@ #include "content/common/content_export.h" #include "content/common/content_security_policy_header.h" -#include "third_party/WebKit/public/common/feature_policy/feature_policy.h" -#include "third_party/WebKit/public/common/frame/frame_policy.h" -#include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" +#include "third_party/blink/public/common/feature_policy/feature_policy.h" +#include "third_party/blink/public/common/frame/frame_policy.h" +#include "third_party/blink/public/platform/web_insecure_request_policy.h" #include "url/origin.h" namespace blink { diff --git a/chromium/content/common/frame_resize_params.cc b/chromium/content/common/frame_resize_params.cc new file mode 100644 index 00000000000..fc5059d0fc6 --- /dev/null +++ b/chromium/content/common/frame_resize_params.cc @@ -0,0 +1,19 @@ +// 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_resize_params.h" + +namespace content { + +FrameResizeParams::FrameResizeParams() + : auto_resize_enabled(false), auto_resize_sequence_number(0u) {} + +FrameResizeParams::FrameResizeParams(const FrameResizeParams& other) = default; + +FrameResizeParams::~FrameResizeParams() {} + +FrameResizeParams& FrameResizeParams::operator=( + const FrameResizeParams& other) = default; + +} // namespace content diff --git a/chromium/content/common/frame_resize_params.h b/chromium/content/common/frame_resize_params.h new file mode 100644 index 00000000000..425590722c0 --- /dev/null +++ b/chromium/content/common/frame_resize_params.h @@ -0,0 +1,47 @@ +// 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_RESIZE_PARAMS_H_ +#define CONTENT_COMMON_FRAME_RESIZE_PARAMS_H_ + +#include "content/common/content_export.h" +#include "content/public/common/screen_info.h" +#include "third_party/blink/public/platform/web_display_mode.h" +#include "ui/gfx/geometry/size.h" + +namespace content { + +// TODO(fsamuel): We might want to unify this with content::ResizeParams. +struct CONTENT_EXPORT FrameResizeParams { + FrameResizeParams(); + FrameResizeParams(const FrameResizeParams& other); + ~FrameResizeParams(); + + FrameResizeParams& operator=(const FrameResizeParams& other); + + // Information about the screen (dpi, depth, etc..). + ScreenInfo screen_info; + + // Whether or not blink should be in auto-resize mode. + bool auto_resize_enabled; + + // The minimum size for Blink if auto-resize is enabled. + gfx::Size min_size_for_auto_resize; + + // The maximum size for Blink if auto-resize is enabled. + gfx::Size max_size_for_auto_resize; + + // This variable is increased after each auto-resize. If the + // renderer receives a ResizeParams with stale auto_resize_seqence_number, + // then the resize request is dropped. + uint64_t auto_resize_sequence_number; + + gfx::Rect screen_space_rect; + + gfx::Size local_frame_size; +}; + +} // namespace content + +#endif // CONTENT_COMMON_FRAME_RESIZE_PARAMS_H_ diff --git a/chromium/content/common/indexed_db/indexed_db.mojom b/chromium/content/common/indexed_db/indexed_db.mojom index 47d03ec296b..15edf0ef4cb 100644 --- a/chromium/content/common/indexed_db/indexed_db.mojom +++ b/chromium/content/common/indexed_db/indexed_db.mojom @@ -8,10 +8,11 @@ module indexed_db.mojom; -import "mojo/common/file_path.mojom"; +import "mojo/public/mojom/base/file_path.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "mojo/common/time.mojom"; -import "third_party/WebKit/public/mojom/blob/blob.mojom"; +import "mojo/public/mojom/base/string16.mojom"; +import "mojo/public/mojom/base/time.mojom"; +import "third_party/blink/public/mojom/blob/blob.mojom"; import "url/mojom/origin.mojom"; enum CursorDirection { @@ -131,9 +132,9 @@ struct IndexKeys { }; struct FileInfo { - mojo.common.mojom.FilePath path; + mojo_base.mojom.FilePath path; mojo_base.mojom.String16 name; - mojo.common.mojom.Time last_modified; + mojo_base.mojom.Time last_modified; }; struct BlobInfo { diff --git a/chromium/content/common/indexed_db/indexed_db.typemap b/chromium/content/common/indexed_db/indexed_db.typemap index 1640ff07cae..aad054c269e 100644 --- a/chromium/content/common/indexed_db/indexed_db.typemap +++ b/chromium/content/common/indexed_db/indexed_db.typemap @@ -8,7 +8,7 @@ public_headers = [ "//content/common/indexed_db/indexed_db_key_path.h", "//content/common/indexed_db/indexed_db_key_range.h", "//content/common/indexed_db/indexed_db_metadata.h", - "//third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h", + "//third_party/blink/public/platform/modules/indexeddb/web_idb_types.h", ] traits_headers = [ "//content/common/indexed_db/indexed_db_struct_traits.h" ] type_mappings = [ diff --git a/chromium/content/common/indexed_db/indexed_db_key.h b/chromium/content/common/indexed_db/indexed_db_key.h index 5668f1a2f3f..411f1c5fc28 100644 --- a/chromium/content/common/indexed_db/indexed_db_key.h +++ b/chromium/content/common/indexed_db/indexed_db_key.h @@ -13,7 +13,7 @@ #include "base/logging.h" #include "base/strings/string16.h" #include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" +#include "third_party/blink/public/platform/modules/indexeddb/web_idb_types.h" namespace content { diff --git a/chromium/content/common/indexed_db/indexed_db_key_path.h b/chromium/content/common/indexed_db/indexed_db_key_path.h index a8431e98dfb..70c67f941f4 100644 --- a/chromium/content/common/indexed_db/indexed_db_key_path.h +++ b/chromium/content/common/indexed_db/indexed_db_key_path.h @@ -11,7 +11,7 @@ #include "base/logging.h" #include "base/strings/string16.h" #include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" +#include "third_party/blink/public/platform/modules/indexeddb/web_idb_types.h" namespace content { diff --git a/chromium/content/common/indexed_db/indexed_db_key_range.cc b/chromium/content/common/indexed_db/indexed_db_key_range.cc index f1938bfb2cd..e073e649df4 100644 --- a/chromium/content/common/indexed_db/indexed_db_key_range.cc +++ b/chromium/content/common/indexed_db/indexed_db_key_range.cc @@ -5,7 +5,7 @@ #include "content/common/indexed_db/indexed_db_key_range.h" #include "base/logging.h" -#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBTypes.h" +#include "third_party/blink/public/platform/modules/indexeddb/web_idb_types.h" namespace content { diff --git a/chromium/content/common/input/event_with_latency_info.h b/chromium/content/common/input/event_with_latency_info.h index 3ac2bdd3a32..7dc0e8113ce 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/WebKit/public/platform/WebGestureEvent.h" -#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" -#include "third_party/WebKit/public/platform/WebTouchEvent.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 "ui/events/blink/blink_event_util.h" #include "ui/events/blink/web_input_event_traits.h" #include "ui/latency/latency_info.h" 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 0e2f6ff5a6e..640e42e71fd 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/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_input_event.h" using blink::WebGestureEvent; using blink::WebInputEvent; @@ -55,8 +55,7 @@ GestureEventWithLatencyInfo CreateGestureEvent(WebInputEvent::Type type, float y = 0.0f) { GestureEventWithLatencyInfo gesture(type, WebInputEvent::kNoModifiers, timestamp, ui::LatencyInfo()); - gesture.event.x = x; - gesture.event.y = y; + gesture.event.SetPositionInWidget(gfx::PointF(x, y)); return gesture; } diff --git a/chromium/content/common/input/gesture_event_stream_validator.cc b/chromium/content/common/input/gesture_event_stream_validator.cc index 5338ce8603d..e5a95ea3385 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/WebKit/public/platform/WebGestureEvent.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_gesture_event.h" +#include "third_party/blink/public/platform/web_input_event.h" #include "ui/events/blink/web_input_event_traits.h" using blink::WebInputEvent; @@ -21,8 +21,10 @@ GestureEventStreamValidator::GestureEventStreamValidator() GestureEventStreamValidator::~GestureEventStreamValidator() { } -bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, - std::string* error_msg) { +bool GestureEventStreamValidator::Validate( + const blink::WebGestureEvent& event, + const bool fling_cancellation_is_deferred, + std::string* error_msg) { DCHECK(error_msg); error_msg->clear(); if (!WebInputEvent::IsGestureEventType(event.GetType())) { @@ -31,7 +33,7 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, } switch (event.GetType()) { case WebInputEvent::kGestureScrollBegin: - if (scrolling_) + if (scrolling_ && !fling_cancellation_is_deferred) error_msg->append("Scroll begin during scroll\n"); if (pinching_) error_msg->append("Scroll begin during pinch\n"); @@ -42,7 +44,7 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, error_msg->append("Scroll update outside of scroll\n"); break; case WebInputEvent::kGestureFlingStart: - if (event.source_device == blink::kWebGestureDeviceTouchscreen && + if (event.SourceDevice() == blink::kWebGestureDeviceTouchscreen && !event.data.fling_start.velocity_x && !event.data.fling_start.velocity_y) { error_msg->append("Zero velocity touchscreen fling\n"); @@ -51,7 +53,8 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, error_msg->append("Fling start outside of scroll\n"); if (pinching_) error_msg->append("Flinging while pinching\n"); - scrolling_ = false; + // Don't reset scrolling_ since the GSE sent by the fling_controller_ at + // the end of the fling resets it. break; case WebInputEvent::kGestureScrollEnd: if (!scrolling_) @@ -105,10 +108,16 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, // 'continuity check', requiring that all events between an initial tap-down // and whatever terminates the sequence to have the same source device type, // and that touchpad gestures are only found on ScrollEvents. - if (event.source_device == blink::kWebGestureDeviceUninitialized) + if (event.SourceDevice() == blink::kWebGestureDeviceUninitialized) error_msg->append("Gesture event source is uninitialized.\n"); return error_msg->empty(); } +bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event, + std::string* error_msg) { + return Validate(event, /* fling_cancellation_is_deferred = */ false, + error_msg); +} + } // namespace content diff --git a/chromium/content/common/input/gesture_event_stream_validator.h b/chromium/content/common/input/gesture_event_stream_validator.h index 5d8ae8f3e23..49303e1e159 100644 --- a/chromium/content/common/input/gesture_event_stream_validator.h +++ b/chromium/content/common/input/gesture_event_stream_validator.h @@ -24,6 +24,9 @@ class CONTENT_EXPORT GestureEventStreamValidator { // If |event| is valid for the current stream, returns true. // Otherwise, returns false with a corresponding error message. + bool Validate(const blink::WebGestureEvent& event, + const bool fling_cancellation_is_deferred, + std::string* error_msg); bool Validate(const blink::WebGestureEvent& event, std::string* error_msg); private: diff --git a/chromium/content/common/input/ime_text_span_conversions.cc b/chromium/content/common/input/ime_text_span_conversions.cc index 59ef7f35643..cd83e90b704 100644 --- a/chromium/content/common/input/ime_text_span_conversions.cc +++ b/chromium/content/common/input/ime_text_span_conversions.cc @@ -38,4 +38,80 @@ ui::ImeTextSpan::Type ConvertWebImeTextSpanTypeToUiType( return ui::ImeTextSpan::Type::kComposition; } +ui::mojom::ImeTextSpanThickness ConvertUiThicknessToUiImeTextSpanThickness( + ui::ImeTextSpan::Thickness thickness) { + switch (thickness) { + case ui::ImeTextSpan::Thickness::kNone: + return ui::mojom::ImeTextSpanThickness::kNone; + case ui::ImeTextSpan::Thickness::kThin: + return ui::mojom::ImeTextSpanThickness::kThin; + case ui::ImeTextSpan::Thickness::kThick: + return ui::mojom::ImeTextSpanThickness::kThick; + } + + NOTREACHED(); + return ui::mojom::ImeTextSpanThickness::kThin; +} + +ui::ImeTextSpan::Thickness ConvertUiImeTextSpanThicknessToUiThickness( + ui::mojom::ImeTextSpanThickness thickness) { + switch (thickness) { + case ui::mojom::ImeTextSpanThickness::kNone: + return ui::ImeTextSpan::Thickness::kNone; + case ui::mojom::ImeTextSpanThickness::kThin: + return ui::ImeTextSpan::Thickness::kThin; + case ui::mojom::ImeTextSpanThickness::kThick: + return ui::ImeTextSpan::Thickness::kThick; + } + + NOTREACHED(); + return ui::ImeTextSpan::Thickness::kThin; +} + +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), + ui_ime_text_span.background_color, + ui_ime_text_span.suggestion_highlight_color, + ui_ime_text_span.suggestions); + blink_ime_text_span.underline_color = ui_ime_text_span.underline_color; + return blink_ime_text_span; +} + +std::vector<blink::WebImeTextSpan> ConvertUiImeTextSpansToBlinkImeTextSpans( + const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) { + std::vector<blink::WebImeTextSpan> blink_ime_text_spans; + for (const auto& ui_ime_text_span : ui_ime_text_spans) { + blink_ime_text_spans.push_back( + ConvertUiImeTextSpanToBlinkImeTextSpan(ui_ime_text_span)); + } + return blink_ime_text_spans; +} + +ui::ImeTextSpan ConvertBlinkImeTextSpanToUiImeTextSpan( + const blink::WebImeTextSpan& blink_ime_text_span) { + ui::ImeTextSpan ui_ime_text_span = ui::ImeTextSpan( + ConvertWebImeTextSpanTypeToUiType(blink_ime_text_span.type), + blink_ime_text_span.start_offset, blink_ime_text_span.end_offset, + ConvertUiImeTextSpanThicknessToUiThickness(blink_ime_text_span.thickness), + blink_ime_text_span.background_color, + blink_ime_text_span.suggestion_highlight_color, + blink_ime_text_span.suggestions); + ui_ime_text_span.underline_color = blink_ime_text_span.underline_color; + return ui_ime_text_span; +} + +std::vector<ui::ImeTextSpan> ConvertBlinkImeTextSpansToUiImeTextSpans( + const std::vector<blink::WebImeTextSpan>& blink_ime_text_spans) { + std::vector<ui::ImeTextSpan> ui_ime_text_spans; + for (const auto& blink_ime_text_span : blink_ime_text_spans) { + ui_ime_text_spans.push_back( + ConvertBlinkImeTextSpanToUiImeTextSpan(blink_ime_text_span)); + } + return ui_ime_text_spans; +} + } // namespace content diff --git a/chromium/content/common/input/ime_text_span_conversions.h b/chromium/content/common/input/ime_text_span_conversions.h index 50d78de2899..18353d300d7 100644 --- a/chromium/content/common/input/ime_text_span_conversions.h +++ b/chromium/content/common/input/ime_text_span_conversions.h @@ -5,7 +5,7 @@ #ifndef CONTENT_COMMON_INPUT_IME_TEXT_SPAN_CONVERSIONS_H_ #define CONTENT_COMMON_INPUT_IME_TEXT_SPAN_CONVERSIONS_H_ -#include "third_party/WebKit/public/web/WebImeTextSpan.h" +#include "third_party/blink/public/web/web_ime_text_span.h" #include "ui/base/ime/ime_text_span.h" namespace content { @@ -14,6 +14,18 @@ blink::WebImeTextSpan::Type ConvertUiImeTextSpanTypeToWebType( ui::ImeTextSpan::Type type); ui::ImeTextSpan::Type ConvertWebImeTextSpanTypeToUiType( blink::WebImeTextSpan::Type type); +ui::mojom::ImeTextSpanThickness ConvertUiThicknessToUiImeTextSpanThickness( + ui::ImeTextSpan::Thickness thickness); +ui::ImeTextSpan::Thickness ConvertUiImeTextSpanThicknessToUiThickness( + ui::mojom::ImeTextSpanThickness thickness); +blink::WebImeTextSpan ConvertUiImeTextSpanToBlinkImeTextSpan( + const ui::ImeTextSpan&); +ui::ImeTextSpan ConvertBlinkImeTextSpanToUiImeTextSpan( + const blink::WebImeTextSpan&); +std::vector<blink::WebImeTextSpan> ConvertUiImeTextSpansToBlinkImeTextSpans( + const std::vector<ui::ImeTextSpan>&); +std::vector<ui::ImeTextSpan> ConvertBlinkImeTextSpansToUiImeTextSpans( + const std::vector<blink::WebImeTextSpan>&); } // namespace content diff --git a/chromium/content/common/input/input_event_ack.h b/chromium/content/common/input/input_event_ack.h index 5db1a07d443..321c0201a5d 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/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/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_stream_validator.cc b/chromium/content/common/input/input_event_stream_validator.cc index 9206718012d..a4299f073bb 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/WebKit/public/platform/WebGestureEvent.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_gesture_event.h" +#include "third_party/blink/public/platform/web_input_event.h" #include "ui/events/blink/web_input_event_traits.h" using blink::WebInputEvent; @@ -25,23 +25,28 @@ InputEventStreamValidator::InputEventStreamValidator() InputEventStreamValidator::~InputEventStreamValidator() { } -void InputEventStreamValidator::Validate(const WebInputEvent& event) { +void InputEventStreamValidator::Validate( + const WebInputEvent& event, + const bool fling_cancellation_is_deferred /* = false */) { if (!enabled_) return; - DCHECK(ValidateImpl(event, &error_msg_)) + DCHECK(ValidateImpl(event, fling_cancellation_is_deferred, &error_msg_)) << error_msg_ << "\nInvalid Event: " << ui::WebInputEventTraits::ToString(event); } -bool InputEventStreamValidator::ValidateImpl(const blink::WebInputEvent& event, - std::string* error_msg) { +bool InputEventStreamValidator::ValidateImpl( + const blink::WebInputEvent& event, + const bool fling_cancellation_is_deferred, + std::string* error_msg) { DCHECK(error_msg); if (WebInputEvent::IsGestureEventType(event.GetType())) { const WebGestureEvent& gesture = static_cast<const WebGestureEvent&>(event); // TODO(jdduke): Validate touchpad gesture streams. - if (gesture.source_device == blink::kWebGestureDeviceTouchscreen) - return gesture_validator_.Validate(gesture, error_msg); + if (gesture.SourceDevice() == blink::kWebGestureDeviceTouchscreen) + return gesture_validator_.Validate( + gesture, fling_cancellation_is_deferred, error_msg); } else if (WebInputEvent::IsTouchEventType(event.GetType())) { const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); return touch_validator_.Validate(touch, error_msg); diff --git a/chromium/content/common/input/input_event_stream_validator.h b/chromium/content/common/input/input_event_stream_validator.h index e2d726e5422..7bf2238ee63 100644 --- a/chromium/content/common/input/input_event_stream_validator.h +++ b/chromium/content/common/input/input_event_stream_validator.h @@ -24,10 +24,13 @@ class InputEventStreamValidator { InputEventStreamValidator(); ~InputEventStreamValidator(); - void Validate(const blink::WebInputEvent&); + void Validate(const blink::WebInputEvent&, + const bool fling_cancellation_is_deferred = false); private: - bool ValidateImpl(const blink::WebInputEvent&, std::string* error_msg); + bool ValidateImpl(const blink::WebInputEvent&, + const bool fling_cancellation_is_deferred, + std::string* error_msg); GestureEventStreamValidator gesture_validator_; TouchEventStreamValidator touch_validator_; diff --git a/chromium/content/common/input/input_event_struct_traits.cc b/chromium/content/common/input/input_event_struct_traits.cc index c6b923ed503..c1e18caff8c 100644 --- a/chromium/content/common/input/input_event_struct_traits.cc +++ b/chromium/content/common/input/input_event_struct_traits.cc @@ -6,7 +6,7 @@ #include "base/i18n/char_iterator.h" #include "content/common/input_messages.h" -#include "third_party/WebKit/public/platform/WebKeyboardEvent.h" +#include "third_party/blink/public/platform/web_keyboard_event.h" #include "ui/latency/mojo/latency_info_struct_traits.h" namespace mojo { @@ -111,18 +111,17 @@ bool StructTraits<content::mojom::EventDataView, InputEventUniquePtr>::Read( if (!event.ReadGestureData<content::mojom::GestureDataPtr>(&gesture_data)) return false; (*out)->web_event.reset(new blink::WebGestureEvent( - type, event.modifiers(), event.timestamp_seconds())); + type, event.modifiers(), event.timestamp_seconds(), + gesture_data->source_device)); blink::WebGestureEvent* gesture_event = static_cast<blink::WebGestureEvent*>((*out)->web_event.get()); - gesture_event->x = gesture_data->widget_position.x(); - gesture_event->y = gesture_data->widget_position.y(); - gesture_event->global_x = gesture_data->screen_position.x(); - gesture_event->global_y = gesture_data->screen_position.y(); + gesture_event->SetPositionInWidget(gesture_data->widget_position); + gesture_event->SetPositionInScreen(gesture_data->screen_position); gesture_event->is_source_touch_event_set_non_blocking = gesture_data->is_source_touch_event_set_non_blocking; gesture_event->primary_pointer_type = gesture_data->primary_pointer_type; - gesture_event->source_device = gesture_data->source_device; + gesture_event->SetSourceDevice(gesture_data->source_device); gesture_event->unique_touch_event_id = gesture_data->unique_touch_event_id; gesture_event->resending_plugin_id = gesture_data->resending_plugin_id; @@ -395,7 +394,7 @@ StructTraits<content::mojom::EventDataView, InputEventUniquePtr>::gesture_data( auto gesture_data = content::mojom::GestureData::New(); gesture_data->screen_position = gesture_event->PositionInScreen(); gesture_data->widget_position = gesture_event->PositionInWidget(); - gesture_data->source_device = gesture_event->source_device; + gesture_data->source_device = gesture_event->SourceDevice(); gesture_data->is_source_touch_event_set_non_blocking = gesture_event->is_source_touch_event_set_non_blocking; gesture_data->primary_pointer_type = gesture_event->primary_pointer_type; diff --git a/chromium/content/common/input/input_handler.mojom b/chromium/content/common/input/input_handler.mojom index 200dac42039..b5725e1dbf9 100644 --- a/chromium/content/common/input/input_handler.mojom +++ b/chromium/content/common/input/input_handler.mojom @@ -8,7 +8,7 @@ import "content/common/input/synchronous_compositor.mojom"; import "content/common/native_types.mojom"; import "mojo/public/mojom/base/string16.mojom"; import "services/ui/public/interfaces/ime/ime.mojom"; -import "third_party/WebKit/public/web/selection_menu_behavior.mojom"; +import "third_party/blink/public/web/selection_menu_behavior.mojom"; import "ui/events/mojo/event.mojom"; import "ui/events/mojo/event_constants.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; @@ -177,6 +177,9 @@ interface WidgetInputHandlerHost { // Sent by the compositor when a fling animation is stopped. DidStopFlinging(); + // Sent by the compositor when a GSB has started scrolling the viewport. + DidStartScrollingViewport(); + // Required for cancelling an ongoing input method composition. ImeCancelComposition(); diff --git a/chromium/content/common/input/input_param_traits_unittest.cc b/chromium/content/common/input/input_param_traits_unittest.cc index f00519eaf2b..81d1d69cd85 100644 --- a/chromium/content/common/input/input_param_traits_unittest.cc +++ b/chromium/content/common/input/input_param_traits_unittest.cc @@ -10,16 +10,15 @@ #include <utility> #include <vector> -#include "base/memory/ptr_util.h" #include "content/common/input/input_event.h" #include "content/common/input_messages.h" #include "ipc/ipc_message.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/WebGestureEvent.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" -#include "third_party/WebKit/public/platform/WebKeyboardEvent.h" -#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" -#include "third_party/WebKit/public/platform/WebTouchEvent.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" namespace content { namespace { @@ -105,7 +104,7 @@ TEST_F(InputParamTraitsTest, InitializedEvents) { blink::WebInputEvent::kGestureScrollBegin, blink::WebInputEvent::kNoModifiers, blink::WebInputEvent::GetStaticTimeStampForTests()); - gesture_event.x = -1; + gesture_event.SetPositionInWidget(gfx::PointF(-1, 0)); events.push_back(std::make_unique<InputEvent>(gesture_event, latency)); blink::WebTouchEvent touch_event( diff --git a/chromium/content/common/input/sync_compositor_messages.h b/chromium/content/common/input/sync_compositor_messages.h index db37296dc0f..fcfd89e58d0 100644 --- a/chromium/content/common/input/sync_compositor_messages.h +++ b/chromium/content/common/input/sync_compositor_messages.h @@ -15,7 +15,7 @@ #include "content/common/content_param_traits.h" #include "content/public/common/input_event_ack_state.h" #include "ipc/ipc_message_macros.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_input_event.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/scroll_offset.h" diff --git a/chromium/content/common/input/synchronous_compositor.mojom b/chromium/content/common/input/synchronous_compositor.mojom index 5bb8817a2eb..3c139c417cc 100644 --- a/chromium/content/common/input/synchronous_compositor.mojom +++ b/chromium/content/common/input/synchronous_compositor.mojom @@ -4,7 +4,7 @@ module content.mojom; -import "mojo/common/time.mojom"; +import "mojo/public/mojom/base/time.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; import "services/viz/public/interfaces/compositing/begin_frame_args.mojom"; import "services/viz/public/interfaces/compositing/compositor_frame.mojom"; @@ -30,7 +30,7 @@ struct SyncCompositorCommonRendererParams; // because input must be delivered in order with the compositing events. interface SynchronousCompositor { // Computes the scroll at given time. - ComputeScroll(mojo.common.mojom.TimeTicks time); + ComputeScroll(mojo_base.mojom.TimeTicks time); // Hardware draw asynchronously, ReturnFrame will return the result on // the associated SynchronousCompositorControlHost. diff --git a/chromium/content/common/input/synthetic_pointer_action_params.cc b/chromium/content/common/input/synthetic_pointer_action_params.cc index 23a42ec2e1c..a54e974b247 100644 --- a/chromium/content/common/input/synthetic_pointer_action_params.cc +++ b/chromium/content/common/input/synthetic_pointer_action_params.cc @@ -27,6 +27,10 @@ unsigned SyntheticPointerActionParams::GetWebMouseEventModifier( return blink::WebMouseEvent::kMiddleButtonDown; case SyntheticPointerActionParams::Button::RIGHT: return blink::WebMouseEvent::kRightButtonDown; + case SyntheticPointerActionParams::Button::BACK: + return blink::WebMouseEvent::kBackButtonDown; + case SyntheticPointerActionParams::Button::FORWARD: + return blink::WebMouseEvent::kForwardButtonDown; } NOTREACHED(); return blink::WebMouseEvent::kNoModifiers; @@ -43,9 +47,13 @@ SyntheticPointerActionParams::GetWebMouseEventButton( return blink::WebMouseEvent::Button::kMiddle; case SyntheticPointerActionParams::Button::RIGHT: return blink::WebMouseEvent::Button::kRight; + case SyntheticPointerActionParams::Button::BACK: + return blink::WebMouseEvent::Button::kBack; + case SyntheticPointerActionParams::Button::FORWARD: + return blink::WebMouseEvent::Button::kForward; } NOTREACHED(); return blink::WebMouseEvent::Button::kNoButton; } -} // namespace content
\ No newline at end of file +} // namespace content diff --git a/chromium/content/common/input/synthetic_pointer_action_params.h b/chromium/content/common/input/synthetic_pointer_action_params.h index 970cc8c480f..7b30e830d41 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/input/input_param_traits.h" #include "content/common/input/synthetic_gesture_params.h" #include "content/common/input/synthetic_web_input_event_builders.h" -#include "third_party/WebKit/public/platform/WebTouchEvent.h" +#include "third_party/blink/public/platform/web_touch_event.h" #include "ui/gfx/geometry/point_f.h" namespace ipc_fuzzer { @@ -33,7 +33,14 @@ struct CONTENT_EXPORT SyntheticPointerActionParams { POINTER_ACTION_TYPE_MAX = IDLE }; - enum class Button { LEFT, MIDDLE, RIGHT, BUTTON_MAX = RIGHT }; + enum class Button { + LEFT, + MIDDLE, + RIGHT, + BACK, + FORWARD, + BUTTON_MAX = FORWARD + }; SyntheticPointerActionParams(); SyntheticPointerActionParams(PointerActionType action_type); 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 da8fa3d92fb..617d0ea12b5 100644 --- a/chromium/content/common/input/synthetic_web_input_event_builders.cc +++ b/chromium/content/common/input/synthetic_web_input_event_builders.cc @@ -97,8 +97,8 @@ WebGestureEvent SyntheticWebGestureEventBuilder::Build( int modifiers) { DCHECK(WebInputEvent::IsGestureEventType(type)); WebGestureEvent result(type, modifiers, - ui::EventTimeStampToSeconds(ui::EventTimeForNow())); - result.source_device = source_device; + ui::EventTimeStampToSeconds(ui::EventTimeForNow()), + source_device); if (type == WebInputEvent::kGestureTap || type == WebInputEvent::kGestureTapUnconfirmed || type == WebInputEvent::kGestureDoubleTap) { @@ -143,10 +143,8 @@ WebGestureEvent SyntheticWebGestureEventBuilder::BuildPinchUpdate( WebGestureEvent result = Build(WebInputEvent::kGesturePinchUpdate, source_device, modifiers); result.data.pinch_update.scale = scale; - result.x = anchor_x; - result.y = anchor_y; - result.global_x = anchor_x; - result.global_y = anchor_y; + result.SetPositionInWidget(blink::WebFloatPoint(anchor_x, anchor_y)); + result.SetPositionInScreen(blink::WebFloatPoint(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 e34268985c0..3247d0d243d 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/WebKit/public/platform/WebGestureEvent.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" -#include "third_party/WebKit/public/platform/WebKeyboardEvent.h" -#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" -#include "third_party/WebKit/public/platform/WebTouchEvent.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" // Provides sensible creation of default WebInputEvents for testing purposes. diff --git a/chromium/content/common/input/touch_event_stream_validator.cc b/chromium/content/common/input/touch_event_stream_validator.cc index aa2d2bb1a5a..f6e0abd14a0 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/WebKit/public/platform/WebTouchEvent.h" +#include "third_party/blink/public/platform/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 ba1757f9c43..0372d8b60b4 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/WebKit/public/platform/WebTouchEvent.h" +#include "third_party/blink/public/platform/web_touch_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 e041b2042c5..897d78e5b58 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/WebKit/public/platform/WebTouchEvent.h" +#include "third_party/blink/public/platform/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 0343eb8fc1c..eac4718d4ff 100644 --- a/chromium/content/common/input/web_touch_event_traits.h +++ b/chromium/content/common/input/web_touch_event_traits.h @@ -6,7 +6,7 @@ #define CONTENT_COMMON_INPUT_WEB_TOUCH_EVENT_TRAITS_H_ #include "content/common/content_export.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" +#include "third_party/blink/public/platform/web_input_event.h" namespace blink { class WebTouchEvent; diff --git a/chromium/content/common/input_messages.h b/chromium/content/common/input_messages.h index 79aad9fc062..89df9cc4f40 100644 --- a/chromium/content/common/input_messages.h +++ b/chromium/content/common/input_messages.h @@ -29,8 +29,8 @@ #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/WebKit/public/platform/WebInputEvent.h" -#include "third_party/WebKit/public/platform/WebPointerProperties.h" +#include "third_party/blink/public/platform/web_input_event.h" +#include "third_party/blink/public/platform/web_pointer_properties.h" #include "ui/events/blink/did_overscroll_params.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" @@ -353,6 +353,9 @@ IPC_MESSAGE_ROUTED1(InputHostMsg_DidOverscroll, // Sent by the compositor when a fling animation is stopped. IPC_MESSAGE_ROUTED0(InputHostMsg_DidStopFlinging) +// Sent by the compositor when a GSB has started scrolling the viewport. +IPC_MESSAGE_ROUTED0(InputHostMsg_DidStartScrollingViewport) + // Acknowledges receipt of a InputMsg_MoveCaret message. IPC_MESSAGE_ROUTED0(InputHostMsg_MoveCaret_ACK) diff --git a/chromium/content/common/leveldb_wrapper.mojom b/chromium/content/common/leveldb_wrapper.mojom index 8640584e445..c2619016289 100644 --- a/chromium/content/common/leveldb_wrapper.mojom +++ b/chromium/content/common/leveldb_wrapper.mojom @@ -4,7 +4,7 @@ module content.mojom; -import "components/leveldb/public/interfaces/leveldb.mojom"; +import "components/services/leveldb/public/interfaces/leveldb.mojom"; // Gives information about changes to a LevelDB database. // Note that observer methods are called before the callbacks for the @@ -40,6 +40,9 @@ interface LevelDBWrapperGetAllCallback { // A wrapper around leveldb that supports giving notifications when values // change. +// TODO(dmurph): rename & move LevelDBWrapper to DOMStorageDatabase as the +// implementation is now tied specifically to that functionality. +// https://crbug.com/809771 interface LevelDBWrapper { AddObserver(associated LevelDBObserver observer); diff --git a/chromium/content/common/mac/attributed_string_coder.h b/chromium/content/common/mac/attributed_string_coder.h index 5258884744c..7100793b51d 100644 --- a/chromium/content/common/mac/attributed_string_coder.h +++ b/chromium/content/common/mac/attributed_string_coder.h @@ -72,6 +72,8 @@ class CONTENT_EXPORT AttributedStringCoder { public: explicit EncodedString(base::string16 string); EncodedString(); + EncodedString(const EncodedString& other); + EncodedString& operator=(const EncodedString& other); ~EncodedString(); // Accessors: diff --git a/chromium/content/common/mac/attributed_string_coder.mm b/chromium/content/common/mac/attributed_string_coder.mm index 18d28a03013..34f2d0e228f 100644 --- a/chromium/content/common/mac/attributed_string_coder.mm +++ b/chromium/content/common/mac/attributed_string_coder.mm @@ -72,6 +72,12 @@ AttributedStringCoder::EncodedString::EncodedString() : string_() { } +AttributedStringCoder::EncodedString::EncodedString( + const EncodedString& other) = default; + +AttributedStringCoder::EncodedString& AttributedStringCoder::EncodedString:: +operator=(const EncodedString& other) = default; + AttributedStringCoder::EncodedString::~EncodedString() { } diff --git a/chromium/content/common/mac/font_loader.h b/chromium/content/common/mac/font_loader.h index a0d4b61c4fa..02f8196dc1e 100644 --- a/chromium/content/common/mac/font_loader.h +++ b/chromium/content/common/mac/font_loader.h @@ -5,11 +5,11 @@ #ifndef CONTENT_COMMON_MAC_FONT_LOADER_H_ #define CONTENT_COMMON_MAC_FONT_LOADER_H_ -#include <memory> - #include <CoreGraphics/CoreGraphics.h> #include <stdint.h> +#include <memory> + #include "base/callback_forward.h" #include "content/common/content_export.h" #include "mojo/public/cpp/system/buffer.h" @@ -27,19 +27,18 @@ class FontLoader { struct CONTENT_EXPORT ResultInternal { ResultInternal(); ~ResultInternal(); - uint32_t font_data_size = 0; + mojo::ScopedSharedBufferHandle font_data; uint32_t font_id = 0; }; // Callback for the reporting result of LoadFont(). - // - The first argument is the data size. // - The ScopedSharedBufferHandle points to a shared memory buffer containing // the raw data for the font file. // - The last argument is the font_id: a unique identifier for the on-disk // file we load for the font. - using LoadedCallback = base::OnceCallback< - void(uint32_t, mojo::ScopedSharedBufferHandle, uint32_t)>; + using LoadedCallback = + base::OnceCallback<void(mojo::ScopedSharedBufferHandle, uint32_t)>; // Load a font specified by |font| into a shared memory buffer suitable for // sending over IPC. On failure, zeroes and an invalid handle are reported diff --git a/chromium/content/common/mac/font_loader.mm b/chromium/content/common/mac/font_loader.mm index 9cdd80684bf..c802bdb5514 100644 --- a/chromium/content/common/mac/font_loader.mm +++ b/chromium/content/common/mac/font_loader.mm @@ -17,7 +17,6 @@ #import "base/mac/foundation_util.h" #include "base/mac/scoped_cftyperef.h" #import "base/mac/scoped_nsobject.h" -#include "base/memory/ptr_util.h" #include "base/strings/sys_string_conversions.h" #include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" @@ -95,8 +94,6 @@ std::unique_ptr<FontLoader::ResultInternal> LoadFontOnFileThread( return nullptr; } - result->font_data_size = font_file_size_32; - // Font loading used to call ATSFontGetContainer() and used that as font id. // ATS is deprecated. CoreText offers up the ATSFontRef typeface ID via // CTFontGetPlatformFont. @@ -112,15 +109,12 @@ std::unique_ptr<FontLoader::ResultInternal> LoadFontOnFileThread( void ReplyOnUIThread(FontLoader::LoadedCallback callback, std::unique_ptr<FontLoader::ResultInternal> result) { if (!result) { - std::move(callback).Run(0, mojo::ScopedSharedBufferHandle(), 0); + std::move(callback).Run(mojo::ScopedSharedBufferHandle(), 0); return; } - DCHECK_NE(0u, result->font_data_size); DCHECK_NE(0u, result->font_id); - - std::move(callback).Run(result->font_data_size, std::move(result->font_data), - result->font_id); + std::move(callback).Run(std::move(result->font_data), result->font_id); } } // namespace diff --git a/chromium/content/common/manifest_share_target_util_unittest.cc b/chromium/content/common/manifest_share_target_util_unittest.cc new file mode 100644 index 00000000000..edfc6767ea7 --- /dev/null +++ b/chromium/content/common/manifest_share_target_util_unittest.cc @@ -0,0 +1,266 @@ +// 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 <map> +#include <utility> + +#include "content/public/common/manifest_share_target_util.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace content { +namespace { + +constexpr char kTitle[] = "My title"; +constexpr char kText[] = "My text"; +constexpr char kUrlSpec[] = "https://www.google.com/"; + +} // namespace + +TEST(ManifestShareTargetUtilTest, ReplaceUrlPlaceholdersInvalidTemplate) { + // Badly nested placeholders. + GURL url_template = GURL("http://example.com/?q={"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + url_template = GURL("http://example.com/?q={title"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + url_template = GURL("http://example.com/?q={title{text}}"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + url_template = GURL("http://example.com/?q={title{}"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + url_template = GURL("http://example.com/?q={{title}}"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // Placeholder with non-identifier character. + url_template = GURL("http://example.com/?q={title?}"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // Placeholder with digit character. + url_template = GURL("http://example.com/?q={title1}"); + EXPECT_TRUE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_TRUE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // Empty placeholder. + url_template = GURL("http://example.com/?q={}"); + EXPECT_TRUE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_TRUE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // Invalid placeholder in URL fragment. + url_template = GURL("http://example.com/#{title?}"); + EXPECT_FALSE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_FALSE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // { in path. + url_template = GURL("http://example.com/subpath{/"); + EXPECT_TRUE(ValidateWebShareUrlTemplate(url_template)); + EXPECT_TRUE( + ReplaceWebShareUrlPlaceholders(url_template, "", "", GURL(), nullptr)); + + // Invalid placeholder. Non-empty title, text, share URL and non-empty output + // parameter. + GURL url_template_filled; + url_template = GURL("http://example.com/?q={"); + EXPECT_FALSE(ReplaceWebShareUrlPlaceholders(url_template, "text", "title", + GURL("http://www.google.com"), + &url_template_filled)); +} + +TEST(ManifestShareTargetUtilTest, ReplaceWebShareUrlPlaceholders) { + const GURL kUrl(kUrlSpec); + + // No placeholders. + GURL url_template = GURL("http://example.com/?q=a#a"); + GURL url_template_filled; + bool succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, + kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ(url_template, url_template_filled); + + // One title placeholder. + url_template = GURL("http://example.com/#{title}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#My%20title", url_template_filled.spec()); + + // One text placeholder. + url_template = GURL("http://example.com/#{text}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#My%20text", url_template_filled.spec()); + + // One url placeholder. + url_template = GURL("http://example.com/#{url}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#https%3A%2F%2Fwww.google.com%2F", + url_template_filled.spec()); + + // One of each placeholder, in title, text, url order. + url_template = GURL("http://example.com/#{title}{text}{url}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://example.com/#My%20titleMy%20texthttps%3A%2F%2Fwww.google.com%2F", + url_template_filled.spec()); + + // One of each placeholder, in url, text, title order. + url_template = GURL("http://example.com/#{url}{text}{title}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://example.com/#https%3A%2F%2Fwww.google.com%2FMy%20textMy%20title", + url_template_filled.spec()); + + // Two of each placeholder, some next to each other, others not. + url_template = + GURL("http://example.com/#{title}{url}{text}{text}{title}{url}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://example.com/" + "#My%20titlehttps%3A%2F%2Fwww.google.com%2FMy%20textMy%20textMy%" + "20titlehttps%3A%2F%2Fwww.google.com%2F", + url_template_filled.spec()); + + // Placeholders are in a query string, as values. The expected use case. + // Two of each placeholder, some next to each other, others not. + url_template = GURL( + "http://example.com?title={title}&url={url}&text={text}&text={text}&" + "title={title}&url={url}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://" + "example.com/?title=My%20title&url=https%3A%2F%2Fwww.google.com%2F&" + "text=My%20text&" + "text=My%20text&title=My%20title&url=https%3A%2F%2Fwww.google.com%2F", + url_template_filled.spec()); + + // Empty placeholder. + url_template = GURL("http://example.com/#{}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#", url_template_filled.spec()); + + // Unexpected placeholders. + url_template = GURL("http://example.com/#{nonexistentplaceholder}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#", url_template_filled.spec()); + + // Placeholders should only be replaced in query and fragment. + url_template = GURL("http://example.com/subpath{title}/?q={title}#{title}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/subpath%7Btitle%7D/?q=My%20title#My%20title", + url_template_filled.spec()); + + // Braces in the path, which would be invalid, but should parse fine as they + // are escaped. + url_template = GURL("http://example.com/subpath{/?q={title}"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/subpath%7B/?q=My%20title", + url_template_filled.spec()); + + // |url_template| with % escapes. + url_template = GURL("http://example.com#%20{title}%20"); + succeeded = ReplaceWebShareUrlPlaceholders(url_template, kTitle, kText, kUrl, + &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#%20My%20title%20", url_template_filled.spec()); +} + +// Test URL escaping done by ReplaceWebShareUrlPlaceholders(). +TEST(ManifestShareTargetUtilTest, ReplaceWebShareUrlPlaceholders_Escaping) { + const GURL kUrl(kUrlSpec); + const GURL kUrlTemplate("http://example.com/#{title}"); + + // Share data that contains percent escapes. + GURL url_template_filled; + bool succeeded = ReplaceWebShareUrlPlaceholders( + kUrlTemplate, "My%20title", kText, kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#My%2520title", url_template_filled.spec()); + + // Share data that contains placeholders. These should not be replaced. + succeeded = ReplaceWebShareUrlPlaceholders(kUrlTemplate, "{title}", kText, + kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#%7Btitle%7D", url_template_filled.spec()); + + // All characters that shouldn't be escaped. + succeeded = ReplaceWebShareUrlPlaceholders(kUrlTemplate, + "-_.!~*'()0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz", + kText, kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://example.com/#-_.!~*'()0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz", + url_template_filled.spec()); + + // All characters that should be escaped. + succeeded = + ReplaceWebShareUrlPlaceholders(kUrlTemplate, " \"#$%&+,/:;<=>?@[\\]^`{|}", + kText, kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ( + "http://example.com/" + "#%20%22%23%24%25%26%2B%2C%2F%3A%3B%3C%3D%3E%3F%40%5B%5C%5D%5E%60%7B%7C%" + "7D", + url_template_filled.spec()); + + // Unicode chars. + // U+263B + succeeded = ReplaceWebShareUrlPlaceholders(kUrlTemplate, "\xe2\x98\xbb", + kText, kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#%E2%98%BB", url_template_filled.spec()); + + // U+00E9 + succeeded = ReplaceWebShareUrlPlaceholders(kUrlTemplate, "\xc3\xa9", kText, + kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#%C3%A9", url_template_filled.spec()); + + // U+1F4A9 + succeeded = ReplaceWebShareUrlPlaceholders(kUrlTemplate, "\xf0\x9f\x92\xa9", + kText, kUrl, &url_template_filled); + EXPECT_TRUE(succeeded); + EXPECT_EQ("http://example.com/#%F0%9F%92%A9", url_template_filled.spec()); +} + +} // namespace content diff --git a/chromium/content/common/media/media_devices.typemap b/chromium/content/common/media/media_devices.typemap index 0ffd81ca2f1..2451e202204 100644 --- a/chromium/content/common/media/media_devices.typemap +++ b/chromium/content/common/media/media_devices.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/mediastream/media_devices.mojom" +mojom = "//third_party/blink/public/platform/modules/mediastream/media_devices.mojom" public_headers = [ "//content/common/media/media_devices.h" ] traits_headers = [ "//content/common/media/media_devices_typemap_traits.h" ] sources = [ @@ -11,4 +11,5 @@ sources = [ type_mappings = [ "blink.mojom.MediaDeviceType=content::MediaDeviceType", "blink.mojom.MediaDeviceInfo=content::MediaDeviceInfo", + "blink.mojom.FacingMode=media::VideoFacingMode", ] diff --git a/chromium/content/common/media/media_devices_typemap_traits.cc b/chromium/content/common/media/media_devices_typemap_traits.cc index e265d225411..3a46450496f 100644 --- a/chromium/content/common/media/media_devices_typemap_traits.cc +++ b/chromium/content/common/media/media_devices_typemap_traits.cc @@ -48,6 +48,45 @@ bool EnumTraits<blink::mojom::MediaDeviceType, content::MediaDeviceType>:: } // static +blink::mojom::FacingMode +EnumTraits<blink::mojom::FacingMode, media::VideoFacingMode>::ToMojom( + media::VideoFacingMode facing_mode) { + switch (facing_mode) { + case media::MEDIA_VIDEO_FACING_NONE: + return blink::mojom::FacingMode::NONE; + case media::MEDIA_VIDEO_FACING_USER: + return blink::mojom::FacingMode::USER; + case media::MEDIA_VIDEO_FACING_ENVIRONMENT: + return blink::mojom::FacingMode::ENVIRONMENT; + default: + break; + } + NOTREACHED(); + return blink::mojom::FacingMode::NONE; +} + +// static +bool EnumTraits<blink::mojom::FacingMode, media::VideoFacingMode>::FromMojom( + blink::mojom::FacingMode input, + media::VideoFacingMode* out) { + switch (input) { + case blink::mojom::FacingMode::NONE: + *out = media::MEDIA_VIDEO_FACING_NONE; + return true; + case blink::mojom::FacingMode::USER: + *out = media::MEDIA_VIDEO_FACING_USER; + return true; + case blink::mojom::FacingMode::ENVIRONMENT: + *out = media::MEDIA_VIDEO_FACING_ENVIRONMENT; + return true; + default: + break; + } + NOTREACHED(); + return false; +} + +// static bool StructTraits< blink::mojom::MediaDeviceInfoDataView, content::MediaDeviceInfo>::Read(blink::mojom::MediaDeviceInfoDataView input, diff --git a/chromium/content/common/media/media_devices_typemap_traits.h b/chromium/content/common/media/media_devices_typemap_traits.h index b30cc694de9..b15e8001f6f 100644 --- a/chromium/content/common/media/media_devices_typemap_traits.h +++ b/chromium/content/common/media/media_devices_typemap_traits.h @@ -6,7 +6,7 @@ #define CONTENT_COMMON_MEDIA_MEDIA_DEVICES_TYPEMAP_TRAITS_H_ #include "content/common/media/media_devices.h" -#include "third_party/WebKit/public/platform/modules/mediastream/media_devices.mojom.h" +#include "third_party/blink/public/platform/modules/mediastream/media_devices.mojom.h" namespace mojo { @@ -19,6 +19,14 @@ struct EnumTraits<blink::mojom::MediaDeviceType, content::MediaDeviceType> { }; template <> +struct EnumTraits<blink::mojom::FacingMode, media::VideoFacingMode> { + static blink::mojom::FacingMode ToMojom(media::VideoFacingMode facing_mode); + + static bool FromMojom(blink::mojom::FacingMode input, + media::VideoFacingMode* out); +}; + +template <> struct StructTraits<blink::mojom::MediaDeviceInfoDataView, content::MediaDeviceInfo> { static const std::string& device_id(const content::MediaDeviceInfo& info) { diff --git a/chromium/content/common/media/media_player_delegate_messages.h b/chromium/content/common/media/media_player_delegate_messages.h index 14824d1c052..7fd75b9430d 100644 --- a/chromium/content/common/media/media_player_delegate_messages.h +++ b/chromium/content/common/media/media_player_delegate_messages.h @@ -8,12 +8,15 @@ // IPC messages for interactions between the WebMediaPlayerDelegate in the // renderer process and MediaWebContentsObserver in the browser process. +// TODO(apacible): Mojoify MediaPlayerDelegateMsg, then remove this file. +// https://crbug.com/824965 + #include <stdint.h> #include "content/common/content_export.h" #include "ipc/ipc_message_macros.h" #include "media/base/media_content_type.h" -#include "third_party/WebKit/public/platform/WebFullscreenVideoStatus.h" +#include "third_party/blink/public/platform/web_fullscreen_video_status.h" #include "ui/gfx/ipc/geometry/gfx_param_traits.h" #undef IPC_MESSAGE_EXPORT @@ -83,4 +86,10 @@ IPC_MESSAGE_ROUTED2(MediaPlayerDelegateHostMsg_OnMediaSizeChanged, int /* delegate_id, distinguishes instances */, gfx::Size /* new size of video */) +IPC_MESSAGE_ROUTED1(MediaPlayerDelegateHostMsg_OnPictureInPictureSourceChanged, + int /* delegate id */) + +IPC_MESSAGE_ROUTED1(MediaPlayerDelegateHostMsg_OnPictureInPictureModeEnded, + int /* delegate id */) + #endif // CONTENT_COMMON_MEDIA_MEDIA_PLAYER_DELEGATE_MESSAGES_H_ diff --git a/chromium/content/common/media/media_player_messages_android.h b/chromium/content/common/media/media_player_messages_android.h index b9729bda437..a52e7f8e023 100644 --- a/chromium/content/common/media/media_player_messages_android.h +++ b/chromium/content/common/media/media_player_messages_android.h @@ -12,7 +12,7 @@ #include "ipc/ipc_message_macros.h" #include "media/blink/renderer_media_player_interface.h" #include "media/gpu/ipc/common/media_param_traits.h" -#include "third_party/WebKit/public/platform/modules/remoteplayback/WebRemotePlaybackAvailability.h" +#include "third_party/blink/public/platform/modules/remoteplayback/web_remote_playback_availability.h" #include "ui/gfx/geometry/rect_f.h" #include "url/gurl.h" diff --git a/chromium/content/common/media/media_session.typemap b/chromium/content/common/media/media_session.typemap index e31ffdddb12..e4b831bd5cb 100644 --- a/chromium/content/common/media/media_session.typemap +++ b/chromium/content/common/media/media_session.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/mediasession/media_session.mojom" +mojom = "//third_party/blink/public/platform/modules/mediasession/media_session.mojom" public_headers = [ "//content/public/common/media_metadata.h" ] traits_headers = [ "//content/common/media/media_session_struct_traits.h" ] type_mappings = [ diff --git a/chromium/content/common/media/media_session_struct_traits.h b/chromium/content/common/media/media_session_struct_traits.h index 571f653277e..0cd7c66b1b5 100644 --- a/chromium/content/common/media/media_session_struct_traits.h +++ b/chromium/content/common/media/media_session_struct_traits.h @@ -5,7 +5,7 @@ #ifndef CONTENT_COMMON_MEDIA_MEDIA_SESSION_STRUCT_TRAITS_H_ #define CONTENT_COMMON_MEDIA_MEDIA_SESSION_STRUCT_TRAITS_H_ -#include "third_party/WebKit/public/platform/modules/mediasession/media_session.mojom.h" +#include "third_party/blink/public/platform/modules/mediasession/media_session.mojom.h" namespace mojo { diff --git a/chromium/content/common/media/media_stream.mojom b/chromium/content/common/media/media_stream.mojom index 8477e35009c..483ac0c1253 100644 --- a/chromium/content/common/media/media_stream.mojom +++ b/chromium/content/common/media/media_stream.mojom @@ -99,3 +99,13 @@ interface MediaStreamDispatcherHost { // Tells the browser process that the stream has been started successfully. OnStreamStarted(string label); }; + +// Browser-side interface that is used by the renderer process to notify the +// addition or deletion of tracks. +interface MediaStreamTrackMetricsHost { + // Adds the track with the specified information to the list of tracks. + AddTrack(uint64 id, bool is_audio, bool is_remote); + + // Removes the track with the specified ID from the list of tracks. + RemoveTrack(uint64 id); +}; diff --git a/chromium/content/common/media/media_stream_track_metrics_host_messages.h b/chromium/content/common/media/media_stream_track_metrics_host_messages.h deleted file mode 100644 index 6f357094512..00000000000 --- a/chromium/content/common/media/media_stream_track_metrics_host_messages.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_MESSAGES_H_ -#define CONTENT_COMMON_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_MESSAGES_H_ - -#include <stdint.h> - -#include "base/values.h" -#include "content/common/content_export.h" -#include "ipc/ipc_message_macros.h" - -#undef IPC_MESSAGE_EXPORT -#define IPC_MESSAGE_EXPORT CONTENT_EXPORT -#define IPC_MESSAGE_START MediaStreamTrackMetricsHostMsgStart - -// Messages sent to MediaStreamTrackMetricsHost. -IPC_MESSAGE_CONTROL3(MediaStreamTrackMetricsHost_AddTrack, - uint64_t /* id */, - bool /* is_audio */, - bool /* is_remote */) -IPC_MESSAGE_CONTROL1(MediaStreamTrackMetricsHost_RemoveTrack, uint64_t /* id */) - -#endif // CONTENT_COMMON_MEDIA_MEDIA_STREAM_TRACK_METRICS_HOST_MESSAGES_H_ diff --git a/chromium/content/common/media/peer_connection_tracker_messages.h b/chromium/content/common/media/peer_connection_tracker_messages.h index cb9b5bd89f7..f5821e06ced 100644 --- a/chromium/content/common/media/peer_connection_tracker_messages.h +++ b/chromium/content/common/media/peer_connection_tracker_messages.h @@ -15,9 +15,19 @@ #define IPC_MESSAGE_START PeerConnectionTrackerMsgStart IPC_STRUCT_BEGIN(PeerConnectionInfo) + // ID of the peer connection. Unique only within the renderer process. IPC_STRUCT_MEMBER(int, lid) + // Textual ID of the peer connection. It corresponds to RTCPeerConnection.id. + // TODO(eladalon): Update comment or remove TODO, depending on whether + // RTCPeerconnection.id ends up being standardized or rejected. + // https://crbug.com/775415 + IPC_STRUCT_MEMBER(std::string, peer_connection_id) + // Serialized version of RTCConfiguration. IPC_STRUCT_MEMBER(std::string, rtc_configuration) + // Serialized version of blink::WebMediaConstraints. IPC_STRUCT_MEMBER(std::string, constraints) + // The URL of the blink::WebLocalFrame within which this peer connection + // lives. Used for debugging purposes (displayed by WebRTC-Internals). IPC_STRUCT_MEMBER(std::string, url) IPC_STRUCT_END() diff --git a/chromium/content/common/native_types.typemap b/chromium/content/common/native_types.typemap index 8e2f44e0f18..780ba7aa63b 100644 --- a/chromium/content/common/native_types.typemap +++ b/chromium/content/common/native_types.typemap @@ -20,13 +20,13 @@ public_headers = [ "//content/public/common/renderer_preferences.h", "//content/public/common/web_preferences.h", "//net/base/network_change_notifier.h", - "//third_party/WebKit/public/platform/WebGestureDevice.h", - "//third_party/WebKit/public/platform/WebGestureEvent.h", - "//third_party/WebKit/public/platform/WebInputEvent.h", - "//third_party/WebKit/public/platform/WebMouseWheelEvent.h", - "//third_party/WebKit/public/platform/WebPointerProperties.h", - "//third_party/WebKit/public/platform/WebTouchPoint.h", - "//third_party/WebKit/public/web/WebPopupType.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", + "//third_party/blink/public/web/web_popup_type.h", "//ui/events/blink/did_overscroll_params.h", "//ui/events/blink/web_input_event_traits.h", "//ui/latency/ipc/latency_info_param_traits.h", @@ -47,13 +47,13 @@ public_deps = [ # transitive allowance, so those targets' own public_deps aren't included in # the set of implied dependencies. "//cc/ipc", - "//content/common:features", + "//content/common:buildflags", "//media", "//media/base/ipc", "//net", - "//ppapi/features", + "//ppapi/buildflags", "//services/network/public/cpp", - "//third_party/WebKit/public/common", + "//third_party/blink/public/common", "//ui/accessibility", "//ui/base/ime:text_input_types", "//ui/gfx/ipc", diff --git a/chromium/content/common/native_types_mac.typemap b/chromium/content/common/native_types_mac.typemap index 8790e5c7a73..c162fc14e21 100644 --- a/chromium/content/common/native_types_mac.typemap +++ b/chromium/content/common/native_types_mac.typemap @@ -5,8 +5,8 @@ mojom = "//content/common/native_types.mojom" os_whitelist = [ "mac" ] public_headers = [ - "//third_party/WebKit/public/platform/WebScrollbarButtonsPlacement.h", - "//third_party/WebKit/public/platform/mac/WebScrollbarTheme.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 = [ @@ -20,7 +20,7 @@ deps = [ "//media", "//media/base/ipc", "//net", - "//third_party/WebKit/public:blink_headers", + "//third_party/blink/public:blink_headers", "//ui/accessibility", "//ui/base/ime:text_input_types", "//ui/gfx/ipc", diff --git a/chromium/content/common/navigation_params.h b/chromium/content/common/navigation_params.h index 7cf25dc6298..806969a8e25 100644 --- a/chromium/content/common/navigation_params.h +++ b/chromium/content/common/navigation_params.h @@ -26,7 +26,7 @@ #include "net/url_request/redirect_info.h" #include "services/network/public/cpp/resource_request_body.h" #include "services/network/public/cpp/resource_response_info.h" -#include "third_party/WebKit/public/platform/WebMixedContentContextType.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" @@ -268,6 +268,11 @@ struct CONTENT_EXPORT RequestNavigationParams { int current_history_list_offset = -1; int current_history_list_length = 0; + // Indicates that the tab was previously discarded. + // wasDiscarded is exposed on Document after discard, see: + // https://github.com/WICG/web-lifecycle + bool was_discarded = false; + // Indicates whether the navigation is to a view-source:// scheme or not. // It is a separate boolean as the view-source scheme is stripped from the // URL before it is sent to the renderer process and the RenderFrame needs diff --git a/chromium/content/common/navigation_params.mojom b/chromium/content/common/navigation_params.mojom index 1a2360cf334..d64b842a477 100644 --- a/chromium/content/common/navigation_params.mojom +++ b/chromium/content/common/navigation_params.mojom @@ -4,8 +4,8 @@ module content.mojom; -import "mojo/common/values.mojom"; -import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom"; +import "mojo/public/mojom/base/values.mojom"; +import "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom"; import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; @@ -62,6 +62,6 @@ struct BeginNavigationParams { // initiator information in DevTools protocol format. See // https://chromedevtools.github.io/devtools-protocol/tot/Network#type-Initiator // for details. - mojo.common.mojom.DictionaryValue? devtools_initiator; + mojo_base.mojom.DictionaryValue? devtools_initiator; }; diff --git a/chromium/content/common/navigation_params.typemap b/chromium/content/common/navigation_params.typemap index 9bb4cdd679b..036a10c4a90 100644 --- a/chromium/content/common/navigation_params.typemap +++ b/chromium/content/common/navigation_params.typemap @@ -4,9 +4,11 @@ mojom = "//content/common/navigation_params.mojom" public_headers = - [ "//third_party/WebKit/public/platform/WebMixedContentContextType.h" ] + [ "//third_party/blink/public/platform/web_mixed_content_context_type.h" ] traits_headers = [ "//content/common/resource_messages.h" ] deps = [ "//content:export", ] -type_mappings = [ "content.mojom.MixedContentContextType=::blink::WebMixedContentContextType" ] +type_mappings = [ + "content.mojom.MixedContentContextType=::blink::WebMixedContentContextType", +] diff --git a/chromium/content/common/net/url_fetcher.cc b/chromium/content/common/net/url_fetcher.cc index ab75940d575..9af15ee5ddb 100644 --- a/chromium/content/common/net/url_fetcher.cc +++ b/chromium/content/common/net/url_fetcher.cc @@ -5,7 +5,6 @@ #include "content/public/common/url_fetcher.h" #include "base/bind.h" -#include "base/memory/ptr_util.h" #include "content/common/net/url_request_user_data.h" #include "net/url_request/url_fetcher.h" diff --git a/chromium/content/common/notifications/DEPS b/chromium/content/common/notifications/DEPS index b0398690d37..3855191b858 100644 --- a/chromium/content/common/notifications/DEPS +++ b/chromium/content/common/notifications/DEPS @@ -1,3 +1,3 @@ include_rules = [ - "+third_party/WebKit/public/platform/modules/notifications/notification.mojom.h", + "+third_party/blink/public/platform/modules/notifications/notification.mojom.h", ] diff --git a/chromium/content/common/notifications/notification_struct_traits.h b/chromium/content/common/notifications/notification_struct_traits.h index 83fe6a8a40d..b4ee6075e5f 100644 --- a/chromium/content/common/notifications/notification_struct_traits.h +++ b/chromium/content/common/notifications/notification_struct_traits.h @@ -9,11 +9,10 @@ #include "base/strings/string16.h" #include "content/common/content_export.h" #include "content/public/common/platform_notification_data.h" -#include "mojo/common/common_custom_types_struct_traits.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" #include "mojo/public/cpp/bindings/struct_traits.h" #include "skia/public/interfaces/bitmap_skbitmap_struct_traits.h" -#include "third_party/WebKit/public/platform/modules/notifications/notification.mojom.h" +#include "third_party/blink/public/platform/modules/notifications/notification.mojom.h" #include "url/gurl.h" #include "url/mojom/url_gurl_mojom_traits.h" diff --git a/chromium/content/common/notifications/notification_struct_traits_unittest.cc b/chromium/content/common/notifications/notification_struct_traits_unittest.cc index b37e99497ae..1ecf6106af8 100644 --- a/chromium/content/common/notifications/notification_struct_traits_unittest.cc +++ b/chromium/content/common/notifications/notification_struct_traits_unittest.cc @@ -13,7 +13,7 @@ #include "content/public/common/platform_notification_data.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/modules/notifications/notification.mojom.h" +#include "third_party/blink/public/platform/modules/notifications/notification.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "url/gurl.h" diff --git a/chromium/content/common/notifications/notification_types.typemap b/chromium/content/common/notifications/notification_types.typemap index 5ab8b9f13fb..f96161612fc 100644 --- a/chromium/content/common/notifications/notification_types.typemap +++ b/chromium/content/common/notifications/notification_types.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/notifications/notification.mojom" +mojom = "//third_party/blink/public/platform/modules/notifications/notification.mojom" public_headers = [ "//content/public/common/notification_resources.h", "//content/public/common/platform_notification_data.h", @@ -11,7 +11,7 @@ traits_headers = [ "//content/common/notifications/notification_struct_traits.h" ] deps = [ "//mojo/public/cpp/bindings", - "//third_party/WebKit/public:blink_headers", + "//third_party/blink/public:blink_headers", ] type_mappings = [ "blink.mojom.NotificationData=content::PlatformNotificationData", diff --git a/chromium/content/common/origin_trials/OWNERS b/chromium/content/common/origin_trials/OWNERS index ea471dac3a6..47b509bfe3e 100644 --- a/chromium/content/common/origin_trials/OWNERS +++ b/chromium/content/common/origin_trials/OWNERS @@ -1,8 +1,8 @@ # This file also covers ownership of the following directories: # //chrome/common/origin_trials/ # //content/renderer/origin_trials/ -# //third_party/WebKit/common/origin_trials/ -# //third_party/WebKit/public/common/origin_trials/ +# //third_party/blink/common/origin_trials/ +# //third_party/blink/public/common/origin_trials/ # //tools/origin_trials/ chasej@chromium.org diff --git a/chromium/content/common/origin_trials/trial_policy_impl.cc b/chromium/content/common/origin_trials/trial_policy_impl.cc index 41f9bbfbe1c..e85ee25b245 100644 --- a/chromium/content/common/origin_trials/trial_policy_impl.cc +++ b/chromium/content/common/origin_trials/trial_policy_impl.cc @@ -9,7 +9,7 @@ #include "content/public/common/content_features.h" #include "content/public/common/origin_trial_policy.h" #include "content/public/common/origin_util.h" -#include "third_party/WebKit/public/common/origin_trials/trial_token_validator.h" +#include "third_party/blink/public/common/origin_trials/trial_token_validator.h" namespace content { diff --git a/chromium/content/common/origin_trials/trial_policy_impl.h b/chromium/content/common/origin_trials/trial_policy_impl.h index 603a7dc30b4..370c5067b31 100644 --- a/chromium/content/common/origin_trials/trial_policy_impl.h +++ b/chromium/content/common/origin_trials/trial_policy_impl.h @@ -7,7 +7,7 @@ #include "base/strings/string_piece.h" #include "content/common/content_export.h" -#include "third_party/WebKit/public/common/origin_trials/trial_policy.h" +#include "third_party/blink/public/common/origin_trials/trial_policy.h" namespace blink { class TrialTokenValidator; diff --git a/chromium/content/common/page_messages.h b/chromium/content/common/page_messages.h index 423a9f1282e..4e8cf807539 100644 --- a/chromium/content/common/page_messages.h +++ b/chromium/content/common/page_messages.h @@ -46,10 +46,18 @@ IPC_MESSAGE_ROUTED2(PageMsg_SetHistoryOffsetAndLength, IPC_MESSAGE_ROUTED1(PageMsg_AudioStateChanged, bool /* is_audio_playing */) +// Pause and unpause active tasks regarding deferLoading, active javascripts, +// timer, scheduled task through |blink::WebFrameScheduler|. +IPC_MESSAGE_ROUTED1(PageMsg_PausePageScheduledTasks, bool /* paused */) + // Sent to OOPIF renderers when the main frame's ScreenInfo changes. IPC_MESSAGE_ROUTED1(PageMsg_UpdateScreenInfo, content::ScreenInfo /* screen_info */) +// Sent to all renderers, instructing them to freeze all frames that belongs to +// this page. +IPC_MESSAGE_ROUTED0(PageMsg_FreezePage) + // ----------------------------------------------------------------------------- // Messages sent from the renderer to the browser. diff --git a/chromium/content/common/page_state.mojom b/chromium/content/common/page_state.mojom index 830aae044b8..c1a006a3a5f 100644 --- a/chromium/content/common/page_state.mojom +++ b/chromium/content/common/page_state.mojom @@ -5,8 +5,8 @@ module content.history.mojom; import "mojo/public/mojom/base/string16.mojom"; -import "mojo/common/time.mojom"; -import "third_party/WebKit/public/platform/referrer.mojom"; +import "mojo/public/mojom/base/time.mojom"; +import "third_party/blink/public/platform/referrer.mojom"; import "url/mojom/url.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; @@ -37,7 +37,7 @@ struct DEPRECATED_FileSystemFile { url.mojom.Url filesystem_url@0; uint64 offset@1; uint64 length@2; - mojo.common.mojom.Time modification_time@3; + mojo_base.mojom.Time modification_time@3; }; // Next Ordinal: 4 @@ -45,7 +45,7 @@ struct File { mojo_base.mojom.String16 path@0; uint64 offset@1; uint64 length@2; - mojo.common.mojom.Time modification_time@3; + mojo_base.mojom.Time modification_time@3; }; // Next Ordinal: 4 diff --git a/chromium/content/common/page_state_serialization.cc b/chromium/content/common/page_state_serialization.cc index 5af4a897578..4231b01474a 100644 --- a/chromium/content/common/page_state_serialization.cc +++ b/chromium/content/common/page_state_serialization.cc @@ -16,10 +16,10 @@ #include "content/common/unique_name_helper.h" #include "content/public/common/referrer_struct_traits.h" #include "ipc/ipc_message_utils.h" -#include "mojo/common/time_struct_traits.h" #include "mojo/public/cpp/base/string16_mojom_traits.h" +#include "mojo/public/cpp/base/time_mojom_traits.h" #include "services/network/public/cpp/resource_request_body.h" -#include "third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h" +#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" #include "ui/display/display.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" @@ -706,8 +706,11 @@ void WriteResourceRequestBody(const network::ResourceRequestBody& request_body, case network::DataElement::TYPE_BLOB: data_element->set_blob_uuid(element.blob_uuid()); break; - case network::DataElement::TYPE_RAW_FILE: case network::DataElement::TYPE_DATA_PIPE: + NOTIMPLEMENTED(); + break; + case network::DataElement::TYPE_RAW_FILE: + case network::DataElement::TYPE_CHUNKED_DATA_PIPE: case network::DataElement::TYPE_UNKNOWN: NOTREACHED(); continue; diff --git a/chromium/content/common/page_state_serialization.h b/chromium/content/common/page_state_serialization.h index 29a43617dc9..729550b7852 100644 --- a/chromium/content/common/page_state_serialization.h +++ b/chromium/content/common/page_state_serialization.h @@ -15,9 +15,9 @@ #include "build/build_config.h" #include "content/common/content_export.h" #include "services/network/public/cpp/resource_request_body.h" -#include "third_party/WebKit/public/platform/WebHTTPBody.h" -#include "third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h" -#include "third_party/WebKit/public/platform/WebReferrerPolicy.h" +#include "third_party/blink/public/platform/web_history_scroll_restoration_type.h" +#include "third_party/blink/public/platform/web_http_body.h" +#include "third_party/blink/public/platform/web_referrer_policy.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h" #include "url/gurl.h" diff --git a/chromium/content/common/pepper_file_util.h b/chromium/content/common/pepper_file_util.h index 48afdeb7ed7..bded20a9857 100644 --- a/chromium/content/common/pepper_file_util.h +++ b/chromium/content/common/pepper_file_util.h @@ -7,8 +7,8 @@ #include "base/files/file.h" #include "base/sync_socket.h" +#include "ppapi/buildflags/buildflags.h" #include "ppapi/c/pp_file_info.h" -#include "ppapi/features/features.h" #include "storage/common/fileapi/file_system_types.h" #if !BUILDFLAG(ENABLE_PLUGINS) diff --git a/chromium/content/common/pepper_plugin_list.h b/chromium/content/common/pepper_plugin_list.h index fdf569a42f5..44f3341631b 100644 --- a/chromium/content/common/pepper_plugin_list.h +++ b/chromium/content/common/pepper_plugin_list.h @@ -7,7 +7,7 @@ #include <vector> -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #if !BUILDFLAG(ENABLE_PLUGINS) #error "Plugins should be enabled" diff --git a/chromium/content/common/pepper_renderer_instance_data.h b/chromium/content/common/pepper_renderer_instance_data.h index a3445ecee73..23dc106317a 100644 --- a/chromium/content/common/pepper_renderer_instance_data.h +++ b/chromium/content/common/pepper_renderer_instance_data.h @@ -5,7 +5,7 @@ #ifndef CONTENT_COMMON_PEPPER_RENDERER_INSTANCE_DATA_H_ #define CONTENT_COMMON_PEPPER_RENDERER_INSTANCE_DATA_H_ -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "url/gurl.h" #if !BUILDFLAG(ENABLE_PLUGINS) diff --git a/chromium/content/common/plugin_list.cc b/chromium/content/common/plugin_list.cc index 21c69a6d36a..bc350650084 100644 --- a/chromium/content/common/plugin_list.cc +++ b/chromium/content/common/plugin_list.cc @@ -114,7 +114,7 @@ void PluginList::LoadPlugins() { will_load_callback = will_load_plugins_callback_; } if (!will_load_callback.is_null()) - will_load_callback.Run(); + std::move(will_load_callback).Run(); std::vector<base::FilePath> plugin_paths; GetPluginPathsToLoad(&plugin_paths); diff --git a/chromium/content/common/plugin_list.h b/chromium/content/common/plugin_list.h index 0504985133c..59aa05d47c4 100644 --- a/chromium/content/common/plugin_list.h +++ b/chromium/content/common/plugin_list.h @@ -18,7 +18,7 @@ #include "build/build_config.h" #include "content/common/content_export.h" #include "content/public/common/webplugininfo.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #if !BUILDFLAG(ENABLE_PLUGINS) #error "Plugins should be enabled" diff --git a/chromium/content/common/presentation/presentation.typemap b/chromium/content/common/presentation/presentation.typemap index 33ac3db53a6..e6d6a8c0f1e 100644 --- a/chromium/content/common/presentation/presentation.typemap +++ b/chromium/content/common/presentation/presentation.typemap @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/presentation/presentation.mojom" +mojom = "//third_party/blink/public/platform/modules/presentation/presentation.mojom" public_headers = [ "//content/public/common/presentation_connection_message.h", "//content/public/common/presentation_info.h", diff --git a/chromium/content/common/presentation/presentation_struct_traits.h b/chromium/content/common/presentation/presentation_struct_traits.h index 08906ba2f02..13d406efedf 100644 --- a/chromium/content/common/presentation/presentation_struct_traits.h +++ b/chromium/content/common/presentation/presentation_struct_traits.h @@ -13,7 +13,7 @@ #include "base/strings/string_util.h" #include "content/public/common/presentation_connection_message.h" #include "content/public/common/presentation_info.h" -#include "third_party/WebKit/public/platform/modules/presentation/presentation.mojom.h" +#include "third_party/blink/public/platform/modules/presentation/presentation.mojom.h" #include "url/mojom/url.mojom.h" namespace mojo { diff --git a/chromium/content/common/push_messaging.mojom b/chromium/content/common/push_messaging.mojom index 6d9b3f764ae..7966268f95e 100644 --- a/chromium/content/common/push_messaging.mojom +++ b/chromium/content/common/push_messaging.mojom @@ -23,7 +23,6 @@ enum PushErrorType { NOT_FOUND = 4, NOT_SUPPORTED = 5, INVALID_STATE = 6, - LAST = INVALID_STATE }; interface PushMessaging { diff --git a/chromium/content/common/push_messaging.typemap b/chromium/content/common/push_messaging.typemap index 698dc1cb77c..62eaf37df81 100644 --- a/chromium/content/common/push_messaging.typemap +++ b/chromium/content/common/push_messaging.typemap @@ -5,7 +5,7 @@ mojom = "//content/common/push_messaging.mojom" public_headers = [ "//content/public/common/push_subscription_options.h", - "//third_party/WebKit/public/platform/modules/push_messaging/WebPushError.h", + "//third_party/blink/public/platform/modules/push_messaging/web_push_error.h", ] traits_headers = [ "//content/common/push_messaging_param_traits.h" ] sources = [ @@ -15,7 +15,7 @@ deps = [ "//content:export", ] public_deps = [ - "//third_party/WebKit/public:blink_headers", + "//third_party/blink/public:blink_headers", ] type_mappings = [ "content.mojom.PushErrorType=blink::WebPushError::ErrorType", diff --git a/chromium/content/common/push_messaging_param_traits.cc b/chromium/content/common/push_messaging_param_traits.cc index d5ae8f5a42b..c28c61778dd 100644 --- a/chromium/content/common/push_messaging_param_traits.cc +++ b/chromium/content/common/push_messaging_param_traits.cc @@ -46,8 +46,8 @@ static_assert(blink::WebPushError::ErrorType::kErrorTypeInvalidState == static_assert(blink::WebPushError::ErrorType::kErrorTypeLast == static_cast<blink::WebPushError::ErrorType>( - content::mojom::PushErrorType::LAST), - "PushErrorType enums must match, LAST"); + content::mojom::PushErrorType::kMaxValue), + "PushErrorType enums must match, kMaxValue"); // static bool StructTraits<content::mojom::PushSubscriptionOptionsDataView, diff --git a/chromium/content/common/render_frame_metadata.mojom b/chromium/content/common/render_frame_metadata.mojom index 787a3b7ce88..a2283f9d152 100644 --- a/chromium/content/common/render_frame_metadata.mojom +++ b/chromium/content/common/render_frame_metadata.mojom @@ -4,11 +4,27 @@ module content.mojom; +import "services/viz/public/interfaces/compositing/selection.mojom"; import "ui/gfx/geometry/mojo/geometry.mojom"; // See components/viz/service/quads/render_frame_metadata.h struct RenderFrameMetadata { - gfx.mojom.Vector2dF root_scroll_offset; + // The background color of a CompositorFrame. It can be used for filling the + // content area if the primary surface is unavailable and fallback is not + // specified. + uint32 root_background_color; + + // Scroll offset of the root layer. This optional parameter is only sent + // during tests. + gfx.mojom.Vector2dF? root_scroll_offset; + + // Indicates whether the scroll offset of the root layer is at top, i.e., + // whether scroll_offset.y() == 0. + bool is_scroll_offset_at_top; + + // Selection region relative to the current viewport. If the selection is + // empty or otherwise unused, the bound types will indicate such. + viz.mojom.Selection selection; }; // This interface is provided by the renderer. It can optionally enable @@ -24,8 +40,8 @@ interface RenderFrameMetadataObserver { // RenderFrameMetadataObserver::ReportAllFrameSubmissionsForTesting. interface RenderFrameMetadataObserverClient { // Notified when RenderFrameMetadata has changed. - OnRenderFrameMetadataChanged(RenderFrameMetadata metadata); + OnRenderFrameMetadataChanged(uint32 frame_token, RenderFrameMetadata metadata); // Notified on all frame submissions. - OnFrameSubmissionForTesting(); + OnFrameSubmissionForTesting(uint32 frame_token); }; diff --git a/chromium/content/common/render_frame_metadata_struct_traits.cc b/chromium/content/common/render_frame_metadata_struct_traits.cc index c8c2719f2be..e6129ebf056 100644 --- a/chromium/content/common/render_frame_metadata_struct_traits.cc +++ b/chromium/content/common/render_frame_metadata_struct_traits.cc @@ -4,7 +4,9 @@ #include "content/common/render_frame_metadata_struct_traits.h" +#include "services/viz/public/cpp/compositing/selection_struct_traits.h" #include "ui/gfx/geometry/mojo/geometry_struct_traits.h" +#include "ui/gfx/mojo/selection_bound_struct_traits.h" namespace mojo { @@ -13,7 +15,10 @@ bool StructTraits<content::mojom::RenderFrameMetadataDataView, cc::RenderFrameMetadata>:: Read(content::mojom::RenderFrameMetadataDataView data, cc::RenderFrameMetadata* out) { - return data.ReadRootScrollOffset(&out->root_scroll_offset); + out->root_background_color = data.root_background_color(); + out->is_scroll_offset_at_top = data.is_scroll_offset_at_top(); + return data.ReadRootScrollOffset(&out->root_scroll_offset) && + data.ReadSelection(&out->selection); } } // namespace mojo diff --git a/chromium/content/common/render_frame_metadata_struct_traits.h b/chromium/content/common/render_frame_metadata_struct_traits.h index d19afa008c0..de13e7a88c9 100644 --- a/chromium/content/common/render_frame_metadata_struct_traits.h +++ b/chromium/content/common/render_frame_metadata_struct_traits.h @@ -5,6 +5,7 @@ #ifndef CONTENT_COMMON_RENDER_FRAME_METADATA_STRUCT_TRAITS_H_ #define CONTENT_COMMON_RENDER_FRAME_METADATA_STRUCT_TRAITS_H_ +#include "base/optional.h" #include "cc/trees/render_frame_metadata.h" #include "content/common/render_frame_metadata.mojom-shared.h" @@ -13,11 +14,25 @@ namespace mojo { template <> struct StructTraits<content::mojom::RenderFrameMetadataDataView, cc::RenderFrameMetadata> { - static gfx::Vector2dF root_scroll_offset( + static SkColor root_background_color( + const cc::RenderFrameMetadata& metadata) { + return metadata.root_background_color; + } + + static base::Optional<gfx::Vector2dF> root_scroll_offset( const cc::RenderFrameMetadata& metadata) { return metadata.root_scroll_offset; } + static bool is_scroll_offset_at_top(const cc::RenderFrameMetadata& metadata) { + return metadata.is_scroll_offset_at_top; + } + + static const viz::Selection<gfx::SelectionBound>& selection( + const cc::RenderFrameMetadata& metadata) { + return metadata.selection; + } + static bool Read(content::mojom::RenderFrameMetadataDataView data, cc::RenderFrameMetadata* out); }; diff --git a/chromium/content/common/render_message_filter.mojom b/chromium/content/common/render_message_filter.mojom index 52092d89fab..15d97f9b140 100644 --- a/chromium/content/common/render_message_filter.mojom +++ b/chromium/content/common/render_message_filter.mojom @@ -7,9 +7,8 @@ module content.mojom; import "content/common/input/input_handler.mojom"; import "content/common/native_types.mojom"; import "content/common/widget.mojom"; -import "mojo/common/thread_priority.mojom"; -import "mojo/public/mojom/base/string16.mojom"; -import "mojo/common/time.mojom"; +import "mojo/public/mojom/base/thread_priority.mojom"; +import "mojo/public/mojom/base/time.mojom"; import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; @@ -29,12 +28,12 @@ interface RenderMessageFilter { // Requests that the browser cache |data| associated with |url| and |expected_response_time|. // TODO(https://crbug.com/779444): Verify or remove |url| and |cache_storage_origin|. DidGenerateCacheableMetadata(url.mojom.Url url, - mojo.common.mojom.Time expected_response_time, + mojo_base.mojom.Time expected_response_time, array<uint8> data); // Requests that the browser cache |data| for the specified CacheStorage entry. DidGenerateCacheableMetadataInCacheStorage( - url.mojom.Url url, mojo.common.mojom.Time expected_response_time, + url.mojom.Url url, mojo_base.mojom.Time expected_response_time, array<uint8> data, url.mojom.Origin cache_storage_origin, string cache_storage_cache_name); @@ -42,12 +41,7 @@ interface RenderMessageFilter { [Sync] HasGpuProcess() => (bool has_gpu_process); // Asks the browser to change the priority of thread. - // (Linux only, NOP on other platforms.) + [EnableIf=supports_thread_priorities] SetThreadPriority(int32 platform_thread_id, - mojo.common.mojom.ThreadPriority thread_priority); - - // Request that the browser load a font into shared memory for us. - // TODO(https://crbug.com/676224). Only used for MacOS. - [Sync] LoadFont(mojo_base.mojom.String16 font_name, float font_point_size) - => (uint32 buffer_size, handle<shared_buffer>? font_data, uint32 font_id); + mojo_base.mojom.ThreadPriority thread_priority); }; diff --git a/chromium/content/common/render_widget_window_tree_client_factory.mojom b/chromium/content/common/render_widget_window_tree_client_factory.mojom index 22cc65deeec..0c1ae21b5cc 100644 --- a/chromium/content/common/render_widget_window_tree_client_factory.mojom +++ b/chromium/content/common/render_widget_window_tree_client_factory.mojom @@ -4,14 +4,14 @@ module content.mojom; -import "mojo/common/unguessable_token.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/ui/public/interfaces/window_tree.mojom"; interface RenderWidgetWindowTreeClient { // Asks the renderer to create a Window for the frame with the routing id // |routing_id| and embeds the WindowTreeClient that was previously supplied // to ScheduleEmbed(). - Embed(uint32 frame_routing_id, mojo.common.mojom.UnguessableToken token); + Embed(uint32 frame_routing_id, mojo_base.mojom.UnguessableToken token); // Called when a render frame has been destroyed. This is sent via mojom // to handle to ensure there aren't race conditions because of message order diff --git a/chromium/content/common/renderer.mojom b/chromium/content/common/renderer.mojom index 0410f53a8ec..05886a72fce 100644 --- a/chromium/content/common/renderer.mojom +++ b/chromium/content/common/renderer.mojom @@ -7,8 +7,8 @@ module content.mojom; import "content/common/native_types.mojom"; import "content/common/service_worker/embedded_worker.mojom"; import "ipc/constants.mojom"; -import "mojo/common/time.mojom"; -import "mojo/common/unguessable_token.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 "services/service_manager/public/mojom/interface_provider.mojom"; import "services/service_manager/public/mojom/service.mojom"; @@ -61,7 +61,7 @@ struct CreateViewParams { // attribute them to the context frame. // |devtools_main_frame_token| is only defined by the browser and is never // sent back from the renderer in the control calls. - mojo.common.mojom.UnguessableToken devtools_main_frame_token; + mojo_base.mojom.UnguessableToken devtools_main_frame_token; // The ID of the proxy object for the main frame in this view. It is only // used if |swapped_out| is true. @@ -148,7 +148,7 @@ struct CreateFrameParams { // attribute them to the context frame. // |devtools_frame_token| is only defined by the browser and is never // sent back from the renderer in the control calls. - mojo.common.mojom.UnguessableToken devtools_frame_token; + mojo_base.mojom.UnguessableToken devtools_frame_token; // When the new frame has a parent, |frame_owner_properties| holds the // properties of the HTMLFrameOwnerElement from the parent process. @@ -210,7 +210,7 @@ interface Renderer { CreateFrameProxy(int32 routing_id, int32 render_view_routing_id, int32 opener_routing_id, int32 parent_routing_id, FrameReplicationState replication_state, - mojo.common.mojom.UnguessableToken devtools_frame_token); + mojo_base.mojom.UnguessableToken devtools_frame_token); // Tells the renderer that the network type has changed so that // navigator.onLine and navigator.connection can be updated. @@ -226,8 +226,8 @@ interface Renderer { // unavailable, it will be set to net::nqe::internal::INVALID_RTT_THROUGHPUT. OnNetworkQualityChanged( network.mojom.EffectiveConnectionType effective_connection_type, - mojo.common.mojom.TimeDelta http_rtt, - mojo.common.mojom.TimeDelta transport_rtt, + mojo_base.mojom.TimeDelta http_rtt, + mojo_base.mojom.TimeDelta transport_rtt, double bandwidth_kbps); // Tells the renderer to suspend/resume the webkit timers. Only for use on @@ -248,7 +248,6 @@ interface Renderer { // Tells the renderer process to enter or leave background mode. - // TODO(crbug:676224) Make this conditional on IPC_MESSAGE_LOG_ENABLED. SetProcessBackgrounded(bool background); // Tells the scheduler about "keep-alive" state which can be due to: diff --git a/chromium/content/common/resize_params.cc b/chromium/content/common/resize_params.cc index b30dfc37bd9..5e1fd102f66 100644 --- a/chromium/content/common/resize_params.cc +++ b/chromium/content/common/resize_params.cc @@ -7,7 +7,9 @@ namespace content { ResizeParams::ResizeParams() - : browser_controls_shrink_blink_size(false), + : auto_resize_enabled(false), + auto_resize_sequence_number(0u), + browser_controls_shrink_blink_size(false), scroll_focused_node_into_view(false), top_controls_height(0.f), bottom_controls_height(0.f), diff --git a/chromium/content/common/resize_params.h b/chromium/content/common/resize_params.h index 2bea4764eb5..51c472dd522 100644 --- a/chromium/content/common/resize_params.h +++ b/chromium/content/common/resize_params.h @@ -9,7 +9,7 @@ #include "components/viz/common/surfaces/local_surface_id.h" #include "content/common/content_export.h" #include "content/public/common/screen_info.h" -#include "third_party/WebKit/public/platform/WebDisplayMode.h" +#include "third_party/blink/public/platform/web_display_mode.h" #include "ui/gfx/geometry/size.h" namespace content { @@ -22,6 +22,20 @@ struct CONTENT_EXPORT ResizeParams { // Information about the screen (dpi, depth, etc..). ScreenInfo screen_info; + // Whether or not blink should be in auto-resize mode. + bool auto_resize_enabled; + + // The minimum size for Blink if auto-resize is enabled. + gfx::Size min_size_for_auto_resize; + + // The maximum size for Blink if auto-resize is enabled. + gfx::Size max_size_for_auto_resize; + + // This variable is increased after each auto-resize. If the + // renderer receives a ResizeParams with stale auto_resize_seqence_number, + // then the resize request is dropped. + uint64_t auto_resize_sequence_number; + // The size for the widget in DIPs. gfx::Size new_size; diff --git a/chromium/content/common/resource_messages.h b/chromium/content/common/resource_messages.h index ebc2ab1211c..edcf425d7ea 100644 --- a/chromium/content/common/resource_messages.h +++ b/chromium/content/common/resource_messages.h @@ -22,7 +22,7 @@ #include "net/http/http_response_info.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/network_param_ipc_traits.h" -#include "third_party/WebKit/public/platform/WebMixedContentContextType.h" +#include "third_party/blink/public/platform/web_mixed_content_context_type.h" #ifndef INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_ #define INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_ diff --git a/chromium/content/common/sandbox_init_mac.cc b/chromium/content/common/sandbox_init_mac.cc index eaf4ffaac1a..583e283f276 100644 --- a/chromium/content/common/sandbox_init_mac.cc +++ b/chromium/content/common/sandbox_init_mac.cc @@ -4,7 +4,7 @@ #include "content/public/common/sandbox_init.h" -#include "base/callback.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/logging.h" @@ -13,6 +13,7 @@ #include "gpu/config/gpu_info.h" #include "gpu/config/gpu_info_collector.h" #include "gpu/config/gpu_switches.h" +#include "gpu/config/gpu_switching.h" #include "gpu/config/gpu_util.h" #include "gpu/ipc/common/gpu_preferences_util.h" #include "media/gpu/vt_video_decode_accelerator_mac.h" @@ -56,6 +57,10 @@ base::OnceClosure MaybeWrapWithGPUSandboxHook( gpu_preferences.log_gpu_control_list_decisions, command_line, nullptr); gpu::CacheGpuFeatureInfo(gpu_feature_info); + if (gpu::SwitchableGPUsSupported(gpu_info, *command_line)) { + gpu::InitializeSwitchableGPUs( + gpu_feature_info.enabled_gpu_driver_bug_workarounds); + } // Preload either the desktop GL or the osmesa so, depending on the // --use-gl flag. gl::init::InitializeGLOneOff(); @@ -70,23 +75,13 @@ base::OnceClosure MaybeWrapWithGPUSandboxHook( base::Passed(std::move(original))); } -// Fill in |sandbox_type| and |allowed_dir| based on the command line, returns -// false if the current process type doesn't need to be sandboxed or if the -// sandbox was disabled from the command line. -bool GetSandboxInfoFromCommandLine(service_manager::SandboxType* sandbox_type, - base::FilePath* allowed_dir) { +// Fill in |sandbox_type| based on the command line. Returns false if the +// current process type doesn't need to be sandboxed or if the sandbox was +// disabled from the command line. +bool GetSandboxTypeFromCommandLine(service_manager::SandboxType* sandbox_type) { DCHECK(sandbox_type); - DCHECK(allowed_dir); - *allowed_dir = base::FilePath(); // Empty by default. auto* command_line = base::CommandLine::ForCurrentProcess(); - std::string process_type = - command_line->GetSwitchValueASCII(switches::kProcessType); - if (process_type == switches::kUtilityProcess) { - *allowed_dir = - command_line->GetSwitchValuePath(switches::kUtilityProcessAllowedDir); - } - *sandbox_type = service_manager::SandboxTypeFromCommandLine(*command_line); if (service_manager::IsUnsandboxedSandboxType(*sandbox_type)) return false; @@ -102,22 +97,19 @@ bool GetSandboxInfoFromCommandLine(service_manager::SandboxType* sandbox_type, } // namespace -bool InitializeSandbox(service_manager::SandboxType sandbox_type, - const base::FilePath& allowed_dir) { +bool InitializeSandbox(service_manager::SandboxType sandbox_type) { return service_manager::Sandbox::Initialize( - sandbox_type, allowed_dir, + sandbox_type, MaybeWrapWithGPUSandboxHook(sandbox_type, base::OnceClosure())); } bool InitializeSandbox(base::OnceClosure post_warmup_hook) { service_manager::SandboxType sandbox_type = service_manager::SANDBOX_TYPE_INVALID; - base::FilePath allowed_dir; - return !GetSandboxInfoFromCommandLine(&sandbox_type, &allowed_dir) || + return !GetSandboxTypeFromCommandLine(&sandbox_type) || service_manager::Sandbox::Initialize( - sandbox_type, allowed_dir, - MaybeWrapWithGPUSandboxHook(sandbox_type, - std::move(post_warmup_hook))); + sandbox_type, MaybeWrapWithGPUSandboxHook( + sandbox_type, std::move(post_warmup_hook))); } bool InitializeSandbox() { diff --git a/chromium/content/common/sandbox_mac_fontloading_unittest.mm b/chromium/content/common/sandbox_mac_fontloading_unittest.mm index db98aab9a0a..3684f43c790 100644 --- a/chromium/content/common/sandbox_mac_fontloading_unittest.mm +++ b/chromium/content/common/sandbox_mac_fontloading_unittest.mm @@ -112,16 +112,19 @@ TEST_F(MacSandboxTest, FontLoadingTest) { std::unique_ptr<FontLoader::ResultInternal> result = FontLoader::LoadFontForTesting(base::ASCIIToUTF16("Geeza Pro"), 16); - EXPECT_GT(result->font_data_size, 0U); + ASSERT_TRUE(result); + ASSERT_TRUE(result->font_data.is_valid()); + uint64_t font_data_size = result->font_data->GetSize(); + EXPECT_GT(font_data_size, 0U); EXPECT_GT(result->font_id, 0U); mojo::ScopedSharedBufferMapping mapping = - result->font_data->Map(result->font_data_size); + result->font_data->Map(font_data_size); ASSERT_TRUE(mapping); base::WriteFileDescriptor(fileno(temp_file), static_cast<const char*>(mapping.get()), - result->font_data_size); + font_data_size); ASSERT_TRUE(RunTestInSandbox(service_manager::SANDBOX_TYPE_RENDERER, "FontLoadingTestCase", diff --git a/chromium/content/common/sandbox_mac_unittest_helper.mm b/chromium/content/common/sandbox_mac_unittest_helper.mm index 999d96eb3c0..b1daac3fbdb 100644 --- a/chromium/content/common/sandbox_mac_unittest_helper.mm +++ b/chromium/content/common/sandbox_mac_unittest_helper.mm @@ -11,7 +11,6 @@ extern "C" { #include <map> #include <memory> -#include "base/files/file_path.h" #include "base/logging.h" #include "base/process/kill.h" #include "content/test/test_content_client.h" @@ -157,7 +156,7 @@ MULTIPROCESS_TEST_MAIN(mac_sandbox_test_runner) { } service_manager::SandboxMac::Warmup(sandbox_type); - if (!service_manager::SandboxMac::Enable(sandbox_type, base::FilePath())) { + if (!service_manager::SandboxMac::Enable(sandbox_type)) { LOG(ERROR) << "Failed to initialize sandbox " << sandbox_type; return -1; } diff --git a/chromium/content/common/service_manager/service_manager_connection_impl.cc b/chromium/content/common/service_manager/service_manager_connection_impl.cc index ae2e334dacc..49f0da67e49 100644 --- a/chromium/content/common/service_manager/service_manager_connection_impl.cc +++ b/chromium/content/common/service_manager/service_manager_connection_impl.cc @@ -13,7 +13,6 @@ #include "base/callback_helpers.h" #include "base/lazy_instance.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/threading/thread_checker.h" #include "base/threading/thread_task_runner_handle.h" diff --git a/chromium/content/common/service_worker/controller_service_worker.mojom b/chromium/content/common/service_worker/controller_service_worker.mojom index 89c2ea813dc..b08c3a9bcfd 100644 --- a/chromium/content/common/service_worker/controller_service_worker.mojom +++ b/chromium/content/common/service_worker/controller_service_worker.mojom @@ -7,11 +7,11 @@ module content.mojom; import "content/common/service_worker/dispatch_fetch_event_params.mojom"; import "content/common/service_worker/service_worker_event_dispatcher.mojom"; import "content/common/service_worker/service_worker_fetch_response_callback.mojom"; -import "mojo/common/time.mojom"; +import "mojo/public/mojom/base/time.mojom"; import "services/network/public/mojom/url_loader.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_event_status.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom"; -import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; +import "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom"; // S13nServiceWorker: // Represents a service worker that is a 'controller'. @@ -41,7 +41,7 @@ interface ControllerServiceWorker { DispatchFetchEvent(DispatchFetchEventParams params, ServiceWorkerFetchResponseCallback response_callback) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // TODO(kinuko): Add DispatchExtendableMessageEvent() as well. diff --git a/chromium/content/common/service_worker/dispatch_fetch_event_params.mojom b/chromium/content/common/service_worker/dispatch_fetch_event_params.mojom index 2a1d1360df1..05d50cc0893 100644 --- a/chromium/content/common/service_worker/dispatch_fetch_event_params.mojom +++ b/chromium/content/common/service_worker/dispatch_fetch_event_params.mojom @@ -5,7 +5,7 @@ module content.mojom; import "services/network/public/mojom/url_loader.mojom"; -import "third_party/WebKit/public/mojom/blob/blob.mojom"; +import "third_party/blink/public/mojom/blob/blob.mojom"; // Used for service worker navigation preload, to create // FetchEvent#preloadResponse. diff --git a/chromium/content/common/service_worker/embedded_worker.mojom b/chromium/content/common/service_worker/embedded_worker.mojom index 499899a2b25..1dbda4e6cbc 100644 --- a/chromium/content/common/service_worker/embedded_worker.mojom +++ b/chromium/content/common/service_worker/embedded_worker.mojom @@ -9,14 +9,15 @@ import "content/common/service_worker/controller_service_worker.mojom"; import "content/common/service_worker/service_worker_event_dispatcher.mojom"; import "content/common/service_worker/service_worker_provider.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "mojo/common/time.mojom"; -import "mojo/common/unguessable_token.mojom"; +import "mojo/public/mojom/base/time.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom"; -import "third_party/WebKit/public/web/console_message.mojom"; -import "third_party/WebKit/public/web/devtools_agent.mojom"; -import "third_party/WebKit/public/web/worker_content_settings_proxy.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom"; +import "third_party/blink/public/platform/web_feature.mojom"; +import "third_party/blink/public/web/console_message.mojom"; +import "third_party/blink/public/web/devtools_agent.mojom"; +import "third_party/blink/public/web/worker_content_settings_proxy.mojom"; import "url/mojom/url.mojom"; // Parameters to launch a service worker. This is passed from the browser to the @@ -37,7 +38,7 @@ struct EmbeddedWorkerStartParams { // The id to talk with the DevTools agent for the worker. int32 worker_devtools_agent_route_id; // Unique token identifying this worker for DevTools. - mojo.common.mojom.UnguessableToken devtools_worker_token; + mojo_base.mojom.UnguessableToken devtools_worker_token; // When true, worker script evaluation is blocked until // EmbeddedWorkerInstanceClient::ResumeAfterDownload() is called. bool pause_after_download; @@ -71,9 +72,9 @@ struct EmbeddedWorkerStartParams { // Holds timing information about the start worker sequence for UMA. struct EmbeddedWorkerStartTiming { // When this Blink instance finished initializing. - mojo.common.mojom.TimeTicks blink_initialized_time; + mojo_base.mojom.TimeTicks blink_initialized_time; // When the start worker message was received by the renderer. - mojo.common.mojom.TimeTicks start_worker_received_time; + mojo_base.mojom.TimeTicks start_worker_received_time; }; // EmbeddedWorkerInstanceClient is the renderer-side ("Client") of @@ -110,6 +111,17 @@ interface EmbeddedWorkerInstanceHost { // message has been missed, the browser will terminate the service worker. RequestTermination(); + // Tells the browser process that this service worker used |feature|, for + // UseCounter purposes. The browser process propagates the feature usage bit + // to all clients controlled by the service worker. See + // https://crbug.com/376039 for background. + // Note: Because CountFeature() is possible to be called on the main thread + // during service worker startup and is also called on the worker thread after + // that, we put it here rather than interface ServiceWorkerHost, so that we + // can still keep interface ServiceWorkerHost being used solely on the worker + // thread in the renderer process. + CountFeature(blink.mojom.WebFeature feature); + // Indicates that the worker is ready for inspection. OnReadyForInspection(); // Indicates that the worker has finished loading the script. diff --git a/chromium/content/common/service_worker/embedded_worker_messages.h b/chromium/content/common/service_worker/embedded_worker_messages.h deleted file mode 100644 index be5e5c3e1ff..00000000000 --- a/chromium/content/common/service_worker/embedded_worker_messages.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_COMMON_SERVICE_WORKER_EMBEDDED_WORKER_MESSAGES_H_ -#define CONTENT_COMMON_SERVICE_WORKER_EMBEDDED_WORKER_MESSAGES_H_ - -#include <stdint.h> - -#include "ipc/ipc_message.h" -#include "ipc/ipc_message_macros.h" -#include "ipc/ipc_param_traits.h" - -#undef IPC_MESSAGE_EXPORT -#define IPC_MESSAGE_EXPORT CONTENT_EXPORT - -#define IPC_MESSAGE_START EmbeddedWorkerMsgStart - -// Renderer -> Browser message to count an API use. |feature| must be one of the -// values from blink::UseCounter::Feature enum. -IPC_MESSAGE_CONTROL2(EmbeddedWorkerHostMsg_CountFeature, - int64_t /* service_worker_version_id */, - uint32_t /* feature */) - -#endif // CONTENT_COMMON_SERVICE_WORKER_EMBEDDED_WORKER_MESSAGES_H_ diff --git a/chromium/content/common/service_worker/service_worker_container.mojom b/chromium/content/common/service_worker/service_worker_container.mojom index 055be4d4bab..07dc0255a65 100644 --- a/chromium/content/common/service_worker/service_worker_container.mojom +++ b/chromium/content/common/service_worker/service_worker_container.mojom @@ -6,13 +6,19 @@ module content.mojom; import "content/common/service_worker/controller_service_worker.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "third_party/WebKit/public/mojom/message_port/message_port.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_error_type.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom"; -import "third_party/WebKit/public/platform/web_feature.mojom"; +import "third_party/blink/public/mojom/message_port/message_port.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom"; +import "third_party/blink/public/platform/web_feature.mojom"; import "url/mojom/url.mojom"; +// Used for EnsureControllerServiceWorker() to indicate why a controllee needs +// a controller ServiceWorker. +enum ControllerServiceWorkerPurpose { + FETCH_SUB_RESOURCE +}; + // mojom::ServiceWorkerContainerHost is a browser-side interface. The renderer // process uses this interface to request the browser process to do operations // involving service worker registrations. @@ -56,7 +62,7 @@ interface ServiceWorkerContainerHost { => (blink.mojom.ServiceWorkerRegistrationObjectInfo? registration); // S13nServiceWorker: - // Gets a Mojo end point to the controller ServiceWorker. This may start a + // Returns a Mojo end point to the controller ServiceWorker. This may start a // service worker instance in a renderer process if the corresponding // instance is not alive. // This method must be called only by the controllees. @@ -64,12 +70,19 @@ interface ServiceWorkerContainerHost { // connection error of the returned pipe. The detailed error reasons are not // reported to the controllees, but the browser process is responsible for // properly handling the failure and recording the reasons. - GetControllerServiceWorker(ControllerServiceWorker& controller); + // |purpose| is used for UMA. + EnsureControllerServiceWorker(ControllerServiceWorker& controller, + ControllerServiceWorkerPurpose purpose); // S13nServiceWorker: // Clones the Mojo end point to the ServiceWorker container host. This is // used to communicate with the host from dedicated and shared workers. CloneForWorker(ServiceWorkerContainerHost& container_host_for_worker); + + // Does nothing but calls the callback. Useful for pumping the message pipe + // for this interface and associated interfaces: when the callback is called, + // you know all incoming messages up to the Ping() call have been received. + Ping() => (); }; // mojom::ServiceWorkerContainer is a renderer-side interface. diff --git a/chromium/content/common/service_worker/service_worker_event_dispatcher.mojom b/chromium/content/common/service_worker/service_worker_event_dispatcher.mojom index 815aa49d33a..2d97943541e 100644 --- a/chromium/content/common/service_worker/service_worker_event_dispatcher.mojom +++ b/chromium/content/common/service_worker/service_worker_event_dispatcher.mojom @@ -7,13 +7,13 @@ module content.mojom; import "content/common/service_worker/dispatch_fetch_event_params.mojom"; import "content/common/service_worker/service_worker_fetch_response_callback.mojom"; import "mojo/public/mojom/base/string16.mojom"; -import "mojo/common/time.mojom"; -import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom"; -import "third_party/WebKit/public/platform/modules/payments/payment_app.mojom"; -import "third_party/WebKit/public/mojom/message_port/message_port.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_client.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_event_status.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom"; +import "mojo/public/mojom/base/time.mojom"; +import "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom"; +import "third_party/blink/public/platform/modules/payments/payment_app.mojom"; +import "third_party/blink/public/mojom/message_port/message_port.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_client.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; @@ -59,17 +59,17 @@ const int32 kPushEventTimeoutSeconds = 90; // to dispatch events from the browser-side. // // Those events expecting such response -// (blink.mojom.ServiceWorkerEventStatus, mojo.common.mojom.Time) are considered +// (blink.mojom.ServiceWorkerEventStatus, mojo_base.mojom.Time) are considered // 'simple events'. ServiceWorkerVersion::CreateSimpleEventCallback can be used // to create the callback for these. interface ServiceWorkerEventDispatcher { DispatchInstallEvent() => (blink.mojom.ServiceWorkerEventStatus status, bool has_fetch_handler, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchActivateEvent() => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // These methods dispatch to the ServiceWorkerGlobalScope the events listed on // https://wicg.github.io/background-fetch/#service-worker-global-events. @@ -78,20 +78,20 @@ interface ServiceWorkerEventDispatcher { // content::BackgroundFetchRegistrationId. DispatchBackgroundFetchAbortEvent(string developer_id) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchBackgroundFetchClickEvent(string developer_id, BackgroundFetchState state) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchBackgroundFetchFailEvent(string developer_id, array<BackgroundFetchSettledFetch> fetches) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchBackgroundFetchedEvent(string developer_id, string unique_id, array<BackgroundFetchSettledFetch> fetches) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // The Dispatch*FetchEvent() callback is called once the event finishes, // which means the event handler ran and all outstanding respondWith() and @@ -101,21 +101,21 @@ interface ServiceWorkerEventDispatcher { DispatchFetchEvent(DispatchFetchEventParams params, ServiceWorkerFetchResponseCallback response_callback) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchNotificationClickEvent(string notification_id, PlatformNotificationData notification_data, int32 action_index, mojo_base.mojom.String16? reply) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchNotificationCloseEvent(string notification_id, PlatformNotificationData notification_data) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchPushEvent(PushEventPayload payload) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // Arguments are passed to the event handler as parameters of SyncEvent. // Ref: https://wicg.github.io/BackgroundSync/spec/#sync-event // S13nServiceWorker: |timeout| is the amount of time to allow this event to @@ -123,29 +123,29 @@ interface ServiceWorkerEventDispatcher { // Non-S13nServiceWorker: |timeout| is just ignored. DispatchSyncEvent(string id, bool last_chance, - mojo.common.mojom.TimeDelta timeout) + mojo_base.mojom.TimeDelta timeout) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchAbortPaymentEvent( int32 event_id, payments.mojom.PaymentHandlerResponseCallback result_of_abort_payment) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchCanMakePaymentEvent( int32 event_id, payments.mojom.CanMakePaymentEventData event_data, payments.mojom.PaymentHandlerResponseCallback result_of_can_make_payment) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchPaymentRequestEvent( int32 payment_request_id, payments.mojom.PaymentRequestEventData request_data, payments.mojom.PaymentHandlerResponseCallback response_callback) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); DispatchExtendableMessageEvent(ExtendableMessageEvent event) => (blink.mojom.ServiceWorkerEventStatus status, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // Pings the service worker to check if it is responsive. If the callback is // not called within a certain period of time, the browser will terminate the diff --git a/chromium/content/common/service_worker/service_worker_fetch_request.typemap b/chromium/content/common/service_worker/service_worker_fetch_request.typemap index b5bf9009c96..013db542c01 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_request.typemap +++ b/chromium/content/common/service_worker/service_worker_fetch_request.typemap @@ -3,7 +3,7 @@ # found in the LICENSE file. mojom = - "//third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom" + "//third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom" public_headers = [ "//content/common/service_worker/service_worker_types.h", "//content/public/common/request_context_type.h", diff --git a/chromium/content/common/service_worker/service_worker_fetch_request_mojom_traits.h b/chromium/content/common/service_worker/service_worker_fetch_request_mojom_traits.h index 449c4ca18ff..55862700585 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_request_mojom_traits.h +++ b/chromium/content/common/service_worker/service_worker_fetch_request_mojom_traits.h @@ -9,7 +9,7 @@ #include "content/public/common/referrer.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" #include "storage/common/blob_storage/blob_handle.h" -#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" namespace mojo { diff --git a/chromium/content/common/service_worker/service_worker_fetch_response.typemap b/chromium/content/common/service_worker/service_worker_fetch_response.typemap index dac46502d1c..60c7e5d5aa3 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_response.typemap +++ b/chromium/content/common/service_worker/service_worker_fetch_response.typemap @@ -2,7 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -mojom = "//third_party/WebKit/public/platform/modules/fetch/fetch_api_response.mojom" +mojom = + "//third_party/blink/public/platform/modules/fetch/fetch_api_response.mojom" public_headers = [ "//content/common/service_worker/service_worker_types.h" ] traits_headers = [ "//content/common/service_worker/service_worker_fetch_response_mojom_traits.h" ] sources = [ diff --git a/chromium/content/common/service_worker/service_worker_fetch_response_callback.mojom b/chromium/content/common/service_worker/service_worker_fetch_response_callback.mojom index 8b134fcded1..105b2639cac 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_response_callback.mojom +++ b/chromium/content/common/service_worker/service_worker_fetch_response_callback.mojom @@ -4,9 +4,9 @@ module content.mojom; -import "mojo/common/time.mojom"; -import "third_party/WebKit/public/mojom/blob/blob.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_stream_handle.mojom"; +import "mojo/public/mojom/base/time.mojom"; +import "third_party/blink/public/mojom/blob/blob.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_stream_handle.mojom"; [Native] struct ServiceWorkerResponse; @@ -18,24 +18,24 @@ struct ServiceWorkerResponse; interface ServiceWorkerFetchResponseCallback { // Responds to the request with |response|. The body is empty. OnResponse(ServiceWorkerResponse response, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // Responds to the request with |response|. The body is returned as a blob. // TODO(kinuko): This should not be necessary once we properly support // transferring blob within |response|. See crbug.com/75523 for more details. OnResponseBlob(ServiceWorkerResponse response, blink.mojom.Blob body_as_blob, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // Responds to the request with |response|. The body is provided as a // non-Mojo Blob via |response.blob_uuid|. The callback is useful for Blob // lifetime management purposes and is called once the caller is done with // the Blob. TODO(kinuko): Remove this once MojoBlob is fully shipped. OnResponseLegacyBlob(ServiceWorkerResponse response, - mojo.common.mojom.Time dispatch_event_time) => (); + mojo_base.mojom.Time dispatch_event_time) => (); // Responds to the request with |response|. The body is returned as a stream. OnResponseStream(ServiceWorkerResponse response, blink.mojom.ServiceWorkerStreamHandle body_as_stream, - mojo.common.mojom.Time dispatch_event_time); + mojo_base.mojom.Time dispatch_event_time); // Provides no response to the request. The callee should fall back to the // network. - OnFallback(mojo.common.mojom.Time dispatch_event_time); + OnFallback(mojo_base.mojom.Time dispatch_event_time); }; diff --git a/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.cc b/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.cc index 5a868970ca8..4d615363d26 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.cc +++ b/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.cc @@ -14,7 +14,7 @@ #include "content/common/service_worker/service_worker_types.h" #include "content/public/common/referrer_struct_traits.h" #include "ipc/ipc_message_utils.h" -#include "mojo/common/time_struct_traits.h" +#include "mojo/public/cpp/base/time_mojom_traits.h" #include "url/mojom/url_gurl_mojom_traits.h" namespace mojo { diff --git a/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.h b/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.h index e5a0f70e4cb..51d7d859813 100644 --- a/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.h +++ b/chromium/content/common/service_worker/service_worker_fetch_response_mojom_traits.h @@ -10,8 +10,8 @@ #include "base/numerics/safe_conversions.h" #include "content/common/service_worker/service_worker_types.h" -#include "third_party/WebKit/public/mojom/blob/blob.mojom.h" -#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_response.mojom.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_response.mojom.h" namespace mojo { 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 acb16b12daf..0b4912c8982 100644 --- a/chromium/content/common/service_worker/service_worker_loader_helpers.cc +++ b/chromium/content/common/service_worker/service_worker_loader_helpers.cc @@ -170,10 +170,7 @@ ServiceWorkerLoaderHelpers::CloneResourceRequestBody( NOTREACHED(); break; case network::DataElement::TYPE_DATA_PIPE: { - network::mojom::DataPipeGetterPtrInfo clone_ptr_info; - element.data_pipe()->Clone(mojo::MakeRequest(&clone_ptr_info)); - network::mojom::DataPipeGetterPtr clone_ptr(std::move(clone_ptr_info)); - clone->AppendDataPipe(std::move(clone_ptr)); + clone->AppendDataPipe(element.CloneDataPipeGetter()); break; } case network::DataElement::TYPE_RAW_FILE: @@ -181,6 +178,10 @@ ServiceWorkerLoaderHelpers::CloneResourceRequestBody( element.offset(), element.length(), element.expected_modification_time()); break; + case network::DataElement::TYPE_CHUNKED_DATA_PIPE: + NOTREACHED() << "There should be no chunked data pipes going through " + "ServiceWorker"; + break; case network::DataElement::TYPE_BLOB: NOTREACHED() << "There should be no blob elements in NetworkService"; break; diff --git a/chromium/content/common/service_worker/service_worker_loader_helpers.h b/chromium/content/common/service_worker/service_worker_loader_helpers.h index 27e1a02f31d..3654e07fcfe 100644 --- a/chromium/content/common/service_worker/service_worker_loader_helpers.h +++ b/chromium/content/common/service_worker/service_worker_loader_helpers.h @@ -9,7 +9,7 @@ #include "content/common/service_worker/service_worker_types.h" #include "net/http/http_request_headers.h" #include "net/url_request/redirect_info.h" -#include "third_party/WebKit/public/mojom/blob/blob.mojom.h" +#include "third_party/blink/public/mojom/blob/blob.mojom.h" namespace network { class ResourceRequestBody; diff --git a/chromium/content/common/service_worker/service_worker_messages.h b/chromium/content/common/service_worker/service_worker_messages.h index aceea652a86..9c6dd91051c 100644 --- a/chromium/content/common/service_worker/service_worker_messages.h +++ b/chromium/content/common/service_worker/service_worker_messages.h @@ -19,9 +19,7 @@ #include "ipc/ipc_message_macros.h" #include "ipc/ipc_param_traits.h" #include "services/network/public/mojom/fetch_api.mojom.h" -#include "third_party/WebKit/public/common/message_port/message_port_channel.h" -#include "third_party/WebKit/public/common/message_port/transferable_message.h" -#include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h" +#include "third_party/blink/public/platform/modules/serviceworker/web_service_worker_error.h" #undef IPC_MESSAGE_EXPORT #define IPC_MESSAGE_EXPORT CONTENT_EXPORT @@ -29,13 +27,13 @@ #define IPC_MESSAGE_START ServiceWorkerMsgStart IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ServiceWorkerErrorType, - blink::mojom::ServiceWorkerErrorType::kLast) + blink::mojom::ServiceWorkerErrorType::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ServiceWorkerState, - blink::mojom::ServiceWorkerState::kLast) + blink::mojom::ServiceWorkerState::kMaxValue) IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ServiceWorkerResponseError, - blink::mojom::ServiceWorkerResponseError::kLast) + blink::mojom::ServiceWorkerResponseError::kMaxValue) IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest) IPC_STRUCT_TRAITS_MEMBER(mode) @@ -79,16 +77,6 @@ IPC_STRUCT_TRAITS_BEGIN(content::PushEventPayload) IPC_STRUCT_TRAITS_END() //--------------------------------------------------------------------------- -// Messages sent from the child process to the browser. - -// Sends MessageEvent to a client (renderer->browser). -IPC_MESSAGE_ROUTED2( - ServiceWorkerHostMsg_PostMessageToClient, - std::string /* uuid */, - scoped_refptr< - base::RefCountedData<blink::TransferableMessage>> /* message */) - -//--------------------------------------------------------------------------- // Messages sent from the browser to the child process. // // NOTE: All ServiceWorkerMsg messages not sent via EmbeddedWorker must have diff --git a/chromium/content/common/service_worker/service_worker_provider.mojom b/chromium/content/common/service_worker/service_worker_provider.mojom index 3b3e306e383..de8bda5821d 100644 --- a/chromium/content/common/service_worker/service_worker_provider.mojom +++ b/chromium/content/common/service_worker/service_worker_provider.mojom @@ -7,14 +7,24 @@ module content.mojom; import "content/common/service_worker/service_worker_container.mojom"; import "services/network/public/mojom/url_loader_factory.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom"; -import "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom"; // The name of the InterfaceProviderSpec in service manifests used by the // frame tree to expose service-worker-specific interfaces between renderer // and browser. const string kNavigation_ServiceWorkerSpec = "navigation:service_worker"; +// S13nServiceWorker: +// Sent from the browser process to the renderer. Contains parameteres for the +// constructor of ServiceWorkerNetworkProvider used for starting a shared +// worker. +struct ServiceWorkerProviderInfoForSharedWorker { + int32 provider_id; + associated ServiceWorkerContainerHost host_ptr_info; + associated ServiceWorkerContainer& client_request; +}; + // Sent from the browser process to the renderer. Contains parameters for the // constructor of ServiceWorkerNetworkProvider used for starting a service // worker. @@ -27,7 +37,7 @@ struct ServiceWorkerProviderInfoForStartWorker { associated ServiceWorkerContainerHost host_ptr_info; associated ServiceWorkerContainer& client_request; - // For servicified service worker only. + // S13nServiceWorker: // The loader to use for loading the worker's main script and // importScripts(). associated network.mojom.URLLoaderFactory? script_loader_factory_ptr_info; diff --git a/chromium/content/common/service_worker/service_worker_provider_host_info.h b/chromium/content/common/service_worker/service_worker_provider_host_info.h index 809286643be..d7ebeb3228c 100644 --- a/chromium/content/common/service_worker/service_worker_provider_host_info.h +++ b/chromium/content/common/service_worker/service_worker_provider_host_info.h @@ -7,7 +7,7 @@ #include "content/common/service_worker/service_worker_container.mojom.h" #include "content/common/service_worker/service_worker_types.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom.h" namespace content { @@ -56,14 +56,14 @@ struct CONTENT_EXPORT ServiceWorkerProviderHostInfo { // Mojo endpoint to send a message from the renderer to the browser. This // will be associated with ServiceWorkerDisptacherHost. |host_request| should - // be valid when ServiceWorkerProviderHostInfo is passed to any Mojo methods. + // be valid when ServiceWorkerProviderHostInfo is passed to any Mojo method. // After used to create the ServiceWorkerProviderHost, this will be invalid. mojom::ServiceWorkerContainerHostAssociatedRequest host_request; // Mojo endpoint to send a message from the browser to the renderer. This - // will be associated with ServiceWorkerDisptacherHost. |client_ptr_info| + // will be associated with ServiceWorkerDispatcherHost. |client_ptr_info| // should be valid when ServiceWorkerProviderHostInfo is passed to any Mojo - // methods. + // method. // After used to create the ServiceWorkerProviderHost, this will be invalid. mojom::ServiceWorkerContainerAssociatedPtrInfo client_ptr_info; diff --git a/chromium/content/common/service_worker/service_worker_provider_struct_traits.h b/chromium/content/common/service_worker/service_worker_provider_struct_traits.h index d9aa94bb56a..20316209d9d 100644 --- a/chromium/content/common/service_worker/service_worker_provider_struct_traits.h +++ b/chromium/content/common/service_worker/service_worker_provider_struct_traits.h @@ -6,7 +6,7 @@ #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_STRUCT_TRAITS_H_ #include "content/common/service_worker/service_worker_provider.mojom.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_provider_type.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom.h" namespace mojo { diff --git a/chromium/content/common/service_worker/service_worker_types.cc b/chromium/content/common/service_worker/service_worker_types.cc index 632db938939..4f93a652e54 100644 --- a/chromium/content/common/service_worker/service_worker_types.cc +++ b/chromium/content/common/service_worker/service_worker_types.cc @@ -19,8 +19,19 @@ const char kServiceWorkerGetRegistrationErrorPrefix[] = "Failed to get a ServiceWorkerRegistration: "; const char kServiceWorkerGetRegistrationsErrorPrefix[] = "Failed to get ServiceWorkerRegistration objects: "; -const char kFetchScriptError[] = +const char kServiceWorkerFetchScriptError[] = "An unknown error occurred when fetching the script."; +const char kServiceWorkerBadHTTPResponseError[] = + "A bad HTTP response code (%d) was received when fetching the script."; +const char kServiceWorkerSSLError[] = + "An SSL certificate error occurred when fetching the script."; +const char kServiceWorkerBadMIMEError[] = + "The script has an unsupported MIME type ('%s')."; +const char kServiceWorkerNoMIMEError[] = + "The script does not have a MIME type."; +const char kServiceWorkerRedirectError[] = + "The script resource is behind a redirect, which is disallowed."; +const char kServiceWorkerAllowed[] = "Service-Worker-Allowed"; ServiceWorkerFetchRequest::ServiceWorkerFetchRequest() = default; diff --git a/chromium/content/common/service_worker/service_worker_types.h b/chromium/content/common/service_worker/service_worker_types.h index ab84fa9d335..bf4983a15ce 100644 --- a/chromium/content/common/service_worker/service_worker_types.h +++ b/chromium/content/common/service_worker/service_worker_types.h @@ -19,12 +19,12 @@ #include "content/public/common/request_context_type.h" #include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/public/mojom/request_context_frame_type.mojom.h" -#include "third_party/WebKit/public/mojom/page/page_visibility_state.mojom.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_client.mojom.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_object.mojom.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_registration.mojom.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_state.mojom.h" -#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom.h" +#include "third_party/blink/public/mojom/page/page_visibility_state.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_client.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_state.mojom.h" +#include "third_party/blink/public/platform/modules/fetch/fetch_api_request.mojom.h" #include "url/gurl.h" // This file is to have common definitions that are to be shared by @@ -46,7 +46,13 @@ extern const char kServiceWorkerUpdateErrorPrefix[]; extern const char kServiceWorkerUnregisterErrorPrefix[]; extern const char kServiceWorkerGetRegistrationErrorPrefix[]; extern const char kServiceWorkerGetRegistrationsErrorPrefix[]; -extern const char kFetchScriptError[]; +extern const char kServiceWorkerFetchScriptError[]; +extern const char kServiceWorkerBadHTTPResponseError[]; +extern const char kServiceWorkerSSLError[]; +extern const char kServiceWorkerBadMIMEError[]; +extern const char kServiceWorkerNoMIMEError[]; +extern const char kServiceWorkerRedirectError[]; +extern const char kServiceWorkerAllowed[]; // Constants for invalid identifiers. static const int kInvalidEmbeddedWorkerThreadId = -1; diff --git a/chromium/content/common/service_worker/service_worker_utils.h b/chromium/content/common/service_worker/service_worker_utils.h index 8afa7dc5bb2..9df6f6668ae 100644 --- a/chromium/content/common/service_worker/service_worker_utils.h +++ b/chromium/content/common/service_worker/service_worker_utils.h @@ -13,7 +13,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/resource_type.h" #include "net/http/http_request_headers.h" -#include "third_party/WebKit/public/mojom/service_worker/service_worker_error_type.mojom.h" +#include "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom.h" #include "url/gurl.h" namespace content { diff --git a/chromium/content/common/shared_worker/shared_worker.mojom b/chromium/content/common/shared_worker/shared_worker.mojom index ca8229bb7cd..c7539c4f154 100644 --- a/chromium/content/common/shared_worker/shared_worker.mojom +++ b/chromium/content/common/shared_worker/shared_worker.mojom @@ -4,7 +4,7 @@ module content.mojom; -import "third_party/WebKit/public/web/devtools_agent.mojom"; +import "third_party/blink/public/web/devtools_agent.mojom"; // Interface used by the host to control the shared worker. interface SharedWorker { diff --git a/chromium/content/common/shared_worker/shared_worker_client.mojom b/chromium/content/common/shared_worker/shared_worker_client.mojom index 0ff30a396fe..9e2c6fc12c0 100644 --- a/chromium/content/common/shared_worker/shared_worker_client.mojom +++ b/chromium/content/common/shared_worker/shared_worker_client.mojom @@ -4,8 +4,8 @@ module content.mojom; -import "third_party/WebKit/public/platform/web_feature.mojom"; -import "third_party/WebKit/public/web/shared_worker_creation_context_type.mojom"; +import "third_party/blink/public/mojom/shared_worker/shared_worker_creation_context_type.mojom"; +import "third_party/blink/public/platform/web_feature.mojom"; // An interface used by clients (e.g., the renderer where "new SharedWorker()" // was invoked) to observe events from a shared worker. diff --git a/chromium/content/common/shared_worker/shared_worker_connector.mojom b/chromium/content/common/shared_worker/shared_worker_connector.mojom index f0b663fb786..39cd78c7450 100644 --- a/chromium/content/common/shared_worker/shared_worker_connector.mojom +++ b/chromium/content/common/shared_worker/shared_worker_connector.mojom @@ -6,7 +6,7 @@ module content.mojom; import "content/common/shared_worker/shared_worker_client.mojom"; import "content/common/shared_worker/shared_worker_info.mojom"; -import "third_party/WebKit/public/web/shared_worker_creation_context_type.mojom"; +import "third_party/blink/public/mojom/shared_worker/shared_worker_creation_context_type.mojom"; // This interface is exposed to enable a client to create and connect to a // shared worker. diff --git a/chromium/content/common/shared_worker/shared_worker_factory.mojom b/chromium/content/common/shared_worker/shared_worker_factory.mojom index ef8dffb7ae0..13c068af65a 100644 --- a/chromium/content/common/shared_worker/shared_worker_factory.mojom +++ b/chromium/content/common/shared_worker/shared_worker_factory.mojom @@ -4,12 +4,14 @@ module content.mojom; +import "content/common/service_worker/service_worker_provider.mojom"; import "content/common/shared_worker/shared_worker.mojom"; import "content/common/shared_worker/shared_worker_host.mojom"; import "content/common/shared_worker/shared_worker_info.mojom"; -import "mojo/common/unguessable_token.mojom"; +import "mojo/public/mojom/base/unguessable_token.mojom"; +import "services/network/public/mojom/url_loader_factory.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; -import "third_party/WebKit/public/web/worker_content_settings_proxy.mojom"; +import "third_party/blink/public/web/worker_content_settings_proxy.mojom"; // The name of the InterfaceProviderSpec in service manifests used by the // frame tree to expose shared-worker-specific interfaces between renderer and @@ -27,8 +29,30 @@ interface SharedWorkerFactory { CreateSharedWorker( SharedWorkerInfo info, bool pause_on_start, - mojo.common.mojom.UnguessableToken devtools_worker_token, + mojo_base.mojom.UnguessableToken devtools_worker_token, blink.mojom.WorkerContentSettingsProxy content_settings, + + // S13nServiceWorker: + // The info about the host in the browser process that provides support + // for this shared worker to be a service worker client. Null when + // S13nServiceWorker is disabled. + ServiceWorkerProviderInfoForSharedWorker? service_worker_provider_info, + + // S13nServiceWorker: + // The URLLoaderFactory to use to request the shared worker's script + // (just the main script resource; importScripts() should go through the + // usual loader or the controller service worker if appropriate). + // + // Null when S13nServiceWorker is disabled. + // + // It doesn't really need to be associated, but a similar associated + // interface ptr is sent for service worker startup, so making this + // associated too simplifies code on the renderer, as + // ServiceWorkerNetworkProvider::script_loader_factory_ can be an + // associated interface ptr used for both service worker and shared + // worker execution contexts. + associated network.mojom.URLLoaderFactory? script_loader_factory_ptr_info, + SharedWorkerHost host, SharedWorker& shared_worker, service_manager.mojom.InterfaceProvider interface_provider); diff --git a/chromium/content/common/shared_worker/shared_worker_host.mojom b/chromium/content/common/shared_worker/shared_worker_host.mojom index 1a893fac15d..58e6082b5ca 100644 --- a/chromium/content/common/shared_worker/shared_worker_host.mojom +++ b/chromium/content/common/shared_worker/shared_worker_host.mojom @@ -4,7 +4,7 @@ module content.mojom; -import "third_party/WebKit/public/platform/web_feature.mojom"; +import "third_party/blink/public/platform/web_feature.mojom"; // Each shared worker has a corresponding host. The host controls the lifetime // of the shared worker. This interface is used by the shared worker to talk to diff --git a/chromium/content/common/shared_worker/shared_worker_info.mojom b/chromium/content/common/shared_worker/shared_worker_info.mojom index eec393499f5..38782d71ee1 100644 --- a/chromium/content/common/shared_worker/shared_worker_info.mojom +++ b/chromium/content/common/shared_worker/shared_worker_info.mojom @@ -4,8 +4,8 @@ module content.mojom; -import "third_party/WebKit/public/mojom/net/ip_address_space.mojom"; -import "third_party/WebKit/public/platform/content_security_policy.mojom"; +import "third_party/blink/public/mojom/net/ip_address_space.mojom"; +import "third_party/blink/public/platform/content_security_policy.mojom"; import "url/mojom/url.mojom"; // Meta data that is necessary to create a new shared worker context. This diff --git a/chromium/content/common/single_request_url_loader_factory.cc b/chromium/content/common/single_request_url_loader_factory.cc index 9bbe28c4611..1a3828903af 100644 --- a/chromium/content/common/single_request_url_loader_factory.cc +++ b/chromium/content/common/single_request_url_loader_factory.cc @@ -8,7 +8,6 @@ #include <utility> #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/sequenced_task_runner.h" #include "base/threading/sequenced_task_runner_handle.h" @@ -57,14 +56,14 @@ class SingleRequestURLLoaderFactory::HandlerState }; class SingleRequestURLLoaderFactory::FactoryInfo - : public SharedURLLoaderFactoryInfo { + : public network::SharedURLLoaderFactoryInfo { public: explicit FactoryInfo(scoped_refptr<HandlerState> state) : state_(std::move(state)) {} ~FactoryInfo() override = default; // SharedURLLoaderFactoryInfo: - scoped_refptr<SharedURLLoaderFactory> CreateFactory() override { + scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override { return new SingleRequestURLLoaderFactory(std::move(state_)); } @@ -89,7 +88,7 @@ void SingleRequestURLLoaderFactory::CreateLoaderAndStart( state_->HandleRequest(std::move(loader), std::move(client)); } -std::unique_ptr<SharedURLLoaderFactoryInfo> +std::unique_ptr<network::SharedURLLoaderFactoryInfo> SingleRequestURLLoaderFactory::Clone() { return std::make_unique<FactoryInfo>(state_); } diff --git a/chromium/content/common/single_request_url_loader_factory.h b/chromium/content/common/single_request_url_loader_factory.h index 44673b26896..0250e786be4 100644 --- a/chromium/content/common/single_request_url_loader_factory.h +++ b/chromium/content/common/single_request_url_loader_factory.h @@ -5,7 +5,7 @@ #ifndef CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_ #define CONTENT_COMMON_SINGLE_REQUEST_URL_LOADER_FACTORY_H_ -#include "content/public/common/shared_url_loader_factory.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "base/memory/ref_counted.h" #include "services/network/public/mojom/url_loader.mojom.h" @@ -15,7 +15,7 @@ namespace content { // An implementation of SharedURLLoaderFactory which handles only a single // request. It's an error to call CreateLoaderAndStart() more than a total of // one time across this object or any of its clones. -class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory { +class SingleRequestURLLoaderFactory : public network::SharedURLLoaderFactory { public: using RequestHandler = base::OnceCallback<void(network::mojom::URLLoaderRequest, @@ -32,7 +32,7 @@ class SingleRequestURLLoaderFactory : public SharedURLLoaderFactory { network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) override; - std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override; + std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override; private: class FactoryInfo; diff --git a/chromium/content/common/speech_recognition_messages.h b/chromium/content/common/speech_recognition_messages.h index e9d7f0693e4..a7843381fac 100644 --- a/chromium/content/common/speech_recognition_messages.h +++ b/chromium/content/common/speech_recognition_messages.h @@ -49,8 +49,8 @@ IPC_STRUCT_TRAITS_END() // Used to start a speech recognition session. IPC_STRUCT_BEGIN(SpeechRecognitionHostMsg_StartRequest_Params) - // The render view requesting speech recognition. - IPC_STRUCT_MEMBER(int, render_view_id) + // The render frame requesting speech recognition. + IPC_STRUCT_MEMBER(int, render_frame_id) // Unique ID associated with the JS object making the calls. IPC_STRUCT_MEMBER(int, request_id) // Language to use for speech recognition. @@ -73,25 +73,25 @@ IPC_MESSAGE_CONTROL1(SpeechRecognitionHostMsg_StartRequest, SpeechRecognitionHostMsg_StartRequest_Params) // Requests the speech recognition service to abort speech recognition on -// behalf of the given |render_view_id| and |request_id|. If there are no -// sessions associated with the |request_id| in the render view, this call +// behalf of the given |render_frame_id| and |request_id|. If there are no +// sessions associated with the |request_id| in the render frame, this call // does nothing. IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_AbortRequest, - int /* render_view_id */, + int /* render_frame_id */, int /* request_id */) // Requests the speech recognition service to abort all speech recognitions on -// behalf of the given |render_view_id|. If speech recognition is not happening -// or is happening on behalf of some other render view, this call does nothing. +// behalf of the given |render_frame_id|. If speech recognition is not happening +// or is happening on behalf of some other render frame, this call does nothing. IPC_MESSAGE_CONTROL1(SpeechRecognitionHostMsg_AbortAllRequests, - int /* render_view_id */) + int /* render_frame_id */) // Requests the speech recognition service to stop audio capture on behalf of -// the given |render_view_id|. Any audio recorded so far will be fed to the +// the given |render_frame_id|. Any audio recorded so far will be fed to the // speech recognizer. If speech recognition is not happening nor or is -// happening on behalf of some other render view, this call does nothing. +// happening on behalf of some other render frame, this call does nothing. IPC_MESSAGE_CONTROL2(SpeechRecognitionHostMsg_StopCaptureRequest, - int /* render_view_id */, + int /* render_frame_id */, int /* request_id */) // Browser -> Renderer messages. diff --git a/chromium/content/common/throttling_url_loader.cc b/chromium/content/common/throttling_url_loader.cc index fc8c82159cb..0d0ba0268bf 100644 --- a/chromium/content/common/throttling_url_loader.cc +++ b/chromium/content/common/throttling_url_loader.cc @@ -60,6 +60,20 @@ class ThrottlingURLLoader::ForwardingThrottleDelegate loader_->ResumeReadingBodyFromNet(throttle_); } + void InterceptResponse( + network::mojom::URLLoaderPtr new_loader, + network::mojom::URLLoaderClientRequest new_client_request, + network::mojom::URLLoaderPtr* original_loader, + network::mojom::URLLoaderClientRequest* original_client_request) + override { + if (!loader_) + return; + + ScopedDelegateCall scoped_delegate_call(this); + loader_->InterceptResponse(std::move(new_loader), + std::move(new_client_request), original_loader, + original_client_request); + } void Detach() { loader_ = nullptr; } private: @@ -95,7 +109,7 @@ class ThrottlingURLLoader::ForwardingThrottleDelegate }; ThrottlingURLLoader::StartInfo::StartInfo( - scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory, + scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory, int32_t in_routing_id, int32_t in_request_id, uint32_t in_options, @@ -112,10 +126,8 @@ ThrottlingURLLoader::StartInfo::~StartInfo() = default; ThrottlingURLLoader::ResponseInfo::ResponseInfo( const network::ResourceResponseHead& in_response_head, - const base::Optional<net::SSLInfo>& in_ssl_info, network::mojom::DownloadedTempFilePtr in_downloaded_file) : response_head(in_response_head), - ssl_info(in_ssl_info), downloaded_file(std::move(in_downloaded_file)) {} ThrottlingURLLoader::ResponseInfo::~ResponseInfo() = default; @@ -136,7 +148,7 @@ ThrottlingURLLoader::PriorityInfo::~PriorityInfo() = default; // static std::unique_ptr<ThrottlingURLLoader> ThrottlingURLLoader::CreateLoaderAndStart( - scoped_refptr<SharedURLLoaderFactory> factory, + scoped_refptr<network::SharedURLLoaderFactory> factory, std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, int32_t routing_id, int32_t request_id, @@ -205,7 +217,7 @@ ThrottlingURLLoader::ThrottlingURLLoader( } void ThrottlingURLLoader::Start( - scoped_refptr<SharedURLLoaderFactory> factory, + scoped_refptr<network::SharedURLLoaderFactory> factory, int32_t routing_id, int32_t request_id, uint32_t options, @@ -242,7 +254,7 @@ void ThrottlingURLLoader::Start( } void ThrottlingURLLoader::StartNow( - SharedURLLoaderFactory* factory, + network::SharedURLLoaderFactory* factory, int32_t routing_id, int32_t request_id, uint32_t options, @@ -296,7 +308,6 @@ void ThrottlingURLLoader::StopDeferringForThrottle( void ThrottlingURLLoader::OnReceiveResponse( const network::ResourceResponseHead& response_head, - const base::Optional<net::SSLInfo>& ssl_info, network::mojom::DownloadedTempFilePtr downloaded_file) { DCHECK_EQ(DEFERRED_NONE, deferred_stage_); DCHECK(!loader_cancelled_); @@ -316,13 +327,13 @@ void ThrottlingURLLoader::OnReceiveResponse( if (deferred) { deferred_stage_ = DEFERRED_RESPONSE; response_info_ = std::make_unique<ResponseInfo>( - response_head, ssl_info, std::move(downloaded_file)); + response_head, std::move(downloaded_file)); client_binding_.PauseIncomingMethodCallProcessing(); return; } } - forwarding_client_->OnReceiveResponse(response_head, ssl_info, + forwarding_client_->OnReceiveResponse(response_head, std::move(downloaded_file)); } @@ -454,19 +465,21 @@ void ThrottlingURLLoader::Resume() { } case DEFERRED_REDIRECT: { client_binding_.ResumeIncomingMethodCallProcessing(); - forwarding_client_->OnReceiveRedirect(redirect_info_->redirect_info, - redirect_info_->response_head); // TODO(dhausknecht) at this point we do not actually know if we commit to // the redirect or if it will be cancelled. FollowRedirect would be a more // suitable place to set this URL but there we do not have the data. response_url_ = redirect_info_->redirect_info.new_url; + forwarding_client_->OnReceiveRedirect(redirect_info_->redirect_info, + redirect_info_->response_head); + // Note: |this| may be deleted here. break; } case DEFERRED_RESPONSE: { client_binding_.ResumeIncomingMethodCallProcessing(); forwarding_client_->OnReceiveResponse( - response_info_->response_head, response_info_->ssl_info, + response_info_->response_head, std::move(response_info_->downloaded_file)); + // Note: |this| may be deleted here. break; } default: @@ -498,6 +511,24 @@ void ThrottlingURLLoader::ResumeReadingBodyFromNet( url_loader_->ResumeReadingBodyFromNet(); } +void ThrottlingURLLoader::InterceptResponse( + network::mojom::URLLoaderPtr new_loader, + network::mojom::URLLoaderClientRequest new_client_request, + network::mojom::URLLoaderPtr* original_loader, + network::mojom::URLLoaderClientRequest* original_client_request) { + response_intercepted_ = true; + + if (original_loader) + *original_loader = std::move(url_loader_); + url_loader_ = std::move(new_loader); + + if (original_client_request) + *original_client_request = client_binding_.Unbind(); + client_binding_.Bind(std::move(new_client_request)); + client_binding_.set_connection_error_handler(base::BindOnce( + &ThrottlingURLLoader::OnClientConnectionError, base::Unretained(this))); +} + void ThrottlingURLLoader::DisconnectClient(base::StringPiece custom_reason) { client_binding_.Close(); diff --git a/chromium/content/common/throttling_url_loader.h b/chromium/content/common/throttling_url_loader.h index 54e48644751..af9f50ebead 100644 --- a/chromium/content/common/throttling_url_loader.h +++ b/chromium/content/common/throttling_url_loader.h @@ -14,9 +14,9 @@ #include "base/threading/thread_task_runner_handle.h" #include "content/common/content_export.h" #include "content/common/possibly_associated_interface_ptr.h" -#include "content/public/common/shared_url_loader_factory.h" #include "content/public/common/url_loader_throttle.h" #include "mojo/public/cpp/bindings/binding.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -38,7 +38,7 @@ class CONTENT_EXPORT ThrottlingURLLoader // note that the request may not start immediately since it could be deferred // by throttles. static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart( - scoped_refptr<SharedURLLoaderFactory> factory, + scoped_refptr<network::SharedURLLoaderFactory> factory, std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, int32_t routing_id, int32_t request_id, @@ -62,6 +62,8 @@ class CONTENT_EXPORT ThrottlingURLLoader forwarding_client_ = client; } + bool response_intercepted() const { return response_intercepted_; } + private: class ForwardingThrottleDelegate; @@ -70,14 +72,14 @@ class CONTENT_EXPORT ThrottlingURLLoader network::mojom::URLLoaderClient* client, const net::NetworkTrafficAnnotationTag& traffic_annotation); - void Start(scoped_refptr<SharedURLLoaderFactory> factory, + void Start(scoped_refptr<network::SharedURLLoaderFactory> factory, int32_t routing_id, int32_t request_id, uint32_t options, network::ResourceRequest* url_request, scoped_refptr<base::SingleThreadTaskRunner> task_runner); - void StartNow(SharedURLLoaderFactory* factory, + void StartNow(network::SharedURLLoaderFactory* factory, int32_t routing_id, int32_t request_id, uint32_t options, @@ -100,7 +102,6 @@ class CONTENT_EXPORT ThrottlingURLLoader // network::mojom::URLLoaderClient implementation: void OnReceiveResponse( const network::ResourceResponseHead& response_head, - const base::Optional<net::SSLInfo>& ssl_info, network::mojom::DownloadedTempFilePtr downloaded_file) override; void OnReceiveRedirect( const net::RedirectInfo& redirect_info, @@ -122,6 +123,11 @@ class CONTENT_EXPORT ThrottlingURLLoader void SetPriority(net::RequestPriority priority); void PauseReadingBodyFromNet(URLLoaderThrottle* throttle); void ResumeReadingBodyFromNet(URLLoaderThrottle* throttle); + void InterceptResponse( + network::mojom::URLLoaderPtr new_loader, + network::mojom::URLLoaderClientRequest new_client_request, + network::mojom::URLLoaderPtr* original_loader, + network::mojom::URLLoaderClientRequest* original_client_request); // Disconnects the client connection and releases the URLLoader. void DisconnectClient(base::StringPiece custom_description); @@ -164,15 +170,16 @@ class CONTENT_EXPORT ThrottlingURLLoader network::mojom::URLLoaderPtr url_loader_; struct StartInfo { - StartInfo(scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory, - int32_t in_routing_id, - int32_t in_request_id, - uint32_t in_options, - network::ResourceRequest* in_url_request, - scoped_refptr<base::SingleThreadTaskRunner> in_task_runner); + StartInfo( + scoped_refptr<network::SharedURLLoaderFactory> in_url_loader_factory, + int32_t in_routing_id, + int32_t in_request_id, + uint32_t in_options, + network::ResourceRequest* in_url_request, + scoped_refptr<base::SingleThreadTaskRunner> in_task_runner); ~StartInfo(); - scoped_refptr<SharedURLLoaderFactory> url_loader_factory; + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory; int32_t routing_id; int32_t request_id; uint32_t options; @@ -186,12 +193,10 @@ class CONTENT_EXPORT ThrottlingURLLoader struct ResponseInfo { ResponseInfo(const network::ResourceResponseHead& in_response_head, - const base::Optional<net::SSLInfo>& in_ssl_info, network::mojom::DownloadedTempFilePtr in_downloaded_file); ~ResponseInfo(); network::ResourceResponseHead response_head; - base::Optional<net::SSLInfo> ssl_info; network::mojom::DownloadedTempFilePtr downloaded_file; }; // Set if response is deferred. @@ -226,6 +231,8 @@ class CONTENT_EXPORT ThrottlingURLLoader // The latest request URL from where we expect a response GURL response_url_; + bool response_intercepted_ = false; + base::WeakPtrFactory<ThrottlingURLLoader> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); diff --git a/chromium/content/common/throttling_url_loader_unittest.cc b/chromium/content/common/throttling_url_loader_unittest.cc index e6a0c8fe7ae..b7a22c10b4f 100644 --- a/chromium/content/common/throttling_url_loader_unittest.cc +++ b/chromium/content/common/throttling_url_loader_unittest.cc @@ -7,9 +7,9 @@ #include "base/macros.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" -#include "content/common/weak_wrapper_shared_url_loader_factory.h" #include "content/public/common/browser_side_navigation_policy.h" #include "content/public/common/url_loader_throttle.h" +#include "content/public/common/weak_wrapper_shared_url_loader_factory.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -37,7 +37,7 @@ class TestURLLoaderFactory : public network::mojom::URLLoaderFactory, mojo::Binding<network::mojom::URLLoader>& url_loader_binding() { return url_loader_binding_; } - scoped_refptr<SharedURLLoaderFactory> shared_factory() { + scoped_refptr<network::SharedURLLoaderFactory> shared_factory() { return shared_factory_; } @@ -54,8 +54,7 @@ class TestURLLoaderFactory : public network::mojom::URLLoaderFactory, } void NotifyClientOnReceiveResponse() { - client_ptr_->OnReceiveResponse(network::ResourceResponseHead(), - base::nullopt, nullptr); + client_ptr_->OnReceiveResponse(network::ResourceResponseHead(), nullptr); } void NotifyClientOnReceiveRedirect() { @@ -135,7 +134,13 @@ class TestURLLoaderClient : public network::mojom::URLLoaderClient { size_t on_complete_called() const { return on_complete_called_; } - void set_on_received_response_callback(const base::Closure& callback) { + void set_on_received_redirect_callback( + const base::RepeatingClosure& callback) { + on_received_redirect_callback_ = callback; + } + + void set_on_received_response_callback( + const base::RepeatingClosure& callback) { on_received_response_callback_ = callback; } @@ -148,7 +153,6 @@ class TestURLLoaderClient : public network::mojom::URLLoaderClient { // network::mojom::URLLoaderClient implementation: void OnReceiveResponse( const network::ResourceResponseHead& response_head, - const base::Optional<net::SSLInfo>& ssl_info, network::mojom::DownloadedTempFilePtr downloaded_file) override { on_received_response_called_++; if (on_received_response_callback_) @@ -158,6 +162,8 @@ class TestURLLoaderClient : public network::mojom::URLLoaderClient { const net::RedirectInfo& redirect_info, const network::ResourceResponseHead& response_head) override { on_received_redirect_called_++; + if (on_received_redirect_callback_) + on_received_redirect_callback_.Run(); } void OnDataDownloaded(int64_t data_len, int64_t encoded_data_len) override {} void OnUploadProgress(int64_t current_position, @@ -177,7 +183,8 @@ class TestURLLoaderClient : public network::mojom::URLLoaderClient { size_t on_received_redirect_called_ = 0; size_t on_complete_called_ = 0; - base::Closure on_received_response_callback_; + base::RepeatingClosure on_received_redirect_callback_; + base::RepeatingClosure on_received_response_callback_; OnCompleteCallback on_complete_callback_; DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); @@ -614,7 +621,7 @@ TEST_F(ThrottlingURLLoaderTest, ResumeNoOpIfNotDeferred) { }); throttle_->set_will_start_request_callback(resume_callback); throttle_->set_will_redirect_request_callback(resume_callback); - throttle_->set_will_process_response_callback(resume_callback); + throttle_->set_will_process_response_callback(std::move(resume_callback)); base::RunLoop run_loop; client_.set_on_complete_callback(base::Bind( @@ -906,7 +913,8 @@ TEST_F(ThrottlingURLLoaderTest, PauseResumeReadingBodyFromNet) { EXPECT_EQ(1u, factory_.resume_reading_body_from_net_called()); } -TEST_F(ThrottlingURLLoaderTest, DestroyingThrottlingURLLoaderInDelegateCall) { +TEST_F(ThrottlingURLLoaderTest, + DestroyingThrottlingURLLoaderInDelegateCall_Response) { base::RunLoop run_loop1; throttle_->set_will_process_response_callback(base::Bind( [](const base::Closure& quit_closure, @@ -955,5 +963,54 @@ TEST_F(ThrottlingURLLoaderTest, DestroyingThrottlingURLLoaderInDelegateCall) { EXPECT_EQ(nullptr, throttle_); } +// Regression test for crbug.com/833292. +TEST_F(ThrottlingURLLoaderTest, + DestroyingThrottlingURLLoaderInDelegateCall_Redirect) { + base::RunLoop run_loop1; + throttle_->set_will_redirect_request_callback(base::BindRepeating( + [](const base::RepeatingClosure& quit_closure, + URLLoaderThrottle::Delegate* delegate, bool* defer) { + *defer = true; + quit_closure.Run(); + }, + run_loop1.QuitClosure())); + + base::RunLoop run_loop2; + client_.set_on_received_redirect_callback(base::BindRepeating( + [](ThrottlingURLLoaderTest* test, + const base::RepeatingClosure& quit_closure) { + // Destroy the ThrottlingURLLoader while inside a delegate call from a + // throttle. + test->loader().reset(); + + // The throttle should stay alive. + EXPECT_NE(nullptr, test->throttle()); + + quit_closure.Run(); + }, + base::Unretained(this), run_loop2.QuitClosure())); + + CreateLoaderAndStart(); + + factory_.NotifyClientOnReceiveRedirect(); + + run_loop1.Run(); + + EXPECT_EQ(1u, throttle_->will_start_request_called()); + EXPECT_EQ(1u, throttle_->will_redirect_request_called()); + EXPECT_EQ(0u, throttle_->will_process_response_called()); + + throttle_->delegate()->Resume(); + run_loop2.Run(); + + // The ThrottlingURLLoader should be gone. + EXPECT_EQ(nullptr, loader_); + // The throttle should stay alive and destroyed later. + EXPECT_NE(nullptr, throttle_); + + scoped_task_environment_.RunUntilIdle(); + EXPECT_EQ(nullptr, throttle_); +} + } // namespace } // namespace content diff --git a/chromium/content/common/unique_name_helper.cc b/chromium/content/common/unique_name_helper.cc index 8aed7052e21..676e4412ded 100644 --- a/chromium/content/common/unique_name_helper.cc +++ b/chromium/content/common/unique_name_helper.cc @@ -248,15 +248,16 @@ std::string UniqueNameHelper::UpdateLegacyNameFromV24( // tree and go down from there, it is impossible for a frame path to contain // a unique name (which needs a replacement) that has not already been seen // and inserted into |replacements|. - size_t index = 0; for (const auto& replacement : *replacements) { + // Note: this find() call should only start searching from immediately + // after the most recent replacement, to guarantee each section of the + // name is only replaced once. But it was accidentally omitted from the + // initial version of the migration code. size_t next_index = legacy_name.find(replacement.old_name); if (next_index == std::string::npos) continue; legacy_name.replace(next_index, replacement.old_name.size(), replacement.new_name); - index = next_index - - (replacement.old_name.size() - replacement.new_name.size()); } return legacy_name; } diff --git a/chromium/content/common/unique_name_helper_unittest.cc b/chromium/content/common/unique_name_helper_unittest.cc index 753a416813c..bb196c2551a 100644 --- a/chromium/content/common/unique_name_helper_unittest.cc +++ b/chromium/content/common/unique_name_helper_unittest.cc @@ -9,7 +9,6 @@ #include <vector> #include "base/auto_reset.h" -#include "base/memory/ptr_util.h" #include "base/optional.h" #include "base/strings/nullable_string16.h" #include "base/strings/string_piece.h" diff --git a/chromium/content/common/url_loader_factory_bundle.cc b/chromium/content/common/url_loader_factory_bundle.cc index 378b4e07ea2..e3d31d68690 100644 --- a/chromium/content/common/url_loader_factory_bundle.cc +++ b/chromium/content/common/url_loader_factory_bundle.cc @@ -20,7 +20,7 @@ URLLoaderFactoryBundleInfo::URLLoaderFactoryBundleInfo( URLLoaderFactoryBundleInfo::~URLLoaderFactoryBundleInfo() = default; -scoped_refptr<SharedURLLoaderFactory> +scoped_refptr<network::SharedURLLoaderFactory> URLLoaderFactoryBundleInfo::CreateFactory() { auto other = std::make_unique<URLLoaderFactoryBundleInfo>(); other->default_factory_info_ = std::move(default_factory_info_); @@ -78,7 +78,8 @@ void URLLoaderFactoryBundle::CreateLoaderAndStart( traffic_annotation); } -std::unique_ptr<SharedURLLoaderFactoryInfo> URLLoaderFactoryBundle::Clone() { +std::unique_ptr<network::SharedURLLoaderFactoryInfo> +URLLoaderFactoryBundle::Clone() { network::mojom::URLLoaderFactoryPtrInfo default_factory_info; if (default_factory_) default_factory_->Clone(mojo::MakeRequest(&default_factory_info)); diff --git a/chromium/content/common/url_loader_factory_bundle.h b/chromium/content/common/url_loader_factory_bundle.h index 235bf8182de..3db8f4fc096 100644 --- a/chromium/content/common/url_loader_factory_bundle.h +++ b/chromium/content/common/url_loader_factory_bundle.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "content/common/content_export.h" -#include "content/public/common/shared_url_loader_factory.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" class GURL; @@ -20,7 +20,7 @@ namespace content { // Holds the internal state of a URLLoaderFactoryBundle in a form that is safe // to pass across sequences. class CONTENT_EXPORT URLLoaderFactoryBundleInfo - : public SharedURLLoaderFactoryInfo { + : public network::SharedURLLoaderFactoryInfo { public: URLLoaderFactoryBundleInfo(); URLLoaderFactoryBundleInfo( @@ -40,7 +40,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo protected: // SharedURLLoaderFactoryInfo implementation. - scoped_refptr<SharedURLLoaderFactory> CreateFactory() override; + scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override; network::mojom::URLLoaderFactoryPtrInfo default_factory_info_; std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo> @@ -51,7 +51,8 @@ class CONTENT_EXPORT URLLoaderFactoryBundleInfo // Encapsulates a collection of URLLoaderFactoryPtrs which can be usd to acquire // loaders for various types of resource requests. -class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory { +class CONTENT_EXPORT URLLoaderFactoryBundle + : public network::SharedURLLoaderFactory { public: URLLoaderFactoryBundle(); @@ -81,7 +82,7 @@ class CONTENT_EXPORT URLLoaderFactoryBundle : public SharedURLLoaderFactory { const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) override; - std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override; + std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override; // The |info| contains replacement factories for a subset of the existing // bundle. diff --git a/chromium/content/common/url_schemes.cc b/chromium/content/common/url_schemes.cc index c951b551a8a..a269e1de2cb 100644 --- a/chromium/content/common/url_schemes.cc +++ b/chromium/content/common/url_schemes.cc @@ -6,8 +6,9 @@ #include <string.h> -#include <algorithm> +#include <iterator> +#include "base/no_destructor.h" #include "base/strings/string_util.h" #include "content/public/common/content_client.h" #include "content/public/common/url_constants.h" @@ -17,15 +18,6 @@ namespace content { namespace { -// These lists are lazily initialized below and are leaked on shutdown to -// prevent any destructors from being called that will slow us down or cause -// problems. -std::vector<std::string>* savable_schemes = nullptr; -// Note we store url::Origins here instead of strings to deal with -// canonicalization. -std::vector<url::Origin>* secure_origins = nullptr; -std::vector<std::string>* service_worker_schemes = nullptr; - const char* const kDefaultSavableSchemes[] = { url::kHttpScheme, url::kHttpsScheme, @@ -37,21 +29,41 @@ const char* const kDefaultSavableSchemes[] = { url::kDataScheme }; +// These lists are lazily initialized below and are leaked on shutdown to +// prevent any destructors from being called that will slow us down or cause +// problems. +std::vector<std::string>& GetMutableSavableSchemes() { + static base::NoDestructor<std::vector<std::string>> schemes; + return *schemes; +} + +// Note we store url::Origins here instead of strings to deal with +// canonicalization. +std::vector<url::Origin>& GetMutableSecureOrigins() { + static base::NoDestructor<std::vector<url::Origin>> origins; + return *origins; +} + +std::vector<std::string>& GetMutableServiceWorkerSchemes() { + static base::NoDestructor<std::vector<std::string>> schemes; + return *schemes; +} + } // namespace void RegisterContentSchemes(bool lock_schemes) { ContentClient::Schemes schemes; GetContentClient()->AddAdditionalSchemes(&schemes); - url::AddStandardScheme(kChromeDevToolsScheme, url::SCHEME_WITHOUT_PORT); - url::AddStandardScheme(kChromeUIScheme, url::SCHEME_WITHOUT_PORT); - url::AddStandardScheme(kGuestScheme, url::SCHEME_WITHOUT_PORT); + url::AddStandardScheme(kChromeDevToolsScheme, url::SCHEME_WITH_HOST); + url::AddStandardScheme(kChromeUIScheme, url::SCHEME_WITH_HOST); + url::AddStandardScheme(kGuestScheme, url::SCHEME_WITH_HOST); for (auto& scheme : schemes.standard_schemes) - url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT); + url::AddStandardScheme(scheme.c_str(), url::SCHEME_WITH_HOST); for (auto& scheme : schemes.referrer_schemes) - url::AddReferrerScheme(scheme.c_str(), url::SCHEME_WITHOUT_PORT); + url::AddReferrerScheme(scheme.c_str(), url::SCHEME_WITH_HOST); schemes.secure_schemes.push_back(kChromeUIScheme); schemes.secure_schemes.push_back(kChromeErrorScheme); @@ -86,34 +98,28 @@ void RegisterContentSchemes(bool lock_schemes) { url::LockSchemeRegistries(); // Combine the default savable schemes with the additional ones given. - delete savable_schemes; - savable_schemes = new std::vector<std::string>; - for (auto* default_scheme : kDefaultSavableSchemes) - savable_schemes->push_back(default_scheme); - savable_schemes->insert(savable_schemes->end(), - schemes.savable_schemes.begin(), - schemes.savable_schemes.end()); - - delete service_worker_schemes; - service_worker_schemes = new std::vector<std::string>; - *service_worker_schemes = std::move(schemes.service_worker_schemes); - - delete secure_origins; - secure_origins = new std::vector<url::Origin>; - *secure_origins = std::move(schemes.secure_origins); - network::cors::legacy::RegisterSecureOrigins(*secure_origins); + GetMutableSavableSchemes().assign(std::begin(kDefaultSavableSchemes), + std::end(kDefaultSavableSchemes)); + GetMutableSavableSchemes().insert(GetMutableSavableSchemes().end(), + schemes.savable_schemes.begin(), + schemes.savable_schemes.end()); + + GetMutableServiceWorkerSchemes() = std::move(schemes.service_worker_schemes); + + GetMutableSecureOrigins() = std::move(schemes.secure_origins); + network::cors::legacy::RegisterSecureOrigins(GetSecureOrigins()); } const std::vector<std::string>& GetSavableSchemes() { - return *savable_schemes; + return GetMutableSavableSchemes(); } const std::vector<url::Origin>& GetSecureOrigins() { - return *secure_origins; + return GetMutableSecureOrigins(); } const std::vector<std::string>& GetServiceWorkerSchemes() { - return *service_worker_schemes; + return GetMutableServiceWorkerSchemes(); } } // namespace content diff --git a/chromium/content/common/view_messages.h b/chromium/content/common/view_messages.h index 7e83d1783a5..1f619836b51 100644 --- a/chromium/content/common/view_messages.h +++ b/chromium/content/common/view_messages.h @@ -44,17 +44,17 @@ #include "media/base/ipc/media_param_traits.h" #include "media/capture/ipc/capture_param_traits.h" #include "net/base/network_change_notifier.h" -#include "ppapi/features/features.h" -#include "third_party/WebKit/public/platform/WebDisplayMode.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebIntrinsicSizingInfo.h" -#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h" -#include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" -#include "third_party/WebKit/public/web/WebMediaPlayerAction.h" -#include "third_party/WebKit/public/web/WebPluginAction.h" -#include "third_party/WebKit/public/web/WebPopupType.h" -#include "third_party/WebKit/public/web/WebTextDirection.h" +#include "ppapi/buildflags/buildflags.h" +#include "third_party/blink/public/platform/modules/screen_orientation/web_screen_orientation_type.h" +#include "third_party/blink/public/platform/web_display_mode.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_device_emulation_params.h" +#include "third_party/blink/public/web/web_media_player_action.h" +#include "third_party/blink/public/web/web_plugin_action.h" +#include "third_party/blink/public/web/web_popup_type.h" +#include "third_party/blink/public/web/web_text_direction.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h" #include "ui/base/ui_base_types.h" @@ -69,8 +69,8 @@ #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" #if defined(OS_MACOSX) -#include "third_party/WebKit/public/platform/WebScrollbarButtonsPlacement.h" -#include "third_party/WebKit/public/platform/mac/WebScrollbarTheme.h" +#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 @@ -162,6 +162,10 @@ IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(content::ResizeParams) IPC_STRUCT_TRAITS_MEMBER(screen_info) + IPC_STRUCT_TRAITS_MEMBER(auto_resize_enabled) + IPC_STRUCT_TRAITS_MEMBER(min_size_for_auto_resize) + IPC_STRUCT_TRAITS_MEMBER(max_size_for_auto_resize) + IPC_STRUCT_TRAITS_MEMBER(auto_resize_sequence_number) IPC_STRUCT_TRAITS_MEMBER(new_size) IPC_STRUCT_TRAITS_MEMBER(compositor_viewport_pixel_size) IPC_STRUCT_TRAITS_MEMBER(browser_controls_shrink_blink_size) @@ -343,19 +347,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_Close) // rect so that we don't have to fetch it every time WebKit asks for it. IPC_MESSAGE_ROUTED1(ViewMsg_Resize, content::ResizeParams /* params */) -// Tells the widget to use the provided viz::LocalSurfaceId to submit -// CompositorFrames for autosize. -// TODO(fsamuel): Replace these parameters with ResizeParams eventually. After -// surface sync is on by default everywhere, ResizeParams should be renamed to -// SynchronizedVisualParams. -IPC_MESSAGE_ROUTED(ViewMsg_SetLocalSurfaceIdForAutoResize, - uint64_t /* sequence_number */, - gfx::Size /* min_size */, - gfx::Size /* max_size */, - content::ScreenInfo /* screen_info */, - uint32_t /* content_source_id */, - viz::LocalSurfaceId /* local_surface_id */) - // Enables device emulation. See WebDeviceEmulationParams for description. IPC_MESSAGE_ROUTED1(ViewMsg_EnableDeviceEmulation, blink::WebDeviceEmulationParams /* params */) @@ -445,16 +436,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_Move_ACK) // Used to instruct the RenderView to send back updates to the preferred size. IPC_MESSAGE_ROUTED0(ViewMsg_EnablePreferredSizeChangedMode) -// Used to instruct the RenderView to automatically resize and send back -// updates for the new size. -IPC_MESSAGE_ROUTED2(ViewMsg_EnableAutoResize, - gfx::Size /* min_size */, - gfx::Size /* max_size */) - -// Used to instruct the RenderView to disalbe automatically resize. -IPC_MESSAGE_ROUTED1(ViewMsg_DisableAutoResize, - gfx::Size /* new_size */) - // Changes the text direction of the currently selected input field (if any). IPC_MESSAGE_ROUTED1(ViewMsg_SetTextDirection, blink::WebTextDirection /* direction */) @@ -525,9 +506,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_ResolveTapDisambiguation, gfx::Point /* tap_viewport_offset */, bool /* is_long_press */) -// Fetches complete rendered content of a web page as plain text. -IPC_MESSAGE_ROUTED0(ViewMsg_GetRenderedText) - IPC_MESSAGE_ROUTED0(ViewMsg_SelectWordAroundCaret) // Sent by the browser to ask the renderer to redraw. Robust to events that can @@ -536,9 +514,11 @@ IPC_MESSAGE_ROUTED0(ViewMsg_SelectWordAroundCaret) IPC_MESSAGE_ROUTED1(ViewMsg_ForceRedraw, ui::LatencyInfo /* latency_info */) -// Sets the viewport intersection on the widget for an out-of-process iframe. -IPC_MESSAGE_ROUTED1(ViewMsg_SetViewportIntersection, - gfx::Rect /* viewport_intersection */) +// Sets the viewport intersection and compositor raster area on the widget for +// an out-of-process iframe. +IPC_MESSAGE_ROUTED2(ViewMsg_SetViewportIntersection, + gfx::Rect /* viewport_intersection */, + gfx::Rect /* compositor_visible_rect */) // Sets the inert bit on an out-of-process iframe. IPC_MESSAGE_ROUTED1(ViewMsg_SetIsInert, bool /* inert */) @@ -760,18 +740,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_SelectWordAroundCaretAck, int /* start_adjust */, int /* end_adjust */) -#if defined(OS_ANDROID) -// Notifies that an unhandled tap has occurred at the specified x,y position -// and that the UI may need to be triggered. -IPC_MESSAGE_ROUTED2(ViewHostMsg_ShowUnhandledTapUIIfNeeded, - int /* x */, - int /* y */) - -#elif defined(OS_MACOSX) -// Receives content of a web page as plain text. -IPC_MESSAGE_ROUTED1(ViewMsg_GetRenderedTextCompleted, std::string) -#endif - // 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/weak_wrapper_shared_url_loader_factory.cc b/chromium/content/common/weak_wrapper_shared_url_loader_factory.cc deleted file mode 100644 index c53bddcf5d5..00000000000 --- a/chromium/content/common/weak_wrapper_shared_url_loader_factory.cc +++ /dev/null @@ -1,47 +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/weak_wrapper_shared_url_loader_factory.h" - -#include "content/common/wrapper_shared_url_loader_factory.h" -#include "mojo/public/cpp/bindings/interface_request.h" - -namespace content { - -WeakWrapperSharedURLLoaderFactory::WeakWrapperSharedURLLoaderFactory( - network::mojom::URLLoaderFactory* factory_ptr) - : factory_ptr_(factory_ptr) {} - -void WeakWrapperSharedURLLoaderFactory::Detach() { - factory_ptr_ = nullptr; -} - -void WeakWrapperSharedURLLoaderFactory::CreateLoaderAndStart( - network::mojom::URLLoaderRequest loader, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - if (!factory_ptr_) - return; - factory_ptr_->CreateLoaderAndStart(std::move(loader), routing_id, request_id, - options, request, std::move(client), - traffic_annotation); -} - -std::unique_ptr<SharedURLLoaderFactoryInfo> -WeakWrapperSharedURLLoaderFactory::Clone() { - network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info; - if (factory_ptr_) - factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info)); - return std::make_unique<WrapperSharedURLLoaderFactoryInfo>( - std::move(factory_ptr_info)); -} - -WeakWrapperSharedURLLoaderFactory::~WeakWrapperSharedURLLoaderFactory() = - default; - -} // namespace content diff --git a/chromium/content/common/weak_wrapper_shared_url_loader_factory.h b/chromium/content/common/weak_wrapper_shared_url_loader_factory.h deleted file mode 100644 index 37d7dc9c49b..00000000000 --- a/chromium/content/common/weak_wrapper_shared_url_loader_factory.h +++ /dev/null @@ -1,47 +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_WEAK_WRAPPER_SHARED_URL_LOADER_FACTORY_H_ -#define CONTENT_COMMON_WEAK_WRAPPER_SHARED_URL_LOADER_FACTORY_H_ - -#include "content/common/content_export.h" -#include "content/public/common/shared_url_loader_factory.h" -#include "services/network/public/mojom/url_loader_factory.mojom.h" - -namespace content { - -// A SharedURLLoaderFactory implementation that wraps a raw -// mojom::URLLoaderFactory pointer. -class CONTENT_EXPORT WeakWrapperSharedURLLoaderFactory - : public SharedURLLoaderFactory { - public: - explicit WeakWrapperSharedURLLoaderFactory( - network::mojom::URLLoaderFactory* factory_ptr); - - // Detaches from the raw mojom::URLLoaderFactory pointer. All subsequent calls - // to CreateLoaderAndStart() will fail silently. - void Detach(); - - // SharedURLLoaderFactory implementation. - void CreateLoaderAndStart(network::mojom::URLLoaderRequest loader, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& - traffic_annotation) override; - - std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override; - - private: - ~WeakWrapperSharedURLLoaderFactory() override; - - // Not owned. - network::mojom::URLLoaderFactory* factory_ptr_ = nullptr; -}; - -} // namespace content - -#endif // CONTENT_COMMON_WEAK_WRAPPER_URL_LOADER_FACTORY_H_ diff --git a/chromium/content/common/wrapper_shared_url_loader_factory.cc b/chromium/content/common/wrapper_shared_url_loader_factory.cc index 5c595d67fde..370d3ab507e 100644 --- a/chromium/content/common/wrapper_shared_url_loader_factory.cc +++ b/chromium/content/common/wrapper_shared_url_loader_factory.cc @@ -17,7 +17,7 @@ WrapperSharedURLLoaderFactoryInfo::WrapperSharedURLLoaderFactoryInfo( WrapperSharedURLLoaderFactoryInfo::~WrapperSharedURLLoaderFactoryInfo() = default; -scoped_refptr<SharedURLLoaderFactory> +scoped_refptr<network::SharedURLLoaderFactory> WrapperSharedURLLoaderFactoryInfo::CreateFactory() { return base::MakeRefCounted<WrapperSharedURLLoaderFactory>( std::move(factory_ptr_info_)); diff --git a/chromium/content/common/wrapper_shared_url_loader_factory.h b/chromium/content/common/wrapper_shared_url_loader_factory.h index 371c3fbbde1..fd1bc0871b8 100644 --- a/chromium/content/common/wrapper_shared_url_loader_factory.h +++ b/chromium/content/common/wrapper_shared_url_loader_factory.h @@ -7,8 +7,8 @@ #include "content/common/content_export.h" #include "content/common/possibly_associated_interface_ptr.h" -#include "content/public/common/shared_url_loader_factory.h" #include "mojo/public/cpp/bindings/interface_request.h" +#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" namespace content { @@ -16,7 +16,7 @@ namespace content { // A SharedURLLoaderFactoryInfo implementation that wraps a // network::mojom::URLLoaderFactoryPtrInfo. class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo - : public SharedURLLoaderFactoryInfo { + : public network::SharedURLLoaderFactoryInfo { public: WrapperSharedURLLoaderFactoryInfo(); explicit WrapperSharedURLLoaderFactoryInfo( @@ -26,7 +26,7 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo private: // SharedURLLoaderFactoryInfo implementation. - scoped_refptr<SharedURLLoaderFactory> CreateFactory() override; + scoped_refptr<network::SharedURLLoaderFactory> CreateFactory() override; network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info_; }; @@ -34,7 +34,8 @@ class CONTENT_EXPORT WrapperSharedURLLoaderFactoryInfo // A SharedURLLoaderFactory implementation that wraps a // PtrTemplateType<network::mojom::URLLoaderFactory>. template <template <typename> class PtrTemplateType> -class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory { +class WrapperSharedURLLoaderFactoryBase + : public network::SharedURLLoaderFactory { public: using PtrType = PtrTemplateType<network::mojom::URLLoaderFactory>; using PtrInfoType = typename PtrType::PtrInfoType; @@ -61,7 +62,7 @@ class WrapperSharedURLLoaderFactoryBase : public SharedURLLoaderFactory { std::move(client), traffic_annotation); } - std::unique_ptr<SharedURLLoaderFactoryInfo> Clone() override { + std::unique_ptr<network::SharedURLLoaderFactoryInfo> Clone() override { network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info; if (factory_ptr_) factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info)); |