summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/public/common
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/third_party/blink/public/common
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/public/common')
-rw-r--r--chromium/third_party/blink/public/common/BUILD.gn23
-rw-r--r--chromium/third_party/blink/public/common/css/preferred_color_scheme.h1
-rw-r--r--chromium/third_party/blink/public/common/feature_policy/document_policy.h5
-rw-r--r--chromium/third_party/blink/public/common/feature_policy/feature_policy.h8
-rw-r--r--chromium/third_party/blink/public/common/features.h45
-rw-r--r--chromium/third_party/blink/public/common/indexeddb/indexeddb_key.h2
-rw-r--r--chromium/third_party/blink/public/common/indexeddb/indexeddb_key_path.h1
-rw-r--r--chromium/third_party/blink/public/common/input/OWNERS2
-rw-r--r--chromium/third_party/blink/public/common/input/synthetic_web_input_event_builders.h116
-rw-r--r--chromium/third_party/blink/public/common/input/web_coalesced_input_event.h4
-rw-r--r--chromium/third_party/blink/public/common/input/web_coalesced_input_event_mojom_traits.h53
-rw-r--r--chromium/third_party/blink/public/common/input/web_gesture_event.h13
-rw-r--r--chromium/third_party/blink/public/common/input/web_input_event.h2
-rw-r--r--chromium/third_party/blink/public/common/input/web_mouse_wheel_event.h5
-rw-r--r--chromium/third_party/blink/public/common/loader/throttling_url_loader.h19
-rw-r--r--chromium/third_party/blink/public/common/loader/url_loader_throttle.h6
-rw-r--r--chromium/third_party/blink/public/common/manifest/manifest.h13
-rw-r--r--chromium/third_party/blink/public/common/manifest/manifest_mojom_traits.h20
-rw-r--r--chromium/third_party/blink/public/common/mediastream/media_devices.h8
-rw-r--r--chromium/third_party/blink/public/common/mediastream/media_stream_request.h7
-rw-r--r--chromium/third_party/blink/public/common/origin_trials/origin_trial_policy.h3
-rw-r--r--chromium/third_party/blink/public/common/origin_trials/trial_token.h15
-rw-r--r--chromium/third_party/blink/public/common/origin_trials/trial_token_validator.h20
-rw-r--r--chromium/third_party/blink/public/common/page/OWNERS4
-rw-r--r--chromium/third_party/blink/public/common/page/drag_mojom_traits.h52
-rw-r--r--chromium/third_party/blink/public/common/page/web_drag_operation.h61
-rw-r--r--chromium/third_party/blink/public/common/peerconnection/OWNERS6
-rw-r--r--chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker.typemap16
-rw-r--r--chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker_mojom_traits.h26
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/BUILD.gn34
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/README.md6
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h77
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h14
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_metrics.h12
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_study_participation.h2
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings.h92
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h42
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiable_surface.h65
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiable_token.h229
-rw-r--r--chromium/third_party/blink/public/common/privacy_budget/identifiable_token_builder.h185
-rw-r--r--chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h8
-rw-r--r--chromium/third_party/blink/public/common/switches.h25
42 files changed, 1280 insertions, 67 deletions
diff --git a/chromium/third_party/blink/public/common/BUILD.gn b/chromium/third_party/blink/public/common/BUILD.gn
index 64c1801272f..5e3396552aa 100644
--- a/chromium/third_party/blink/public/common/BUILD.gn
+++ b/chromium/third_party/blink/public/common/BUILD.gn
@@ -31,6 +31,11 @@ buildflag_header("buildflags") {
flags = [ "RTC_USE_H264=$rtc_use_h264" ]
}
+source_set("common_export") {
+ visibility = [ "//third_party/blink/public/common/*" ]
+ sources = [ "common_export.h" ]
+}
+
source_set("headers") {
visibility = [
"//chrome/*",
@@ -52,7 +57,6 @@ source_set("headers") {
"bluetooth/web_bluetooth_device_id_mojom_traits.h",
"cache_storage/cache_storage_utils.h",
"client_hints/client_hints.h",
- "common_export.h",
"context_menu_data/edit_flags.h",
"context_menu_data/input_field_type.h",
"context_menu_data/media_type.h",
@@ -84,7 +88,9 @@ source_set("headers") {
"indexeddb/indexeddb_metadata.h",
"indexeddb/web_idb_types.h",
"input/pointer_id.h",
+ "input/synthetic_web_input_event_builders.h",
"input/web_coalesced_input_event.h",
+ "input/web_coalesced_input_event_mojom_traits.h",
"input/web_gesture_device.h",
"input/web_gesture_event.h",
"input/web_input_event.h",
@@ -134,15 +140,14 @@ source_set("headers") {
"origin_trials/origin_trial_policy.h",
"origin_trials/trial_token.h",
"origin_trials/trial_token_validator.h",
+ "page/drag_mojom_traits.h",
"page/launching_process_state.h",
"page/page_zoom.h",
+ "page/web_drag_operation.h",
+ "peerconnection/peer_connection_tracker_mojom_traits.h",
"peerconnection/webrtc_ip_handling_policy.h",
"permissions/permission_utils.h",
"prerender/prerender_rel_type.h",
- "privacy_budget/identifiability_metric_builder.h",
- "privacy_budget/identifiability_metrics.h",
- "privacy_budget/identifiability_study_participation.h",
- "privacy_budget/identifiable_surface.h",
"scheduler/web_scheduler_tracked_feature.h",
"screen_orientation/web_screen_orientation_lock_type.h",
"screen_orientation/web_screen_orientation_type.h",
@@ -162,11 +167,14 @@ source_set("headers") {
]
public_deps = [
+ "//mojo/public/cpp/bindings",
"//services/metrics/public/cpp:metrics_cpp",
"//services/network/public/cpp:cpp",
"//skia",
"//skia/public/mojom:shared_typemap_traits",
+ "//third_party/blink/public/common/privacy_budget",
"//third_party/blink/public/mojom:mojom_modules_headers",
+ "//third_party/blink/public/mojom:mojom_platform_shared",
"//third_party/blink/public/mojom:web_bluetooth_mojo_bindings_headers",
"//ui/events:event_constants",
"//ui/events/types:headers",
@@ -175,6 +183,7 @@ source_set("headers") {
deps = [
":buildflags",
+ ":common_export",
"//base",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
@@ -208,10 +217,6 @@ source_set("headers") {
if (is_win) {
sources += [ "dwrite_rasterizer_support/dwrite_rasterizer_support.h" ]
}
-
- # common_export.h is an implementation detail of component builds,
- # not part of the public API.
- public = sources - [ "common_export.h" ]
}
if (is_android || is_win) {
diff --git a/chromium/third_party/blink/public/common/css/preferred_color_scheme.h b/chromium/third_party/blink/public/common/css/preferred_color_scheme.h
index d14dde56dff..09d793e0c7a 100644
--- a/chromium/third_party/blink/public/common/css/preferred_color_scheme.h
+++ b/chromium/third_party/blink/public/common/css/preferred_color_scheme.h
@@ -9,7 +9,6 @@ namespace blink {
// Use for passing preferred color scheme from the OS to the renderer.
enum class PreferredColorScheme {
- kNoPreference,
kDark,
kLight,
kMaxValue = kLight,
diff --git a/chromium/third_party/blink/public/common/feature_policy/document_policy.h b/chromium/third_party/blink/public/common/feature_policy/document_policy.h
index 8974fc791ac..fe85fbee711 100644
--- a/chromium/third_party/blink/public/common/feature_policy/document_policy.h
+++ b/chromium/third_party/blink/public/common/feature_policy/document_policy.h
@@ -88,11 +88,6 @@ class BLINK_COMMON_EXPORT DocumentPolicy {
bool IsFeatureEnabled(mojom::DocumentPolicyFeature feature,
const PolicyValue& threshold_value) const;
- // Returns true if the feature is being migrated to document policy
- // TODO(iclelland): remove this method when those features are fully
- // migrated to document policy.
- bool IsFeatureSupported(mojom::DocumentPolicyFeature feature) const;
-
// Returns the value of the given feature on the given origin.
PolicyValue GetFeatureValue(mojom::DocumentPolicyFeature feature) const;
diff --git a/chromium/third_party/blink/public/common/feature_policy/feature_policy.h b/chromium/third_party/blink/public/common/feature_policy/feature_policy.h
index 3056bc65ab0..c85a2e6053d 100644
--- a/chromium/third_party/blink/public/common/feature_policy/feature_policy.h
+++ b/chromium/third_party/blink/public/common/feature_policy/feature_policy.h
@@ -5,13 +5,9 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_FEATURE_POLICY_FEATURE_POLICY_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_FEATURE_POLICY_FEATURE_POLICY_H_
-#include <memory>
-#include <utility>
+#include <map>
#include <vector>
-#include "base/containers/flat_map.h"
-#include "base/containers/flat_set.h"
-#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "services/network/public/mojom/web_sandbox_flags.mojom-shared.h"
#include "third_party/blink/public/common/common_export.h"
@@ -229,7 +225,7 @@ class BLINK_COMMON_EXPORT FeaturePolicy {
// the |inherited_policies_| as well as the header policies.
FeatureState GetFeatureState() const;
- const url::Origin& GetOriginForTest() { return origin_; }
+ const url::Origin& GetOriginForTest() const { return origin_; }
// Returns the list of features which can be controlled by Feature Policy.
const FeatureList& GetFeatureList() const;
diff --git a/chromium/third_party/blink/public/common/features.h b/chromium/third_party/blink/public/common/features.h
index 430b6d55d90..18f5e4a609e 100644
--- a/chromium/third_party/blink/public/common/features.h
+++ b/chromium/third_party/blink/public/common/features.h
@@ -18,6 +18,7 @@ namespace features {
BLINK_COMMON_EXPORT extern const base::Feature
kBlockingDownloadsInAdFrameWithoutUserActivation;
BLINK_COMMON_EXPORT extern const base::Feature kPaintHolding;
+BLINK_COMMON_EXPORT extern const base::Feature kPaintHoldingCrossOrigin;
BLINK_COMMON_EXPORT extern const base::Feature
kEagerCacheStorageSetupForServiceWorkers;
BLINK_COMMON_EXPORT extern const base::Feature kScriptStreaming;
@@ -30,8 +31,11 @@ BLINK_COMMON_EXPORT extern const base::Feature kCSSOMViewScrollCoordinates;
BLINK_COMMON_EXPORT extern const base::Feature kDisplayLocking;
BLINK_COMMON_EXPORT extern const base::Feature kMaxOverlapBoundsForFixed;
BLINK_COMMON_EXPORT extern const base::Feature kJSONModules;
+BLINK_COMMON_EXPORT extern const base::Feature kForceSynchronousHTMLParsing;
BLINK_COMMON_EXPORT extern const base::Feature kTopLevelAwait;
BLINK_COMMON_EXPORT extern const base::Feature kLayoutNG;
+BLINK_COMMON_EXPORT extern const base::Feature kLayoutNGRuby;
+BLINK_COMMON_EXPORT extern const base::Feature kFragmentItem;
BLINK_COMMON_EXPORT extern const base::Feature kMixedContentAutoupgrade;
BLINK_COMMON_EXPORT extern const base::Feature kNavigationPredictor;
BLINK_COMMON_EXPORT extern const base::Feature kPlzDedicatedWorker;
@@ -48,6 +52,9 @@ BLINK_COMMON_EXPORT extern const base::Feature kRTCOfferExtmapAllowMixed;
BLINK_COMMON_EXPORT extern const base::Feature kV8OptimizeWorkersForPerformance;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcMultiplexCodec;
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcHideLocalIpsWithMdns;
+BLINK_COMMON_EXPORT extern const base::Feature kIntensiveWakeUpThrottling;
+
+BLINK_COMMON_EXPORT extern const base::Feature kOptOutWebRTCFromAllThrottling;
#if BUILDFLAG(RTC_USE_H264) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS)
BLINK_COMMON_EXPORT extern const base::Feature kWebRtcH264WithOpenH264FFmpeg;
@@ -67,8 +74,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kFileHandlingAPI;
BLINK_COMMON_EXPORT extern const base::Feature kAllowSyncXHRInPageDismissal;
BLINK_COMMON_EXPORT extern const base::Feature kPrefetchPrivacyChanges;
-BLINK_COMMON_EXPORT extern const base::Feature kWebComponentsV0Enabled;
-
BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeParamName[];
BLINK_COMMON_EXPORT extern const char kMixedContentAutoupgradeModeAllPassive[];
@@ -83,8 +88,6 @@ BLINK_COMMON_EXPORT extern const base::Feature
BLINK_COMMON_EXPORT extern const base::Feature kAudioWorkletRealtimeThread;
BLINK_COMMON_EXPORT extern const base::Feature kLightweightNoStatePrefetch;
-BLINK_COMMON_EXPORT extern const base::Feature
- kLightweightNoStatePrefetch_FetchFonts;
BLINK_COMMON_EXPORT extern const base::Feature kSaveDataImgSrcset;
@@ -129,6 +132,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kARIAAnnotations;
BLINK_COMMON_EXPORT extern const base::Feature kCompositeCrossOriginIframes;
+BLINK_COMMON_EXPORT extern const base::Feature kTransformInterop;
+
BLINK_COMMON_EXPORT extern const base::Feature kSubresourceRedirect;
BLINK_COMMON_EXPORT extern const base::Feature kSetLowPriorityForBeacon;
@@ -146,18 +151,21 @@ BLINK_COMMON_EXPORT extern const base::Feature kLowLatencyWebGLSwapChain;
BLINK_COMMON_EXPORT extern const base::Feature kDawn2dCanvas;
BLINK_COMMON_EXPORT extern const base::Feature
- kForceExtraRenderingToTrackStickyFrame;
-
-BLINK_COMMON_EXPORT extern const base::Feature
kCSSReducedFontLoadingInvalidations;
+BLINK_COMMON_EXPORT extern const base::Feature
+ kCSSReducedFontLoadingLayoutInvalidations;
BLINK_COMMON_EXPORT extern const base::Feature kDiscardCodeCacheAfterFirstUse;
BLINK_COMMON_EXPORT extern const base::Feature
kSuppressContentTypeForBeaconMadeWithArrayBufferView;
+BLINK_COMMON_EXPORT extern const base::Feature kBlockFlowHandlesWebkitLineClamp;
+
BLINK_COMMON_EXPORT extern const base::Feature kBlockHTMLParserOnStyleSheets;
+BLINK_COMMON_EXPORT extern const base::Feature kLinkDisabledNewSpecBehavior;
+
BLINK_COMMON_EXPORT extern const base::Feature kFontPreloadingDelaysRendering;
BLINK_COMMON_EXPORT extern const base::FeatureParam<int>
kFontPreloadingDelaysRenderingParam;
@@ -166,6 +174,13 @@ BLINK_COMMON_EXPORT extern const base::Feature kFlexGaps;
BLINK_COMMON_EXPORT extern const base::Feature kFlexNG;
BLINK_COMMON_EXPORT extern const base::Feature kKeepScriptResourceAlive;
+BLINK_COMMON_EXPORT extern const base::Feature kDelayAsyncScriptExecution;
+enum class DelayAsyncScriptDelayType {
+ kFinishedParsing,
+ kFirstPaintOrFinishedParsing,
+};
+BLINK_COMMON_EXPORT extern const base::FeatureParam<DelayAsyncScriptDelayType>
+ kDelayAsyncScriptExecutionDelayParam;
BLINK_COMMON_EXPORT extern const base::Feature kAppCache;
BLINK_COMMON_EXPORT extern const base::Feature kAppCacheRequireOriginTrial;
@@ -188,6 +203,16 @@ BLINK_COMMON_EXPORT extern const base::Feature kThrottleInstallingServiceWorker;
BLINK_COMMON_EXPORT extern const base::FeatureParam<int>
kInstallingServiceWorkerOutstandingThrottledLimit;
+// This flag is used to set field parameters to choose predictor we use when
+// kResamplingInputEvents is disabled. It's used for gatherig accuracy metrics
+// on finch and also for choosing predictor type for predictedEvents API without
+// enabling resampling. It does not have any effect when the resampling flag is
+// enabled.
+BLINK_COMMON_EXPORT extern const base::Feature kInputPredictorTypeChoice;
+
+// Enables resampling input events on main thread.
+BLINK_COMMON_EXPORT extern const base::Feature kResamplingInputEvents;
+
// Enables resampling GestureScroll events on compositor thread.
BLINK_COMMON_EXPORT extern const base::Feature kResamplingScrollEvents;
@@ -245,6 +270,12 @@ BLINK_COMMON_EXPORT
extern const char
kSkipTouchEventFilterFilteringProcessParamValueBrowserAndRenderer[];
+BLINK_COMMON_EXPORT extern const base::Feature kWebXrMultiGpu;
+BLINK_COMMON_EXPORT extern const base::Feature
+ kCSSMatchedPropertiesCacheDependencies;
+
+BLINK_COMMON_EXPORT extern const base::Feature kParkableStringsToDisk;
+
} // namespace features
} // namespace blink
diff --git a/chromium/third_party/blink/public/common/indexeddb/indexeddb_key.h b/chromium/third_party/blink/public/common/indexeddb/indexeddb_key.h
index 16159009d85..e58b215534d 100644
--- a/chromium/third_party/blink/public/common/indexeddb/indexeddb_key.h
+++ b/chromium/third_party/blink/public/common/indexeddb/indexeddb_key.h
@@ -10,7 +10,7 @@
#include <string>
#include <vector>
-#include "base/logging.h"
+#include "base/check_op.h"
#include "base/strings/string16.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/indexeddb/web_idb_types.h"
diff --git a/chromium/third_party/blink/public/common/indexeddb/indexeddb_key_path.h b/chromium/third_party/blink/public/common/indexeddb/indexeddb_key_path.h
index 9f5422c88eb..973c4c4d38e 100644
--- a/chromium/third_party/blink/public/common/indexeddb/indexeddb_key_path.h
+++ b/chromium/third_party/blink/public/common/indexeddb/indexeddb_key_path.h
@@ -8,7 +8,6 @@
#include <string>
#include <vector>
-#include "base/logging.h"
#include "base/strings/string16.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/indexeddb/web_idb_types.h"
diff --git a/chromium/third_party/blink/public/common/input/OWNERS b/chromium/third_party/blink/public/common/input/OWNERS
new file mode 100644
index 00000000000..d5fefd82012
--- /dev/null
+++ b/chromium/third_party/blink/public/common/input/OWNERS
@@ -0,0 +1,2 @@
+per-file *_mojom_traits*.*=set noparent
+per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/chromium/third_party/blink/public/common/input/synthetic_web_input_event_builders.h b/chromium/third_party/blink/public/common/input/synthetic_web_input_event_builders.h
new file mode 100644
index 00000000000..27201ad8e38
--- /dev/null
+++ b/chromium/third_party/blink/public/common/input/synthetic_web_input_event_builders.h
@@ -0,0 +1,116 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_
+
+#include "base/time/time.h"
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/input/web_gesture_event.h"
+#include "third_party/blink/public/common/input/web_input_event.h"
+#include "third_party/blink/public/common/input/web_keyboard_event.h"
+#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
+#include "third_party/blink/public/common/input/web_touch_event.h"
+#include "ui/events/types/scroll_types.h"
+
+// Provides sensible creation of default WebInputEvents for testing purposes.
+
+namespace blink {
+
+class BLINK_COMMON_EXPORT SyntheticWebMouseEventBuilder {
+ public:
+ static blink::WebMouseEvent Build(blink::WebInputEvent::Type type);
+ static blink::WebMouseEvent Build(
+ blink::WebInputEvent::Type type,
+ float window_x,
+ float window_y,
+ int modifiers,
+ blink::WebPointerProperties::PointerType pointer_type =
+ blink::WebPointerProperties::PointerType::kMouse);
+};
+
+class BLINK_COMMON_EXPORT SyntheticWebMouseWheelEventBuilder {
+ public:
+ static blink::WebMouseWheelEvent Build(
+ blink::WebMouseWheelEvent::Phase phase);
+ static blink::WebMouseWheelEvent Build(float x,
+ float y,
+ float dx,
+ float dy,
+ int modifiers,
+ ui::ScrollGranularity delta_units);
+ static blink::WebMouseWheelEvent Build(float x,
+ float y,
+ float global_x,
+ float global_y,
+ float dx,
+ float dy,
+ int modifiers,
+ ui::ScrollGranularity delta_units);
+};
+
+class BLINK_COMMON_EXPORT SyntheticWebGestureEventBuilder {
+ public:
+ static blink::WebGestureEvent Build(blink::WebInputEvent::Type type,
+ blink::WebGestureDevice source_device,
+ int modifiers = 0);
+ static blink::WebGestureEvent BuildScrollBegin(
+ float dx_hint,
+ float dy_hint,
+ blink::WebGestureDevice source_device,
+ int pointer_count = 1);
+ static blink::WebGestureEvent BuildScrollUpdate(
+ float dx,
+ float dy,
+ int modifiers,
+ blink::WebGestureDevice source_device);
+ static blink::WebGestureEvent BuildPinchUpdate(
+ float scale,
+ float anchor_x,
+ float anchor_y,
+ int modifiers,
+ blink::WebGestureDevice source_device);
+ static blink::WebGestureEvent BuildFling(
+ float velocity_x,
+ float velocity_y,
+ blink::WebGestureDevice source_device);
+};
+
+class BLINK_COMMON_EXPORT SyntheticWebTouchEvent : public blink::WebTouchEvent {
+ public:
+ SyntheticWebTouchEvent();
+
+ // Mark all the points as stationary, and remove any released points.
+ void ResetPoints();
+
+ // Adds an additional point to the touch list, returning the point's index.
+ int PressPoint(float x,
+ float y,
+ float radius_x = 20.f,
+ float radius_y = 20.f,
+ float rotation_angle = 0.f,
+ float force = 1.f);
+ void MovePoint(int index,
+ float x,
+ float y,
+ float radius_x = 20.f,
+ float radius_y = 20.f,
+ float rotation_angle = 0.f,
+ float force = 1.f);
+ void ReleasePoint(int index);
+ void CancelPoint(int index);
+
+ void SetTimestamp(base::TimeTicks timestamp);
+
+ int FirstFreeIndex();
+
+ private:
+ // A pointer id of each touch pointer. Every time when a pointer is pressed
+ // the screen, it will be assigned to a new pointer id.
+ unsigned pointer_id_;
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_
diff --git a/chromium/third_party/blink/public/common/input/web_coalesced_input_event.h b/chromium/third_party/blink/public/common/input/web_coalesced_input_event.h
index 2a3326373be..a33bef65575 100644
--- a/chromium/third_party/blink/public/common/input/web_coalesced_input_event.h
+++ b/chromium/third_party/blink/public/common/input/web_coalesced_input_event.h
@@ -29,6 +29,7 @@ class BLINK_COMMON_EXPORT WebCoalescedInputEvent {
const ui::LatencyInfo&);
// Copy constructor to deep copy the event.
WebCoalescedInputEvent(const WebCoalescedInputEvent&);
+ ~WebCoalescedInputEvent();
WebInputEvent* EventPointer();
void AddCoalescedEvent(const blink::WebInputEvent&);
@@ -45,6 +46,7 @@ class BLINK_COMMON_EXPORT WebCoalescedInputEvent {
GetPredictedEventsPointers() const;
const ui::LatencyInfo& latency_info() const { return latency_; }
+ ui::LatencyInfo& latency_info() { return latency_; }
bool CanCoalesceWith(const WebCoalescedInputEvent& other) const
WARN_UNUSED_RESULT;
@@ -64,8 +66,6 @@ class BLINK_COMMON_EXPORT WebCoalescedInputEvent {
ui::LatencyInfo latency_;
};
-using WebScopedCoalescedInputEvent = std::unique_ptr<WebCoalescedInputEvent>;
-
} // namespace blink
#endif
diff --git a/chromium/third_party/blink/public/common/input/web_coalesced_input_event_mojom_traits.h b/chromium/third_party/blink/public/common/input/web_coalesced_input_event_mojom_traits.h
new file mode 100644
index 00000000000..48721be33eb
--- /dev/null
+++ b/chromium/third_party/blink/public/common/input/web_coalesced_input_event_mojom_traits.h
@@ -0,0 +1,53 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_WEB_COALESCED_INPUT_EVENT_MOJOM_TRAITS_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_WEB_COALESCED_INPUT_EVENT_MOJOM_TRAITS_H_
+
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/input/web_coalesced_input_event.h"
+#include "third_party/blink/public/mojom/input/input_handler.mojom.h"
+
+namespace mojo {
+
+template <>
+struct BLINK_COMMON_EXPORT
+ StructTraits<blink::mojom::EventDataView,
+ std::unique_ptr<blink::WebCoalescedInputEvent>> {
+ static blink::WebInputEvent::Type type(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event) {
+ return event->Event().GetType();
+ }
+
+ static int32_t modifiers(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event) {
+ return event->Event().GetModifiers();
+ }
+
+ static base::TimeTicks timestamp(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event) {
+ return event->Event().TimeStamp();
+ }
+
+ static const ui::LatencyInfo& latency(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event) {
+ return event->latency_info();
+ }
+
+ static blink::mojom::KeyDataPtr key_data(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event);
+ static blink::mojom::PointerDataPtr pointer_data(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event);
+ static blink::mojom::GestureDataPtr gesture_data(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event);
+ static blink::mojom::TouchDataPtr touch_data(
+ const std::unique_ptr<blink::WebCoalescedInputEvent>& event);
+
+ static bool Read(blink::mojom::EventDataView r,
+ std::unique_ptr<blink::WebCoalescedInputEvent>* out);
+};
+
+} // namespace mojo
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_WEB_COALESCED_INPUT_EVENT_MOJOM_TRAITS_H_
diff --git a/chromium/third_party/blink/public/common/input/web_gesture_event.h b/chromium/third_party/blink/public/common/input/web_gesture_event.h
index 548defc2b6e..72ef59d1f06 100644
--- a/chromium/third_party/blink/public/common/input/web_gesture_event.h
+++ b/chromium/third_party/blink/public/common/input/web_gesture_event.h
@@ -5,7 +5,8 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_WEB_GESTURE_EVENT_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_INPUT_WEB_GESTURE_EVENT_H_
-#include "base/logging.h"
+#include "base/check.h"
+#include "base/notreached.h"
#include "cc/paint/element_id.h"
#include "third_party/blink/public/common/input/web_gesture_device.h"
#include "third_party/blink/public/common/input/web_input_event.h"
@@ -76,7 +77,10 @@ class BLINK_COMMON_EXPORT WebGestureEvent : public WebInputEvent {
// a hit-test. Should be used for gestures queued up internally within
// the renderer process. This is an ElementIdType instead of ElementId
// due to the fact that ElementId has a non-trivial constructor that
- // can't easily participate in this union of structs.
+ // can't easily participate in this union of structs. Note that while
+ // this is used in scroll unification to perform a main thread hit test,
+ // in which case |main_thread_hit_tested| is true, it is also used in
+ // other cases like scroll events reinjected for scrollbar scrolling.
cc::ElementIdType scrollable_area_element_id;
// Initial motion that triggered the scroll.
float delta_x_hint;
@@ -95,6 +99,11 @@ class BLINK_COMMON_EXPORT WebGestureEvent : public WebInputEvent {
// True if this event is generated from a wheel event with synthetic
// phase.
bool synthetic;
+ // If true, this event has been hit tested by the main thread and the
+ // result is stored in scrollable_area_element_id. Used only in scroll
+ // unification when the event is sent back the the compositor for a
+ // second time after the main thread hit test is complete.
+ bool main_thread_hit_tested;
} scroll_begin;
struct {
diff --git a/chromium/third_party/blink/public/common/input/web_input_event.h b/chromium/third_party/blink/public/common/input/web_input_event.h
index 00f34eb7f30..c599513dd8f 100644
--- a/chromium/third_party/blink/public/common/input/web_input_event.h
+++ b/chromium/third_party/blink/public/common/input/web_input_event.h
@@ -35,7 +35,7 @@
#include <memory>
-#include "base/logging.h"
+#include "base/notreached.h"
#include "base/time/time.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/mojom/input/input_event.mojom-shared.h"
diff --git a/chromium/third_party/blink/public/common/input/web_mouse_wheel_event.h b/chromium/third_party/blink/public/common/input/web_mouse_wheel_event.h
index ce4f21f477c..2121b51c692 100644
--- a/chromium/third_party/blink/public/common/input/web_mouse_wheel_event.h
+++ b/chromium/third_party/blink/public/common/input/web_mouse_wheel_event.h
@@ -100,6 +100,11 @@ class BLINK_COMMON_EXPORT WebMouseWheelEvent : public WebMouseEvent {
bool CanCoalesce(const WebInputEvent& event) const override;
void Coalesce(const WebInputEvent& event) override;
+ // Return the platform specific default event action given the mouse wheel
+ // event. Can be used to determine the appropriate value for |event_action|.
+ static EventAction GetPlatformSpecificDefaultEventAction(
+ const WebMouseWheelEvent& event);
+
private:
bool HaveConsistentPhase(const WebMouseWheelEvent& event) const;
};
diff --git a/chromium/third_party/blink/public/common/loader/throttling_url_loader.h b/chromium/third_party/blink/public/common/loader/throttling_url_loader.h
index 1ce0af505d8..ad5f8fc4e8c 100644
--- a/chromium/third_party/blink/public/common/loader/throttling_url_loader.h
+++ b/chromium/third_party/blink/public/common/loader/throttling_url_loader.h
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/threading/thread_task_runner_handle.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
@@ -40,6 +41,9 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
// Reason used when resetting the URLLoader to follow a redirect.
static const char kFollowRedirectReason[];
+ // |url_request| can be mutated by this function, and doesn't need to stay
+ // alive after calling this function.
+ //
// |client| must stay alive during the lifetime of the returned object. Please
// note that the request may not start immediately since it could be deferred
// by throttles.
@@ -52,7 +56,9 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
network::ResourceRequest* url_request,
network::mojom::URLLoaderClient* client,
const net::NetworkTrafficAnnotationTag& traffic_annotation,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ base::Optional<std::vector<std::string>> cors_exempt_header_list =
+ base::nullopt);
~ThrottlingURLLoader() override;
@@ -112,7 +118,8 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
int32_t request_id,
uint32_t options,
network::ResourceRequest* url_request,
- scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ base::Optional<std::vector<std::string>> cors_exempt_header_list);
void StartNow();
void RestartWithFlagsNow();
@@ -135,6 +142,9 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
// Restart the request using |original_url_|.
void RestartWithURLResetAndFlags(int additional_load_flags);
+ // Restart the request immediately if the response has not started yet.
+ void RestartWithURLResetAndFlagsNow(int additional_load_flags);
+
// network::mojom::URLLoaderClient implementation:
void OnReceiveResponse(
network::mojom::URLResponseHeadPtr response_head) override;
@@ -182,6 +192,7 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
};
DeferredStage deferred_stage_ = DEFERRED_NONE;
bool loader_completed_ = false;
+ bool did_receive_response_ = false;
struct ThrottleEntry {
ThrottleEntry(ThrottlingURLLoader* loader,
@@ -219,7 +230,8 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
int32_t in_request_id,
uint32_t in_options,
network::ResourceRequest* in_url_request,
- scoped_refptr<base::SingleThreadTaskRunner> in_task_runner);
+ scoped_refptr<base::SingleThreadTaskRunner> in_task_runner,
+ base::Optional<std::vector<std::string>> in_cors_exempt_header_list);
~StartInfo();
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
@@ -230,6 +242,7 @@ class BLINK_COMMON_EXPORT ThrottlingURLLoader
network::ResourceRequest url_request;
// |task_runner| is used to set up |client_receiver_|.
scoped_refptr<base::SingleThreadTaskRunner> task_runner;
+ base::Optional<std::vector<std::string>> cors_exempt_header_list;
};
// Holds any info needed to start or restart the request. Used when start is
// deferred or when FollowRedirectForcingRestart() is called.
diff --git a/chromium/third_party/blink/public/common/loader/url_loader_throttle.h b/chromium/third_party/blink/public/common/loader/url_loader_throttle.h
index dfeceaa30b0..cf2c1dcb9f1 100644
--- a/chromium/third_party/blink/public/common/loader/url_loader_throttle.h
+++ b/chromium/third_party/blink/public/common/loader/url_loader_throttle.h
@@ -121,6 +121,12 @@ class BLINK_COMMON_EXPORT URLLoaderThrottle {
// using a combined value of all of the |additional_load_flags|.
virtual void RestartWithURLResetAndFlags(int additional_load_flags);
+ // Restarts the URL loader immediately using |additional_load_flags| and the
+ // unmodified URL if it was changed in WillStartRequest().
+ //
+ // Restarting is only valid before BeforeWillProcessResponse() is called.
+ virtual void RestartWithURLResetAndFlagsNow(int additional_load_flags);
+
protected:
virtual ~Delegate();
};
diff --git a/chromium/third_party/blink/public/common/manifest/manifest.h b/chromium/third_party/blink/public/common/manifest/manifest.h
index c0241781ebf..917736c1aa9 100644
--- a/chromium/third_party/blink/public/common/manifest/manifest.h
+++ b/chromium/third_party/blink/public/common/manifest/manifest.h
@@ -126,6 +126,12 @@ struct BLINK_COMMON_EXPORT Manifest {
std::map<base::string16, std::vector<base::string16>> accept;
};
+ // Structure representing a Protocol Handler.
+ struct BLINK_COMMON_EXPORT ProtocolHandler {
+ base::string16 protocol;
+ GURL url;
+ };
+
// Structure representing a related application.
struct BLINK_COMMON_EXPORT RelatedApplication {
RelatedApplication();
@@ -188,6 +194,13 @@ struct BLINK_COMMON_EXPORT Manifest {
// https://github.com/WICG/file-handling/blob/master/explainer.md
std::vector<FileHandler> file_handlers;
+ // Empty if parsing failed or the field was not present.
+ // TODO(crbug.com/1019239): This is going into the mainline manifest spec,
+ // remove the TODO once that PR goes in.
+ // The URLProtocolHandler explainer can be found here:
+ // https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/URLProtocolHandler/explainer.md
+ std::vector<ProtocolHandler> protocol_handlers;
+
// Empty if the parsing failed, the field was not present, empty or all the
// applications inside the array were invalid. The order of the array
// indicates the priority of the application to use.
diff --git a/chromium/third_party/blink/public/common/manifest/manifest_mojom_traits.h b/chromium/third_party/blink/public/common/manifest/manifest_mojom_traits.h
index da4707058bd..b6476d35944 100644
--- a/chromium/third_party/blink/public/common/manifest/manifest_mojom_traits.h
+++ b/chromium/third_party/blink/public/common/manifest/manifest_mojom_traits.h
@@ -112,6 +112,11 @@ struct BLINK_COMMON_EXPORT
return manifest.file_handlers;
}
+ static const std::vector<::blink::Manifest::ProtocolHandler>&
+ protocol_handlers(const ::blink::Manifest& manifest) {
+ return manifest.protocol_handlers;
+ }
+
static const std::vector<::blink::Manifest::RelatedApplication>&
related_applications(const ::blink::Manifest& manifest) {
return manifest.related_applications;
@@ -301,6 +306,21 @@ struct BLINK_COMMON_EXPORT
template <>
struct BLINK_COMMON_EXPORT
+ StructTraits<blink::mojom::ManifestProtocolHandlerDataView,
+ ::blink::Manifest::ProtocolHandler> {
+ static base::StringPiece16 protocol(
+ const ::blink::Manifest::ProtocolHandler& protocol) {
+ return internal::TruncateString16(protocol.protocol);
+ }
+ static const GURL& url(const ::blink::Manifest::ProtocolHandler& protocol) {
+ return protocol.url;
+ }
+ static bool Read(blink::mojom::ManifestProtocolHandlerDataView data,
+ ::blink::Manifest::ProtocolHandler* out);
+};
+
+template <>
+struct BLINK_COMMON_EXPORT
EnumTraits<blink::mojom::ManifestImageResource_Purpose,
::blink::Manifest::ImageResource::Purpose> {
static blink::mojom::ManifestImageResource_Purpose ToMojom(
diff --git a/chromium/third_party/blink/public/common/mediastream/media_devices.h b/chromium/third_party/blink/public/common/mediastream/media_devices.h
index d87affeb087..c0ba8bd3415 100644
--- a/chromium/third_party/blink/public/common/mediastream/media_devices.h
+++ b/chromium/third_party/blink/public/common/mediastream/media_devices.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/optional.h"
#include "media/base/video_facing.h"
#include "third_party/blink/public/common/common_export.h"
@@ -32,7 +33,8 @@ struct BLINK_COMMON_EXPORT WebMediaDeviceInfo {
const std::string& device_id,
const std::string& label,
const std::string& group_id,
- media::VideoFacingMode video_facing = media::MEDIA_VIDEO_FACING_NONE);
+ media::VideoFacingMode video_facing = media::MEDIA_VIDEO_FACING_NONE,
+ const base::Optional<bool>& pan_tilt_zoom_supported = base::nullopt);
explicit WebMediaDeviceInfo(
const media::VideoCaptureDeviceDescriptor& descriptor);
~WebMediaDeviceInfo();
@@ -42,7 +44,9 @@ struct BLINK_COMMON_EXPORT WebMediaDeviceInfo {
std::string device_id;
std::string label;
std::string group_id;
- media::VideoFacingMode video_facing;
+ media::VideoFacingMode video_facing =
+ media::VideoFacingMode::MEDIA_VIDEO_FACING_NONE;
+ base::Optional<bool> pan_tilt_zoom_supported;
};
using WebMediaDeviceInfoArray = std::vector<WebMediaDeviceInfo>;
diff --git a/chromium/third_party/blink/public/common/mediastream/media_stream_request.h b/chromium/third_party/blink/public/common/mediastream/media_stream_request.h
index ee5e4073fa5..6c530625c4f 100644
--- a/chromium/third_party/blink/public/common/mediastream/media_stream_request.h
+++ b/chromium/third_party/blink/public/common/mediastream/media_stream_request.h
@@ -57,7 +57,8 @@ struct BLINK_COMMON_EXPORT MediaStreamDevice {
const std::string& id,
const std::string& name,
media::VideoFacingMode facing,
- const base::Optional<std::string>& group_id = base::nullopt);
+ const base::Optional<std::string>& group_id = base::nullopt,
+ const base::Optional<bool>& pan_tilt_zoom_supported = base::nullopt);
MediaStreamDevice(mojom::MediaStreamType type,
const std::string& id,
const std::string& name,
@@ -98,6 +99,10 @@ struct BLINK_COMMON_EXPORT MediaStreamDevice {
// The device's group ID.
base::Optional<std::string> group_id;
+ // Whether the device supports pan-tilt-zoom.
+ // Only applicable to video devices.
+ base::Optional<bool> pan_tilt_zoom_supported;
+
// The device id of a matched output device if any (otherwise empty).
// Only applicable to audio devices.
base::Optional<std::string> matched_output_device_id;
diff --git a/chromium/third_party/blink/public/common/origin_trials/origin_trial_policy.h b/chromium/third_party/blink/public/common/origin_trials/origin_trial_policy.h
index 905a7c7bdf2..879cea4267f 100644
--- a/chromium/third_party/blink/public/common/origin_trials/origin_trial_policy.h
+++ b/chromium/third_party/blink/public/common/origin_trials/origin_trial_policy.h
@@ -23,6 +23,9 @@ class OriginTrialPolicy {
virtual bool IsFeatureDisabled(base::StringPiece feature) const {
return false;
}
+ virtual bool IsFeatureDisabledForUser(base::StringPiece feature) const {
+ return false;
+ }
virtual bool IsTokenDisabled(base::StringPiece token_signature) const {
return false;
}
diff --git a/chromium/third_party/blink/public/common/origin_trials/trial_token.h b/chromium/third_party/blink/public/common/origin_trials/trial_token.h
index eccae423a79..001b10b6d27 100644
--- a/chromium/third_party/blink/public/common/origin_trials/trial_token.h
+++ b/chromium/third_party/blink/public/common/origin_trials/trial_token.h
@@ -30,7 +30,8 @@ enum class OriginTrialTokenStatus {
kWrongVersion = 7,
kFeatureDisabled = 8,
kTokenDisabled = 9,
- kMaxValue = kTokenDisabled
+ kFeatureDisabledForUser = 10,
+ kMaxValue = kFeatureDisabledForUser
};
// The Origin Trials Framework (OT) provides limited access to experimental
@@ -49,6 +50,8 @@ class BLINK_COMMON_EXPORT TrialToken {
public:
~TrialToken();
+ enum class UsageRestriction { kNone, kSubset };
+
// If the string represents a signed well-formed token, a token object is
// returned, and success is returned in the |out_status| parameter. Otherwise,
// the |out_status| parameter indicates what was wrong with the string, and
@@ -73,6 +76,7 @@ class BLINK_COMMON_EXPORT TrialToken {
base::Time expiry_time() { return expiry_time_; }
std::string signature() { return signature_; }
bool is_third_party() const { return is_third_party_; }
+ UsageRestriction usage_restriction() { return usage_restriction_; }
protected:
// Tests can access the Parse method directly to validate it, and so are
@@ -112,7 +116,8 @@ class BLINK_COMMON_EXPORT TrialToken {
bool match_subdomains,
const std::string& feature_name,
uint64_t expiry_timestamp,
- bool is_third_party);
+ bool is_third_party,
+ UsageRestriction usage_restriction);
// The origin for which this token is valid. Must be a secure origin.
url::Origin origin_;
@@ -134,6 +139,12 @@ class BLINK_COMMON_EXPORT TrialToken {
// https://docs.google.com/document/d/1xALH9W7rWmX0FpjudhDeS2TNTEOXuPn4Tlc9VmuPdHA
// for more details.
bool is_third_party_;
+
+ // Indicates the alternative usage restriction mode imposed on the token.
+ // See design doc
+ // https://docs.google.com/document/d/1xALH9W7rWmX0FpjudhDeS2TNTEOXuPn4Tlc9VmuPdHA
+ // for more details.
+ UsageRestriction usage_restriction_;
};
} // namespace blink
diff --git a/chromium/third_party/blink/public/common/origin_trials/trial_token_validator.h b/chromium/third_party/blink/public/common/origin_trials/trial_token_validator.h
index 824e74a8250..aa27c9cff12 100644
--- a/chromium/third_party/blink/public/common/origin_trials/trial_token_validator.h
+++ b/chromium/third_party/blink/public/common/origin_trials/trial_token_validator.h
@@ -30,7 +30,8 @@ struct BLINK_COMMON_EXPORT TrialTokenResult {
explicit TrialTokenResult(OriginTrialTokenStatus);
TrialTokenResult(OriginTrialTokenStatus status,
std::string name,
- base::Time expiry);
+ base::Time expiry,
+ bool is_third_party);
~TrialTokenResult();
OriginTrialTokenStatus status;
@@ -53,12 +54,23 @@ class BLINK_COMMON_EXPORT TrialTokenValidator {
base::flat_map<std::string /* feature_name */,
std::vector<std::string /* token */>>;
- // If the token validates, status is set to OriginTrialTokenStatus::kSuccess,
- // feature_name is set to name of the feature this token enables, expiry_time
- // is set to the expiry time of the token. This method is thread-safe.
+ // If the token validates, status will be set to
+ // OriginTrialTokenStatus::kSuccess, the rest will be populated with name of
+ // the feature this token enables, the expiry time of the token and whether it
+ // is a third-party token. Otherwise, only the status will be set.
+ // This method is thread-safe.
virtual TrialTokenResult ValidateToken(base::StringPiece token,
const url::Origin& origin,
base::Time current_time) const;
+ // Validates a token for the given |origin|. If identified as a third-party
+ // token, instead validate for the given |third_party_origin|. Validation of a
+ // third-party token will fail if |third_party-origin| is not given. Returns
+ // the same result as ValidateToken() above.
+ // This method is thread-safe.
+ virtual TrialTokenResult ValidateToken(base::StringPiece token,
+ const url::Origin& origin,
+ const url::Origin* third_party_origin,
+ base::Time current_time) const;
bool RequestEnablesFeature(const net::URLRequest* request,
base::StringPiece feature_name,
diff --git a/chromium/third_party/blink/public/common/page/OWNERS b/chromium/third_party/blink/public/common/page/OWNERS
index 08850f42120..d5fefd82012 100644
--- a/chromium/third_party/blink/public/common/page/OWNERS
+++ b/chromium/third_party/blink/public/common/page/OWNERS
@@ -1,2 +1,2 @@
-per-file *.mojom=set noparent
-per-file *.mojom=file://ipc/SECURITY_OWNERS
+per-file *_mojom_traits*.*=set noparent
+per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
diff --git a/chromium/third_party/blink/public/common/page/drag_mojom_traits.h b/chromium/third_party/blink/public/common/page/drag_mojom_traits.h
new file mode 100644
index 00000000000..c6334b4d7db
--- /dev/null
+++ b/chromium/third_party/blink/public/common/page/drag_mojom_traits.h
@@ -0,0 +1,52 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_DRAG_MOJOM_TRAITS_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_DRAG_MOJOM_TRAITS_H_
+
+#include "mojo/public/cpp/bindings/enum_traits.h"
+#include "mojo/public/cpp/bindings/struct_traits.h"
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/page/web_drag_operation.h"
+#include "third_party/blink/public/mojom/page/widget.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+struct BLINK_COMMON_EXPORT
+ EnumTraits<blink::mojom::DragOperation, blink::WebDragOperation> {
+ static blink::mojom::DragOperation ToMojom(blink::WebDragOperation op);
+ static bool FromMojom(blink::mojom::DragOperation op,
+ blink::WebDragOperation* out);
+};
+
+template <>
+struct BLINK_COMMON_EXPORT
+ StructTraits<blink::mojom::AllowedDragOperationsDataView,
+ blink::WebDragOperationsMask> {
+ static bool allow_copy(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationCopy;
+ }
+ static bool allow_link(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationLink;
+ }
+ static bool allow_generic(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationGeneric;
+ }
+ static bool allow_private(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationPrivate;
+ }
+ static bool allow_move(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationMove;
+ }
+ static bool allow_delete(const blink::WebDragOperationsMask& op_mask) {
+ return op_mask & blink::kWebDragOperationDelete;
+ }
+ static bool Read(blink::mojom::AllowedDragOperationsDataView data,
+ blink::WebDragOperationsMask* out);
+};
+
+} // namespace mojo
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_DRAG_MOJOM_TRAITS_H_
diff --git a/chromium/third_party/blink/public/common/page/web_drag_operation.h b/chromium/third_party/blink/public/common/page/web_drag_operation.h
new file mode 100644
index 00000000000..d68944b89e6
--- /dev/null
+++ b/chromium/third_party/blink/public/common/page/web_drag_operation.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_WEB_DRAG_OPERATION_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_WEB_DRAG_OPERATION_H_
+
+#include <limits.h>
+
+namespace blink {
+
+// "Verb" of a drag-and-drop operation as negotiated between the source and
+// destination.
+// (These constants match their equivalents in WebCore's DragActions.h and
+// should not be renumbered.)
+// TODO(hferreiro): replace this enum and the corresponding one in
+// drag_actions.h with blink::mojom::DragOperation.
+enum WebDragOperation {
+ kWebDragOperationNone = 0,
+ kWebDragOperationCopy = 1,
+ kWebDragOperationLink = 2,
+ kWebDragOperationGeneric = 4,
+ kWebDragOperationPrivate = 8,
+ kWebDragOperationMove = 16,
+ kWebDragOperationDelete = 32,
+ kWebDragOperationEvery = UINT_MAX
+};
+
+// Alternate typedef to make it clear when this is being used as a mask
+// with potentially multiple value bits set.
+typedef WebDragOperation WebDragOperationsMask;
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PAGE_WEB_DRAG_OPERATION_H_
diff --git a/chromium/third_party/blink/public/common/peerconnection/OWNERS b/chromium/third_party/blink/public/common/peerconnection/OWNERS
new file mode 100644
index 00000000000..7f69766290a
--- /dev/null
+++ b/chromium/third_party/blink/public/common/peerconnection/OWNERS
@@ -0,0 +1,6 @@
+file://third_party/blink/renderer/modules/peerconnection/OWNERS
+
+per-file *_mojom_traits*.*=set noparent
+per-file *_mojom_traits*.*=file://ipc/SECURITY_OWNERS
+per-file *.typemap=set noparent
+per-file *.typemap=file://ipc/SECURITY_OWNERS
diff --git a/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker.typemap b/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker.typemap
new file mode 100644
index 00000000000..4edd7c77949
--- /dev/null
+++ b/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker.typemap
@@ -0,0 +1,16 @@
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+mojom = "//third_party/blink/public/mojom/peerconnection/peer_connection_tracker.mojom"
+
+public_headers = [
+ "//base/power_monitor/power_observer.h",
+ "//third_party/blink/public/common/common_export.h",
+]
+
+traits_headers = [ "//third_party/blink/public/common/peerconnection/peer_connection_tracker_mojom_traits.h" ]
+
+type_mappings = [
+ "blink.mojom.DeviceThermalState=::base::PowerObserver::DeviceThermalState",
+]
diff --git a/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker_mojom_traits.h b/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker_mojom_traits.h
new file mode 100644
index 00000000000..12191955e1a
--- /dev/null
+++ b/chromium/third_party/blink/public/common/peerconnection/peer_connection_tracker_mojom_traits.h
@@ -0,0 +1,26 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PEERCONNECTION_PEER_CONNECTION_TRACKER_MOJOM_TRAITS_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PEERCONNECTION_PEER_CONNECTION_TRACKER_MOJOM_TRAITS_H_
+
+#include "base/power_monitor/power_observer.h"
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/mojom/peerconnection/peer_connection_tracker.mojom.h"
+
+namespace mojo {
+
+template <>
+struct BLINK_COMMON_EXPORT EnumTraits<blink::mojom::DeviceThermalState,
+ base::PowerObserver::DeviceThermalState> {
+ static blink::mojom::DeviceThermalState ToMojom(
+ base::PowerObserver::DeviceThermalState type);
+
+ static bool FromMojom(blink::mojom::DeviceThermalState input,
+ base::PowerObserver::DeviceThermalState* out);
+};
+
+} // namespace mojo
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PEERCONNECTION_PEER_CONNECTION_TRACKER_MOJOM_TRAITS_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/BUILD.gn b/chromium/third_party/blink/public/common/privacy_budget/BUILD.gn
new file mode 100644
index 00000000000..2f35bb930b1
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+source_set("internal") {
+ sources = [ "identifiability_internal_templates.h" ]
+
+ visibility = [
+ ":*",
+ "//third_party/blink/common/privacy_budget:*",
+ ]
+}
+
+source_set("privacy_budget") {
+ sources = [
+ "identifiability_metric_builder.h",
+ "identifiability_metrics.h",
+ "identifiability_study_participation.h",
+ "identifiability_study_settings.h",
+ "identifiability_study_settings_provider.h",
+ "identifiable_surface.h",
+ "identifiable_token.h",
+ "identifiable_token_builder.h",
+ ]
+
+ deps = [
+ ":internal",
+ "//base",
+ "//services/metrics/public/cpp:metrics_cpp",
+ "//services/network/public/cpp:cpp",
+ "//third_party/blink/public/common:common_export",
+ "//third_party/blink/public/mojom:web_feature_mojo_bindings",
+ ]
+}
diff --git a/chromium/third_party/blink/public/common/privacy_budget/README.md b/chromium/third_party/blink/public/common/privacy_budget/README.md
new file mode 100644
index 00000000000..1fdb8d801e7
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/README.md
@@ -0,0 +1,6 @@
+# Privacy Budget: Core Metrics and Aggregation
+
+See [Privacy Budget: Code
+Locations](../../../../../docs/privacy_budget_code_locations.md) for
+details.
+
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h
new file mode 100644
index 00000000000..db6915d7522
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h
@@ -0,0 +1,77 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_INTERNAL_TEMPLATES_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_INTERNAL_TEMPLATES_H_
+
+#include <cstdint>
+#include <cstring>
+#include <type_traits>
+
+namespace blink {
+
+namespace internal {
+
+// Handroll a remove_cv_t until we get to C++20.
+template <typename T>
+using remove_cvref_t = typename std::remove_cv_t<std::remove_reference_t<T>>;
+
+// Kinda conservative implementation of
+// std::has_unique_object_representations<>. Perhaps not as conservative as we'd
+// like.
+//
+// At a minimum, this predicate should require that the data type not contain
+// internal padding since uninitialized padding bytes defeat the uniqueness of
+// the representation. Trailing padding is allowed.
+//
+// Not checking <version> because we don't want to use the feature
+// automatically. We should wait until C++-17 library functionality is
+// explicitly allowed in Chromium.
+template <typename T>
+using has_unique_object_representations = std::is_arithmetic<T>;
+
+// Calculate a digest of an object with a unique representation.
+//
+// In a perfect world, we should also require that this representation be
+// portable or made to be portable. Such a transformation could be done, for
+// example, by adopting a consistent byte ordering on all platforms.
+//
+// This function should only be invoked on a bare (sans qualifiers and
+// references) type for the sake of simplicity.
+//
+// Should not be used as a primitive for manually constructing a unique
+// representation. For such cases, use the byte-wise digest functions instead.
+//
+// Should not be used outside of the narrow use cases in this file.
+//
+// This implementation does not work for x86 extended precision floating point
+// numbers. These are 80-bits wide, but in practice includes 6 bytes of padding
+// in order to extend the size to 16 bytes. The extra bytes are uninitialized
+// and will not contribute a stable digest.
+template <
+ typename T,
+ typename std::enable_if_t<std::is_same<T, remove_cvref_t<T>>::value &&
+ std::is_trivially_copyable<T>::value &&
+ has_unique_object_representations<T>::value &&
+ sizeof(T) <= sizeof(int64_t)>* = nullptr>
+constexpr int64_t DigestOfObjectRepresentation(T in) {
+ // If |in| is small enough, the digest is itself. There's no point hashing
+ // this value since the identity has all the properties we are looking for
+ // in a digest.
+ if (std::is_integral<T>::value && std::is_signed<T>::value)
+ return in;
+
+ if (std::is_integral<T>::value && sizeof(T) < sizeof(int64_t))
+ return in;
+
+ int64_t result = 0;
+ std::memcpy(&result, &in, sizeof(in));
+ return result;
+}
+
+} // namespace internal
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_INTERNAL_TEMPLATES_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h
index 47678eec244..dc2fcc09555 100644
--- a/chromium/third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_metric_builder.h
@@ -12,6 +12,7 @@
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/common/common_export.h"
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
+#include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
#include "third_party/blink/public/mojom/web_feature/web_feature.mojom-forward.h"
namespace blink {
@@ -112,16 +113,21 @@ class BLINK_COMMON_EXPORT IdentifiabilityMetricBuilder
// Set the metric using a previously constructed |IdentifiableSurface|.
IdentifiabilityMetricBuilder& Set(IdentifiableSurface surface,
- int64_t result);
+ IdentifiableToken sample);
+
+ // Set the metric using and IdentifiableSurface::Type and an |input|.
+ IdentifiabilityMetricBuilder& Set(IdentifiableSurface::Type type,
+ uint64_t input,
+ IdentifiableToken sample);
// Convenience method for recording the result of invoking a simple API
- // surface with a UseCounter.
+ // surface with a |UseCounter|.
IdentifiabilityMetricBuilder& SetWebfeature(mojom::WebFeature feature,
- int64_t result) {
+ IdentifiableToken sample) {
return Set(IdentifiableSurface::FromTypeAndInput(
IdentifiableSurface::Type::kWebFeature,
static_cast<uint64_t>(feature)),
- result);
+ sample);
}
// Shadow the underlying Record() implementation until the upstream pipeline
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_metrics.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_metrics.h
index 8c9c3387181..48ddca2ffc2 100644
--- a/chromium/third_party/blink/public/common/privacy_budget/identifiability_metrics.h
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_metrics.h
@@ -5,8 +5,7 @@
#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_METRICS_H_
#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_METRICS_H_
-#include <stdint.h>
-
+#include <cstdint>
#include <cstring>
#include <type_traits>
@@ -15,9 +14,9 @@
namespace blink {
-// DigestForMetrics, which is NOT a cryptographic hash function, takes a span of
-// bytes as input and calculates a digest that can be used with identifiability
-// metric reporting functions.
+// IdentifiabilityDigestOfBytes, which is NOT a cryptographic hash function,
+// takes a span of bytes as input and calculates a digest that can be used with
+// identifiability metric reporting functions.
//
// The returned digest ...:
//
@@ -46,6 +45,9 @@ IdentifiabilityDigestOfBytes(base::span<const uint8_t> in);
// IdentifiabilityDigestHelper(); such declarations should be made in a header
// included before this header so that they can be used by the span and
// parameter pack overloads of IdentifiabilityDigestHelper.
+//
+// TODO(asanka): Remove once callers have been migrated to
+// IdentifiabilityToken().
// Integer version.
template <typename T,
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_participation.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_participation.h
index c6e41d6db7d..9732bef4af2 100644
--- a/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_participation.h
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_participation.h
@@ -15,6 +15,8 @@ namespace blink {
// This method can be used to avoid computation that is only needed for the
// study, such as complex digest calculation on canvas operations; for UKM
// reporting, filtering should happen automatically.
+//
+// TODO(asanka): Migrate callers to IdentifiabilityStudySettings.
bool BLINK_COMMON_EXPORT IsUserInIdentifiabilityStudy();
} // namespace blink
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings.h
new file mode 100644
index 00000000000..3cf8a1872da
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings.h
@@ -0,0 +1,92 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_H_
+
+#include <memory>
+
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h"
+#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
+
+namespace blink {
+
+// Determines whether the identifiability study is active and if so whether a
+// given surface or surface type should be sampled.
+//
+// This class can used from multiple threads and does not require
+// synchronization.
+//
+// See documentation on individual methods for notes on thread safety.
+class BLINK_COMMON_EXPORT IdentifiabilityStudySettings {
+ public:
+ // Constructs a default IdentifiabilityStudySettings instance. By default the
+ // settings instance acts as if the study is disabled, and implicitly as if
+ // all surfaces and types are blocked.
+ IdentifiabilityStudySettings();
+
+ // Constructs a IdentifiabilityStudySettings instance which reflects the state
+ // specified by |provider|.
+ explicit IdentifiabilityStudySettings(
+ std::unique_ptr<IdentifiabilityStudySettingsProvider> provider);
+
+ ~IdentifiabilityStudySettings();
+
+ // Get a pointer to an instance of IdentifiabilityStudySettings for the
+ // process.
+ //
+ // This method and the returned object is safe to use from any thread and is
+ // never destroyed.
+ //
+ // On the browser process, the returned instance is authoritative. On all
+ // other processes the returned instance should be considered advisory. It's
+ // only meant as an optimization to avoid calculating things unnecessarily.
+ static const IdentifiabilityStudySettings* Get();
+
+ // Initialize the process-wide settings instance with the specified settings
+ // provider. Should only be called once per process and only from the main
+ // thread.
+ //
+ // For testing, you can use ResetStateForTesting().
+ static void SetGlobalProvider(
+ std::unique_ptr<IdentifiabilityStudySettingsProvider> provider);
+
+ // Returns true if the study is active for this client. Once if it returns
+ // true, it doesn't return false at any point after. The converse is not true.
+ bool IsActive() const;
+
+ // Returns true if |surface| is allowed.
+ //
+ // Will always return false if IsActive() is false. I.e. If the study is
+ // inactive, all surfaces are considered to be blocked. Hence it is sufficient
+ // to call this function directly instead of calling IsActive() before it.
+ bool IsSurfaceAllowed(IdentifiableSurface surface) const;
+
+ // Returns true if |type| is allowed.
+ //
+ // Will always return false if IsActive() is false. I.e. If the study is
+ // inactive, all surface types are considered to be blocked. Hence it is
+ // sufficient to call this function directly instead of calling IsActive()
+ // before it.
+ bool IsTypeAllowed(IdentifiableSurface::Type type) const;
+
+ // Only used for testing. Resets internal state and violates API contracts
+ // made above about the lifetime of IdentifiabilityStudySettings*.
+ static void ResetStateForTesting();
+
+ IdentifiabilityStudySettings(IdentifiabilityStudySettings&&) = delete;
+ IdentifiabilityStudySettings(const IdentifiabilityStudySettings&) = delete;
+ IdentifiabilityStudySettings& operator=(const IdentifiabilityStudySettings&) =
+ delete;
+
+ private:
+ const std::unique_ptr<IdentifiabilityStudySettingsProvider> provider_;
+ const bool is_enabled_ = false;
+ const bool is_any_surface_or_type_blocked_ = false;
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h
new file mode 100644
index 00000000000..1aa41a66676
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiability_study_settings_provider.h
@@ -0,0 +1,42 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_
+
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
+
+namespace blink {
+
+class BLINK_COMMON_EXPORT IdentifiabilityStudySettingsProvider {
+ public:
+ virtual ~IdentifiabilityStudySettingsProvider();
+
+ // Returns true if the identifiability study is active. For any specific
+ // instance of IdentifiabilityStudySettings, this answer cannot change. It
+ // will only be queried once.
+ virtual bool IsActive() const = 0;
+
+ // Returns true if any specific surface or type is blocked. Otherwise it is
+ // assumed that neither IsSurfaceBlocked() nor IsTypeBlocked() will ever
+ // return true for anything.
+ //
+ // Only meaningful if IsActive() returns true.
+ virtual bool IsAnyTypeOrSurfaceBlocked() const = 0;
+
+ // Returns true if the given surface should be sampled.
+ //
+ // If IsActive() is false, this method will not be called.
+ virtual bool IsSurfaceAllowed(IdentifiableSurface surface) const = 0;
+
+ // Returns true if the given surface type should be sampled.
+ //
+ // If IsActive() is false, this method will not be called.
+ virtual bool IsTypeAllowed(IdentifiableSurface::Type type) const = 0;
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABILITY_STUDY_SETTINGS_PROVIDER_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiable_surface.h b/chromium/third_party/blink/public/common/privacy_budget/identifiable_surface.h
index 8e159b0885a..4f74660be5a 100644
--- a/chromium/third_party/blink/public/common/privacy_budget/identifiable_surface.h
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiable_surface.h
@@ -24,13 +24,28 @@ namespace blink {
// * Immutable.
// * Efficient enough to pass by value.
//
+// Internally, an identifiable surface is represented as a 64-bit unsigned
+// integer that can be used as the metric hash for reporting metrics via UKM.
+//
+// The least-significant |kTypeBits| of the value is used to store
+// a IdentifiableSurface::Type value. The remainder stores the 56
+// least-significant bits of an IdentifiableToken.
class IdentifiableSurface {
public:
+ // Number of bits used by Type.
+ static constexpr int kTypeBits = 8;
+
+ // Bitmask for extracting Type value from a surface hash.
+ static constexpr uint64_t kTypeMask = (1 << kTypeBits) - 1;
+
+ // Indicator for an uninitialized IdentifiableSurface. Maps to
+ // {Type::kReservedInternal, 0} which is not possible for a valid surface.
+ static constexpr uint64_t kInvalidHash = 0;
+
// Type of identifiable surface.
//
// Even though the data type is uint64_t, we can only use 8 bits due to how we
- // pack the surface type and a digest of the input into a 64 bits. See
- // README.md in this directory for details on encoding.
+ // pack the surface type and a digest of the input into a 64 bits.
//
// These values are used for aggregation across versions. Entries should not
// be renumbered and numeric values should never be reused.
@@ -47,9 +62,12 @@ class IdentifiableSurface {
kCanvasReadback = 2,
// We can use values up to and including |kMax|.
- kMax = 0xff
+ kMax = (1 << kTypeBits) - 1
};
+ // Default constructor is invalid.
+ IdentifiableSurface() : IdentifiableSurface(kInvalidHash) {}
+
// Construct an IdentifiableSurface based on a precalculated metric hash. Can
// also be used as the first step in decoding an encoded metric hash.
static constexpr IdentifiableSurface FromMetricHash(uint64_t metric_hash) {
@@ -62,6 +80,11 @@ class IdentifiableSurface {
return IdentifiableSurface(KeyFromSurfaceTypeAndInput(type, input));
}
+ // Construct an invalid identifiable surface.
+ static constexpr IdentifiableSurface Invalid() {
+ return IdentifiableSurface(kInvalidHash);
+ }
+
// Returns the UKM metric hash corresponding to this IdentifiableSurface.
constexpr uint64_t ToUkmMetricHash() const { return metric_hash_; }
@@ -79,7 +102,12 @@ class IdentifiableSurface {
return std::get<1>(SurfaceTypeAndInputFromMetricKey(metric_hash_));
}
+ constexpr bool IsValid() const { return metric_hash_ != kInvalidHash; }
+
private:
+ constexpr explicit IdentifiableSurface(uint64_t metric_hash)
+ : metric_hash_(metric_hash) {}
+
// Returns a 64-bit metric key given an IdentifiableSurfaceType and a 64 bit
// input digest.
//
@@ -88,7 +116,7 @@ class IdentifiableSurface {
static constexpr uint64_t KeyFromSurfaceTypeAndInput(Type type,
uint64_t input) {
uint64_t type_as_int = static_cast<uint64_t>(type);
- return type_as_int | (input << 8);
+ return type_as_int | (input << kTypeBits);
}
// Returns the IdentifiableSurfaceType and the input hash given a metric key.
@@ -98,12 +126,10 @@ class IdentifiableSurface {
// from that used to construct this IdentifiableSurface.
static constexpr std::tuple<Type, uint64_t> SurfaceTypeAndInputFromMetricKey(
uint64_t metric) {
- return std::make_tuple(static_cast<Type>(metric & 0xff), metric >> 8);
+ return std::make_tuple(static_cast<Type>(metric & kTypeMask),
+ metric >> kTypeBits);
}
- private:
- constexpr explicit IdentifiableSurface(uint64_t metric_hash)
- : metric_hash_(metric_hash) {}
uint64_t metric_hash_;
};
@@ -112,6 +138,21 @@ constexpr bool operator<(const IdentifiableSurface& left,
return left.ToUkmMetricHash() < right.ToUkmMetricHash();
}
+constexpr bool operator<=(const IdentifiableSurface& left,
+ const IdentifiableSurface& right) {
+ return left.ToUkmMetricHash() <= right.ToUkmMetricHash();
+}
+
+constexpr bool operator>(const IdentifiableSurface& left,
+ const IdentifiableSurface& right) {
+ return left.ToUkmMetricHash() > right.ToUkmMetricHash();
+}
+
+constexpr bool operator>=(const IdentifiableSurface& left,
+ const IdentifiableSurface& right) {
+ return left.ToUkmMetricHash() >= right.ToUkmMetricHash();
+}
+
constexpr bool operator==(const IdentifiableSurface& left,
const IdentifiableSurface& right) {
return left.ToUkmMetricHash() == right.ToUkmMetricHash();
@@ -129,6 +170,14 @@ struct IdentifiableSurfaceHash {
}
};
+// Compare function compatible with std::less
+struct IdentifiableSurfaceCompLess {
+ bool operator()(const IdentifiableSurface& lhs,
+ const IdentifiableSurface& rhs) const {
+ return lhs.ToUkmMetricHash() < rhs.ToUkmMetricHash();
+ }
+};
+
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_SURFACE_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiable_token.h b/chromium/third_party/blink/public/common/privacy_budget/identifiable_token.h
new file mode 100644
index 00000000000..9c4b39250cc
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiable_token.h
@@ -0,0 +1,229 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_H_
+
+#include <cstdint>
+#include <type_traits>
+
+#include "base/containers/span.h"
+#include "base/numerics/safe_conversions.h"
+#include "base/strings/string_piece.h"
+#include "third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h"
+#include "third_party/blink/public/common/privacy_budget/identifiability_metrics.h"
+
+namespace blink {
+
+// Constructs a token that can be used for reporting a metric or constructing an
+// identifiable surface.
+//
+// The token construction is a single step conversion that takes one of several
+// constrained inputs and emits a value. The method by which the value is
+// constructed intentionally cannot be chained. If such behavior is required,
+// then this class should be modified to accommodate the new use case rather
+// than implementing custom chaining schemes at call sites.
+//
+// Once constructed, a token can only be consumed by
+// IdentifiabiltyMetricsBuilder and IdentifiableSurface. For all others, it is a
+// copyable, opaque token.
+//
+// Reliance on implicit conversion imposes limitations on how
+// IdentifiableToken class is to be used. For example the following works:
+//
+// std::string foo = ....;
+// IdentifiableToken sample(foo);
+//
+// .. due to the following implicit conversion:
+//
+// 1. std::string -> const std::string&
+// : lvalue -> lvalue reference + cv-qualification
+// 2. const std::string& -> base::StringPiece
+// : user-defined conversion via constructor
+// base::StringPiece(const std::string&)
+//
+// However, when used within a builder expression, the user-defined conversion
+// doesn't occur due to there not being a single user defined conversion from
+// std::string -> IdentifiableToken. I.e. the following does not work:
+//
+// std::string foo = ....;
+// IdentifiabilityMetricBuilder(...).Set(surface, foo);
+// ^^^
+// The compiler can't deduce a two step user-defined conversion for |foo|.
+//
+// All overrides of the constructor should ensure that there exists a unique
+// representation of the data type being sampled, and that the sample value is
+// constructed based on this unique representation.
+//
+// TODO(asanka): Also require that the representation be portable.
+//
+// Extending IdentifiableToken to support more data types:
+// -----------------------------------------------------------
+//
+// This class is intentionally placed in blink/public/common due to the
+// requirement that these primitives be made available to both the renderer and
+// the browser. However, it would be desirable to have renderer or browser
+// specific functions for mapping common types in either domain into a sample.
+//
+// The recommended methods to do so are (one-of):
+//
+// 1. Use an existing byte span representation.
+//
+// E.g.: Assuming |v| is a WTF::Vector
+// IdentifiabilityMetricBuilder(...).Set(...,
+// base::as_bytes(base::make_span(v.Data(), v.Size())));
+//
+// Note again that serializing to a stream of bytes may not be sufficient
+// if the underlying types don't have a unique representation.
+//
+// 2. Construct a byte-wise unique representation and invoke
+// IdentifiableToken(ByteSpan) either explicitly or implicitly via
+// user-defined conversions.
+//
+// Note: Avoid doing template magic. There's already too much here. Templates
+// make it difficult to verify that the correct stable representation is
+// the one getting ingested into the reporting workflow.
+//
+// Instead, explicitly invoke some wrapper that emits a ByteSpan (a.k.a.
+// base::span<const uint8_t>.
+class IdentifiableToken {
+ public:
+ // Generic buffer of bytes.
+ using ByteSpan = base::span<const uint8_t>;
+
+ // Representation type of the sample.
+ using TokenType = int64_t;
+
+ // A byte buffer specified as a span.
+ //
+ // This is essentially the base case. If it were the base case, then
+ // IdentifiableToken would be closer to a proper digest.
+ //
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ IdentifiableToken(ByteSpan span)
+ : value_(IdentifiabilityDigestOfBytes(span)) {}
+
+ // Integers, big and small. Includes char.
+ template <typename T,
+ typename U = internal::remove_cvref_t<T>,
+ typename std::enable_if_t<std::is_integral<U>::value>* = nullptr>
+ constexpr IdentifiableToken(T in) // NOLINT(google-explicit-constructor)
+ : value_(base::IsValueInRangeForNumericType<TokenType, U>(in)
+ ? in
+ : internal::DigestOfObjectRepresentation<U>(in)) {}
+
+ // Enums. Punt to the underlying type.
+ template <typename T,
+ typename U = typename std::underlying_type<T>::type,
+ typename std::enable_if_t<std::is_enum<T>::value>* = nullptr>
+ constexpr IdentifiableToken(T in) // NOLINT(google-explicit-constructor)
+ : IdentifiableToken(static_cast<U>(in)) {}
+
+ // All floating point values get converted to double before encoding.
+ //
+ // Why? We'd like to minimize accidental divergence of values due to the data
+ // type that the callsite happened to be using at the time.
+ //
+ // On some platforms sizeof(long double) gives us 16 (i.e. 128 bits), while
+ // only 10 of those bytes are initialized. If the whole sizeof(long double)
+ // buffer were to be ingested, then the uninitialized memory will cause the
+ // resulting digest to be useless.
+ template <
+ typename T,
+ typename U = internal::remove_cvref_t<T>,
+ typename std::enable_if_t<std::is_floating_point<U>::value>* = nullptr>
+ constexpr IdentifiableToken(T in) // NOLINT(google-explicit-constructor)
+ : value_(internal::DigestOfObjectRepresentation<double>(
+ static_cast<double>(in))) {}
+
+ // StringPiece. Decays to base::span<> but requires an explicit constructor
+ // invocation.
+ //
+ // Care must be taken when using string types with IdentifiableToken() since
+ // there's not privacy expectation in the resulting token value. If the string
+ // used as an input is privacy sensitive, it should not be passed in as-is.
+ explicit IdentifiableToken(base::StringPiece s)
+ : IdentifiableToken(base::as_bytes(base::make_span(s))) {
+ // The cart is before the horse, but it's a static_assert<>.
+ static_assert(
+ std::is_same<ByteSpan,
+ decltype(base::as_bytes(base::make_span(s)))>::value,
+ "base::as_bytes() doesn't return ByteSpan");
+ }
+
+ // Span of known trivial types except for BytesSpan, which is the base case.
+ template <typename T,
+ size_t Extent,
+ typename U = internal::remove_cvref_t<T>,
+ typename std::enable_if_t<
+ std::is_arithmetic<U>::value &&
+ !std::is_same<ByteSpan::element_type, T>::value>* = nullptr>
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ IdentifiableToken(base::span<T, Extent> span)
+ : IdentifiableToken(base::as_bytes(span)) {}
+
+ // A span of non-trivial things where each thing can be digested individually.
+ template <typename T,
+ size_t Extent,
+ typename std::enable_if_t<
+ !std::is_arithmetic<T>::value &&
+ !std::is_same<ByteSpan::element_type, T>::value>* = nullptr>
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ IdentifiableToken(base::span<T, Extent> span) {
+ TokenType cur_digest = 0;
+ for (const auto& element : span) {
+ TokenType digests[2];
+ digests[0] = cur_digest;
+ digests[1] = IdentifiableToken(element).value_;
+ cur_digest = IdentifiabilityDigestOfBytes(
+ base::as_bytes(base::make_span(digests)));
+ }
+ value_ = cur_digest;
+ }
+
+ // Parameter pack where each parameter can be digested individually. Requires
+ // at least two parameters.
+ template <typename T1, typename T2, typename... Trest>
+ constexpr IdentifiableToken(T1 first, T2 second, Trest... rest) {
+ TokenType samples[] = {IdentifiableToken(first).value_,
+ IdentifiableToken(second).value_,
+ (IdentifiableToken(rest).value_)...};
+ value_ = IdentifiableToken(base::make_span(samples)).value_;
+ }
+
+ constexpr bool operator<(const IdentifiableToken& that) const {
+ return value_ < that.value_;
+ }
+
+ constexpr bool operator<=(const IdentifiableToken& that) const {
+ return value_ <= that.value_;
+ }
+
+ constexpr bool operator>(const IdentifiableToken& that) const {
+ return value_ > that.value_;
+ }
+
+ constexpr bool operator>=(const IdentifiableToken& that) const {
+ return value_ >= that.value_;
+ }
+
+ constexpr bool operator==(const IdentifiableToken& that) const {
+ return value_ == that.value_;
+ }
+
+ constexpr bool operator!=(const IdentifiableToken& that) const {
+ return value_ != that.value_;
+ }
+
+ private:
+ friend class IdentifiabilityMetricBuilder;
+ friend class IdentifiableSurface;
+
+ // TODO(asanka): This should be const. Switch over once the incremental digest
+ // functions land.
+ TokenType value_ = 0;
+};
+
+} // namespace blink
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_H_
diff --git a/chromium/third_party/blink/public/common/privacy_budget/identifiable_token_builder.h b/chromium/third_party/blink/public/common/privacy_budget/identifiable_token_builder.h
new file mode 100644
index 00000000000..616dc7f51f3
--- /dev/null
+++ b/chromium/third_party/blink/public/common/privacy_budget/identifiable_token_builder.h
@@ -0,0 +1,185 @@
+// Copyright 2020 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_
+#define THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_
+
+#include "base/containers/span.h"
+#include "base/sys_byteorder.h"
+#include "third_party/blink/public/common/common_export.h"
+#include "third_party/blink/public/common/privacy_budget/identifiability_internal_templates.h"
+#include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
+
+namespace blink {
+
+// Builds an IdentifiableToken incrementally.
+//
+// Use this when the input to a sample is a bunch of disjoint objects, or the
+// sample needs to include objects that are incrementally encountered.
+//
+// Notes:
+// * The digest returned by this class is *NOT* the same as the one
+// IdentifiabilityDigestOfBytes for the same set of bytes. This is due to
+// block based chaining of digests used by this class.
+// IdentifiabilityDigestOfBytes and this class are *NOT* interchangeable.
+//
+// TODO(asanka): IdentifiabilityDigestOfBytes() and this class should
+// interop better. Perhaps by making the latter use the former.
+//
+// * The digest returned by this class is *NOT* the same as what you would
+// acquire by invoking IdentifiableToken() over the same object.
+// IdentifiableToken() and this class are *NOT* interchangeable.
+//
+// * The digest returned by this class only depends on the cumulative sequence
+// of bytes that are fed to it. The partitioning thereof is irrelevant.
+//
+// * This object never finalizes. Partial digests can be extracted at any
+// point.
+class BLINK_COMMON_EXPORT IdentifiableTokenBuilder {
+ public:
+ // Convenient alias for a span of const uint8_t.
+ using ByteBuffer = base::span<const uint8_t>;
+
+ // Initializes an "empty" incremental digest for the purpose of constructing
+ // an identifiability sample.
+ IdentifiableTokenBuilder();
+
+ // Initializes an incremental digest and populates it with the data contained
+ // in |message|.
+ explicit IdentifiableTokenBuilder(ByteBuffer message);
+
+ // Copies the intermediate state.
+ IdentifiableTokenBuilder(const IdentifiableTokenBuilder&);
+
+ // Feeds data contained in |buffer| to the digest.
+ IdentifiableTokenBuilder& AddBytes(ByteBuffer buffer);
+
+ // Feeds data contained in |buffer| to the digest, but precedes the buffer
+ // contents with an integer indicating the length. Use this when:
+ //
+ // * |buffer| is atomic. I.e. it will always be added as a single buffer.
+ //
+ // * The boundary between |buffer| and adjacent objects cannot be uniquely
+ // established based on content.
+ //
+ // E.g.: Ignoring NUL terminators, the pair of strings "abcd", "efgh" will be
+ // assigned token as the strings "abcdefg", "h" if both are added
+ // individually via AddBytes(). But they will have distinct digests if
+ // added via AddAtomic().
+ //
+ // If the contents of the object cannot be specified in a contiguous span of
+ // memory, then consider adding a length directly via AddValue() prior to
+ // adding the contents of the buffer. Doing so will achieve the same ends as
+ // AddAtomic().
+ IdentifiableTokenBuilder& AddAtomic(ByteBuffer buffer);
+
+ // Helper for feeding primitive types by value efficiently. Anything more
+ // complicated than that should be passed in as a base::span<const uint8_t>.
+ //
+ // Adds eight bytes to the digest. If the type of the value doesn't consume
+ // all of the bytes, pads the remainder with NUL bytes.
+ template <typename T,
+ typename std::enable_if_t<
+ std::is_same<T, internal::remove_cvref_t<T>>::value &&
+ internal::has_unique_object_representations<T>::value &&
+ sizeof(T) <= sizeof(uint64_t)>* = nullptr>
+ IdentifiableTokenBuilder& AddValue(T in) {
+ AlignPartialBuffer();
+ int64_t clean_buffer =
+ base::ByteSwapToLE64(internal::DigestOfObjectRepresentation(in));
+ return AddBytes(base::make_span(
+ reinterpret_cast<const uint8_t*>(&clean_buffer), sizeof(clean_buffer)));
+ }
+
+ // Conversion operator captures an intermediate digest.
+ //
+ // The sample captures all the data that's been fed into the digest so far,
+ // but doesn't finalize the digest. It is valid to continue adding data after
+ // constructing an intermediate sample.
+ //
+ // (google-explicit-constructor also flags user-defined conversion operators.)
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ operator IdentifiableToken() const;
+
+ // Captures an intermediate digest.
+ //
+ // The sample captures all the data that's been fed into the digest so far,
+ // but doesn't finalize the digest. It is valid to continue adding data after
+ // constructing an intermediate sample.
+ IdentifiableToken GetToken() const;
+
+ // No comparisons.
+ bool operator==(const IdentifiableTokenBuilder&) const = delete;
+ bool operator<(const IdentifiableTokenBuilder&) const = delete;
+
+ private:
+ // Block size. Must be a multiple of 64. Higher block sizes consume more
+ // memory. The extra cost is unlikely to be worth it.
+ //
+ // Under the covers we use CityHash64. It can pretty efficiently digest
+ // 64-byte blocks.
+ static constexpr size_t kBlockSizeInBytes = 64;
+
+ // Target alignment for new buffers. This is set to 8 for all platforms and
+ // must always stay constant across platforms.
+ static constexpr size_t kBlockAlignment = 8;
+
+ // A span of exactly |kBlockSizeInBytes| bytes.
+ using FullBlock = base::span<const uint8_t, kBlockSizeInBytes>;
+
+ // Returns true if the partial buffer is aligned on |kBlockAlignment|
+ // boundary.
+ bool IsAligned() const { return partial_size_ % kBlockAlignment == 0; }
+
+ // Appends enough NUL bytes to |partial_| until the next insertion point is
+ // aligned on a |kBlockAlignment| boundary.
+ //
+ // If the partial buffer is non-empty, its size is unlikely to be aligned at
+ // machine word boundary. This makes subsequent append operations slow for
+ // data types that are already aligned.
+ //
+ // This should only be called prior to adding an atomic buffer.
+ void AlignPartialBuffer();
+
+ // Captures the |kBlockSizeInBytes| bytes of data in |block| into the digest.
+ // |block| must be exactly this many bytes.
+ void DigestBlock(FullBlock block);
+
+ // Captures as many bytes as possible from |message| into the partial block in
+ // |partial_|. It captures a maximum of |kBlockSizeInBytes - 1| bytes.
+ //
+ // Returns a span covering the remainder of |message| that was not consumed.
+ ByteBuffer SkimIntoPartial(ByteBuffer message);
+
+ // Returns a span for the contents of the partial block.
+ //
+ // Can be called at any point. Does not change the state of the partial
+ // buffer.
+ ByteBuffer GetPartialBlock() const {
+ return base::make_span(&partial_[0], partial_size_);
+ }
+
+ // Returns a span that includes the contents of the partial block and backed
+ // by |partial_|.
+ //
+ // NOTE: Should only be called once |kBlockSizeInBytes| bytes have been
+ // accumulated. Resets |partial_size_| upon completion.
+ //
+ // NOTE: Any subsequent AddBytes(), AddValue(), AddAtomic() calls will
+ // invalidate the returned FullBlock.
+ FullBlock TakeCompletedBlock();
+
+ // Accumulates smaller pieces of data until we have a full block.
+ alignas(int64_t) uint8_t partial_[kBlockSizeInBytes];
+
+ // Count of bytes in |partial_|.
+ size_t partial_size_;
+
+ // Merkle-Damgård chaining.
+ uint64_t chaining_value_;
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_PRIVACY_BUDGET_IDENTIFIABLE_TOKEN_BUILDER_H_
diff --git a/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h b/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h
index 80d7addbfde..0816f730a63 100644
--- a/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h
+++ b/chromium/third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h
@@ -88,9 +88,15 @@ enum class WebSchedulerTrackedFeature {
kPrinting = 43,
kWebDatabase = 44,
kPictureInPicture = 45,
+ kPortal = 46,
+ kSpeechRecognizer = 47,
+ kIdleManager = 48,
+ kPaymentManager = 49,
+ kSpeechSynthesis = 50,
+ kKeyboardLock = 51,
// NB: This enum is used in a bitmask, so kMaxValue must be less than 64.
- kMaxValue = kPictureInPicture
+ kMaxValue = kKeyboardLock
};
static_assert(static_cast<uint32_t>(WebSchedulerTrackedFeature::kMaxValue) < 64,
diff --git a/chromium/third_party/blink/public/common/switches.h b/chromium/third_party/blink/public/common/switches.h
index fa70aa81117..12c6799b214 100644
--- a/chromium/third_party/blink/public/common/switches.h
+++ b/chromium/third_party/blink/public/common/switches.h
@@ -14,6 +14,31 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
+BLINK_COMMON_EXPORT extern const char kAllowPreCommitInput[];
+BLINK_COMMON_EXPORT extern const char kDefaultTileWidth[];
+BLINK_COMMON_EXPORT extern const char kDefaultTileHeight[];
+BLINK_COMMON_EXPORT extern const char kDisableImageAnimationResync[];
+BLINK_COMMON_EXPORT extern const char kDisableLowResTiling[];
+BLINK_COMMON_EXPORT extern const char kDisablePartialRaster[];
+BLINK_COMMON_EXPORT extern const char kDisableRGBA4444Textures[];
+BLINK_COMMON_EXPORT extern const char kDisableZeroCopy[];
+BLINK_COMMON_EXPORT extern const char
+ kEnableGpuMemoryBufferCompositorResources[];
+BLINK_COMMON_EXPORT extern const char kEnableLowResTiling[];
+BLINK_COMMON_EXPORT extern const char kEnableRGBA4444Textures[];
+BLINK_COMMON_EXPORT extern const char kEnableZeroCopy[];
+BLINK_COMMON_EXPORT extern const char kGpuRasterizationMSAASampleCount[];
+BLINK_COMMON_EXPORT extern const char kIntensiveWakeUpThrottlingPolicy[];
+BLINK_COMMON_EXPORT extern const char
+ kIntensiveWakeUpThrottlingPolicy_ForceDisable[];
+BLINK_COMMON_EXPORT extern const char
+ kIntensiveWakeUpThrottlingPolicy_ForceEnable[];
+BLINK_COMMON_EXPORT extern const char kMaxUntiledLayerHeight[];
+BLINK_COMMON_EXPORT extern const char kMaxUntiledLayerWidth[];
+BLINK_COMMON_EXPORT extern const char kMinHeightForGpuRasterTile[];
+BLINK_COMMON_EXPORT extern const char kShowLayoutShiftRegions[];
+BLINK_COMMON_EXPORT extern const char kShowPaintRects[];
+
BLINK_COMMON_EXPORT extern const char kUserAgentClientHintDisable[];
} // namespace switches
} // namespace blink