diff --git a/DEPS b/DEPS index ff38dd6..8bc98c2b 100644 --- a/DEPS +++ b/DEPS
@@ -299,7 +299,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'acf8224030a79d87470640caced05e2a4abae976', + 'v8_revision': 'b942470a8611ff0b26010b266ff6ce4ea9e19bb8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. @@ -311,7 +311,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': '76cec9aed8e2293f955f87b68bc7563bae5e6a8f', + 'pdfium_revision': '8e29731ccef4414cf5473d75d373699b8fc97b64', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -322,7 +322,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:10.20221127.3.1', + 'fuchsia_version': 'version:10.20221128.0.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -374,7 +374,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '96095db275e0ffc3595058a29760f1519d9f26bc', + 'devtools_frontend_revision': '1e884f69b3a175e2d76d223c74a0c4b42b09db85', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -414,7 +414,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'quiche_revision': 'a9c7837f7085662870031f8134f7464e56f1bb01', + 'quiche_revision': 'c5c29b5f77bf1927dab1a342d646dc33c876bf65', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ios_webkit # and whatever else without interference from each other. @@ -782,7 +782,7 @@ 'src/clank': { 'url': 'https://chrome-internal.googlesource.com/clank/internal/apps.git' + '@' + - '70c98f0a28f6f63ce53b802c47fff0b48fc2cf9c', + 'ab420e476148b08c0d8785eefacc960609a0357f', 'condition': 'checkout_android and checkout_src_internal', }, @@ -1220,7 +1220,7 @@ Var('chromium_git') + '/devtools/devtools-frontend' + '@' + Var('devtools_frontend_revision'), 'src/third_party/devtools-frontend-internal': { - 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '68d8fc24eb32a2e52733c7139695121ce96e5243', + 'url': 'https://chrome-internal.googlesource.com/devtools/devtools-internal.git' + '@' + '779f7e8556813ced07419897222e8a6c519b90a7', 'condition': 'checkout_src_internal', }, @@ -1435,7 +1435,7 @@ Var('chromium_git') + '/external/libaddressinput.git' + '@' + 'df35d6c42da4fa2759e4cfb592afe33817993b89', 'src/third_party/libaom/source/libaom': - Var('aomedia_git') + '/aom.git' + '@' + '407ee57e289d3ed907c57de16275c7615a93f9d9', + Var('aomedia_git') + '/aom.git' + '@' + 'd7fc49b8b6b5663ec93b6850839e3451e3dd0339', 'src/third_party/libavif/src': Var('chromium_git') + '/external/github.com/AOMediaCodec/libavif.git' + '@' + Var('libavif_revision'), @@ -1635,7 +1635,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '32e057826cb604da7f51f9f774e569f2b4884aa8', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '5f99acc936816759400c8ce5e4ee1cee2fc0633e', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1820,7 +1820,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '09447faf1a22821f35ca4a3fc9c06e3bf1125756', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '95b556f022f5de4aba2e7619844dffd7dab58adc', + Var('webrtc_git') + '/src.git' + '@' + '840ea0f703825e04b0d32c20affd5e42514abdc7', # Wuffs' canonical repository is at github.com/google/wuffs, but we use # Skia's mirror of Wuffs, the same as in upstream Skia's DEPS file. @@ -1890,7 +1890,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@1621e49dfecf6d655428ba429cb8947d909c43d1', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@7ae33fe12319497142dcc29439a657e5d997a865', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index bcd758354..0fe7557 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1191,6 +1191,8 @@ "system/camera/autozoom_toast_controller.h", "system/camera/autozoom_toast_view.cc", "system/camera/autozoom_toast_view.h", + "system/camera/camera_effects_controller.cc", + "system/camera/camera_effects_controller.h", "system/caps_lock_notification_controller.cc", "system/caps_lock_notification_controller.h", "system/cast/cast_feature_pod_controller.cc", @@ -2942,6 +2944,7 @@ "system/bluetooth/fake_bluetooth_device_list_controller.cc", "system/bluetooth/fake_bluetooth_device_list_controller.h", "system/camera/autozoom_toast_controller_unittest.cc", + "system/camera/camera_effects_controller_unittest.cc", "system/caps_lock_notification_controller_unittest.cc", "system/channel_indicator/channel_indicator_quick_settings_view_unittest.cc", "system/channel_indicator/channel_indicator_unittest.cc",
diff --git a/ash/ash_prefs.cc b/ash/ash_prefs.cc index 878f0e4..fe331cb 100644 --- a/ash/ash_prefs.cc +++ b/ash/ash_prefs.cc
@@ -32,6 +32,7 @@ #include "ash/style/dark_light_mode_controller_impl.h" #include "ash/system/camera/autozoom_controller_impl.h" #include "ash/system/camera/autozoom_nudge_controller.h" +#include "ash/system/camera/camera_effects_controller.h" #include "ash/system/caps_lock_notification_controller.h" #include "ash/system/gesture_education/gesture_education_notification_controller.h" #include "ash/system/human_presence/snooping_protection_controller.h" @@ -80,6 +81,7 @@ AutozoomNudgeController::RegisterProfilePrefs(registry); AmbientController::RegisterProfilePrefs(registry); CalendarController::RegisterProfilePrefs(registry); + CameraEffectsController::RegisterProfilePrefs(registry); CapsLockNotificationController::RegisterProfilePrefs(registry, for_test); CaptureModeController::RegisterProfilePrefs(registry); CellularSetupNotifier::RegisterProfilePrefs(registry);
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index e972d17..333b3f3 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -1375,6 +1375,11 @@ "MicMuteNotifications", base::FEATURE_ENABLED_BY_DEFAULT); +// Migrates rule-based input methods from Chromium into an internal codebase. +BASE_FEATURE(kMigrateRuleBasedInputMethods, + "MigrateRuleBasedInputMethods", + base::FEATURE_DISABLED_BY_DEFAULT); + // Disables the deprecated Messages cross-device integration, to be used // along side the flag preinstall-by-default (kMessagesPreinstall). BASE_FEATURE(kDisableMessagesCrossDeviceIntegration,
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 964f90d..76cdbc2 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -398,6 +398,8 @@ BASE_DECLARE_FEATURE(kEducationEnrollmentOobeFlow); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kMicMuteNotifications); COMPONENT_EXPORT(ASH_CONSTANTS) +BASE_DECLARE_FEATURE(kMigrateRuleBasedInputMethods); +COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kDisableMessagesCrossDeviceIntegration); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kMinimumChromeVersion); COMPONENT_EXPORT(ASH_CONSTANTS) BASE_DECLARE_FEATURE(kMojoDBusRelay);
diff --git a/ash/constants/ash_pref_names.cc b/ash/constants/ash_pref_names.cc index 3721276..68c3ab9 100644 --- a/ash/constants/ash_pref_names.cc +++ b/ash/constants/ash_pref_names.cc
@@ -1153,6 +1153,16 @@ // APN Revamp feature. const char kApnMigratedIccids[] = "ash.cellular.apn_migrated_iccids"; +// An integer pref that indicates the background blur level that is applied. +// -1 means disabled. +const char kBackgroundBlur[] = "ash.camera.background_blur"; + +// An boolean pref that indicates whether background replacement is applied. +const char kBackgroundReplace[] = "ash.camera.background_replace"; + +// An boolean pref that indicates whether portrait relighting is applied. +const char kPortraitRelighting[] = "ash.camera.portrait_relighting"; + // NOTE: New prefs should start with the "ash." prefix. Existing prefs moved // into this file should not be renamed, since they may be synced.
diff --git a/ash/constants/ash_pref_names.h b/ash/constants/ash_pref_names.h index 4fcb7e3..c4199220 100644 --- a/ash/constants/ash_pref_names.h +++ b/ash/constants/ash_pref_names.h
@@ -527,6 +527,12 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kApnMigratedIccids[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kBackgroundBlur[]; + +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kBackgroundReplace[]; + +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kPortraitRelighting[]; + } // namespace prefs } // namespace ash
diff --git a/ash/shell.cc b/ash/shell.cc index 8a786474..819b896 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -122,6 +122,7 @@ #include "ash/system/brightness/brightness_controller_chromeos.h" #include "ash/system/brightness_control_delegate.h" #include "ash/system/camera/autozoom_controller_impl.h" +#include "ash/system/camera/camera_effects_controller.h" #include "ash/system/caps_lock_notification_controller.h" #include "ash/system/diagnostics/diagnostics_log_controller.h" #include "ash/system/federated/federated_service_controller.h" @@ -992,6 +993,8 @@ // before it. calendar_controller_.reset(); + camera_effects_controller_.reset(); + shell_delegate_.reset(); multi_capture_service_client_.reset(); @@ -1237,6 +1240,10 @@ calendar_controller_ = std::make_unique<CalendarController>(); + if (CameraEffectsController::IsCameraEffectsSupported()) { + camera_effects_controller_ = std::make_unique<CameraEffectsController>(); + } + shelf_config_ = std::make_unique<ShelfConfig>(); shelf_controller_ = std::make_unique<ShelfController>();
diff --git a/ash/shell.h b/ash/shell.h index 13aaada..fc347b726 100644 --- a/ash/shell.h +++ b/ash/shell.h
@@ -107,6 +107,7 @@ class BluetoothNotificationController; class BrightnessControlDelegate; class CalendarController; +class CameraEffectsController; class CaptureModeController; class ControlVHistogramRecorder; class CrosDisplayConfig; @@ -398,6 +399,9 @@ CalendarController* calendar_controller() { return calendar_controller_.get(); } + CameraEffectsController* camera_effects_controller() { + return camera_effects_controller_.get(); + } CrosDisplayConfig* cros_display_config() { return cros_display_config_.get(); } @@ -847,6 +851,7 @@ std::unique_ptr<BacklightsForcedOffSetter> backlights_forced_off_setter_; std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; std::unique_ptr<CalendarController> calendar_controller_; + std::unique_ptr<CameraEffectsController> camera_effects_controller_; std::unique_ptr<CrosDisplayConfig> cros_display_config_; std::unique_ptr<curtain::SecurityCurtainController> security_curtain_controller_;
diff --git a/ash/system/camera/camera_effects_controller.cc b/ash/system/camera/camera_effects_controller.cc new file mode 100644 index 0000000..339739d2 --- /dev/null +++ b/ash/system/camera/camera_effects_controller.cc
@@ -0,0 +1,298 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/camera/camera_effects_controller.h" + +#include "ash/constants/ash_pref_names.h" +#include "ash/session/session_controller_impl.h" +#include "ash/shell.h" +#include "base/check_is_test.h" +#include "base/task/bind_post_task.h" +#include "base/task/single_thread_task_runner.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" +#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace ash { + +namespace { + +// The value stored in pref to indicate that background blur is disabled. +constexpr int kBackgroundBlurLevelForDisabling = -1; + +// Gets blur level from chrome flag. +cros::mojom::BlurLevel GetBlurLevelFromFlag() { + std::string blur_level = GetFieldTrialParamValueByFeature( + ash::features::kVCBackgroundBlur, "blur_level"); + if (blur_level == "lowest") { + return cros::mojom::BlurLevel::kLowest; + } else if (blur_level == "light") { + return cros::mojom::BlurLevel::kLight; + } else if (blur_level == "medium") { + return cros::mojom::BlurLevel::kMedium; + } else if (blur_level == "heavy") { + return cros::mojom::BlurLevel::kHeavy; + } else if (blur_level == "maximum") { + return cros::mojom::BlurLevel::kMaximum; + } + return cros::mojom::BlurLevel::kLowest; +} + +// The default enable state for all camera effects should be false; but here we +// use the IsCameraEffectsSupported instead until we are able to enable these +// prefs from the ui. +cros::mojom::EffectsConfigPtr GetInitialCameraEffects() { + cros::mojom::EffectsConfigPtr config = cros::mojom::EffectsConfig::New(); + config->blur_enabled = CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur); + config->blur_level = GetBlurLevelFromFlag(); + // We don't want enable a conflict config, so kBackgroundReplace is set to + // enabled only if kBackgroundBlur is not. + config->replace_enabled = + CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace) && + !CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur); + config->relight_enabled = CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight); + + return config; +} + +} // namespace + +CameraEffectsController::CameraEffectsController() { + auto* session_controller = Shell::Get()->session_controller(); + DCHECK(session_controller); + session_observation_.Observe(session_controller); + + current_effects_ = GetInitialCameraEffects(); + + media::CameraHalDispatcherImpl::GetInstance() + ->SetCameraEffectsControllerCallback( + // The callback passed to CameraHalDispatcherImpl will be called on a + // different thread inside CameraHalDispatcherImpl, so we need always + // post the callback onto current task runner. + base::BindPostTask( + base::SequencedTaskRunner::GetCurrentDefault(), + base::BindRepeating( + &CameraEffectsController::OnNewCameraEffectsSet, + weak_factory_.GetWeakPtr()))); +} + +CameraEffectsController::~CameraEffectsController() = default; + +bool CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect effect) { + switch (effect) { + case cros::mojom::CameraEffect::kBackgroundBlur: + return features::IsVCBackgroundBlurEnabled(); + case cros::mojom::CameraEffect::kBackgroundReplace: + return features::IsVCBackgroundReplaceEnabled(); + case cros::mojom::CameraEffect::kPortraitRelight: + return features::IsVCPortraitRelightingEnabled(); + + // returns if any effects is supported for kNone. + case cros::mojom::CameraEffect::kNone: + return features::IsVCBackgroundBlurEnabled() || + features::IsVCBackgroundReplaceEnabled() || + features::IsVCPortraitRelightingEnabled(); + } +} + +cros::mojom::EffectsConfigPtr CameraEffectsController::GetCameraEffects() { + DCHECK(pref_change_registrar_->prefs()); + return GetEffectsConfigFromPref(); +} + +void CameraEffectsController::AddObserver(Observer* observer) { + observers_.AddObserver(observer); +} +void CameraEffectsController::RemoveObserver(Observer* observer) { + observers_.RemoveObserver(observer); +} + +// static +void CameraEffectsController::RegisterProfilePrefs( + PrefRegistrySimple* registry) { + if (!IsCameraEffectsSupported()) + return; + + // We have to register all camera effects prefs; because we need use them to + // construct the cros::mojom::EffectsConfigPtr. + registry->RegisterIntegerPref(prefs::kBackgroundBlur, + GetInitialCameraEffects()->blur_enabled + ? static_cast<int>(GetBlurLevelFromFlag()) + : kBackgroundBlurLevelForDisabling); + + registry->RegisterBooleanPref(prefs::kBackgroundReplace, + GetInitialCameraEffects()->replace_enabled); + + registry->RegisterBooleanPref(prefs::kPortraitRelighting, + GetInitialCameraEffects()->relight_enabled); +} + +void CameraEffectsController::OnActiveUserPrefServiceChanged( + PrefService* pref_service) { + if (pref_change_registrar_ && pref_service == pref_change_registrar_->prefs()) + return; + + // Initial login and user switching in multi profiles. + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); + pref_change_registrar_->Init(pref_service); + + auto callback = + effect_result_for_testing_.has_value() + ? base::BindRepeating( + &CameraEffectsController::OnCameraEffectsPrefChanged, + weak_factory_.GetWeakPtr()) + : base::BindPostTask( + base::SequencedTaskRunner::GetCurrentDefault(), + base::BindRepeating( + &CameraEffectsController::OnCameraEffectsPrefChanged, + weak_factory_.GetWeakPtr())); + + pref_change_registrar_->Add(prefs::kBackgroundBlur, callback); + + pref_change_registrar_->Add(prefs::kBackgroundReplace, callback); + + pref_change_registrar_->Add(prefs::kPortraitRelighting, callback); + + // Initialize camera effects for the first time. + SetCameraEffects(GetEffectsConfigFromPref()); +} + +void CameraEffectsController::OnCameraEffectsPrefChanged( + const std::string& pref_name) { + cros::mojom::EffectsConfigPtr new_effects = GetEffectsConfigFromPref(); + + if (pref_name == prefs::kBackgroundBlur) { + // Skip if current applied effect is already the same as new value.Supported + if (current_effects_->blur_enabled == new_effects->blur_enabled && + current_effects_->blur_level == new_effects->blur_level) { + return; + } + + if (new_effects->blur_enabled) { + // background replace should be disabled since background blur is enabled. + new_effects->replace_enabled = false; + } + + } else if (pref_name == prefs::kBackgroundReplace) { + // Skip if current applied effect is already the same as new value. + if (current_effects_->replace_enabled == new_effects->replace_enabled) { + return; + } + + if (new_effects->replace_enabled) { + // background blur should be disabled since background replace is enabled. + new_effects->blur_enabled = false; + } + } else if (pref_name == prefs::kPortraitRelighting) { + // Skip if current applied effect is already the same as new value. + if (current_effects_->relight_enabled == new_effects->relight_enabled) { + return; + } + } + + SetCameraEffects(std::move(new_effects)); +} + +void CameraEffectsController::SetCameraEffects( + cros::mojom::EffectsConfigPtr config) { + // For backwards compatibility, will be removed after mojom is updated. + if (config->blur_enabled) { + config->effect = cros::mojom::CameraEffect::kBackgroundBlur; + } + if (config->replace_enabled) { + config->effect = cros::mojom::CameraEffect::kBackgroundReplace; + } + if (config->relight_enabled) { + config->effect = cros::mojom::CameraEffect::kPortraitRelight; + } + + // Directly calls the callback for testing case. + if (effect_result_for_testing_.has_value()) { + CHECK_IS_TEST(); + OnNewCameraEffectsSet(std::move(config), + effect_result_for_testing_.value()); + } else { + media::CameraHalDispatcherImpl::GetInstance()->SetCameraEffects( + std::move(config)); + } +} + +void CameraEffectsController::OnNewCameraEffectsSet( + cros::mojom::EffectsConfigPtr new_config, + cros::mojom::SetEffectResult result) { + // If SetCamerEffects succeeded, update `current_effects_` and notify all + // observers. + // This callback with null EffectsConfigPtr indicates that + // (1) The last SetCamerEffect failed. + // (2) It was the first SetCamerEffect call after the camera stack + // initialized; so no camera effects were applied before that. Assuming this + // does not happen very often, the only way to keep the pref to be consisitent + // with the prefs is to reset everything. + if (result == cros::mojom::SetEffectResult::kOk || new_config.is_null()) { + current_effects_ = new_config.is_null() ? GetInitialCameraEffects() + : std::move(new_config); + + for (auto& ob : observers_) { + ob.OnCameraEffectsChanged(current_effects_.Clone()); + } + } + + // Always update prefs with `current_effects_`. + // (1) For "result == kOk", the prefs are updated with the new effects. + // (2) Otherwise, the prefs changes are effectively reverted. + SetEffectsConfigToPref(current_effects_.Clone()); +} + +cros::mojom::EffectsConfigPtr +CameraEffectsController::GetEffectsConfigFromPref() { + cros::mojom::EffectsConfigPtr effects = cros::mojom::EffectsConfig::New(); + const int background_level_in_pref = + pref_change_registrar_->prefs()->GetInteger(prefs::kBackgroundBlur); + + effects->blur_enabled = + background_level_in_pref != kBackgroundBlurLevelForDisabling; + + effects->blur_level = + effects->blur_enabled + ? static_cast<cros::mojom::BlurLevel>(background_level_in_pref) + : GetBlurLevelFromFlag(); + + effects->replace_enabled = + pref_change_registrar_->prefs()->GetBoolean(prefs::kBackgroundReplace); + effects->relight_enabled = + pref_change_registrar_->prefs()->GetBoolean(prefs::kPortraitRelighting); + return effects; +} + +void CameraEffectsController::SetEffectsConfigToPref( + cros::mojom::EffectsConfigPtr new_config) { + cros::mojom::EffectsConfigPtr old_effects = GetEffectsConfigFromPref(); + + if (new_config->blur_enabled != old_effects->blur_enabled || + new_config->blur_level != old_effects->blur_level) { + pref_change_registrar_->prefs()->SetInteger( + prefs::kBackgroundBlur, new_config->blur_enabled + ? static_cast<int>(new_config->blur_level) + : kBackgroundBlurLevelForDisabling); + } + + if (new_config->replace_enabled != old_effects->replace_enabled) { + pref_change_registrar_->prefs()->SetBoolean(prefs::kBackgroundReplace, + new_config->replace_enabled); + } + + if (new_config->relight_enabled != old_effects->relight_enabled) { + pref_change_registrar_->prefs()->SetBoolean(prefs::kPortraitRelighting, + new_config->relight_enabled); + } +} + +} // namespace ash
diff --git a/ash/system/camera/camera_effects_controller.h b/ash/system/camera/camera_effects_controller.h new file mode 100644 index 0000000..0963e30c --- /dev/null +++ b/ash/system/camera/camera_effects_controller.h
@@ -0,0 +1,109 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SYSTEM_CAMERA_CAMERA_EFFECTS_CONTROLLER_H_ +#define ASH_SYSTEM_CAMERA_CAMERA_EFFECTS_CONTROLLER_H_ + +#include <utility> + +#include "ash/ash_export.h" +#include "ash/public/cpp/session/session_controller.h" +#include "ash/public/cpp/session/session_observer.h" +#include "base/memory/weak_ptr.h" +#include "base/observer_list.h" +#include "base/observer_list_types.h" +#include "base/scoped_observation.h" +#include "media/capture/video/chromeos/mojom/effects_pipeline.mojom.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +class PrefRegistrySimple; +class PrefService; +class PrefChangeRegistrar; + +namespace ash { + +// CameraEffectsController is the interface for any object in ash to +// enable/change camera effects. +class ASH_EXPORT CameraEffectsController : public SessionObserver { + public: + // Observer that will be notified on camera effects change. + class Observer : public base::CheckedObserver { + public: + virtual void OnCameraEffectsChanged( + cros::mojom::EffectsConfigPtr new_effects) = 0; + }; + + CameraEffectsController(); + + CameraEffectsController(const CameraEffectsController&) = delete; + CameraEffectsController& operator=(const CameraEffectsController&) = delete; + + ~CameraEffectsController() override; + + // Returns whether a certain / any camera effects is supported. + // IsCameraEffectsSupported(cros::mojom::CameraEffect::kBackgroundBlur) + // returns whether background blur is supported. IsCameraEffectsSupported() + // returns if any camera effects is supported. + static bool IsCameraEffectsSupported( + cros::mojom::CameraEffect effect = cros::mojom::CameraEffect::kNone); + + // Returns currently applied camera effects. + // Should only be called after user logs in. + cros::mojom::EffectsConfigPtr GetCameraEffects(); + + // Adds/Removes an observer. + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); + + // Called inside ash/ash_prefs.cc to register related prefs. + static void RegisterProfilePrefs(PrefRegistrySimple* registry); + + // SessionObserver: + void OnActiveUserPrefServiceChanged(PrefService* pref_service) override; + + void set_effect_result_for_testing( + cros::mojom::SetEffectResult effect_result_for_testing) { + effect_result_for_testing_ = effect_result_for_testing; + } + + private: + // This will be automatically called when any pref changes its value. + void OnCameraEffectsPrefChanged(const std::string& pref_name); + + // SetCameraEffects camera effects with `config`. + void SetCameraEffects(cros::mojom::EffectsConfigPtr config); + + // Callback after SetCameraEffects. Based on the `result`, this function will + // update/revert prefs. + void OnNewCameraEffectsSet(cros::mojom::EffectsConfigPtr new_config, + cros::mojom::SetEffectResult result); + + // Constructs EffectsConfigPtr from prefs. + cros::mojom::EffectsConfigPtr GetEffectsConfigFromPref(); + + // Update prefs with the value in `config`. + void SetEffectsConfigToPref(cros::mojom::EffectsConfigPtr config); + + // Used to bypass the CameraHalDispatcherImpl::SetCameraEffects for testing + // purpose. The value will be null for non-testing cases; and not null in + // testing cases. + absl::optional<cros::mojom::SetEffectResult> effect_result_for_testing_; + + // Used for pref registration. + std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; + + // Records current effects that is applied to camera hal server. + cros::mojom::EffectsConfigPtr current_effects_; + + base::ObserverList<Observer> observers_; + + base::ScopedObservation<SessionController, SessionObserver> + session_observation_{this}; + + base::WeakPtrFactory<CameraEffectsController> weak_factory_{this}; +}; + +} // namespace ash + +#endif // ASH_SYSTEM_CAMERA_CAMERA_EFFECTS_CONTROLLER_H_
diff --git a/ash/system/camera/camera_effects_controller_unittest.cc b/ash/system/camera/camera_effects_controller_unittest.cc new file mode 100644 index 0000000..1723f119 --- /dev/null +++ b/ash/system/camera/camera_effects_controller_unittest.cc
@@ -0,0 +1,449 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/camera/camera_effects_controller.h" + +#include "ash/constants/ash_features.h" +#include "ash/constants/ash_pref_names.h" +#include "ash/session/session_controller_impl.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "base/test/scoped_feature_list.h" + +namespace ash { +namespace { + +// Fake CameraEffectsController Observer to record notifications. +class FakeCameraEffectsControllerObserver + : public CameraEffectsController::Observer { + public: + void OnCameraEffectsChanged( + cros::mojom::EffectsConfigPtr new_effects) override { + last_effects_ = std::move(new_effects); + num_of_calls_ += 1; + } + + int num_of_calls() { return num_of_calls_; } + cros::mojom::EffectsConfigPtr last_effects() { return last_effects_.Clone(); } + + private: + int num_of_calls_ = 0; + cros::mojom::EffectsConfigPtr last_effects_; +}; + +class CameraEffectsControllerTest : public NoSessionAshTestBase { + public: + // NoSessionAshTestBase: + void SetUp() override { + scoped_feature_list_.InitWithFeatures( + {features::kVCBackgroundBlur}, + {features::kVCBackgroundReplace, features::kVCPortraitRelighting}); + + AshTestBase::SetUp(); + + camera_effects_controller_ = Shell::Get()->camera_effects_controller(); + + // Mock the SetCameraEffects calls. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + } + + // Enables/Disables pref values. + void SetEnabledPref(const std::string& perf_name, bool enabled) { + Shell::Get()->session_controller()->GetActivePrefService()->SetBoolean( + perf_name, enabled); + } + + // Updates prefs::kBackgroundBlur pref values. + void SetBackgroundBlurPref(int level) { + Shell::Get()->session_controller()->GetActivePrefService()->SetInteger( + prefs::kBackgroundBlur, level); + } + + protected: + CameraEffectsController* camera_effects_controller_ = nullptr; + base::test::ScopedFeatureList scoped_feature_list_; +}; + +TEST_F(CameraEffectsControllerTest, + IsCameraEffectsSupportedShouldBeConsistentWithFlags) { + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {}, {features::kVCBackgroundBlur, features::kVCBackgroundReplace, + features::kVCPortraitRelighting}); + + // No CameraEffects is supported if all flags are disabled. + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported()); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight)); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundBlur}, + {features::kVCBackgroundReplace, features::kVCPortraitRelighting}); + + // BackgroundBlur should be supported. + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported()); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight)); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundReplace}, + {features::kVCBackgroundBlur, features::kVCPortraitRelighting}); + + // BackgroundReplace should be supported. + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported()); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur)); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight)); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCPortraitRelighting}, + {features::kVCBackgroundBlur, features::kVCBackgroundReplace}); + + // PortraitRelight should be supported. + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported()); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur)); + EXPECT_FALSE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace)); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight)); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundBlur, features::kVCBackgroundReplace, + features::kVCPortraitRelighting}, + {}); + + // All camera effects should be supported. + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported()); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundBlur)); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kBackgroundReplace)); + EXPECT_TRUE(CameraEffectsController::IsCameraEffectsSupported( + cros::mojom::CameraEffect::kPortraitRelight)); + } +} + +TEST_F(CameraEffectsControllerTest, + DefaultCameraEffectsShouldBeConsistentWithFlags) { + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundBlur}, + {features::kVCBackgroundReplace, features::kVCPortraitRelighting}); + + SimulateUserLogin("testuser1@gmail.com"); + + // BackgroundBlur should be enabled. + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundReplace}, + {features::kVCBackgroundBlur, features::kVCPortraitRelighting}); + + SimulateUserLogin("testuser2@gmail.com"); + + // BackgroundReplace should be enabled. + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_TRUE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCPortraitRelighting}, + {features::kVCBackgroundBlur, features::kVCBackgroundReplace}); + + SimulateUserLogin("testuser3@gmail.com"); + + // PortraintRelighting should be enabled. + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_TRUE(camera_effects->relight_enabled); + } + + { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundBlur, features::kVCBackgroundReplace, + features::kVCPortraitRelighting}, + {}); + + SimulateUserLogin("testuser4@gmail.com"); + + // BackgroundReplace should be not enabled when all flags are enabled. + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_TRUE(camera_effects->relight_enabled); + } +} + +TEST_F(CameraEffectsControllerTest, EnableBackgroundBlurTest) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitWithFeatures( + {features::kVCBackgroundReplace}, + {features::kVCBackgroundBlur, features::kVCPortraitRelighting}); + + SimulateUserLogin("testuser@gmail.com"); + + // Check default pref values. + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_TRUE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // Set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetBackgroundBlurPref(1); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_TRUE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // Set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetBackgroundBlurPref(1); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetBackgroundBlurPref(-1); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetBackgroundBlurPref(-1); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); +} + +TEST_F(CameraEffectsControllerTest, EnableBackgroundReplaceTest) { + SimulateUserLogin("testuser@gmail.com"); + + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetEnabledPref(prefs::kBackgroundReplace, true); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetEnabledPref(prefs::kBackgroundReplace, true); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_TRUE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetEnabledPref(prefs::kBackgroundReplace, false); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_TRUE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetEnabledPref(prefs::kBackgroundReplace, false); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_FALSE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); +} + +TEST_F(CameraEffectsControllerTest, EnablePortraitRelightingTest) { + SimulateUserLogin("testuser@gmail.com"); + + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetEnabledPref(prefs::kPortraitRelighting, true); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetEnabledPref(prefs::kPortraitRelighting, true); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_TRUE(camera_effects->relight_enabled); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetEnabledPref(prefs::kPortraitRelighting, false); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_TRUE(camera_effects->relight_enabled); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetEnabledPref(prefs::kPortraitRelighting, false); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_FALSE(camera_effects->replace_enabled); + EXPECT_FALSE(camera_effects->relight_enabled); +} + +TEST_F(CameraEffectsControllerTest, BlurLevelChangeTest) { + SimulateUserLogin("testuser@gmail.com"); + + cros::mojom::EffectsConfigPtr camera_effects = + camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_EQ(camera_effects->blur_level, cros::mojom::BlurLevel::kLowest); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetBackgroundBlurPref(static_cast<int>(cros::mojom::BlurLevel::kMaximum)); + + // Pref values should be reverted. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_EQ(camera_effects->blur_level, cros::mojom::BlurLevel::kLowest); + + // set camera effect success should modify the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetBackgroundBlurPref(static_cast<int>(cros::mojom::BlurLevel::kMaximum)); + + // Pref values should be updated. + camera_effects = camera_effects_controller_->GetCameraEffects(); + EXPECT_TRUE(camera_effects->blur_enabled); + EXPECT_EQ(camera_effects->blur_level, cros::mojom::BlurLevel::kMaximum); +} + +TEST_F(CameraEffectsControllerTest, NotifyObserverTest) { + SimulateUserLogin("testuser@gmail.com"); + + FakeCameraEffectsControllerObserver observer; + camera_effects_controller_->AddObserver(&observer); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kError); + SetBackgroundBlurPref(static_cast<int>(cros::mojom::BlurLevel::kMaximum)); + + // Observers should not be notified if the SetCameraEffects fails. + EXPECT_EQ(observer.num_of_calls(), 0); + + // set camera effect error should revert the perf. + camera_effects_controller_->set_effect_result_for_testing( + cros::mojom::SetEffectResult::kOk); + SetBackgroundBlurPref(static_cast<int>(cros::mojom::BlurLevel::kMaximum)); + + // Observers should be notified if the SetCameraEffects succeeds. + EXPECT_EQ(observer.num_of_calls(), 1); + + // Observers should be notified with the new EffectsConfigPtr. + cros::mojom::EffectsConfigPtr notifyed_effects = observer.last_effects(); + EXPECT_TRUE(notifyed_effects->blur_enabled); + EXPECT_EQ(notifyed_effects->blur_level, cros::mojom::BlurLevel::kMaximum); + + camera_effects_controller_->RemoveObserver(&observer); +} + +} // namespace +} // namespace ash
diff --git a/ash/system/holding_space/holding_space_item_views_section_unittest.cc b/ash/system/holding_space/holding_space_item_views_section_unittest.cc index b966b60..1c15f14 100644 --- a/ash/system/holding_space/holding_space_item_views_section_unittest.cc +++ b/ash/system/holding_space/holding_space_item_views_section_unittest.cc
@@ -146,7 +146,7 @@ // Verifies that partially initialized items will not show until they are fully // initialized. // https://crbug.com/1392609. -#if defined(ADDRESS_SANITIZER) +#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) #define MAYBE_PartiallyInitializedItemsDontShow \ DISABLED_PartiallyInitializedItemsDontShow #else
diff --git a/ash/system/unified/date_tray.cc b/ash/system/unified/date_tray.cc index 820ac29..400209ec 100644 --- a/ash/system/unified/date_tray.cc +++ b/ash/system/unified/date_tray.cc
@@ -28,6 +28,9 @@ time_view_(tray_container()->AddChildView( std::make_unique<TimeTrayItemView>(shelf, TimeView::Type::kDate))), unified_system_tray_(tray) { + SetPressedCallback( + base::BindRepeating(&DateTray::OnButtonPressed, base::Unretained(this))); + tray_container()->SetMargin( /*main_axis_margin=*/kUnifiedTrayContentPadding - ShelfConfig::Get()->status_area_hit_region_padding(), @@ -37,22 +40,6 @@ DateTray::~DateTray() = default; -bool DateTray::PerformAction(const ui::Event& event) { - // Lets the `unified_system_tray_` decide whether to show the bubble or not, - // since it's the owner of the bubble view. - if (is_active()) { - unified_system_tray_->CloseBubble(); - } else { - // Need to set the date tray as active before notifying the system tray of - // an action because we need the system tray to know that the date tray is - // already active when it is creating the `UnifiedSystemTrayBubble`. - SetIsActive(true); - unified_system_tray_->OnDateTrayActionPerformed(event); - } - - return true; -} - std::u16string DateTray::GetAccessibleNameForBubble() { if (unified_system_tray_->IsBubbleShown()) return unified_system_tray_->GetAccessibleNameForQuickSettingsBubble(); @@ -91,6 +78,21 @@ SetIsActive(false); } +void DateTray::OnButtonPressed(const ui::Event& event) { + // Lets the `unified_system_tray_` decide whether to show the bubble or not, + // since it's the owner of the bubble view. + if (is_active()) { + unified_system_tray_->CloseBubble(); + return; + } + + // Need to set the date tray as active before notifying the system tray of + // an action because we need the system tray to know that the date tray is + // already active when it is creating the `UnifiedSystemTrayBubble`. + SetIsActive(true); + unified_system_tray_->OnDateTrayActionPerformed(event); +} + BEGIN_METADATA(DateTray, ActionableView) END_METADATA
diff --git a/ash/system/unified/date_tray.h b/ash/system/unified/date_tray.h index b462b16..fd342ec 100644 --- a/ash/system/unified/date_tray.h +++ b/ash/system/unified/date_tray.h
@@ -6,19 +6,26 @@ #define ASH_SYSTEM_UNIFIED_DATE_TRAY_H_ #include <memory> +#include <string> #include "ash/ash_export.h" #include "ash/system/tray/tray_background_view.h" #include "ash/system/unified/unified_system_tray.h" #include "ui/base/metadata/metadata_header_macros.h" +namespace ui { +class Event; +} // namespace ui + namespace ash { +class Shelf; class TimeTrayItemView; +class TrayBubbleView; -// This date tray is next to the `UnifidedSystemTray`. Activating this tray -// results in the CalendarView showing in the UnifiedSystemTray's bubble. This -// tray doesn't not have its own bubble. +// This date tray is next to the `UnifiedSystemTray`. Activating this tray +// results in the `CalendarView` showing in the `UnifiedSystemTray`'s bubble. +// This tray doesn't have its own bubble. class ASH_EXPORT DateTray : public TrayBackgroundView, public UnifiedSystemTray::Observer { public: @@ -30,7 +37,6 @@ ~DateTray() override; // TrayBackgroundView: - bool PerformAction(const ui::Event& event) override; std::u16string GetAccessibleNameForBubble() override; std::u16string GetAccessibleNameForTray() override; void HandleLocaleChange() override; @@ -44,10 +50,13 @@ void OnOpeningCalendarView() override; void OnLeavingCalendarView() override; + // Callback called when this tray is pressed. + void OnButtonPressed(const ui::Event& event); + private: friend class DateTrayTest; - // Owned. + // Owned by the views hierarchy. TimeTrayItemView* time_view_ = nullptr; // Owned by `StatusAreaWidget`.
diff --git a/ash/system/unified/date_tray_unittest.cc b/ash/system/unified/date_tray_unittest.cc index 5cc7980..71be16f 100644 --- a/ash/system/unified/date_tray_unittest.cc +++ b/ash/system/unified/date_tray_unittest.cc
@@ -12,7 +12,6 @@ #include "ash/system/unified/unified_system_tray_bubble.h" #include "ash/test/ash_test_base.h" #include "base/test/metrics/histogram_tester.h" -#include "base/test/scoped_feature_list.h" #include "base/time/time.h" #include "base/time/time_override.h" #include "ui/events/keycodes/keyboard_codes_posix.h" @@ -27,9 +26,6 @@ ~DateTrayTest() override = default; void SetUp() override { - // Enable calendar view feature. - scoped_feature_list_.InitWithFeatures({ash::features::kCalendarView}, {}); - // Set time override. base::subtle::ScopedTimeClockOverrides time_override( []() { @@ -69,8 +65,8 @@ } private: - base::test::ScopedFeatureList scoped_feature_list_; std::unique_ptr<views::Widget> widget_; + // Owned by `widget_`. DateTray* date_tray_ = nullptr; };
diff --git a/ash/webui/common/resources/office_fallback/office_fallback_dialog.ts b/ash/webui/common/resources/office_fallback/office_fallback_dialog.ts index ab40117..3dbc70d 100644 --- a/ash/webui/common/resources/office_fallback/office_fallback_dialog.ts +++ b/ash/webui/common/resources/office_fallback/office_fallback_dialog.ts
@@ -17,6 +17,7 @@ DRIVE_UNAVAILABLE = 1, ONEDRIVE_UNAVAILABLE = 2, ERROR_OPENING_WEB = 3, + INVALID_GOOGLE_DOCS_URL = 4, } /** @@ -72,6 +73,8 @@ return FallbackReason.ONEDRIVE_UNAVAILABLE; case 'Error opening web': return FallbackReason.ERROR_OPENING_WEB; + case 'Invalid Google Docs URL': + return FallbackReason.INVALID_GOOGLE_DOCS_URL; } console.error('No matching FallbackReason for given string'); return; @@ -147,6 +150,11 @@ `The application ${this.taskTitle} requires OneDrive \ to be available.`; break; + case FallbackReason.INVALID_GOOGLE_DOCS_URL: + titleElement.innerText = `Can't open the URL for ${fileNamesDisplayed}`; + reasonMessageElement.innerText = `The application ${ + this.taskTitle} requires a valid ${this.taskTitle} URL.`; + break; } return template; }
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn index 651a2ea..46ba13e4 100644 --- a/base/allocator/BUILD.gn +++ b/base/allocator/BUILD.gn
@@ -15,7 +15,6 @@ "PartitionAlloc-Everywhere requires the allocator shim") flags = [ - "USE_PARTITION_ALLOC=$use_partition_alloc", "USE_ALLOCATOR_SHIM=$use_allocator_shim", "USE_PARTITION_ALLOC_AS_MALLOC=$use_partition_alloc_as_malloc",
diff --git a/base/allocator/dispatcher/dispatcher.cc b/base/allocator/dispatcher/dispatcher.cc index 8191402..8c5b7e7d 100644 --- a/base/allocator/dispatcher/dispatcher.cc +++ b/base/allocator/dispatcher/dispatcher.cc
@@ -8,6 +8,7 @@ #include "base/allocator/dispatcher/internal/dispatch_data.h" #include "base/allocator/dispatcher/reentry_guard.h" #include "base/allocator/partition_allocator/partition_alloc.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/allocator/partition_allocator/shim/allocator_shim.h" #include "base/check.h" #include "base/dcheck_is_on.h"
diff --git a/base/allocator/dispatcher/dispatcher_unittest.cc b/base/allocator/dispatcher/dispatcher_unittest.cc index 61ce8bd6..cf2735e 100644 --- a/base/allocator/dispatcher/dispatcher_unittest.cc +++ b/base/allocator/dispatcher/dispatcher_unittest.cc
@@ -9,6 +9,7 @@ #include "base/allocator/dispatcher/dispatcher.h" #include "base/allocator/dispatcher/testing/dispatcher_test.h" #include "base/allocator/dispatcher/testing/tools.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "build/build_config.h" #if BUILDFLAG(USE_PARTITION_ALLOC)
diff --git a/base/allocator/dispatcher/internal/dispatch_data.cc b/base/allocator/dispatcher/internal/dispatch_data.cc index 147af6438..2b6b7f5 100644 --- a/base/allocator/dispatcher/internal/dispatch_data.cc +++ b/base/allocator/dispatcher/internal/dispatch_data.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/allocator/dispatcher/internal/dispatch_data.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" namespace base::allocator::dispatcher::internal {
diff --git a/base/allocator/dispatcher/internal/dispatch_data.h b/base/allocator/dispatcher/internal/dispatch_data.h index 5b6959b..62f73dd 100644 --- a/base/allocator/dispatcher/internal/dispatch_data.h +++ b/base/allocator/dispatcher/internal/dispatch_data.h
@@ -6,6 +6,7 @@ #define BASE_ALLOCATOR_DISPATCHER_INTERNAL_DISPATCH_DATA_H_ #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/base_export.h" #include "build/build_config.h"
diff --git a/base/allocator/dispatcher/internal/dispatcher_internal.h b/base/allocator/dispatcher/internal/dispatcher_internal.h index da32380ac..2868b6f33 100644 --- a/base/allocator/dispatcher/internal/dispatcher_internal.h +++ b/base/allocator/dispatcher/internal/dispatcher_internal.h
@@ -11,6 +11,7 @@ #include "base/allocator/dispatcher/internal/tools.h" #include "base/allocator/dispatcher/reentry_guard.h" #include "base/allocator/dispatcher/subsystem.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/compiler_specific.h" #include "build/build_config.h"
diff --git a/base/allocator/dispatcher/internal/dispatcher_internal_unittest.cc b/base/allocator/dispatcher/internal/dispatcher_internal_unittest.cc index 06f46c88..4119b22b 100644 --- a/base/allocator/dispatcher/internal/dispatcher_internal_unittest.cc +++ b/base/allocator/dispatcher/internal/dispatcher_internal_unittest.cc
@@ -3,9 +3,11 @@ // found in the LICENSE file. #include "base/allocator/dispatcher/internal/dispatcher_internal.h" +#include "base/allocator/buildflags.h" #include "base/allocator/dispatcher/testing/dispatcher_test.h" #include "base/allocator/dispatcher/testing/observer_mock.h" #include "base/allocator/dispatcher/testing/tools.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/dcheck_is_on.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/base/allocator/partition_allocator/BUILD.gn b/base/allocator/partition_allocator/BUILD.gn index 290ed1a..9a41878 100644 --- a/base/allocator/partition_allocator/BUILD.gn +++ b/base/allocator/partition_allocator/BUILD.gn
@@ -406,6 +406,7 @@ # defines and partition alloc includes the header file. For chrome, # gen/base/allocator/buildflags.h defines and chrome includes. flags = [ + "USE_PARTITION_ALLOC=$use_partition_alloc", "ENABLE_PARTITION_ALLOC_AS_MALLOC_SUPPORT=$use_partition_alloc_as_malloc", "ENABLE_BACKUP_REF_PTR_SUPPORT=$_enable_backup_ref_ptr_support",
diff --git a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc index e13fe60..0dcc19c 100644 --- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc
@@ -9,6 +9,7 @@ #include "base/allocator/buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_constants.h" #include "base/memory/page_size.h" #include "build/build_config.h"
diff --git a/base/memory/raw_ptr.h b/base/memory/raw_ptr.h index 6a807dc..669ee16 100644 --- a/base/memory/raw_ptr.h +++ b/base/memory/raw_ptr.h
@@ -47,10 +47,6 @@ #define PA_RAW_PTR_CHECK(condition) PA_BASE_CHECK(condition) #endif // BUILDFLAG(IS_NACL) -#if BUILDFLAG(PA_USE_BASE_TRACING) -#include "base/trace_event/base_tracing_forward.h" -#endif // BUILDFLAG(PA_USE_BASE_TRACING) - #if BUILDFLAG(USE_MTE_CHECKED_PTR) && \ defined(PA_ENABLE_MTE_CHECKED_PTR_SUPPORT_WITH_64_BITS_POINTERS) #include "base/allocator/partition_allocator/partition_tag.h" @@ -1374,16 +1370,6 @@ std::swap(lhs.wrapped_ptr_, rhs.wrapped_ptr_); } -#if BUILDFLAG(PA_USE_BASE_TRACING) - // If T can be serialised into trace, its alias is also - // serialisable. - template <class U = T> - typename perfetto::check_traced_value_support<U>::type WriteIntoTrace( - perfetto::TracedValue&& context) const { - perfetto::WriteIntoTracedValue(std::move(context), get()); - } -#endif // BUILDFLAG(PA_USE_BASE_TRACING) - PA_ALWAYS_INLINE void ReportIfDangling() const noexcept { #if BUILDFLAG(USE_BACKUP_REF_PTR) Impl::ReportIfDangling(wrapped_ptr_);
diff --git a/base/memory/raw_ptr_unittest.cc b/base/memory/raw_ptr_unittest.cc index f66585a..b2e84cc 100644 --- a/base/memory/raw_ptr_unittest.cc +++ b/base/memory/raw_ptr_unittest.cc
@@ -37,10 +37,6 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" -#if BUILDFLAG(ENABLE_BASE_TRACING) && BUILDFLAG(PA_USE_BASE_TRACING) -#include "third_party/perfetto/include/perfetto/test/traced_value_test_support.h" // no-presubmit-check nogncheck -#endif // BUILDFLAG(ENABLE_BASE_TRACING) && BUILDFLAG(PA_USE_BASE_TRACING) - #if defined(RAW_PTR_USE_MTE_CHECKED_PTR) #include "base/allocator/partition_allocator/partition_tag_types.h" #endif @@ -1306,31 +1302,6 @@ checked_derived2_ptr); } -#if BUILDFLAG(ENABLE_BASE_TRACING) && BUILDFLAG(PA_USE_BASE_TRACING) -TEST_F(RawPtrTest, TracedValueSupport) { - // Serialise nullptr. - EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<int>()), "0x0"); - - { - // If the pointer is non-null, its dereferenced value will be serialised. - int value = 42; - EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<int>(&value)), "42"); - } - - struct WithTraceSupport { - void WriteIntoTrace(perfetto::TracedValue ctx) const { - std::move(ctx).WriteString("result"); - } - }; - - { - WithTraceSupport value; - EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<WithTraceSupport>(&value)), - "result"); - } -} -#endif // BUILDFLAG(ENABLE_BASE_TRACING) && BUILDFLAG(PA_USE_BASE_TRACING) - class PmfTestBase { public: int MemFunc(char, double) const { return 11; }
diff --git a/base/memory/raw_ref.h b/base/memory/raw_ref.h index b71242d..0d328f5 100644 --- a/base/memory/raw_ref.h +++ b/base/memory/raw_ref.h
@@ -170,17 +170,6 @@ swap(lhs.inner_, rhs.inner_); } -#if BUILDFLAG(PA_USE_BASE_TRACING) - // If T can be serialised into trace, its alias is also - // serialisable. - template <class U = T> - typename perfetto::check_traced_value_support<U>::type WriteIntoTrace( - perfetto::TracedValue&& context) const { - PA_RAW_PTR_CHECK(inner_.get()); // Catch use-after-move. - inner_.WriteIntoTrace(std::move(context)); - } -#endif // BUILDFLAG(PA_USE_BASE_TRACING) - template <class U> friend PA_ALWAYS_INLINE bool operator==(const raw_ref& lhs, const raw_ref<U, RawPtrType>& rhs) {
diff --git a/base/process/memory.cc b/base/process/memory.cc index ca5c49f..8f0ed9f 100644 --- a/base/process/memory.cc +++ b/base/process/memory.cc
@@ -7,6 +7,7 @@ #include <string.h> #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/cxx17_backports.h" #include "base/debug/alias.h" #include "base/immediate_crash.h"
diff --git a/base/task/common/checked_lock_impl.cc b/base/task/common/checked_lock_impl.cc index 71a5ee09..eae408a1 100644 --- a/base/task/common/checked_lock_impl.cc +++ b/base/task/common/checked_lock_impl.cc
@@ -4,6 +4,7 @@ #include "base/task/common/checked_lock_impl.h" +#include <ostream> #include <unordered_map> #include <vector>
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index f056277d..59d3905 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc
@@ -10,6 +10,7 @@ #include "base/allocator/allocator_extension.h" #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/partition_bucket_lookup.h" #include "base/debug/profiler.h"
diff --git a/base/trace_event/malloc_dump_provider.h b/base/trace_event/malloc_dump_provider.h index 56ec9b0..cd5c12a 100644 --- a/base/trace_event/malloc_dump_provider.h +++ b/base/trace_event/malloc_dump_provider.h
@@ -6,6 +6,7 @@ #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/base_export.h" #include "base/memory/raw_ptr.h" #include "base/memory/singleton.h"
diff --git a/base/trace_event/traced_value_support.h b/base/trace_event/traced_value_support.h index c9fb9a1c..028529a 100644 --- a/base/trace_event/traced_value_support.h +++ b/base/trace_event/traced_value_support.h
@@ -5,6 +5,8 @@ #ifndef BASE_TRACE_EVENT_TRACED_VALUE_SUPPORT_H_ #define BASE_TRACE_EVENT_TRACED_VALUE_SUPPORT_H_ +#include "base/memory/raw_ptr.h" +#include "base/memory/raw_ref.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/strings/string_piece.h" @@ -89,6 +91,52 @@ } }; +// If T is serialisable into a trace, raw_ptr<T> is serialisable as well. +template <class T> +struct TraceFormatTraits<::base::raw_ptr<T>, + perfetto::check_traced_value_support_t<T>> { + static void WriteIntoTrace(perfetto::TracedValue context, + const ::base::raw_ptr<T>& value) { + if (!value) { + std::move(context).WritePointer(nullptr); + return; + } + perfetto::WriteIntoTracedValue(std::move(context), *value); + } + + static void WriteIntoTrace(perfetto::TracedValue context, + ::base::raw_ptr<T>& value) { + if (!value) { + std::move(context).WritePointer(nullptr); + return; + } + perfetto::WriteIntoTracedValue(std::move(context), *value); + } +}; + +// If T is serialisable into a trace, raw_ref<T> is serialisable as well. +template <class T> +struct TraceFormatTraits<::base::raw_ref<T>, + perfetto::check_traced_value_support_t<T>> { + static void WriteIntoTrace(perfetto::TracedValue context, + const ::base::raw_ref<T>& value) { + if (!value) { + std::move(context).WritePointer(nullptr); + return; + } + perfetto::WriteIntoTracedValue(std::move(context), *value); + } + + static void WriteIntoTrace(perfetto::TracedValue context, + ::base::raw_ref<T>& value) { + if (!value) { + std::move(context).WritePointer(nullptr); + return; + } + perfetto::WriteIntoTracedValue(std::move(context), *value); + } +}; + // Time-related classes. // TODO(altimin): Make them first-class primitives in TracedValue and Perfetto // UI.
diff --git a/base/trace_event/traced_value_support_unittest.cc b/base/trace_event/traced_value_support_unittest.cc index d65479fe..8394295e 100644 --- a/base/trace_event/traced_value_support_unittest.cc +++ b/base/trace_event/traced_value_support_unittest.cc
@@ -109,5 +109,28 @@ EXPECT_EQ(perfetto::TracedValueToString(base::WStringPiece(L"wide")), "wide"); } +TEST(TracedValueSupportTest, RawPtr) { + // Serialise nullptr. + EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<int>()), "0x0"); + + { + // If the pointer is non-null, its dereferenced value will be serialised. + int value = 42; + EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<int>(&value)), "42"); + } + + struct WithTraceSupport { + void WriteIntoTrace(perfetto::TracedValue ctx) const { + std::move(ctx).WriteString("result"); + } + }; + + { + WithTraceSupport value; + EXPECT_EQ(perfetto::TracedValueToString(raw_ptr<WithTraceSupport>(&value)), + "result"); + } +} + } // namespace trace_event } // namespace base
diff --git a/build/check_gn_headers.py b/build/check_gn_headers.py index e7453b2..6bfb878 100755 --- a/build/check_gn_headers.py +++ b/build/check_gn_headers.py
@@ -28,7 +28,10 @@ """Return all the header files from ninja_deps""" def NinjaSource(): - cmd = [os.path.join(DEPOT_TOOLS_DIR, 'ninja'), '-C', out_dir, '-t', 'deps'] + cmd = [ + os.path.join(SRC_DIR, 'third_party', 'ninja', 'ninja'), '-C', out_dir, + '-t', 'deps' + ] # A negative bufsize means to use the system default, which usually # means fully buffered. popen = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=-1)
diff --git a/build/config/ios/find_signing_identity.py b/build/config/ios/find_signing_identity.py index 8cd8a070..ad79834 100644 --- a/build/config/ios/find_signing_identity.py +++ b/build/config/ios/find_signing_identity.py
@@ -45,7 +45,8 @@ def FindValidIdentity(pattern): """Find all identities matching the pattern.""" lines = list(l.strip() for l in ListIdentities().splitlines()) - # Look for something like "2) XYZ "iPhone Developer: Name (ABC)"" + # Look for something like + # 1) 123ABC123ABC123ABC****** "iPhone Developer: DeveloperName (Team)" regex = re.compile('[0-9]+\) ([A-F0-9]+) "([^"(]*) \(([^)"]*)\)"') result = [] @@ -53,8 +54,9 @@ res = regex.match(line) if res is None: continue - if pattern is None or pattern in res.group(2): - result.append(Identity(*res.groups())) + identifier, developer_name, team = res.groups() + if pattern is None or pattern in '%s (%s)' % (developer_name, team): + result.append(Identity(identifier, developer_name, team)) return result
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 3a2c56c1..3d8266b46 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -10.20221127.0.1 +10.20221128.0.1
diff --git a/chrome/VERSION b/chrome/VERSION index ae4b8120..e67eb3f 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=110 MINOR=0 -BUILD=5445 +BUILD=5446 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 6b57400..fdee47a 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -731,7 +731,6 @@ "//chrome/browser:sharing_send_message_result_generated_enum", "//chrome/browser:survey_http_client_type_enum", "//chrome/browser/notifications/scheduler/public:jni_enums", - "//chrome/browser/supervised_user/supervised_user_error_page:enums_srcjar", "//chrome/browser/ui:duplicate_download_enums_java", "//components/browsing_data/core:browsing_data_utils_java", "//components/browsing_data/core:clear_browsing_data_tab_java",
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java index f6a56b3..18dee9fb 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/TypedUrlsTest.java
@@ -24,6 +24,7 @@ import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.util.browser.Features.DisableFeatures; import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; import org.chromium.components.sync.ModelType; import org.chromium.components.sync.protocol.EntitySpecifics; @@ -36,11 +37,15 @@ import java.util.ArrayList; import java.util.List; +// TODO(crbug.com/1365291): After kSyncEnableHistoryDataType is enabled and +// HISTORY has replaced TYPED_URLS, these tests can be deleted. + /** * Test suite for the typed URLs sync data type. */ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +@DisableFeatures("SyncEnableHistoryDataType") public class TypedUrlsTest { @Rule public SyncTestRule mSyncTestRule = new SyncTestRule();
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 1208f04..c665a85 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -10187,11 +10187,11 @@ <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_AUTOFILL" desc="This string appears as an item in a list of sync data types on a page that asks users if they want to turn on sync. Translate 'autofill' according to https://localization.google.com/glossary/termset?gid=27517723&tsid=77d3626. Used in the tangible sync confirmation page."> Autofill </message> - <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY" desc="This string appears as an item in a list of sync data types on a page that asks users if they want to turn on sync. Translate 'history' according to https://localization.google.com/glossary/termset?gid=27517723&tsid=59c3162. Used in the tangible sync confirmation page."> - History + <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS" desc="This string appears as an item in a list of sync data types on a page that asks users if they want to turn on sync. Translate 'extensions' according to https://localization.google.com/glossary/termset?gid=27517723&tsid=62f9351. Used in the tangible sync confirmation page."> + Extensions </message> - <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS_AND_MORE" desc="This string appears as an item in a list of sync data types on a page that asks users if they want to turn on sync. Translate 'extensions' according to https://localization.google.com/glossary/termset?gid=27517723&tsid=62f9351. Translate 'and more' so that it conveys that there are additional similar items that are not listed. Used in the tangible sync confirmation page."> - Extensions and more + <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY_AND_MORE" desc="This string appears as an item in a list of sync data types on a page that asks users if they want to turn on sync. Translate 'history' according to https://localization.google.com/glossary/termset?gid=27517723&tsid=59c3162. Translate 'and more' so that it conveys that there are additional similar items that are not listed. Used in the tangible sync confirmation page."> + History and more </message> <message name="IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_INFO_DESC" desc="Description in the information about sync and information about customizing Sync settings on the tangible sync confirmation page"> You can always choose what to sync in settings. Google may personalize Search and other services based on your history. @@ -14041,6 +14041,9 @@ <message name="IDS_PRIVACY_SANDBOX_DIALOG_M1_CONSENT_LEARN_MORE_LINK" translateable="false" desc="Learn more link in privacy sandbox consent dialog"> Esed purus vestibulum velit convalli </message> + <message name="IDS_PRIVACY_SANDBOX_DIALOG_M1_CONSENT_BANNER_IMAGE_A11Y_DESCRIPTION" translateable="false" desc="A11y description for the banner image in privacy sandbox consent dialog"> + Sed ullamcorper, ligula ac tempus venenatis + </message> <message name="IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_EEA_TITLE" translateable="false" desc="Title of privacy sandbox notice EEA dialog"> Lorem ipsum Notice EEA @@ -14142,6 +14145,9 @@ <message name="IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_ROW_LEARN_MORE_DESCRIPTION_6" translateable="false" desc="Sixth part of description in privacy sandbox notice ROW dialog"> Cras sed lacus suscipit, efficitur erat nec, semper sapien. Fusce at nunc molestie, elementum augue at, auctor nunc. Sed dui nisi, consectetur sit amet urna vitae, facilisis scelerisque justo. </message> + <message name="IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_ROW_BANNER_IMAGE_A11Y_DESCRIPTION" translateable="false" desc="A11y description for the banner image in privacy sandbox notice ROW dialog"> + Ut venenatis magna nec lacus facilisis + </message> <!-- Automated Password Change on Desktop strings --> <if expr="not is_android">
diff --git a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS.png.sha1 b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS.png.sha1 new file mode 100644 index 0000000..3d2f102 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS.png.sha1
@@ -0,0 +1 @@ +c5f7b7783c7e19362b56e537b77629a231f34981 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS_AND_MORE.png.sha1 b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS_AND_MORE.png.sha1 deleted file mode 100644 index f6084d6..0000000 --- a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS_AND_MORE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -c63bf9c95282046b6d7cd78059720b7b81035b39 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY.png.sha1 b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY.png.sha1 deleted file mode 100644 index 6d072e6..0000000 --- a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -925733623259c2339155999868f19de1bf3caaac \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY_AND_MORE.png.sha1 b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY_AND_MORE.png.sha1 new file mode 100644 index 0000000..ebbef05 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY_AND_MORE.png.sha1
@@ -0,0 +1 @@ +1a018c5a45857cd6bc5724e12fb9054551150389 \ No newline at end of file
diff --git a/chrome/app/password_manager_ui_strings.grdp b/chrome/app/password_manager_ui_strings.grdp index 2dd438f..d97a8eb1 100644 --- a/chrome/app/password_manager_ui_strings.grdp +++ b/chrome/app/password_manager_ui_strings.grdp
@@ -114,4 +114,9 @@ <message name="IDS_PASSWORD_MANAGER_UI_NO_BLOCKED_SITES_DESCRIPTION" desc="The description for the blocked sites section in the Settings if there no blocked sites or apps."> Sites which never save passwords will appear here </message> + <message name="IDS_PASSWORD_MANAGER_UI_NUMBER_OF_ACCOUNTS" desc="The string shown next to each domain in the password manager list view. It indicates the number of accounts stored for that domain. Shown only if number of accounts is more than 1."> + {COUNT, plural, + =1 {{COUNT} account} + other {{COUNT} accounts}} + </message> </grit-part>
diff --git a/chrome/app/password_manager_ui_strings_grdp/IDS_PASSWORD_MANAGER_UI_NUMBER_OF_ACCOUNTS.png.sha1 b/chrome/app/password_manager_ui_strings_grdp/IDS_PASSWORD_MANAGER_UI_NUMBER_OF_ACCOUNTS.png.sha1 new file mode 100644 index 0000000..b1494940 --- /dev/null +++ b/chrome/app/password_manager_ui_strings_grdp/IDS_PASSWORD_MANAGER_UI_NUMBER_OF_ACCOUNTS.png.sha1
@@ -0,0 +1 @@ +292c30a1a1b74a86cdff7c5a56c3d03023a4be05 \ No newline at end of file
diff --git a/chrome/app/theme/chrome_unscaled_resources.grd b/chrome/app/theme/chrome_unscaled_resources.grd index 47b9d2dc..ae217b9e 100644 --- a/chrome/app/theme/chrome_unscaled_resources.grd +++ b/chrome/app/theme/chrome_unscaled_resources.grd
@@ -34,6 +34,8 @@ <include name="IDR_CHROME_PASSWORD_MANAGER_LOGO" file="google_chrome/google_password_manager_logo.svg" type="BINDATA" /> <include name="IDR_PRODUCT_LOGO_24PX_1X" file="google_chrome/chrome_24px_1x.svg" type="BINDATA" /> <include name="IDR_PRODUCT_LOGO_128PX_SVG" file="google_chrome/chrome_128px.svg" type="BINDATA" /> + <include name="IDR_PRODUCT_LOGO_SVG" file="google_chrome/chrome_logo.svg" type="BINDATA" /> + <include name="IDR_PRODUCT_LOGO_ANIMATION_SVG" file="google_chrome/chrome_logo_animation.svg" type="BINDATA" /> <if expr="chromeos_ash"> <include name="IDR_PRODUCT_LOGO_24PX_2X" file="google_chrome/chrome_24px_2x.svg" type="BINDATA" /> <!-- Used by lacros. --> @@ -100,6 +102,8 @@ <include name="IDR_WEBSTORE_APP_ICON_16" file="chromium/chromeos/webstore_app_icon_16.png" type="BINDATA" /> <include name="IDR_WEBSTORE_APP_ICON_128" file="chromium/chromeos/webstore_app_icon_128.png" type="BINDATA" /> </if> + <include name="IDR_PRODUCT_LOGO_SVG" file="chromium/product_logo.svg" type="BINDATA" /> + <include name="IDR_PRODUCT_LOGO_ANIMATION_SVG" file="chromium/product_logo_animation.svg" type="BINDATA" /> </else> </if> <!-- _google_chrome --> <if expr="is_win">
diff --git a/chrome/app/theme/chromium/product_logo.svg b/chrome/app/theme/chromium/product_logo.svg new file mode 100644 index 0000000..5e0b254 --- /dev/null +++ b/chrome/app/theme/chromium/product_logo.svg
@@ -0,0 +1 @@ +<svg viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="M128 191.995c35.346 0 64-28.654 64-64 0-35.347-28.654-64-64-64-35.346 0-64 28.654-64 64 0 35.346 28.654 64 64 64Z" fill="#fff"/><path d="M96.01 183.41a63.681 63.681 0 0 1-23.42-23.43l-.007.004-55.425-96a128.027 128.027 0 0 0 110.841 192.018l55.436-96.018a63.985 63.985 0 0 1-16.465 18.775 64.007 64.007 0 0 1-70.96 4.651Z" fill="#669DF6"/><path d="M191.991 127.984a63.683 63.683 0 0 1-8.581 31.996l.007.004-55.426 96a128.029 128.029 0 0 0 110.872-192H127.991a64 64 0 0 1 64 64Z" fill="#AECBFA"/><path d="M128 180c28.719 0 52-23.281 52-52s-23.281-52-52-52-52 23.281-52 52 23.281 52 52 52Z" fill="#1A73E8"/><path d="M95.99 72.59a63.684 63.684 0 0 1 32.001-8.566v-.008h110.851A128.035 128.035 0 0 0 127.991.026 128.028 128.028 0 0 0 17.13 63.999l55.436 96.018a64.003 64.003 0 0 1 4.65-70.961A64 64 0 0 1 95.991 72.59Z" fill="#1967D2"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h256v256H0z"/></clipPath></defs></svg> \ No newline at end of file
diff --git a/components/resources/default_100_percent/chromium/first_run/chromium_logo_animation.svg b/chrome/app/theme/chromium/product_logo_animation.svg similarity index 100% rename from components/resources/default_100_percent/chromium/first_run/chromium_logo_animation.svg rename to chrome/app/theme/chromium/product_logo_animation.svg
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index aee9744..a94709c 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3206,7 +3206,15 @@ {"time_before_discard", "2m"}}; const FeatureEntry::FeatureParam kHighEfficiencyModeAvailable1Hour[] = { {"time_before_discard", "1h"}}; +const FeatureEntry::FeatureParam kHighEfficiencyModeAvailable4Hour[] = { + {"time_before_discard", "4h"}}; +const FeatureEntry::FeatureParam kHighEfficiencyModeAvailable6Hour[] = { + {"time_before_discard", "6h"}}; +const FeatureEntry::FeatureParam kHighEfficiencyModeAvailable12Hour[] = { + {"time_before_discard", "12h"}}; const FeatureEntry::FeatureParam kHighEfficiencyModeDefaultOn[] = { + {"default_state", "true"}}; +const FeatureEntry::FeatureParam kHighEfficiencyModeDefaultOnAnd30Seconds[] = { {"default_state", "true"}, {"time_before_discard", "30s"}}; const FeatureEntry::FeatureVariation kHighEfficiencyModeAvailableVariations[] = @@ -3219,8 +3227,17 @@ std::size(kHighEfficiencyModeAvailable2Minutes), nullptr}, {"With 1 Hour Discard", kHighEfficiencyModeAvailable1Hour, std::size(kHighEfficiencyModeAvailable1Hour), nullptr}, - {"With Default On and 30 Second Discard", kHighEfficiencyModeDefaultOn, + {"With 4 Hour Discard", kHighEfficiencyModeAvailable4Hour, + std::size(kHighEfficiencyModeAvailable4Hour), nullptr}, + {"With 6 Hour Discard", kHighEfficiencyModeAvailable6Hour, + std::size(kHighEfficiencyModeAvailable6Hour), nullptr}, + {"With 12 Hour Discard", kHighEfficiencyModeAvailable12Hour, + std::size(kHighEfficiencyModeAvailable12Hour), nullptr}, + {"With Default On", kHighEfficiencyModeDefaultOn, std::size(kHighEfficiencyModeDefaultOn), nullptr}, + {"With Default On and 30 Second Discard", + kHighEfficiencyModeDefaultOnAnd30Seconds, + std::size(kHighEfficiencyModeDefaultOnAnd30Seconds), nullptr}, }; #endif // !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc index fa8186e..2c6647a 100644 --- a/chrome/browser/ash/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -4045,6 +4045,9 @@ std::make_unique<CrostiniMountProvider>(profile_, container_id)); } } + + guest_os::GuestOsSharePath::GetForProfile(profile_)->RegisterGuest( + container_id); } void CrostiniManager::UnregisterContainer( @@ -4064,6 +4067,9 @@ mount_registry->Unregister(it->second); mount_provider_ids_.erase(it); } + + guest_os::GuestOsSharePath::GetForProfile(profile_)->UnregisterGuest( + container_id); } void CrostiniManager::UnregisterAllContainers() { @@ -4080,6 +4086,15 @@ mount_registry->Unregister(pair.second); } mount_provider_ids_.clear(); + + auto* share_service = guest_os::GuestOsSharePath::GetForProfile(profile_); + // Copy the list since we're going to iterate+mutate. + auto guests = base::flat_set<guest_os::GuestId>(share_service->ListGuests()); + for (const auto& guest : guests) { + if (guest.vm_type == kCrostiniDefaultVmType) { + share_service->UnregisterGuest(guest); + } + } } bool CrostiniManager::RegisterCreateOptions(
diff --git a/chrome/browser/ash/crostini/crostini_manager_unittest.cc b/chrome/browser/ash/crostini/crostini_manager_unittest.cc index 1d79927d..d991839 100644 --- a/chrome/browser/ash/crostini/crostini_manager_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_manager_unittest.cc
@@ -25,6 +25,7 @@ #include "chrome/browser/ash/crostini/fake_crostini_features.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" #include "chrome/browser/ash/guest_os/guest_os_session_tracker.h" +#include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/public/guest_os_service.h" #include "chrome/browser/ash/guest_os/public/guest_os_wayland_server.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" @@ -2032,10 +2033,13 @@ ->TerminalProviderRegistry(); auto* mount_registry = guest_os::GuestOsService::GetForProfile(profile_.get()) ->MountProviderRegistry(); + auto* share_service = + guest_os::GuestOsSharePath::GetForProfile(profile_.get()); restart_id_ = crostini_manager()->RestartCrostini( container_id(), base::BindLambdaForTesting([&](CrostiniResult result) { ASSERT_GT(terminal_registry->List().size(), 0u); ASSERT_GT(mount_registry->List().size(), 0u); + ASSERT_GT(share_service->ListGuests().size(), 0u); crostini_manager()->RemoveCrostini( kVmName, base::BindOnce(&CrostiniManagerRestartTest::RemoveCrostiniCallback, @@ -2044,6 +2048,7 @@ run_loop()->Run(); ASSERT_EQ(terminal_registry->List().size(), 0u); ASSERT_EQ(mount_registry->List().size(), 0u); + ASSERT_EQ(share_service->ListGuests().size(), 0u); } TEST_F(CrostiniManagerRestartTest, @@ -2053,6 +2058,8 @@ ->TerminalProviderRegistry(); auto* mount_registry = guest_os::GuestOsService::GetForProfile(profile_.get()) ->MountProviderRegistry(); + auto* share_service = + guest_os::GuestOsSharePath::GetForProfile(profile_.get()); vm_tools::cicerone::DeleteLxdContainerResponse response; response.set_status( vm_tools::cicerone::DeleteLxdContainerResponse::DOES_NOT_EXIST); @@ -2061,6 +2068,7 @@ container_id(), base::BindLambdaForTesting([&](CrostiniResult result) { ASSERT_GT(terminal_registry->List().size(), 0u); ASSERT_GT(mount_registry->List().size(), 0u); + ASSERT_GT(share_service->ListGuests().size(), 0u); crostini_manager()->DeleteLxdContainer( container_id(), base::BindOnce(&ExpectBool, run_loop()->QuitClosure(), true)); @@ -2068,6 +2076,7 @@ run_loop()->Run(); ASSERT_EQ(terminal_registry->List().size(), 0u); ASSERT_EQ(mount_registry->List().size(), 0u); + ASSERT_EQ(share_service->ListGuests().size(), 0u); } TEST_F(CrostiniManagerRestartTest, DeleteUnregistersContainers) { @@ -2076,6 +2085,8 @@ ->TerminalProviderRegistry(); auto* mount_registry = guest_os::GuestOsService::GetForProfile(profile_.get()) ->MountProviderRegistry(); + auto* share_service = + guest_os::GuestOsSharePath::GetForProfile(profile_.get()); vm_tools::cicerone::LxdContainerDeletedSignal signal; signal.set_vm_name(container_id().vm_name); signal.set_container_name(container_id().container_name); @@ -2088,9 +2099,11 @@ run_loop()->Run(); ASSERT_GT(terminal_registry->List().size(), 0u); ASSERT_GT(mount_registry->List().size(), 0u); + ASSERT_GT(share_service->ListGuests().size(), 0u); crostini_manager()->OnLxdContainerDeleted(signal); ASSERT_EQ(terminal_registry->List().size(), 0u); ASSERT_EQ(mount_registry->List().size(), 0u); + ASSERT_EQ(share_service->ListGuests().size(), 0u); } class CrostiniManagerEnterpriseReportingTest
diff --git a/chrome/browser/ash/drive/drive_integration_service.cc b/chrome/browser/ash/drive/drive_integration_service.cc index b6f88036..6d545f0 100644 --- a/chrome/browser/ash/drive/drive_integration_service.cc +++ b/chrome/browser/ash/drive/drive_integration_service.cc
@@ -687,7 +687,8 @@ if (ash::features::IsDriveFsBulkPinningEnabled()) { pin_manager_ = std::make_unique<drivefs::pinning::DriveFsPinManager>( - profile->GetPrefs()->GetBoolean(prefs::kDriveFsBulkPinningEnabled)); + profile->GetPrefs()->GetBoolean(prefs::kDriveFsBulkPinningEnabled), + profile->GetPath(), GetDriveFsInterface()); } }
diff --git a/chrome/browser/ash/extensions/file_manager/event_router.cc b/chrome/browser/ash/extensions/file_manager/event_router.cc index 8dc40e4a..6a01775 100644 --- a/chrome/browser/ash/extensions/file_manager/event_router.cc +++ b/chrome/browser/ash/extensions/file_manager/event_router.cc
@@ -43,6 +43,7 @@ #include "chrome/browser/ash/file_manager/trash_common_util.h" #include "chrome/browser/ash/file_manager/volume_manager.h" #include "chrome/browser/ash/file_system_provider/provided_file_system_info.h" +#include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/public/guest_os_service.h" #include "chrome/browser/ash/login/lock/screen_locker.h" #include "chrome/browser/ash/login/ui/login_display_host.h" @@ -640,28 +641,11 @@ pref_change_registrar_->Add(ash::prefs::kFilesAppTrashEnabled, callback); pref_change_registrar_->Add(prefs::kSearchSuggestEnabled, callback); pref_change_registrar_->Add(prefs::kUse24HourClock, callback); - pref_change_registrar_->Add( - crostini::prefs::kCrostiniEnabled, - base::BindRepeating( - &EventRouter::OnCrostiniChanged, weak_factory_.GetWeakPtr(), - crostini::kCrostiniDefaultVmName, crostini::prefs::kCrostiniEnabled, - file_manager_private::CROSTINI_EVENT_TYPE_ENABLE, - file_manager_private::CROSTINI_EVENT_TYPE_DISABLE)); pref_change_registrar_->Add(arc::prefs::kArcEnabled, callback); pref_change_registrar_->Add(arc::prefs::kArcHasAccessToRemovableMedia, callback); pref_change_registrar_->Add(ash::prefs::kFilesAppFolderShortcuts, callback); - auto plugin_vm_callback = base::BindRepeating(&EventRouter::OnPluginVmChanged, - weak_factory_.GetWeakPtr()); - plugin_vm_subscription_ = - std::make_unique<plugin_vm::PluginVmPolicySubscription>( - profile_, base::BindRepeating([](base::RepeatingClosure closure, - bool is_allowed) { closure.Run(); }, - plugin_vm_callback)); - pref_change_registrar_->Add(plugin_vm::prefs::kPluginVmImageExists, - plugin_vm_callback); - ash::system::TimezoneSettings::GetInstance()->AddObserver(this); auto* intent_helper = @@ -1031,6 +1015,7 @@ const std::string& full_path) { event.event_type = event_type; event.vm_name = vm_name; + event.container_name = ""; // Unused for the event types handled by this. file_manager_private::CrostiniEvent::EntriesType entry; entry.additional_properties.Set( "fileSystemRoot", @@ -1053,6 +1038,30 @@ path); } +void EventRouter::OnGuestRegistered(const guest_os::GuestId& guest) { + file_manager_private::CrostiniEvent event; + event.vm_name = guest.vm_name; + event.container_name = guest.container_name; + event.event_type = + extensions::api::file_manager_private::CROSTINI_EVENT_TYPE_ENABLE; + BroadcastEvent(profile_, + extensions::events::FILE_MANAGER_PRIVATE_ON_CROSTINI_CHANGED, + file_manager_private::OnCrostiniChanged::kEventName, + file_manager_private::OnCrostiniChanged::Create(event)); +} + +void EventRouter::OnGuestUnregistered(const guest_os::GuestId& guest) { + file_manager_private::CrostiniEvent event; + event.vm_name = guest.vm_name; + event.container_name = guest.container_name; + event.event_type = + extensions::api::file_manager_private::CROSTINI_EVENT_TYPE_DISABLE; + BroadcastEvent(profile_, + extensions::events::FILE_MANAGER_PRIVATE_ON_CROSTINI_CHANGED, + file_manager_private::OnCrostiniChanged::kEventName, + file_manager_private::OnCrostiniChanged::Create(event)); +} + void EventRouter::OnTabletModeStarted() { BroadcastEvent( profile_, extensions::events::FILE_MANAGER_PRIVATE_ON_TABLET_MODE_CHANGED, @@ -1067,33 +1076,6 @@ file_manager_private::OnTabletModeChanged::Create(/*enabled=*/false)); } -void EventRouter::OnCrostiniChanged( - const std::string& vm_name, - const std::string& pref_name, - extensions::api::file_manager_private::CrostiniEventType pref_true, - extensions::api::file_manager_private::CrostiniEventType pref_false) { - file_manager_private::CrostiniEvent event; - event.vm_name = vm_name; - event.event_type = - profile_->GetPrefs()->GetBoolean(pref_name) ? pref_true : pref_false; - BroadcastEvent(profile_, - extensions::events::FILE_MANAGER_PRIVATE_ON_CROSTINI_CHANGED, - file_manager_private::OnCrostiniChanged::kEventName, - file_manager_private::OnCrostiniChanged::Create(event)); -} - -void EventRouter::OnPluginVmChanged() { - file_manager_private::CrostiniEvent event; - event.vm_name = plugin_vm::kPluginVmName; - event.event_type = plugin_vm::PluginVmFeatures::Get()->IsEnabled(profile_) - ? file_manager_private::CROSTINI_EVENT_TYPE_ENABLE - : file_manager_private::CROSTINI_EVENT_TYPE_DISABLE; - BroadcastEvent(profile_, - extensions::events::FILE_MANAGER_PRIVATE_ON_CROSTINI_CHANGED, - file_manager_private::OnCrostiniChanged::kEventName, - file_manager_private::OnCrostiniChanged::Create(event)); -} - void EventRouter::NotifyDriveConnectionStatusChanged() { DCHECK(profile_); DCHECK(extensions::EventRouter::Get(profile_));
diff --git a/chrome/browser/ash/extensions/file_manager/event_router.h b/chrome/browser/ash/extensions/file_manager/event_router.h index 2530ddbe..45d5b0e 100644 --- a/chrome/browser/ash/extensions/file_manager/event_router.h +++ b/chrome/browser/ash/extensions/file_manager/event_router.h
@@ -169,6 +169,8 @@ const base::FilePath& path) override; void OnUnshare(const std::string& vm_name, const base::FilePath& path) override; + void OnGuestRegistered(const guest_os::GuestId& guest) override; + void OnGuestUnregistered(const guest_os::GuestId& guest) override; // ash:TabletModeObserver overrides. void OnTabletModeStarted() override; @@ -250,16 +252,6 @@ const std::string& file_system_name, const std::string& full_path); - // Called for Crostini events when the specified pref value changes. - void OnCrostiniChanged( - const std::string& vm_name, - const std::string& pref_name, - extensions::api::file_manager_private::CrostiniEventType pref_true, - extensions::api::file_manager_private::CrostiniEventType pref_false); - - // Called when Plugin VM enabled state may have changed. - void OnPluginVmChanged(); - void NotifyDriveConnectionStatusChanged(); void DisplayDriveConfirmDialog(
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index 5fb5474..135b6ec 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -1201,9 +1201,10 @@ TestCase("driveLinkOpenFileThroughTransitiveLink"), TestCase("driveWelcomeBanner"), TestCase("driveOfflineInfoBanner").EnableDriveDssPin(), - TestCase("driveOfflineInfoBannerWithoutFlag"), - TestCase("driveInlineSyncStatusSingleFile").EnableInlineStatusSync(), - TestCase("driveInlineSyncStatusParentFolder").EnableInlineStatusSync() + TestCase("driveOfflineInfoBannerWithoutFlag") + // TODO(b/258987225): Enable + // TestCase("driveInlineSyncStatusSingleFile").EnableInlineStatusSync(), + // TestCase("driveInlineSyncStatusParentFolder").EnableInlineStatusSync() // TODO(b/189173190): Enable // TestCase("driveEnableDocsOfflineDialog"), // TODO(b/189173190): Enable
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index 83fdcf7..6ba4d68c 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -58,6 +58,7 @@ #include "chrome/browser/ash/base/locale_util.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/crostini/crostini_util.h" #include "chrome/browser/ash/drive/drivefs_test_support.h" #include "chrome/browser/ash/drive/file_system_util.h" #include "chrome/browser/ash/extensions/file_manager/event_router.h" @@ -70,6 +71,7 @@ #include "chrome/browser/ash/file_manager/path_util.h" #include "chrome/browser/ash/file_manager/volume_manager.h" #include "chrome/browser/ash/guest_os/guest_id.h" +#include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/guest_os/public/guest_os_mount_provider.h" #include "chrome/browser/ash/guest_os/public/guest_os_service.h" #include "chrome/browser/ash/guest_os/public/types.h" @@ -2082,6 +2084,8 @@ crostini::ContainerInfo(crostini::kCrostiniDefaultContainerName, "testuser", "/home/testuser", "PLACEHOLDER_IP")); + guest_os::GuestOsSharePath::GetForProfile(profile()->GetOriginalProfile()) + ->RegisterGuest(crostini::DefaultContainerId()); static_cast<ash::FakeCrosDisksClient*>(ash::CrosDisksClient::Get()) ->AddCustomMountPointCallback( base::BindRepeating(&FileManagerBrowserTestBase::MaybeMountCrostini, @@ -2867,6 +2871,13 @@ ASSERT_TRUE(enabled.has_value()); profile()->GetPrefs()->SetBoolean(crostini::prefs::kCrostiniEnabled, enabled.value()); + if (enabled.value()) { + guest_os::GuestOsSharePath::GetForProfile(profile())->RegisterGuest( + crostini::DefaultContainerId()); + } else { + guest_os::GuestOsSharePath::GetForProfile(profile())->UnregisterGuest( + crostini::DefaultContainerId()); + } return; }
diff --git a/chrome/browser/ash/file_manager/file_manager_jstest.cc b/chrome/browser/ash/file_manager/file_manager_jstest.cc index 26d438b..63425df 100644 --- a/chrome/browser/ash/file_manager/file_manager_jstest.cc +++ b/chrome/browser/ash/file_manager/file_manager_jstest.cc
@@ -318,6 +318,10 @@ RunTestURL("state/reducers/all_entries_unittest.js"); } +IN_PROC_BROWSER_TEST_F(FileManagerJsTest, ReducerCurrentDirectory) { + RunTestURL("state/reducers/current_directory_unittest.js"); +} + IN_PROC_BROWSER_TEST_F(FileManagerJsTest, XfConflictDialog) { RunTestURL("widgets/xf_conflict_dialog_unittest.js"); }
diff --git a/chrome/browser/ash/file_manager/file_manager_string_util.cc b/chrome/browser/ash/file_manager/file_manager_string_util.cc index 90ccdc8b..7ccd9a7d 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc
@@ -16,6 +16,7 @@ #include "base/values.h" #include "chrome/browser/ash/crostini/crostini_features.h" #include "chrome/browser/ash/crostini/crostini_util.h" +#include "chrome/browser/ash/guest_os/guest_os_share_path.h" #include "chrome/browser/ash/login/demo_mode/demo_session.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" @@ -1087,11 +1088,14 @@ dict->Set("UI_LOCALE", locale); dict->Set("WEEK_START_FROM", GetLocaleBasedWeekStart()); base::Value::List vms; - if (crostini::CrostiniFeatures::Get()->IsEnabled(profile)) { - vms.Append(crostini::kCrostiniDefaultVmName); - } - if (plugin_vm::PluginVmFeatures::Get()->IsEnabled(profile)) { - vms.Append(plugin_vm::kPluginVmName); + auto* share_path = guest_os::GuestOsSharePath::GetForProfile(profile); + if (share_path) { + for (const auto& guest : share_path->ListGuests()) { + base::Value::Dict d; + d.Set("vmName", guest.vm_name); + d.Set("containerName", guest.container_name); + vms.Append(std::move(d)); + } } dict->Set("VMS_FOR_SHARING", std::move(vms)); }
diff --git a/chrome/browser/ash/file_manager/file_tasks.cc b/chrome/browser/ash/file_manager/file_tasks.cc index f5f05ac..581df9b8 100644 --- a/chrome/browser/ash/file_manager/file_tasks.cc +++ b/chrome/browser/ash/file_manager/file_tasks.cc
@@ -442,8 +442,9 @@ UMA_HISTOGRAM_ENUMERATION(kDriveTaskResultMetricName, OfficeTaskResult::OPENED); } else { - GetUserFallbackChoice(profile, task, file_urls, - ash::office_fallback::FallbackReason::kOffline); + GetUserFallbackChoice( + profile, task, file_urls, + ash::office_fallback::FallbackReason::kInvalidGoogleDocsURL); } }
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path.cc b/chrome/browser/ash/guest_os/guest_os_share_path.cc index 5c25ad5..23d68ab 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path.cc
@@ -764,4 +764,21 @@ return false; } +void GuestOsSharePath::RegisterGuest(const GuestId& guest) { + guests_.insert(guest); + for (auto& observer : observers_) { + observer.OnGuestRegistered(guest); + } +} +void GuestOsSharePath::UnregisterGuest(const GuestId& guest) { + guests_.erase(guest); + for (auto& observer : observers_) { + observer.OnGuestUnregistered(guest); + } +} + +const base::flat_set<GuestId>& GuestOsSharePath::ListGuests() { + return guests_; +} + } // namespace guest_os
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path.h b/chrome/browser/ash/guest_os/guest_os_share_path.h index 1f54da4e..179ba9d9 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path.h +++ b/chrome/browser/ash/guest_os/guest_os_share_path.h
@@ -10,12 +10,14 @@ #include <set> #include <vector> +#include "base/containers/flat_set.h" #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/task/sequenced_task_runner.h" #include "chrome/browser/ash/file_manager/volume_manager_observer.h" +#include "chrome/browser/ash/guest_os/guest_id.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/ash/components/dbus/concierge/concierge_client.h" #include "chromeos/ash/components/dbus/seneschal/seneschal_service.pb.h" @@ -58,6 +60,8 @@ const base::FilePath& path) = 0; virtual void OnUnshare(const std::string& vm_name, const base::FilePath& path) = 0; + virtual void OnGuestRegistered(const guest_os::GuestId& guest) = 0; + virtual void OnGuestUnregistered(const guest_os::GuestId& guest) = 0; }; static GuestOsSharePath* GetForProfile(Profile* profile); @@ -145,6 +149,18 @@ // Visible for testing. void PathDeleted(const base::FilePath& path); + // Registers `guest` with this service, so methods which take a VmType will + // operate on it. + void RegisterGuest(const GuestId& guest); + + // Unregisters `guest` so it no longer is included by methods taking a + // `VmType`. + void UnregisterGuest(const GuestId& guest); + + // Returns the list of guests which are currently registered with this + // service. + const base::flat_set<GuestId>& ListGuests(); + // Allow seneschal callback to be overridden for testing. void set_seneschal_callback_for_testing(SeneschalCallback callback) { seneschal_callback_ = std::move(callback); @@ -180,6 +196,7 @@ SeneschalCallback seneschal_callback_; base::ObserverList<Observer>::Unchecked observers_; std::map<base::FilePath, SharedPathInfo> shared_paths_; + base::flat_set<GuestId> guests_; base::WeakPtrFactory<GuestOsSharePath> weak_ptr_factory_{this}; }; // class
diff --git a/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc b/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc index 50c3c68..699bc84 100644 --- a/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc +++ b/chrome/browser/ash/guest_os/guest_os_share_path_unittest.cc
@@ -21,9 +21,12 @@ #include "chrome/browser/ash/file_manager/volume_manager.h" #include "chrome/browser/ash/file_manager/volume_manager_factory.h" #include "chrome/browser/ash/guest_os/guest_os_pref_names.h" +#include "chrome/browser/ash/guest_os/guest_os_session_tracker.h" #include "chrome/browser/ash/guest_os/public/guest_os_service.h" #include "chrome/browser/ash/guest_os/public/guest_os_wayland_server.h" +#include "chrome/browser/ash/guest_os/public/types.h" #include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" +#include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "chrome/browser/component_updater/fake_cros_component_manager.h" #include "chrome/common/chrome_features.h" #include "chrome/test/base/browser_process_platform_part_test_api_chromeos.h" @@ -47,6 +50,7 @@ #include "components/prefs/scoped_user_pref_update.h" #include "components/user_manager/scoped_user_manager.h" #include "content/public/test/browser_task_environment.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -957,4 +961,59 @@ crostini::kCrostiniDefaultVmName, shared_path_)); } +class MockSharePathObserver : public GuestOsSharePath::Observer { + public: + MOCK_METHOD(void, + OnPersistedPathRegistered, + (const std::string& vm_name, const base::FilePath& path), + (override)); + MOCK_METHOD(void, + OnUnshare, + (const std::string& vm_name, const base::FilePath& path), + (override)); + MOCK_METHOD(void, + OnGuestRegistered, + (const guest_os::GuestId& guest), + (override)); + MOCK_METHOD(void, + OnGuestUnregistered, + (const guest_os::GuestId& guest), + (override)); +}; + +TEST_F(GuestOsSharePathTest, RegisterListAndUnregister) { + using testing::_; + using testing::InSequence; + using testing::UnorderedElementsAreArray; + GuestId termina_1{VmType::TERMINA, "termina", "first"}; + GuestId termina_2{VmType::TERMINA, "termina", "second"}; + GuestId other_vm{VmType::TERMINA, "not-termina", "whatever"}; + MockSharePathObserver obs; + guest_os_share_path_->AddObserver(&obs); + std::vector guests{termina_1, termina_2, other_vm}; + + // We'll first register three guests... + EXPECT_CALL(obs, OnGuestRegistered(_)).Times(guests.size()); + + // ...then unregister them in a specific order, so we expect termina_2 and + // other_vm to be the last guests for their respective VMs. + { + InSequence seq; + EXPECT_CALL(obs, OnGuestUnregistered(termina_1)); // termina_1; + EXPECT_CALL(obs, OnGuestUnregistered(termina_2)); // termina_2; + EXPECT_CALL(obs, OnGuestUnregistered(other_vm)); // other_vm; + } + + for (const auto& guest : guests) { + guest_os_share_path_->RegisterGuest(guest); + } + + EXPECT_THAT(guest_os_share_path_->ListGuests(), + UnorderedElementsAreArray(guests)); + + for (const auto& guest : guests) { + guest_os_share_path_->UnregisterGuest(guest); + } +} + } // namespace guest_os
diff --git a/chrome/browser/ash/guest_os/public/guest_os_mount_provider_registry_unittest.cc b/chrome/browser/ash/guest_os/public/guest_os_mount_provider_registry_unittest.cc index 3c327de..72f8ca0 100644 --- a/chrome/browser/ash/guest_os/public/guest_os_mount_provider_registry_unittest.cc +++ b/chrome/browser/ash/guest_os/public/guest_os_mount_provider_registry_unittest.cc
@@ -15,7 +15,7 @@ using Id = GuestOsMountProviderRegistry::Id; -class MockObserver : public GuestOsMountProviderRegistry::Observer { +class MockMountObserver : public GuestOsMountProviderRegistry::Observer { using Id = GuestOsMountProviderRegistry::Id; public: @@ -62,7 +62,7 @@ auto provider1 = std::make_unique<MockMountProvider>(); auto provider2 = std::make_unique<MockMountProvider>(); GuestOsMountProviderRegistry registry; - MockObserver obs; + MockMountObserver obs; registry.AddObserver(&obs); registry.Register(std::move(provider1)); registry.Register(std::move(provider2));
diff --git a/chrome/browser/ash/input_method/native_input_method_engine_observer.cc b/chrome/browser/ash/input_method/native_input_method_engine_observer.cc index 44e327f..b55ec54 100644 --- a/chrome/browser/ash/input_method/native_input_method_engine_observer.cc +++ b/chrome/browser/ash/input_method/native_input_method_engine_observer.cc
@@ -687,8 +687,11 @@ ConnectToImeService(mojom::ConnectionTarget::kImeServiceLib, engine_id); } else if (ShouldRouteToRuleBasedEngine(engine_id)) { const auto new_engine_id = NormalizeRuleBasedEngineId(engine_id); - ConnectToImeService(mojom::ConnectionTarget::kRulebasedEngine, - new_engine_id); + ConnectToImeService( + base::FeatureList::IsEnabled(features::kMigrateRuleBasedInputMethods) + ? mojom::ConnectionTarget::kImeServiceLib + : mojom::ConnectionTarget::kRulebasedEngine, + new_engine_id); // Notify the virtual keyboard extension that the IME has changed. ime_base_observer_->OnActivate(engine_id); } else if (ShouldRouteToNativeMojoEngine(engine_id)) {
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc index 8d7d429..4a397b5a 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.cc
@@ -8,7 +8,9 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "chrome/app/vector_icons/vector_icons.h" +#include "chrome/browser/ash/guest_os/guest_id.h" #include "chrome/browser/ash/guest_os/guest_os_share_path.h" +#include "chrome/browser/ash/guest_os/public/types.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_engagement_metrics_service.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_features.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_files.h" @@ -122,6 +124,9 @@ : profile_(profile), owner_id_(ash::ProfileHelper::GetUserIdHashFromProfile(profile)) { ash::VmPluginDispatcherClient::Get()->AddObserver(this); + plugin_vm_subscription_ = std::make_unique<PluginVmPolicySubscription>( + profile_, base::BindRepeating(&PluginVmManagerImpl::OnPluginVmChanged, + weak_ptr_factory_.GetWeakPtr())); } PluginVmManagerImpl::~PluginVmManagerImpl() { @@ -788,6 +793,15 @@ uninstaller_notification_.reset(); } +void PluginVmManagerImpl::OnPluginVmChanged(bool is_allowed) { + auto* share_path = guest_os::GuestOsSharePath::GetForProfile(profile_); + guest_os::GuestId id{guest_os::VmType::PLUGIN_VM, kPluginVmName, ""}; + if (is_allowed) { + share_path->RegisterGuest(id); + } else { + share_path->UnregisterGuest(id); + } +} } // namespace plugin_vm #undef LOG_FUNCTION_CALL
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h index 87b88e3..35811f4 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h +++ b/chrome/browser/ash/plugin_vm/plugin_vm_manager_impl.h
@@ -11,6 +11,7 @@ #include "chrome/browser/ash/plugin_vm/plugin_vm_manager.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_metrics_util.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_uninstaller_notification.h" +#include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" #include "chrome/browser/ash/vm_starting_observer.h" #include "chromeos/ash/components/dbus/concierge/concierge_service.pb.h" #include "chromeos/ash/components/dbus/dlcservice/dlcservice_client.h" @@ -141,6 +142,10 @@ PluginVmUninstallerNotification::FailedReason reason = PluginVmUninstallerNotification::FailedReason::kUnknown); + // Called when pluginvm changes availability e.g. installed, uninstalled, + // policy changes. + void OnPluginVmChanged(bool is_allowed); + Profile* profile_; std::string owner_id_; uint64_t seneschal_server_handle_ = 0; @@ -187,6 +192,9 @@ // suspending, so delay until an in progress operation finishes. bool pending_destroy_disk_image_ = false; + // We subscribe to events which change our availability. + std::unique_ptr<PluginVmPolicySubscription> plugin_vm_subscription_; + base::WeakPtrFactory<PluginVmManagerImpl> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc index e9c80a0..65f1b2d1 100644 --- a/chrome/browser/ash/plugin_vm/plugin_vm_util.cc +++ b/chrome/browser/ash/plugin_vm/plugin_vm_util.cc
@@ -155,6 +155,10 @@ plugin_vm::prefs::kPluginVmUserId, base::BindRepeating(&PluginVmPolicySubscription::OnPolicyChanged, base::Unretained(this))); + pref_change_registrar_->Add( + plugin_vm::prefs::kPluginVmImageExists, + base::BindRepeating(&PluginVmPolicySubscription::OnPolicyChanged, + base::Unretained(this))); device_allowed_subscription_ = cros_settings->AddSettingsObserver( ash::kPluginVmAllowed, base::BindRepeating(&PluginVmPolicySubscription::OnPolicyChanged,
diff --git a/chrome/browser/ash/power/ml/boot_clock.cc b/chrome/browser/ash/power/ml/boot_clock.cc index 0589ecd..0773e1c 100644 --- a/chrome/browser/ash/power/ml/boot_clock.cc +++ b/chrome/browser/ash/power/ml/boot_clock.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/power/ml/boot_clock.h" #include <time.h> +#include <ostream> #include "base/check_op.h" #include "base/time/time_override.h"
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc index 1b818949..b8b9da91 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager_browsertest.cc
@@ -451,7 +451,7 @@ // Disabled because "autofill::AddTestProfile" times out when sync is disabled. IN_PROC_BROWSER_TEST_P(ChromeBrowsingDataLifetimeManagerScheduledRemovalTest, - DISABLED_Autofill) { + Autofill) { // No autofill data saved in incognito mode. if (IsIncognito()) return;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index aea4ae0..74495d8 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -6567,11 +6567,6 @@ "expiry_milestone": 99 }, { - "name": "touch-to-fill-password-submission", - "owners": [ "kolos", "fhorschig" ], - "expiry_milestone": 109 - }, - { "name": "traffic-counters", "owners": ["khorimoto", "cros-connectivity@google.com"], "expiry_milestone": 120
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index 3e782c1..c54cfb36 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -387,7 +387,6 @@ &password_manager::features::kPasswordDomainCapabilitiesFetching, &password_manager::features::kPasswordChange, &password_manager::features::kRecoverFromNeverSaveAndroid, - &password_manager::features::kTouchToFillPasswordSubmission, &password_manager::features::kUnifiedCredentialManagerDryRun, &password_manager::features::kUnifiedPasswordManagerAndroid, &password_manager::features::kUnifiedPasswordManagerAndroidBranding,
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index e91e9eb..b67694f 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -552,7 +552,6 @@ public static final String TOOLBAR_PHONE_OPTIMIZATIONS = "ToolbarPhoneOptimizations"; public static final String TOOLBAR_SCROLL_ABLATION_ANDROID = "ToolbarScrollAblationAndroid"; public static final String TOOLBAR_USE_HARDWARE_BITMAP_DRAW = "ToolbarUseHardwareBitmapDraw"; - public static final String TOUCH_TO_FILL_PASSWORD_SUBMISSION = "TouchToFillPasswordSubmission"; public static final String TRANSLATE_ASSIST_CONTENT = "TranslateAssistContent"; public static final String TRANSLATE_INTENT = "TranslateIntent"; public static final String TRANSLATE_MESSAGE_UI = "TranslateMessageUI";
diff --git a/chrome/browser/lacros/browser_test_util.cc b/chrome/browser/lacros/browser_test_util.cc index ca3615f..d8b5fc3 100644 --- a/chrome/browser/lacros/browser_test_util.cc +++ b/chrome/browser/lacros/browser_test_util.cc
@@ -44,14 +44,30 @@ bool mouse_up_seen_ = false; }; -void WaitForWindow(const std::string& id, bool exists) { +bool IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions min_version) { + auto* lacros_service = chromeos::LacrosService::Get(); + if (!lacros_service || + !lacros_service->IsAvailable<crosapi::mojom::TestController>()) { + return false; + } + + int interface_version = lacros_service->GetInterfaceVersion( + crosapi::mojom::TestController::Uuid_); + return (interface_version >= static_cast<int>(min_version)); +} + +bool WaitForWindow(const std::string& id, bool exists) { + if (!IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions:: + kDoesWindowExistMinVersion)) { + return false; + } base::RunLoop outer_loop; auto wait_for_window = base::BindRepeating( [](base::RunLoop* outer_loop, const std::string& id, bool expected_exists) { auto* lacros_service = chromeos::LacrosService::Get(); - CHECK(lacros_service->IsAvailable<crosapi::mojom::TestController>()); - base::RunLoop inner_loop(base::RunLoop::Type::kNestableTasksAllowed); bool exists = false; lacros_service->GetRemote<crosapi::mojom::TestController>() @@ -73,16 +89,20 @@ base::RepeatingTimer timer; timer.Start(FROM_HERE, base::Milliseconds(1), std::move(wait_for_window)); outer_loop.Run(); + return true; } -void WaitForElement(const std::string& id, bool exists) { +bool WaitForElement(const std::string& id, bool exists) { + if (!IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions:: + kDoesElementExistMinVersion)) { + return false; + } base::RunLoop outer_loop; auto wait_for_element = base::BindRepeating( [](base::RunLoop* outer_loop, const std::string& id, bool expected_exists) { auto* lacros_service = chromeos::LacrosService::Get(); - CHECK(lacros_service->IsAvailable<crosapi::mojom::TestController>()); - base::RunLoop inner_loop(base::RunLoop::Type::kNestableTasksAllowed); bool exists = false; lacros_service->GetRemote<crosapi::mojom::TestController>() @@ -104,36 +124,34 @@ base::RepeatingTimer timer; timer.Start(FROM_HERE, base::Milliseconds(1), std::move(wait_for_element)); outer_loop.Run(); + return true; } } // namespace -void WaitForElementCreation(const std::string& element_name) { - WaitForElement(element_name, /*exists=*/true); +bool WaitForElementCreation(const std::string& element_name) { + return WaitForElement(element_name, /*exists=*/true); } -void WaitForWindowCreation(const std::string& id) { - WaitForWindow(id, /*exists=*/true); +bool WaitForWindowCreation(const std::string& id) { + return WaitForWindow(id, /*exists=*/true); } -void WaitForWindowDestruction(const std::string& id) { - WaitForWindow(id, /*exists=*/false); +bool WaitForWindowDestruction(const std::string& id) { + return WaitForWindow(id, /*exists=*/false); } -void WaitForShelfItem(const std::string& id, bool exists) { +bool WaitForShelfItem(const std::string& id, bool exists) { + if (!IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions:: + kDoesItemExistInShelfMinVersion)) { + return false; + } base::RunLoop outer_loop; auto wait_for_shelf_item = base::BindRepeating( [](base::RunLoop* outer_loop, const std::string& id, bool expected_exists) { auto* lacros_service = chromeos::LacrosService::Get(); - CHECK(lacros_service->IsAvailable<crosapi::mojom::TestController>()); - int interface_version = lacros_service->GetInterfaceVersion( - crosapi::mojom::TestController::Uuid_); - int min_version = - static_cast<int>(crosapi::mojom::TestController::MethodMinVersions:: - kDoesItemExistInShelfMinVersion); - CHECK_GE(interface_version, min_version); - base::RunLoop inner_loop(base::RunLoop::Type::kNestableTasksAllowed); bool exists = false; lacros_service->GetRemote<crosapi::mojom::TestController>() @@ -155,25 +173,22 @@ base::RepeatingTimer timer; timer.Start(FROM_HERE, base::Milliseconds(1), std::move(wait_for_shelf_item)); outer_loop.Run(); + return true; } -// TODO(crbug.com/1208258): Use ASSERT or EXPECT macros instead of CHECK. -void WaitForShelfItemState(const std::string& id, +bool WaitForShelfItemState(const std::string& id, uint32_t state, const base::Location& location) { + if (!IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions:: + kGetShelfItemStateMinVersion)) { + return false; + } base::RunLoop outer_loop; auto wait_for_state = base::BindRepeating( [](base::RunLoop* outer_loop, const std::string& id, uint32_t expected_state) { auto* lacros_service = chromeos::LacrosService::Get(); - CHECK(lacros_service->IsAvailable<crosapi::mojom::TestController>()); - int interface_version = lacros_service->GetInterfaceVersion( - crosapi::mojom::TestController::Uuid_); - int min_version = - static_cast<int>(crosapi::mojom::TestController::MethodMinVersions:: - kGetShelfItemStateMinVersion); - CHECK_GE(interface_version, min_version); - base::RunLoop inner_loop(base::RunLoop::Type::kNestableTasksAllowed); uint32_t actual_state = static_cast<uint32_t>(crosapi::mojom::ShelfItemState::kNormal); @@ -196,13 +211,19 @@ base::RepeatingTimer timer; timer.Start(FROM_HERE, base::Milliseconds(1), std::move(wait_for_state)); outer_loop.Run(location); + return true; } // Sends a TestController message to Ash to send a mouse click to this |window|. // Waits for both the mouse-down and the mouse-up events to be seen by // |window|. The AuraObserver only waits for the up-event to start processing // before quitting the run loop. -void SendAndWaitForMouseClick(aura::Window* window) { +bool SendAndWaitForMouseClick(aura::Window* window) { + if (!IsTestControllerAvailable( + crosapi::mojom::TestController::MethodMinVersions:: + kClickWindowMinVersion)) { + return false; + } DCHECK(window->IsRootWindow()); std::string id = lacros_window_utility::GetRootWindowUniqueId(window); @@ -214,6 +235,7 @@ lacros_service->GetRemote<crosapi::mojom::TestController>()->ClickWindow(id); run_loop.Run(); aura::Env::GetInstance()->RemoveWindowEventDispatcherObserver(obs.get()); + return true; } } // namespace browser_test_util
diff --git a/chrome/browser/lacros/browser_test_util.h b/chrome/browser/lacros/browser_test_util.h index 4e2d94c..2ee3ded 100644 --- a/chrome/browser/lacros/browser_test_util.h +++ b/chrome/browser/lacros/browser_test_util.h
@@ -21,7 +21,9 @@ namespace browser_test_util { // Waits for an element to be created. -void WaitForElementCreation(const std::string& element_name); +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool WaitForElementCreation(const std::string& element_name); // Some crosapi methods rely on the assumption that ash/exo are aware of the // existence of a Lacros Window. Wayland is an async protocol that uses a @@ -29,18 +31,26 @@ // synchronization mechanism for window creation and destruction. // // Waits for the Window to be created. |id| comes from |GetWindowId|. -void WaitForWindowCreation(const std::string& id); +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool WaitForWindowCreation(const std::string& id); // Waits for the window to be destroyed. |id| comes from |GetWindowId|. -void WaitForWindowDestruction(const std::string& id); +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool WaitForWindowDestruction(const std::string& id); // Waits for the shelf item to either be created or destroyed, matching // |exists|. -void WaitForShelfItem(const std::string& id, bool exists); +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool WaitForShelfItem(const std::string& id, bool exists); // Waits for the app to be closed, running or active, matching |state|, // a bitmask of |crosapi::mojom::ShelfItemState| values. -void WaitForShelfItemState( +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool WaitForShelfItemState( const std::string& id, uint32_t state, const base::Location& location = base::Location::Current()); @@ -54,7 +64,9 @@ // events. This serial_id is a required input to Wayland clipboard APIs. // // |window| must be a root window. -void SendAndWaitForMouseClick(aura::Window* window); +// Returns false if Ash is unavailable or lacks the required TestController +// functionality. +[[nodiscard]] bool SendAndWaitForMouseClick(aura::Window* window); } // namespace browser_test_util
diff --git a/chrome/browser/lacros/clipboard_lacros_browsertest.cc b/chrome/browser/lacros/clipboard_lacros_browsertest.cc index 803b089..c2146c1 100644 --- a/chrome/browser/lacros/clipboard_lacros_browsertest.cc +++ b/chrome/browser/lacros/clipboard_lacros_browsertest.cc
@@ -67,8 +67,9 @@ ->GetNativeWindow(); std::string id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(id); - browser_test_util::SendAndWaitForMouseClick(window->GetRootWindow()); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(id)); + ASSERT_TRUE( + browser_test_util::SendAndWaitForMouseClick(window->GetRootWindow())); // Write some clipboard text and read it back. std::string write_text =
diff --git a/chrome/browser/lacros/input_method_lacros_browsertest.cc b/chrome/browser/lacros/input_method_lacros_browsertest.cc index 6ec432a..bc91e77c 100644 --- a/chrome/browser/lacros/input_method_lacros_browsertest.cc +++ b/chrome/browser/lacros/input_method_lacros_browsertest.cc
@@ -66,12 +66,12 @@ return false; } - browser_test_util::WaitForWindowCreation( - lacros_window_utility::GetRootWindowUniqueId( - BrowserView::GetBrowserViewForBrowser(browser) - ->frame() - ->GetNativeWindow() - ->GetRootWindow())); + std::string window_id = lacros_window_utility::GetRootWindowUniqueId( + BrowserView::GetBrowserViewForBrowser(browser) + ->frame() + ->GetNativeWindow() + ->GetRootWindow()); + EXPECT_TRUE(browser_test_util::WaitForWindowCreation(window_id)); return true; }
diff --git a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc index 8ef42151..8f3db39 100644 --- a/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc +++ b/chrome/browser/lacros/lacros_extension_apps_controller_lacros_browsertest.cc
@@ -59,8 +59,10 @@ } // Wait for item to stop existing in shelf. - if (!app_id_.empty()) - browser_test_util::WaitForShelfItem(app_id_, /*exists=*/false); + if (!app_id_.empty()) { + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(app_id_, /*exists=*/false)); + } } std::string app_id_; @@ -89,7 +91,7 @@ // No item should exist in the shelf before the window is launched. InstallApp(); - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false)); // There should be no app windows. ASSERT_TRUE( @@ -103,7 +105,7 @@ controller->Launch(std::move(launch_params), base::DoNothing()); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true)); } // Test that clicking a pinned chrome app in the shelf launches it. @@ -128,7 +130,7 @@ // No item should exist in the shelf before the window is launched. InstallApp(); - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false)); // Launch the app via LacrosExtensionAppsController. crosapi::mojom::LaunchParamsPtr launch_params = @@ -138,7 +140,7 @@ controller->Launch(std::move(launch_params), base::DoNothing()); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true)); // Pin the shelf item. crosapi::mojom::TestControllerAsyncWaiter waiter( @@ -156,7 +158,7 @@ std::string window_id = lacros_window_utility::GetRootWindowUniqueId( app_window->GetNativeWindow()->GetRootWindow()); app_window->GetBaseWindow()->Close(); - browser_test_util::WaitForWindowDestruction(window_id); + ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(window_id)); } // Confirm that there are no open windows. @@ -210,7 +212,7 @@ // No item should exist in the shelf before the window is launched. InstallApp(); - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false)); // Launch the app via LacrosExtensionAppsController. crosapi::mojom::LaunchParamsPtr launch_params = @@ -220,7 +222,7 @@ controller->Launch(std::move(launch_params), base::DoNothing()); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true)); // Get the context menu. crosapi::mojom::TestControllerAsyncWaiter waiter( @@ -260,7 +262,7 @@ // No item should exist in the shelf before the window is launched. InstallApp(); LOG(INFO) << "No item starts in shelf"; - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false)); // Launch the app via LacrosExtensionAppsController. crosapi::mojom::LaunchParamsPtr launch_params = @@ -271,7 +273,7 @@ // Wait for item to exist in shelf. LOG(INFO) << "Wait for item to appear in shelf after install"; - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/true)); // Select index 2, which corresponds to Uninstall. base::HistogramTester tester; @@ -287,14 +289,14 @@ // This pops up an ash dialog to confirm uninstall. First we wait fo the // dialog to appear, and then we click the confirm button. std::string element_name = kAppUninstallDialogOkButtonId.GetName(); - browser_test_util::WaitForElementCreation(element_name); + ASSERT_TRUE(browser_test_util::WaitForElementCreation(element_name)); waiter.ClickElement(element_name, &success); ASSERT_TRUE(success); // Wait for the item to be no longer visible in the shelf as it's uninstalled // which implicitly closes the window. LOG(INFO) << "Wait for item to disappear from shelf after uninstall"; - browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id(), /*exists=*/false)); } } // namespace
diff --git a/chrome/browser/lacros/overview_lacros_browsertest.cc b/chrome/browser/lacros/overview_lacros_browsertest.cc index 8695a5d..5727c40 100644 --- a/chrome/browser/lacros/overview_lacros_browsertest.cc +++ b/chrome/browser/lacros/overview_lacros_browsertest.cc
@@ -45,7 +45,7 @@ aura::Window* window = browser()->window()->GetNativeWindow(); std::string id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(id)); // Enter overview mode. auto* lacros_service = chromeos::LacrosService::Get(); @@ -56,7 +56,7 @@ // Close the window by closing all tabs and wait for it to stop existing in // ash. browser()->tab_strip_model()->CloseAllTabs(); - browser_test_util::WaitForWindowDestruction(id); + ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(id)); } // We enter overview mode with 2 windows. We delete 1 window during overview @@ -71,7 +71,7 @@ aura::Window* main_window = browser()->window()->GetNativeWindow(); std::string main_id = lacros_window_utility::GetRootWindowUniqueId( main_window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(main_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(main_id)); // Create an incognito window and make it visible. Browser* incognito_browser = Browser::Create(Browser::CreateParams( @@ -82,7 +82,7 @@ incognito_browser->window()->GetNativeWindow(); std::string incognito_id = lacros_window_utility::GetRootWindowUniqueId( incognito_window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(incognito_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(incognito_id)); // Enter overview mode. auto* lacros_service = chromeos::LacrosService::Get(); @@ -93,7 +93,7 @@ // Close the incognito window by closing all tabs and wait for it to stop // existing in ash. incognito_browser->tab_strip_model()->CloseAllTabs(); - browser_test_util::WaitForWindowDestruction(incognito_id); + ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(incognito_id)); // Exit overview mode. waiter.ExitOverviewMode();
diff --git a/chrome/browser/lacros/popup_lacros_browsertest.cc b/chrome/browser/lacros/popup_lacros_browsertest.cc index a7c65d5..9f8b21dc 100644 --- a/chrome/browser/lacros/popup_lacros_browsertest.cc +++ b/chrome/browser/lacros/popup_lacros_browsertest.cc
@@ -73,7 +73,7 @@ aura::Window* window = browser()->window()->GetNativeWindow(); std::string window_id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(window_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(window_id)); // Wait for the window to be globally positioned at 0,0. It will eventually // have this position because it is maximized. We cannot assert the position
diff --git a/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc b/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc index eabb3019..e00ee8b 100644 --- a/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc +++ b/chrome/browser/lacros/tab_scrubber_lacros_browsertest.cc
@@ -60,7 +60,7 @@ aura::Window* window = browser()->window()->GetNativeWindow(); std::string window_id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(window_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(window_id)); // Add further 5 blank tabs. for (int i = 0; i < 5; ++i)
diff --git a/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc b/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc index 7ca5cc56..4845c05 100644 --- a/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc +++ b/chrome/browser/lacros/tablet_mode_lacros_browsertest.cc
@@ -38,7 +38,7 @@ aura::Window* main_window = browser()->window()->GetNativeWindow(); std::string main_id = lacros_window_utility::GetRootWindowUniqueId( main_window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(main_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(main_id)); // Create an incognito window and make it visible. Browser* incognito_browser = Browser::Create(Browser::CreateParams( @@ -49,7 +49,7 @@ incognito_browser->window()->GetNativeWindow(); std::string incognito_id = lacros_window_utility::GetRootWindowUniqueId( incognito_window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(incognito_id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(incognito_id)); // Enter tablet mode. crosapi::mojom::TestControllerAsyncWaiter waiter( @@ -59,7 +59,7 @@ // Close the incognito window by closing all tabs and wait for it to stop // existing in ash. incognito_browser->tab_strip_model()->CloseAllTabs(); - browser_test_util::WaitForWindowDestruction(incognito_id); + ASSERT_TRUE(browser_test_util::WaitForWindowDestruction(incognito_id)); // Exit tablet mode. waiter.ExitTabletMode();
diff --git a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc index 3184e9f..2861a09 100644 --- a/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc +++ b/chrome/browser/lacros/web_contents_can_go_back_observer_browsertest.cc
@@ -86,7 +86,7 @@ ->GetNativeWindow(); std::string id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(id)); EXPECT_FALSE(chrome::CanGoBack(browser())); EXPECT_FALSE(chrome::CanGoForward(browser())); @@ -128,7 +128,7 @@ ->GetNativeWindow(); std::string id = lacros_window_utility::GetRootWindowUniqueId(window->GetRootWindow()); - browser_test_util::WaitForWindowCreation(id); + ASSERT_TRUE(browser_test_util::WaitForWindowCreation(id)); EXPECT_FALSE(chrome::CanGoBack(browser())); EXPECT_FALSE(chrome::CanGoForward(browser()));
diff --git a/chrome/browser/preloading/prerender/prerender_browsertest.cc b/chrome/browser/preloading/prerender/prerender_browsertest.cc index 034d301..6a77a45a 100644 --- a/chrome/browser/preloading/prerender/prerender_browsertest.cc +++ b/chrome/browser/preloading/prerender/prerender_browsertest.cc
@@ -162,10 +162,18 @@ blink::mojom::WebFeature:: kV8Document_Onprerenderingchange_AttributeSetter, 0); + histogram_tester.ExpectBucketCount("Blink.UseCounter.Features", + blink::mojom::WebFeature::kPageVisits, 1); // Start a prerender. The API call should be recorded. GURL prerender_url = embedded_test_server()->GetURL("/simple.html"); prerender_helper().AddPrerender(prerender_url); + // kPageVisits should have been issued for kPageVisits already, but the value + // hasn't been updated due to the update will be delayed until the activation + // in the current design. The value is still expected to be one. + // Please refer to crrev.com/c/3856942 for implementation details. + histogram_tester.ExpectBucketCount("Blink.UseCounter.Features", + blink::mojom::WebFeature::kPageVisits, 1); // Accessing related attributes should also be recorded. ASSERT_TRUE(content::ExecJs(GetActiveWebContents()->GetPrimaryMainFrame(), @@ -187,6 +195,8 @@ blink::mojom::WebFeature:: kV8Document_Onprerenderingchange_AttributeSetter, 1); + histogram_tester.ExpectBucketCount("Blink.UseCounter.Features", + blink::mojom::WebFeature::kPageVisits, 2); } // Tests that Prerender2 cannot be triggered when preload setting is disabled.
diff --git a/chrome/browser/privacy_sandbox/android/java/res/layout/privacy_sandbox_consent_eea_v4.xml b/chrome/browser/privacy_sandbox/android/java/res/layout/privacy_sandbox_consent_eea_v4.xml index 1c35306..bd852d8 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/layout/privacy_sandbox_consent_eea_v4.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/layout/privacy_sandbox_consent_eea_v4.xml
@@ -13,7 +13,29 @@ android:layout_height="match_parent" android:orientation="vertical"> + <LinearLayout + android:id="@+id/progress_bar_container" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:gravity="center" + android:layout_gravity="center" + android:visibility="gone"> + + <ProgressBar + android:layout_width="@dimen/privacy_sandbox_spinner_dimension" + android:layout_height="@dimen/privacy_sandbox_spinner_dimension" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginHorizontal="@dimen/list_item_default_margin" + android:text="@string/privacy_sandbox_m1_consent_saving_label" + style="@style/TextAppearance.TextMedium.Secondary" /> + + </LinearLayout> + <org.chromium.components.browser_ui.widget.BoundedLinearLayout + android:id="@+id/privacy_sandbox_consent_eea_view" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" @@ -136,22 +158,22 @@ android:layout_marginHorizontal="24dp"> <org.chromium.ui.widget.ButtonCompat - android:id="@+id/ack_button" + android:id="@+id/no_button" android:focusable="true" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:layout_marginEnd="@dimen/privacy_sandbox_consent_button_margin_between" - android:text="@string/privacy_sandbox_m1_consent_accept_button" + android:text="@string/privacy_sandbox_m1_consent_decline_button" style="@style/OutlinedButton" /> <org.chromium.ui.widget.ButtonCompat - android:id="@+id/settings_button" + android:id="@+id/ack_button" android:focusable="true" android:layout_width="0dp" android:layout_weight="1" android:layout_height="wrap_content" android:layout_marginStart="@dimen/privacy_sandbox_consent_button_margin_between" - android:text="@string/privacy_sandbox_m1_consent_decline_button" + android:text="@string/privacy_sandbox_m1_consent_accept_button" style="@style/OutlinedButton" /> </LinearLayout>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml index 26d09834..7fee6f6c 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml
@@ -21,6 +21,7 @@ <dimen name="privacy_sandbox_chrome_logo_width">60dp</dimen> <dimen name="privacy_sandbox_chrome_logo_height">61dp</dimen> <dimen name="privacy_sandbox_interests_illustration_height">185dp</dimen> + <dimen name="privacy_sandbox_spinner_dimension">20dp</dimen> <dimen name="custom_preference_category_paddingVertical">8dp</dimen> <dimen name="custom_preference_category_title_marginBottom">8dp</dimen> <dimen name="custom_image_preference_paddingVertical">24dp</dimen>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/xml/fledge_preference_v4.xml b/chrome/browser/privacy_sandbox/android/java/res/xml/fledge_preference_v4.xml index 2a7bcf4..c3e4211 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/xml/fledge_preference_v4.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/xml/fledge_preference_v4.xml
@@ -4,7 +4,52 @@ found in the LICENSE file. --> -<!-- TODO(http://b/254410691): Create page layout. --> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> -</PreferenceScreen> \ No newline at end of file + <org.chromium.components.browser_ui.settings.ChromeSwitchPreference + android:key="fledge_toggle" + android:title="@string/settings_fledge_page_toggle_label" + android:summary="@string/settings_fledge_page_toggle_sub_label" + app:allowDividerBelow="false" /> + + <PreferenceCategory + android:key="current_fledge_sites" + android:layout="@layout/category_with_summary_preference" + android:title="@string/settings_fledge_page_current_sites_heading" + android:summary="@string/settings_fledge_page_current_sites_description" + app:isPreferenceVisible="false" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="fledge_disabled" + android:layout="@layout/centered_image_preference" + android:summary="@string/settings_fledge_page_current_sites_description_disabled" + android:icon="@drawable/ic_motion_photos_off_24dp" + app:isPreferenceVisible="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="fledge_empty" + android:layout="@layout/centered_image_preference" + android:summary="@string/settings_fledge_page_current_sites_description_empty" + android:icon="@drawable/ic_hourglass_empty_24dp" + app:isPreferenceVisible="false" /> + + <org.chromium.components.browser_ui.settings.ChromeBasePreference + android:key="fledge_all_sites" + android:title="@string/settings_fledge_page_see_all_sites_label" + app:isPreferenceVisible="false" + app:allowDividerBelow="true" /> + + <org.chromium.components.browser_ui.settings.ChromeBasePreference + android:key="blocked_fledge_sites" + android:title="@string/settings_fledge_page_blocked_sites_heading" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="fledge_page_footer" + android:summary="@string/settings_fledge_page_footer" + app:isPreferenceVisible="false" + app:allowDividerBelow="false" /> + +</PreferenceScreen>
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/v4/PrivacySandboxDialogConsentEEAV4.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/v4/PrivacySandboxDialogConsentEEAV4.java index 6c9dc91..b738b221 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/v4/PrivacySandboxDialogConsentEEAV4.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/v4/PrivacySandboxDialogConsentEEAV4.java
@@ -12,9 +12,10 @@ import android.widget.ScrollView; import androidx.annotation.NonNull; +import androidx.annotation.VisibleForTesting; -import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxReferrer; -import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxSettingsBaseFragment; +import org.chromium.base.task.PostTask; +import org.chromium.base.task.TaskTraits; import org.chromium.chrome.browser.privacy_sandbox.R; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.ui.widget.ButtonCompat; @@ -24,12 +25,17 @@ * Dialog in the form of a consent shown for the Privacy Sandbox. */ public class PrivacySandboxDialogConsentEEAV4 extends Dialog implements View.OnClickListener { + private static final int SPINNER_DURATION_MS = 1500; + private SettingsLauncher mSettingsLauncher; private View mContentView; private final CheckableImageView mExpandArrowView; private LinearLayout mDropdownContainer; private LinearLayout mDropdownElement; + private LinearLayout mProgressBarContainer; + private LinearLayout mConsentViewContainer; + private boolean mDisableAnimationForTesting; public PrivacySandboxDialogConsentEEAV4( Context context, @NonNull SettingsLauncher settingsLauncher) { @@ -41,8 +47,11 @@ ButtonCompat ackButton = mContentView.findViewById(R.id.ack_button); ackButton.setOnClickListener(this); - ButtonCompat settingsButton = mContentView.findViewById(R.id.settings_button); - settingsButton.setOnClickListener(this); + ButtonCompat noButton = mContentView.findViewById(R.id.no_button); + noButton.setOnClickListener(this); + + mProgressBarContainer = mContentView.findViewById(R.id.progress_bar_container); + mConsentViewContainer = mContentView.findViewById(R.id.privacy_sandbox_consent_eea_view); // Controls for the expanding section. mDropdownElement = mContentView.findViewById(R.id.dropdown_element); @@ -65,15 +74,11 @@ int id = view.getId(); if (id == R.id.ack_button) { // TODO(b/254408752): Report consent acknowledge action. - dismiss(); - } else if (id == R.id.settings_button) { - // TODO(b/254408752): Report open settings action. - dismiss(); - // TODO(b/254408752): Update referrer. - PrivacySandboxSettingsBaseFragment.launchPrivacySandboxSettings( - getContext(), mSettingsLauncher, PrivacySandboxReferrer.PRIVACY_SANDBOX_NOTICE); + showSavingConfirmationAndDismiss(); + } else if (id == R.id.no_button) { + // TODO(b/254408752): Report consent declined action. + showSavingConfirmationAndDismiss(); } else if (id == R.id.dropdown_element) { - var content = mContentView.findViewById(R.id.privacy_sandbox_consent_eea_content); ScrollView scrollView = mContentView.findViewById(R.id.privacy_sandbox_consent_eea_scroll_view); @@ -112,7 +117,22 @@ } } + private void showSavingConfirmationAndDismiss() { + mProgressBarContainer.setVisibility(View.VISIBLE); + mConsentViewContainer.setVisibility(View.GONE); + PostTask.postDelayedTask(TaskTraits.USER_BLOCKING, this::dismiss, getSpinnerDuration()); + } + private boolean isDropdownExpanded() { return mDropdownContainer != null && mDropdownContainer.getVisibility() == View.VISIBLE; } + + private long getSpinnerDuration() { + return mDisableAnimationForTesting ? 0 : SPINNER_DURATION_MS; + } + + @VisibleForTesting + public void disableAnimationForTesting(boolean disable) { + mDisableAnimationForTesting = disable; + } }
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.ts b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.ts index 5a3042c..6c2c90e 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_group.ts +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_group.ts
@@ -24,6 +24,7 @@ const DEFAULT_CATEGORY_LAYOUTS = { [CategoryEnum.EMOJI]: EmojiGroupLayoutType.GRID_LAYOUT, [CategoryEnum.EMOTICON]: EmojiGroupLayoutType.FLEX_LAYOUT, + [CategoryEnum.SYMBOL]: EmojiGroupLayoutType.GRID_LAYOUT, }; export interface EmojiGroupComponent {
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js index 778536e..65b9eb8 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js
@@ -946,7 +946,7 @@ // indicators if present. 10 pixels are added for padding and the shadow. // Reset any existing left margin before calculating a new position. - variants.style.marginLeft = 0; + variants.style.marginLeft = '0'; // get size of emoji picker const pickerRect = this.getBoundingClientRect();
diff --git a/chrome/browser/resources/chromeos/emoji_picker/events.ts b/chrome/browser/resources/chromeos/emoji_picker/events.ts index ca70cef..dcd604a 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/events.ts +++ b/chrome/browser/resources/chromeos/emoji_picker/events.ts
@@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {CategoryEnum} from './types'; export type CategoryButtonClickEvent = CustomEvent<{categoryName: string}>; @@ -17,6 +18,8 @@ baseEmoji: string, allVariants: string[], name: string, + text: string, + category: CategoryEnum, }>; export const EMOJI_BUTTON_CLICK = 'emoji-button-click';
diff --git a/chrome/browser/resources/chromeos/emoji_picker/prefix_search.js b/chrome/browser/resources/chromeos/emoji_picker/prefix_search.js index 29dd52c..6a095ce6 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/prefix_search.js +++ b/chrome/browser/resources/chromeos/emoji_picker/prefix_search.js
@@ -5,6 +5,17 @@ import {Trie} from './structs/trie.js'; import {EmojiVariants} from './types.js'; +/** + * Preprocess a phrase by the following operations: + * (1) remove white whitespace at both ends of the phrase. + * (2) convert all letters into lowercase. + * @param {string} phrase + * @returns {string} + */ +function sanitize(phrase) { + return phrase.trim().toLowerCase(); +} + export class EmojiPrefixSearch { constructor() { /** @type {!Trie} */ @@ -25,7 +36,7 @@ for (const record of collection) { const string = record.base.string; const name = record.base.name; - const terms = this.tokenize_(name).map(term => this.sanitize_(term)); + const terms = this.tokenize_(name).map(term => sanitize(term)); terms.forEach(term => { if (!this.wordToEmojisMap_.has(term)) { this.wordToEmojisMap_.set(term, new Set()); @@ -56,16 +67,7 @@ return Array.from(results); } - /** - * Preprocess a phrase by the following operations: - * (1) remove white whitespace at both ends of the phrase. - * (2) convert all letters into lowercase. - * @param {string} phrase - * @returns {string} - */ - sanitize_(phrase) { - return phrase.trim().toLowerCase(); - } + /** * Clear trie and lookup table. @@ -96,7 +98,7 @@ */ getMatchedKeywords_(emoji, term) { const PRIMARY_NAME_WEIGHT = 1; - return this.tokenize_(this.sanitize_(emoji.base.name)) + return this.tokenize_(sanitize(emoji.base.name)) .map((token, pos) => ({ pos, isMatched: token.startsWith(term), @@ -135,7 +137,7 @@ */ search(query) { const queryScores = new Map(); - const sanitizedQuery = this.sanitize_(query); + const sanitizedQuery = sanitize(query); this.tokenize_(sanitizedQuery).forEach((term, idx) => { // For each token const termScores = new Map();
diff --git a/chrome/browser/resources/chromeos/emoji_picker/types.js b/chrome/browser/resources/chromeos/emoji_picker/types.js index 2b094b2..8ed9775 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/types.js +++ b/chrome/browser/resources/chromeos/emoji_picker/types.js
@@ -43,7 +43,7 @@ /** * @typedef {{name: string, category: string, emoji: Array<EmojiVariants>, - * groupId: string, activate: boolean, disabled: boolean, + * groupId: string, active: boolean, disabled: boolean, * pagination: ?number, preferences: Object<string,string>, * isHistory: boolean}} EmojiGroupElement */
diff --git a/chrome/browser/resources/chromeos/login/BUILD.gn b/chrome/browser/resources/chromeos/login/BUILD.gn index 2bc9af4..c00c9ace 100644 --- a/chrome/browser/resources/chromeos/login/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/BUILD.gn
@@ -213,7 +213,6 @@ "components/test_util.m.js", "components/web_view_helper.m.js", "components/web_view_loader.m.js", - "screens/common/family_link_notice.m.js", "screens/common/hw_data_collection.m.js", "screens/common/smart_privacy_protection.m.js", "screens/common/sync_consent.m.js", @@ -252,6 +251,7 @@ "components/oobe_carousel.js", "components/oobe_cr_lottie.js", "components/oobe_i18n_dropdown.js", + "components/oobe_screens_list.js", "components/oobe_slide.js", "components/progress_list_item.js", "components/security_token_pin.js", @@ -267,6 +267,7 @@ "screens/common/device_disabled.js", "screens/common/enable_kiosk.js", "screens/common/error_message.js", + "screens/common/family_link_notice.js", "screens/common/fingerprint_setup.js", "screens/common/gaia_signin.js", "screens/common/gesture_navigation.js",
diff --git a/chrome/browser/resources/chromeos/login/components/BUILD.gn b/chrome/browser/resources/chromeos/login/components/BUILD.gn index 21af39ad..33fbebe 100644 --- a/chrome/browser/resources/chromeos/login/components/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/components/BUILD.gn
@@ -36,6 +36,7 @@ ":oobe_i18n_dropdown", ":oobe_icons.m", ":oobe_network_icons.m", + ":oobe_screens_list", ":oobe_select.m", ":oobe_slide", ":oobe_types.m", @@ -204,6 +205,15 @@ extra_deps = [ ":oobe_network_icons_module" ] } +js_library("oobe_screens_list") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/oobe_screens_list.js" ] + deps = [ + "./behaviors:oobe_i18n_behavior.m", + "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", + ] + extra_deps = [ ":web_components" ] +} + js_library("oobe_select.m") { sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/components/oobe_select.m.js" ] deps = [] @@ -305,6 +315,7 @@ "oobe_carousel.js", "oobe_cr_lottie.js", "oobe_i18n_dropdown.js", + "oobe_screens_list.js", "oobe_slide.js", "progress_list_item.js", "security_token_pin.js",
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_screens_list.html b/chrome/browser/resources/chromeos/login/components/oobe_screens_list.html new file mode 100644 index 0000000..7b17df9 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/oobe_screens_list.html
@@ -0,0 +1,91 @@ +<!-- Copyright 2022 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. --> + + +<!-- + OOBE polymer element which is used to show a list of optional screens + that would be displayed in CHOOBE. + It has all styling for the screen_item element and can display + for each screen : Icon and a title. +--> + +<style include="oobe-dialog-host-styles cros-color-overrides"> + /* TODO(b/260302591) Update the color to semantic color. --> */ + :host { + --cr-card-button-height: 150px; + --cr-card-button-checked: var(--google-blue-500); + } + + #screensList { + column-gap: 16px; + display: grid; + grid-template-columns: repeat(2, 1fr); + overflow-y: auto; + width: 100%; + } + + .screen-title { + color: var(--cros-text-color-primary); + font: var(--cros-body-1-font); + } + + .screen-item { + background-color: var(--cros-highlight-color); + border: none; + border-radius: 16px; + height: var(--cr-card-button-height); + margin-bottom: 16px; + padding: 0; + transition: color 250ms linear, background-color 250ms linear; + width: 100%; + } + + .screen-icon { + --iron-icon-fill-color: var(--cros-icon-color-blue); + align-items: center; + align-self: center; + display: flex; + height: 32px; + margin-inline-end: 16px; + margin-inline-start: 24px ; + width: 32px; + } + + .screen-title { + align-items: center; + display: flex; + flex-direction: column; + justify-content: center; + margin-inline-end: 16px; + } + + /* If we have an odd number of screens then the last + screen will cover the entire row. */ + .screen-item:nth-child(odd):last-of-type { + width: calc(200% + 16px); + } + + .screen-item[checked=true] { + background-color: var(--cr-card-button-checked); + } + + .screen-item[checked=true] .screen-icon { + --iron-icon-fill-color: var(--cros-icon-color-primary-inverted); + } + + .screen-item[checked=true] .screen-title { + color: var(--cros-button-label-color-primary); + } + +</style> +<div id="screensList"> + <template is="dom-repeat" items="{{screensList}}"> + <cr-button class="screen-item" on-click="onclick_"> + <div class="flex horizontal layout center-justified center"> + <iron-icon class="screen-icon" icon="[[item.icon]]"></iron-icon> + <div class="screen-title">[[item.title]]</div> + </div> + </cr-button> + </template> +</div> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_screens_list.js b/chrome/browser/resources/chromeos/login/components/oobe_screens_list.js new file mode 100644 index 0000000..e22442b --- /dev/null +++ b/chrome/browser/resources/chromeos/login/components/oobe_screens_list.js
@@ -0,0 +1,77 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +import '//resources/cr_elements/chromeos/cros_color_overrides.css.js'; +import '//resources/cr_elements/icons.html.js'; + +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {OobeI18nBehavior, OobeI18nBehaviorInterface} from './behaviors/oobe_i18n_behavior.m.js'; + + +/** + * A single screen item. + * @typedef {{ + * icon: String, + * title: String, + * screenID: String, + * selected: Boolean, + * }} + */ +export let ScreenItem; + +/** + * @constructor + * @extends {PolymerElement} + * @implements {OobeI18nBehaviorInterface} + */ +const OobeScreensListBase = mixinBehaviors([OobeI18nBehavior], PolymerElement); + +/** + * @polymer + */ +export class OobeScreensList extends OobeScreensListBase { + static get is() { + return 'oobe-screens-list'; + } + + static get template() { + return html`{__html_template__}`; + } + + static get properties() { + return { + /** + * List of screens to display. + * @type {!Array<ScreenItem>} + */ + screensList: { + type: Array, + value: [], + }, + /** + * Number of screens selected. + */ + screensSelected: { + type: Number, + value: 0, + notify: true, + }, + }; + } + + onclick_(e) { + var selected = e.model.item.selected; + e.model.item.selected = !selected; + e.currentTarget.setAttribute('checked', !selected); + if (!selected) { + this.screensSelected++; + } else { + this.screensSelected--; + } + } +} + +customElements.define(OobeScreensList.is, OobeScreensList);
diff --git a/chrome/browser/resources/chromeos/login/screens.js b/chrome/browser/resources/chromeos/login/screens.js index 2c7c65b0c..500f9223 100644 --- a/chrome/browser/resources/chromeos/login/screens.js +++ b/chrome/browser/resources/chromeos/login/screens.js
@@ -17,7 +17,7 @@ import './screens/common/device_disabled.js'; import './screens/common/enable_kiosk.js'; import './screens/common/error_message.js'; -import './screens/common/family_link_notice.m.js'; +import './screens/common/family_link_notice.js'; import './screens/common/fingerprint_setup.js'; import './screens/common/gaia_signin.js'; import './screens/common/gesture_navigation.js';
diff --git a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn index 1c192d9..d61560e 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn +++ b/chrome/browser/resources/chromeos/login/screens/common/BUILD.gn
@@ -13,7 +13,6 @@ group("polymer3_elements") { public_deps = [ - ":family_link_notice_module", ":hw_data_collection_module", ":smart_privacy_protection_module", ":sync_consent_module", @@ -49,7 +48,7 @@ ":device_disabled", ":enable_kiosk", ":error_message", - ":family_link_notice.m", + ":family_link_notice", ":fingerprint_setup", ":gaia_signin", ":gesture_navigation", @@ -227,8 +226,8 @@ extra_deps = [ ":web_components" ] } -js_library("family_link_notice.m") { - sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.m.js" ] +js_library("family_link_notice") { + sources = [ "$root_gen_dir/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.js" ] deps = [ "../../components/behaviors:login_screen_behavior.m", "../../components/behaviors:oobe_dialog_host_behavior.m", @@ -237,7 +236,7 @@ "../../components/dialogs:oobe_adaptive_dialog", "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", ] - extra_deps = [ ":family_link_notice_module" ] + extra_deps = [ ":web_components" ] } js_library("fingerprint_setup") { @@ -675,15 +674,6 @@ extra_deps = [ ":web_components" ] } -polymer_modulizer("family_link_notice") { - js_file = "family_link_notice.js" - html_file = "family_link_notice.html" - html_type = "dom-module" - auto_imports = oobe_auto_imports - migrated_imports = oobe_migrated_imports - namespace_rewrites = oobe_namespace_rewrites -} - polymer_modulizer("hw_data_collection") { js_file = "hw_data_collection.js" html_file = "hw_data_collection.html" @@ -724,6 +714,7 @@ "device_disabled.js", "enable_kiosk.js", "error_message.js", + "family_link_notice.js", "fingerprint_setup.js", "gaia_signin.js", "gesture_navigation.js",
diff --git a/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.html b/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.html index 1b2afc26..0f8ed22 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.html +++ b/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.html
@@ -4,41 +4,21 @@ found in the LICENSE file. --> -<link rel="import" href="chrome://resources/html/polymer.html"> - -<link rel="import" href="chrome://resources/cr_elements/cr_shared_vars.css.html"> -<link rel="import" href="chrome://resources/ash/common/i18n_behavior.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> - -<link rel="import" href="../../components/oobe_icons.html"> -<link rel="import" href="../../components/behaviors/login_screen_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_dialog_host_behavior.html"> -<link rel="import" href="../../components/behaviors/oobe_i18n_behavior.html"> -<link rel="import" href="../../components/buttons/oobe_next_button.html"> -<link rel="import" href="../../components/common_styles/common_styles.html"> -<link rel="import" href="../../components/common_styles/oobe_dialog_host_styles.html"> -<link rel="import" href="../../components/dialogs/oobe_adaptive_dialog.html"> - -<dom-module id="family-link-notice-element"> - <template> - <style include="oobe-dialog-host-styles"></style> - <oobe-adaptive-dialog id="familyLinkDialog" role="dialog" - aria-label$="[[getDialogTitle_(locale, email_, domain_)]]"> - <iron-icon slot="icon" icon="oobe-32:family"></iron-icon> - <h1 slot="title">[[getDialogTitle_(locale, email_, domain_)]]</h1> - <div slot="subtitle"> - [[getDialogSubtitle_(locale, isNewGaiaAccount_, email_, domain_)]] - </div> - <div slot="content" class="flex layout vertical center center-justified"> - <img src="images/parental_control.svg" - class="oobe-illustration" aria-hidden="true"> - </div> - <div slot="bottom-buttons"> - <oobe-next-button id="continueButton" - text-key="familyLinkContinueButton" class="focus-on-show" - inverse on-click="onContinueButtonPressed_"></oobe-next-button> - </div> - </oobe-adaptive-dialog> - </template> - <script src="family_link_notice.js"></script> -</dom-module> +<style include="oobe-dialog-host-styles"></style> +<oobe-adaptive-dialog id="familyLinkDialog" role="dialog" + aria-label$="[[getDialogTitle_(locale, email_, domain_)]]"> + <iron-icon slot="icon" icon="oobe-32:family"></iron-icon> + <h1 slot="title">[[getDialogTitle_(locale, email_, domain_)]]</h1> + <div slot="subtitle"> + [[getDialogSubtitle_(locale, isNewGaiaAccount_, email_, domain_)]] + </div> + <div slot="content" class="flex layout vertical center center-justified"> + <img src="images/parental_control.svg" + class="oobe-illustration" aria-hidden="true"> + </div> + <div slot="bottom-buttons"> + <oobe-next-button id="continueButton" + text-key="familyLinkContinueButton" class="focus-on-show" + inverse on-click="onContinueButtonPressed_"></oobe-next-button> + </div> +</oobe-adaptive-dialog>
diff --git a/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.js b/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.js index 841433d1..131f12f 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.js +++ b/chrome/browser/resources/chromeos/login/screens/common/family_link_notice.js
@@ -6,7 +6,21 @@ * @fileoverview Polymer element for Family Link Notice screen. */ -/* #js_imports_placeholder */ +import '//resources/cr_elements/cr_shared_vars.css.js'; +import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; +import '../../components/oobe_icons.m.js'; +import '../../components/common_styles/common_styles.m.js'; +import '../../components/common_styles/oobe_dialog_host_styles.m.js'; + +import {I18nBehavior} from '//resources/ash/common/i18n_behavior.js'; +import {html, mixinBehaviors, Polymer, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {LoginScreenBehavior, LoginScreenBehaviorInterface} from '../../components/behaviors/login_screen_behavior.m.js'; +import {OobeDialogHostBehavior} from '../../components/behaviors/oobe_dialog_host_behavior.m.js'; +import {OobeI18nBehavior, OobeI18nBehaviorInterface} from '../../components/behaviors/oobe_i18n_behavior.m.js'; +import {OobeNextButton} from '../../components/buttons/oobe_next_button.js'; +import {OobeAdaptiveDialog} from '../../components/dialogs/oobe_adaptive_dialog.js'; + /** * @constructor @@ -14,9 +28,9 @@ * @implements {LoginScreenBehaviorInterface} * @implements {OobeI18nBehaviorInterface} */ -const FamilyLinkScreenElementBase = Polymer.mixinBehaviors( +const FamilyLinkScreenElementBase = mixinBehaviors( [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior], - Polymer.Element); + PolymerElement); /** * @typedef {{ @@ -25,12 +39,17 @@ */ FamilyLinkScreenElementBase.$; +/** + * @polymer + */ class FamilyLinkNotice extends FamilyLinkScreenElementBase { static get is() { return 'family-link-notice-element'; } - /* #html_template_placeholder */ + static get template() { + return html`{__html_template__}`; + } static get properties() { return { @@ -39,6 +58,7 @@ */ isNewGaiaAccount_: { type: Boolean, + value: false, }, /** @@ -46,6 +66,7 @@ */ email_: { type: String, + value: '', }, /** @@ -53,17 +74,11 @@ */ domain_: { type: String, + value: '', }, }; } - constructor() { - super(); - this.isNewGaiaAccount_ = false; - this.email_ = ''; - this.domain_ = ''; - } - /** Overridden from LoginScreenBehavior. */ // clang-format off get EXTERNAL_API() {
diff --git a/chrome/browser/resources/intro/sign_in_promo.html b/chrome/browser/resources/intro/sign_in_promo.html index 84f3084..c2c4b98 100644 --- a/chrome/browser/resources/intro/sign_in_promo.html +++ b/chrome/browser/resources/intro/sign_in_promo.html
@@ -260,7 +260,7 @@ <div class="custom-scrollbar" id="safeZone"> <div id="contentArea"> - <img id="product-logo" src="product-logo.png"> + <img id="product-logo" src="product-logo.svg"> <h1 class="fade-in">$i18n{pageTitle}</h1> <p class="fade-in" id="subtitle">$i18n{pageSubtitle}</p> <div id="benefit-cards-container">
diff --git a/chrome/browser/resources/password_manager/password_details_section.html b/chrome/browser/resources/password_manager/password_details_section.html index cd44f5d..3b8dc30 100644 --- a/chrome/browser/resources/password_manager/password_details_section.html +++ b/chrome/browser/resources/password_manager/password_details_section.html
@@ -19,7 +19,9 @@ <cr-icon-button class="icon-arrow-back" id="backButton" on-click="navigateBack_"> </cr-icon-button> - <!-- TODO(crbug.com/1350947): Use selectedGroup_.iconUrl. --> - <site-favicon id="favicon" url="[[selectedGroup_.name]]"></site-favicon> + <!-- TODO(crbug.com/1350947): Support icons for android apps. --> + <site-favicon id="favicon" url="[[selectedGroup_.iconUrl]]" + domain="[[selectedGroup_.name]]"> + </site-favicon> <h2 id="title" class="page-title">[[selectedGroup_.name]]</h2> </div>
diff --git a/chrome/browser/resources/password_manager/password_list_item.html b/chrome/browser/resources/password_manager/password_list_item.html index 095007b..c666b42 100644 --- a/chrome/browser/resources/password_manager/password_list_item.html +++ b/chrome/browser/resources/password_manager/password_list_item.html
@@ -22,14 +22,29 @@ flex: 1; } + #numberOfAccounts { + margin-inline-start: 8px; + } + #seePasswordDetails { margin-inline-end: 10px; } </style> <div class="flex-centered"> - <site-favicon id="favicon" url="[[item.iconUrl]]"></site-favicon> + <!-- TODO(crbug.com/1350947): Support icons for android apps. --> + <site-favicon id="favicon" url="[[item.iconUrl]]" + domain="[[item.name]]"> + </site-favicon> <div id="borderPart" class$="[[elementClass_]]"> - <div class="label" id="displayName">[[item.name]]</div> + <div class="label" id="displayName" + haveAccounts$="[[showNumberOfAccounts_(item)]]"> + [[item.name]] + <template is="dom-if" if="[[showNumberOfAccounts_(item)]]" restamp> + <span id="numberOfAccounts" class="cr-secondary-text"> + [[numberOfAccounts_]] + </span> + </template> + </div> <cr-icon-button id="seePasswordDetails" class="subpage-arrow" focus-row-control focus-type="seePasswordDetails"> </cr-icon-button>
diff --git a/chrome/browser/resources/password_manager/password_list_item.ts b/chrome/browser/resources/password_manager/password_list_item.ts index 453c1515..36d2256e 100644 --- a/chrome/browser/resources/password_manager/password_list_item.ts +++ b/chrome/browser/resources/password_manager/password_list_item.ts
@@ -7,6 +7,7 @@ import './site_favicon.js'; import './shared_style.css.js'; +import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {getTemplate} from './password_list_item.html.js'; @@ -30,7 +31,10 @@ static get properties() { return { - item: Object, + item: { + type: Object, + observer: 'onItemChanged_', + }, first: Boolean, @@ -38,11 +42,17 @@ type: String, computed: 'computeElementClass_(first)', }, + + /** + * The number of accounts in a group as a formatted string. + */ + numberOfAccounts_: String, }; } item: chrome.passwordsPrivate.CredentialGroup; first: boolean; + private numberOfAccounts_: string; private computeElementClass_(): string { return this.first ? 'flex-centered' : 'flex-centered hr'; @@ -67,6 +77,16 @@ }) .catch(() => {}); } + + private async onItemChanged_() { + this.numberOfAccounts_ = + await PluralStringProxyImpl.getInstance().getPluralString( + 'numberOfAccounts', this.item.entries.length); + } + + private showNumberOfAccounts_(): boolean { + return this.item.entries.length > 1; + } } declare global {
diff --git a/chrome/browser/resources/password_manager/password_manager.ts b/chrome/browser/resources/password_manager/password_manager.ts index 1fc346c..3c20c1e 100644 --- a/chrome/browser/resources/password_manager/password_manager.ts +++ b/chrome/browser/resources/password_manager/password_manager.ts
@@ -5,6 +5,7 @@ import './password_manager_app.js'; export {PasswordDetailsSectionElement} from './password_details_section.js'; +export {PasswordListItemElement} from './password_list_item.js'; export {PasswordManagerAppElement} from './password_manager_app.js'; export {BlockedSite, BlockedSitesListChangedListener, CredentialsChangedListener, PasswordCheckInteraction, PasswordCheckStatusChangedListener, PasswordManagerImpl, PasswordManagerProxy} from './password_manager_proxy.js'; export {PasswordsSectionElement} from './passwords_section.js'; @@ -13,4 +14,5 @@ export {CheckupSubpage, Page, Route, RouteObserverMixin, RouteObserverMixinInterface, Router, UrlParam} from './router.js'; export {SettingsSectionElement} from './settings_section.js'; export {PasswordManagerSideBarElement} from './side_bar.js'; +export {SiteFaviconElement} from './site_favicon.js'; export {PasswordManagerToolbarElement} from './toolbar.js';
diff --git a/chrome/browser/resources/password_manager/settings_section.html b/chrome/browser/resources/password_manager/settings_section.html index ced4fc4c..717d30e0 100644 --- a/chrome/browser/resources/password_manager/settings_section.html +++ b/chrome/browser/resources/password_manager/settings_section.html
@@ -80,7 +80,8 @@ <div id="blockedSitesList" class="hr" hidden="[[!blockedSites_.length]]"> <template is="dom-repeat" items="[[blockedSites_]]"> <div class="flex-centered"> - <site-favicon class="favicon" url="[[item.urls.link]]"></site-favicon> + <site-favicon class="favicon" domain="[[item.urls.link]]"> + </site-favicon> <div class="blocked-site-content flex-centered" first$="[[!index]]"> <div class="label site-url">[[item.urls.shown]]</div> <cr-icon-button class="icon-clear" id="removeBlockedValueButton"
diff --git a/chrome/browser/resources/password_manager/site_favicon.html b/chrome/browser/resources/password_manager/site_favicon.html index fc5254a..7aad66d 100644 --- a/chrome/browser/resources/password_manager/site_favicon.html +++ b/chrome/browser/resources/password_manager/site_favicon.html
@@ -1,18 +1,23 @@ -<style> +<style include="cr-hidden-style"> :host { --site-favicon-height: 16px; --site-favicon-width: 16px; + overflow: hidden; } - #favicon { - background-repeat: no-repeat; + #favicon, + #downloadedFavicon { background-size: contain; - border-radius: inherit; - display: block; height: var(--site-favicon-height); width: var(--site-favicon-width); } + + #downloadedFavicon { + display: block; + } </style> -<div id="favicon" - style="background-image: [[getBackgroundImage_(faviconUrl, url)]]"> +<div id="favicon" style="background-image: [[getBackgroundImage_(domain)]]" + hidden="[[showDownloadedIcon_]]"> </div> +<img is="cr-auto-img" id="downloadedFavicon" hidden="[[!showDownloadedIcon_]]" + on-load="onLoadSuccess_" on-error="onLoadError_" auto-src="[[url]]">
diff --git a/chrome/browser/resources/password_manager/site_favicon.ts b/chrome/browser/resources/password_manager/site_favicon.ts index df0c2f8..9e532a2 100644 --- a/chrome/browser/resources/password_manager/site_favicon.ts +++ b/chrome/browser/resources/password_manager/site_favicon.ts
@@ -4,8 +4,11 @@ /** * @fileoverview 'site-favicon' is the section to display the favicon given the - * site URL. + * |url| which can be used to download favicon. If downloading fails |origin| + * will be used as a fallback to obtain the favicon from cache. */ +import 'chrome://resources/cr_elements/cr_auto_img/cr_auto_img.js'; +import 'chrome://resources/cr_elements/cr_hidden_style.css.js'; import {getFavicon, getFaviconForPageURL} from 'chrome://resources/js/icon.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; @@ -15,9 +18,19 @@ export interface SiteFaviconElement { $: { favicon: HTMLElement, + downloadedFavicon: HTMLElement, }; } +/** + * Ensures the URL has a scheme (assumes http if omitted). + * @param url The URL with or without a scheme. + * @return The URL with a scheme, or an empty string. + */ +function ensureUrlHasScheme(url: string): string { + return url.includes('://') ? url : 'http://' + url; +} + export class SiteFaviconElement extends PolymerElement { static get is() { return 'site-favicon'; @@ -29,57 +42,45 @@ static get properties() { return { - faviconUrl: String, - url: String, + domain: String, + url: { + type: String, + observer: 'onUrlChanged_', + }, + + showDownloadedIcon_: { + type: Boolean, + value: false, + }, }; } - faviconUrl: string; + domain: string; url: string; + private showDownloadedIcon_: boolean; private getBackgroundImage_() { - let backgroundImage = getFavicon(''); - if (this.faviconUrl) { - const url = this.ensureUrlHasScheme_(this.faviconUrl); - backgroundImage = getFavicon(url); - } else if (this.url) { - let url = this.removePatternWildcard_(this.url); - url = this.ensureUrlHasScheme_(url); - backgroundImage = getFaviconForPageURL(url || '', false); + if (this.domain) { + const url = ensureUrlHasScheme(this.domain); + return getFaviconForPageURL(url || '', false); } - return backgroundImage; + return getFavicon(''); } - /** - * Removes the wildcard prefix from a pattern string. - * @param pattern The pattern to remove the wildcard from. - * @return The resulting pattern. - */ - private removePatternWildcard_(pattern: string): string { - if (!pattern || pattern.length === 0) { - return pattern; - } - - if (pattern.startsWith('http://[*.]')) { - return pattern.replace('http://[*.]', 'http://'); - } else if (pattern.startsWith('https://[*.]')) { - return pattern.replace('https://[*.]', 'https://'); - } else if (pattern.startsWith('[*.]')) { - return pattern.substring(4, pattern.length); - } - return pattern; + private onLoadSuccess_() { + this.showDownloadedIcon_ = true; + this.dispatchEvent(new CustomEvent( + 'site-favicon-loaded', {bubbles: true, composed: true})); } - /** - * Ensures the URL has a scheme (assumes http if omitted). - * @param url The URL with or without a scheme. - * @return The URL with a scheme, or an empty string. - */ - private ensureUrlHasScheme_(url: string): string { - if (!url || url.length === 0) { - return url; - } - return url.includes('://') ? url : 'http://' + url; + private onLoadError_() { + this.showDownloadedIcon_ = false; + this.dispatchEvent( + new CustomEvent('site-favicon-error', {bubbles: true, composed: true})); + } + + private onUrlChanged_() { + this.showDownloadedIcon_ = false; } }
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_combined_dialog_app.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_combined_dialog_app.html index b51f5dbf..6a19fdf 100644 --- a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_combined_dialog_app.html +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_combined_dialog_app.html
@@ -21,7 +21,7 @@ } </style> -<cr-view-manager id="viewManager"> +<cr-view-manager id="viewManager" aria-live="polite"> <privacy-sandbox-dialog-consent-step id="[[stepEnum_.CONSENT]]" slot="view" fill-content
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_consent_step.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_consent_step.html index 92aa20b..e90c0d6b 100644 --- a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_consent_step.html +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_consent_step.html
@@ -1,8 +1,8 @@ <style include="cr-shared-style shared-style"></style> -<div class="content-area custom-scrollbar" scrollable> +<div class="content-area custom-scrollbar" scrollable tabindex="-1"> <div class="header"> - <img class="logo"> + <img class="logo" alt=""> <h2>$i18n{m1ConsentTitle}</h2> </div> <div class="section cr-secondary-text"> @@ -12,7 +12,7 @@ $i18n{m1ConsentDescription2} </div> <div class="banner"> - <img> + <img alt="$i18n{m1ConsentBannerImageA11yDescription}"> </div> <div class="section cr-secondary-text"> $i18n{m1ConsentDescription3}
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_notice_step.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_notice_step.html index f18c1807..0df9678 100644 --- a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_notice_step.html +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_notice_step.html
@@ -13,10 +13,10 @@ } </style> -<div class="content-area custom-scrollbar" scrollable> +<div class="content-area custom-scrollbar" scrollable tabindex="-1"> <div class="content-wrapper"> <div class="header"> - <img> + <img alt=""> <h2>$i18n{m1NoticeEeaTitle}</h2> </div> <div class="section cr-secondary-text">
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_notice_dialog_app.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_notice_dialog_app.html index ae34fbb..0828975 100644 --- a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_notice_dialog_app.html +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_notice_dialog_app.html
@@ -1,9 +1,9 @@ <style include="cr-shared-style shared-style"></style> <div fill-content> - <div class="content-area custom-scrollbar" scrollable> + <div class="content-area custom-scrollbar" scrollable tabindex="-1"> <div class="header"> - <img class="logo"> + <img class="logo" alt=""> <h2>$i18n{m1NoticeRowTitle}</h2> </div> <div class="section cr-secondary-text"> @@ -13,7 +13,7 @@ $i18n{m1NoticeRowDescription2} </div> <div class="banner"> - <img> + <img alt="$i18n{m1NoticeRowBannerImageA11yDescription}"> </div> <div class="section cr-secondary-text"> $i18n{m1NoticeRowDescription3}
diff --git a/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn b/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn index c62c04b..0dd9626 100644 --- a/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn +++ b/chrome/browser/supervised_user/supervised_user_error_page/BUILD.gn
@@ -23,12 +23,6 @@ ] } -if (is_android) { - java_cpp_enum("enums_srcjar") { - sources = [ "supervised_user_error_page.h" ] - } -} - source_set("unit_tests") { testonly = true sources = [ "supervised_user_error_page_unittest.cc" ]
diff --git a/chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h b/chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h index 50c446c3..d236aa1 100644 --- a/chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h +++ b/chrome/browser/supervised_user/supervised_user_error_page/supervised_user_error_page.h
@@ -9,9 +9,6 @@ namespace supervised_user_error_page { -// A Java counterpart will be generated for this enum. -// GENERATED_JAVA_ENUM_PACKAGE: ( -// org.chromium.chrome.browser.superviseduser.supervisedusererrorpage) enum FilteringBehaviorReason { DEFAULT = 0, ASYNC_CHECKER = 1,
diff --git a/chrome/browser/sync/test/integration/ash_lacros_sync_test.cc b/chrome/browser/sync/test/integration/ash_lacros_sync_test.cc index a0c5c59..fb0339c1 100644 --- a/chrome/browser/sync/test/integration/ash_lacros_sync_test.cc +++ b/chrome/browser/sync/test/integration/ash_lacros_sync_test.cc
@@ -5,6 +5,7 @@ #include "ash/constants/ash_features.h" #include "chrome/browser/ash/crosapi/browser_util.h" #include "chrome/browser/sync/test/integration/sync_test.h" +#include "components/sync/base/features.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_impl.h" #include "components/sync/driver/sync_user_settings.h" @@ -83,24 +84,28 @@ << syncer::UserSelectableOsTypeSetToString( user_settings->GetRegisteredSelectableOsTypes()); + syncer::ModelTypeSet expected_active_types( + syncer::BOOKMARKS, syncer::PREFERENCES, syncer::PASSWORDS, + syncer::AUTOFILL_PROFILE, syncer::AUTOFILL, syncer::AUTOFILL_WALLET_DATA, + syncer::AUTOFILL_WALLET_METADATA, syncer::AUTOFILL_WALLET_OFFER, + syncer::THEMES, syncer::EXTENSIONS, syncer::SEARCH_ENGINES, + syncer::SESSIONS, syncer::APPS, syncer::APP_SETTINGS, + syncer::EXTENSION_SETTINGS, syncer::HISTORY_DELETE_DIRECTIVES, + syncer::DICTIONARY, syncer::DEVICE_INFO, syncer::PRIORITY_PREFERENCES, + syncer::APP_LIST, syncer::ARC_PACKAGE, syncer::PRINTERS, + syncer::READING_LIST, syncer::USER_EVENTS, syncer::USER_CONSENTS, + syncer::SEND_TAB_TO_SELF, syncer::SECURITY_EVENTS, + syncer::WIFI_CONFIGURATIONS, syncer::OS_PREFERENCES, + syncer::OS_PRIORITY_PREFERENCES, syncer::SHARING_MESSAGE, + syncer::WORKSPACE_DESK, syncer::PROXY_TABS, syncer::NIGORI); + if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + expected_active_types.Put(syncer::HISTORY); + } else { + expected_active_types.Put(syncer::TYPED_URLS); + } + // All of the model types, both browser and OS, should be active. - EXPECT_EQ( - sync_service->GetActiveDataTypes(), - syncer::ModelTypeSet( - syncer::BOOKMARKS, syncer::PREFERENCES, syncer::PASSWORDS, - syncer::AUTOFILL_PROFILE, syncer::AUTOFILL, - syncer::AUTOFILL_WALLET_DATA, syncer::AUTOFILL_WALLET_METADATA, - syncer::AUTOFILL_WALLET_OFFER, syncer::THEMES, syncer::TYPED_URLS, - syncer::EXTENSIONS, syncer::SEARCH_ENGINES, syncer::SESSIONS, - syncer::APPS, syncer::APP_SETTINGS, syncer::EXTENSION_SETTINGS, - syncer::HISTORY_DELETE_DIRECTIVES, syncer::DICTIONARY, - syncer::DEVICE_INFO, syncer::PRIORITY_PREFERENCES, syncer::APP_LIST, - syncer::ARC_PACKAGE, syncer::PRINTERS, syncer::READING_LIST, - syncer::USER_EVENTS, syncer::USER_CONSENTS, syncer::SEND_TAB_TO_SELF, - syncer::SECURITY_EVENTS, syncer::WIFI_CONFIGURATIONS, - syncer::OS_PREFERENCES, syncer::OS_PRIORITY_PREFERENCES, - syncer::SHARING_MESSAGE, syncer::WORKSPACE_DESK, syncer::PROXY_TABS, - syncer::NIGORI)); + EXPECT_EQ(sync_service->GetActiveDataTypes(), expected_active_types); } IN_PROC_BROWSER_TEST_F(LacrosOnlyAshSyncTest, AshSyncsOnlyOSTypes) {
diff --git a/chrome/browser/sync/test/integration/enable_disable_test.cc b/chrome/browser/sync/test/integration/enable_disable_test.cc index 2e273a23..07297b9 100644 --- a/chrome/browser/sync/test/integration/enable_disable_test.cc +++ b/chrome/browser/sync/test/integration/enable_disable_test.cc
@@ -15,6 +15,7 @@ #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "components/bookmarks/browser/bookmark_model.h" +#include "components/sync/base/features.h" #include "components/sync/base/model_type.h" #include "components/sync/base/user_selectable_type.h" #include "components/sync/driver/glue/sync_transport_data_prefs.h" @@ -101,6 +102,13 @@ }))); registered_data_types_ = GetSyncService(0)->GetRegisteredDataTypesForTest(); + if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + // The "SyncEnableHistoryDataType" feature soft-disables TYPES_URLS: It'll + // still be technically registered, but will never actually become active + // (due to the controller's GetPreconditionState()). For the purposes of + // these tests, consider it not registered. + registered_data_types_.Remove(syncer::TYPED_URLS); + } multi_grouped_types_ = MultiGroupTypes(registered_data_types_); registered_selectable_types_ = GetRegisteredSelectableTypes(0); } @@ -347,8 +355,19 @@ // Create a bookmark on the server, then turn on Sync on the client. InjectSyncedBookmark(); - ASSERT_TRUE(GetClient(0)->SetupSync()); + // Disable any LowPriorityUserTypes() (in practice, history): This test + // inspects the last-sync-cycle state. If low-prio types are active, they + // cause another (uninteresting) cycle and mess up the stats we're interested + // in. + ASSERT_TRUE(GetClient(0)->SetupSync( + base::BindOnce([](syncer::SyncUserSettings* settings) { + UserSelectableTypeSet types = settings->GetRegisteredSelectableTypes(); + types.Remove(syncer::UserSelectableType::kHistory); + settings->SetSelectedTypes(/*sync_everything=*/false, types); + }))); ASSERT_TRUE(GetSyncService(0)->IsSyncFeatureActive()); + ASSERT_FALSE(GetSyncService(0)->GetActiveDataTypes().HasAny( + syncer::LowPriorityUserTypes())); // Make sure the bookmark got synced down. ASSERT_TRUE(bookmarks_helper::GetBookmarkModel(0)->IsBookmarked( @@ -377,8 +396,19 @@ // Create a bookmark on the server, then turn on Sync on the client. InjectSyncedBookmark(); - ASSERT_TRUE(GetClient(0)->SetupSync()); + // Disable any LowPriorityUserTypes() (in practice, history): This test + // inspects the last-sync-cycle state. If low-prio types are active, they + // cause another (uninteresting) cycle and mess up the stats we're interested + // in. + ASSERT_TRUE(GetClient(0)->SetupSync( + base::BindOnce([](syncer::SyncUserSettings* settings) { + UserSelectableTypeSet types = settings->GetRegisteredSelectableTypes(); + types.Remove(syncer::UserSelectableType::kHistory); + settings->SetSelectedTypes(/*sync_everything=*/false, types); + }))); ASSERT_TRUE(GetSyncService(0)->IsSyncFeatureActive()); + ASSERT_FALSE(GetSyncService(0)->GetActiveDataTypes().HasAny( + syncer::LowPriorityUserTypes())); // Make sure the bookmark got synced down. ASSERT_TRUE(bookmarks_helper::GetBookmarkModel(0)->IsBookmarked(
diff --git a/chrome/browser/sync/test/integration/local_sync_test.cc b/chrome/browser/sync/test/integration/local_sync_test.cc index 78deb147..1f0ce9b8 100644 --- a/chrome/browser/sync/test/integration/local_sync_test.cc +++ b/chrome/browser/sync/test/integration/local_sync_test.cc
@@ -19,6 +19,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "components/browser_sync/browser_sync_switches.h" #include "components/sync/base/command_line_switches.h" +#include "components/sync/base/features.h" #include "components/sync/base/model_type.h" #include "components/sync/driver/sync_service_impl.h" #include "content/public/test/browser_test.h" @@ -71,12 +72,10 @@ base::ScopedTempDir local_sync_backend_dir_; }; -// The local sync backend is currently only supported on Windows, Mac and Linux. -// TODO(crbug.com/1052397): Reassess whether the following block needs to be -// included in lacros-chrome once build flag switch of lacros-chrome is -// complete. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ - (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +// The local sync backend is currently only supported on Windows, Mac, Linux, +// and Lacros. +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_CHROMEOS_LACROS) IN_PROC_BROWSER_TEST_F(LocalSyncTest, ShouldStart) { SyncServiceImpl* service = SyncServiceFactory::GetAsSyncServiceImplForProfileForTesting( @@ -106,17 +105,21 @@ syncer::PRIORITY_PREFERENCES, syncer::WEB_APPS, syncer::PROXY_TABS, syncer::NIGORI); + if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + // If this feature is enabled, HISTORY replaces TYPED_URLS (and HISTORY + // isn't supported in local sync mode). + expected_active_data_types.Remove(syncer::TYPED_URLS); + } + if (features::kTabGroupsSaveSyncIntegration.Get()) { expected_active_data_types.Put(syncer::SAVED_TAB_GROUP); } - // The dictionary is currently only synced on Windows and Linux. + // The dictionary is currently only synced on Windows, Linux, and Lacros. // TODO(crbug.com/1052397): Reassess whether the following block needs to be - // included - // in lacros-chrome once build flag switch of lacros-chrome is + // included in lacros-chrome once build flag switch of lacros-chrome is // complete. - -#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) expected_active_data_types.Put(syncer::DICTIONARY); #endif EXPECT_EQ(service->GetActiveDataTypes(), expected_active_data_types); @@ -128,6 +131,7 @@ EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::SEND_TAB_TO_SELF)); EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::SHARING_MESSAGE)); EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::SEND_TAB_TO_SELF)); + EXPECT_FALSE(service->GetActiveDataTypes().Has(syncer::HISTORY)); } #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || // BUILDFLAG(IS_CHROMEOS_LACROS))
diff --git a/chrome/browser/sync/test/integration/migration_test.cc b/chrome/browser/sync/test/integration/migration_test.cc index fcc9483..da1645e 100644 --- a/chrome/browser/sync/test/integration/migration_test.cc +++ b/chrome/browser/sync/test/integration/migration_test.cc
@@ -5,7 +5,6 @@ #include <memory> #include <vector> -#include "base/compiler_specific.h" #include "base/containers/circular_deque.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h" @@ -14,9 +13,8 @@ #include "chrome/browser/sync/test/integration/preferences_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/common/pref_names.h" -#include "components/prefs/scoped_user_pref_update.h" +#include "components/sync/base/features.h" #include "components/sync/driver/sync_service_impl.h" -#include "components/translate/core/browser/translate_prefs.h" #include "content/public/test/browser_test.h" using bookmarks_helper::AddURL; @@ -120,6 +118,14 @@ // Doesn't make sense to migrate commit only types. preferred_data_types.RemoveAll(syncer::CommitOnlyTypes()); + if (base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType)) { + // The "SyncEnableHistoryDataType" feature soft-disables TYPES_URLS: It'll + // still be technically registered, but will never actually become active + // (due to the controller's GetPreconditionState()). For the purposes of + // these tests, consider it not preferred. + preferred_data_types.Remove(syncer::TYPED_URLS); + } + return preferred_data_types; }
diff --git a/chrome/browser/sync/test/integration/single_client_typed_urls_sync_test.cc b/chrome/browser/sync/test/integration/single_client_typed_urls_sync_test.cc index 654bc6d..d35cad03 100644 --- a/chrome/browser/sync/test/integration/single_client_typed_urls_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_typed_urls_sync_test.cc
@@ -18,6 +18,9 @@ const char kSanityHistoryUrl[] = "http://www.sanity-history.google.com"; +// TODO(crbug.com/1365291): Evaluate which of these tests should be kept after +// kSyncEnableHistoryDataType is enabled and HISTORY has replaced TYPED_URLS. + class SingleClientTypedUrlsSyncTest : public SyncTest { public: SingleClientTypedUrlsSyncTest() : SyncTest(SINGLE_CLIENT) {}
diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc index bcdc5e6..71a46ae 100644 --- a/chrome/browser/sync/test/integration/sync_errors_test.cc +++ b/chrome/browser/sync/test/integration/sync_errors_test.cc
@@ -21,6 +21,7 @@ #include "components/history/core/common/pref_names.h" #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h" +#include "components/sync/base/features.h" #include "components/sync/base/model_type.h" #include "components/sync/driver/sync_service_impl.h" #include "components/sync/model/model_type_controller_delegate.h" @@ -315,23 +316,26 @@ } IN_PROC_BROWSER_TEST_F(SyncErrorTest, DisableDatatypeWhileRunning) { + const syncer::ModelType history_type = + base::FeatureList::IsEnabled(syncer::kSyncEnableHistoryDataType) + ? syncer::HISTORY + : syncer::TYPED_URLS; + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; syncer::ModelTypeSet synced_datatypes = GetSyncService(0)->GetActiveDataTypes(); - ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS)); + ASSERT_TRUE(synced_datatypes.Has(history_type)); ASSERT_TRUE(synced_datatypes.Has(syncer::SESSIONS)); GetProfile(0)->GetPrefs()->SetBoolean(prefs::kSavingBrowserHistoryDisabled, true); // Wait for reconfigurations. - ASSERT_TRUE( - TypeDisabledChecker(GetSyncService(0), syncer::TYPED_URLS).Wait()); + ASSERT_TRUE(TypeDisabledChecker(GetSyncService(0), history_type).Wait()); ASSERT_TRUE(TypeDisabledChecker(GetSyncService(0), syncer::SESSIONS).Wait()); const BookmarkNode* node1 = AddFolder(0, 0, "title1"); SetTitle(0, node1, "new_title1"); ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait()); - // TODO(lipalani): Verify initial sync ended for typed url is false. } // Tests that the unsynced entity will be eventually committed even after failed
diff --git a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc index f780a27..75af9f1 100644 --- a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc
@@ -6,14 +6,12 @@ #include "base/big_endian.h" #include "base/guid.h" -#include "base/i18n/number_formatting.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" -#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/sync_service_impl_harness.h" #include "chrome/browser/sync/test/integration/sync_test.h" @@ -21,6 +19,7 @@ #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "components/history/core/browser/history_types.h" #include "components/sync/base/client_tag_hash.h" +#include "components/sync/base/features.h" #include "components/sync/model/metadata_batch.h" #include "components/sync/protocol/entity_metadata.pb.h" #include "content/public/test/browser_test.h" @@ -52,6 +51,9 @@ const char kDummyUrl[] = "http://dummy-history.google.com/"; } // namespace +// TODO(crbug.com/1365291): Evaluate which of these tests should be kept after +// kSyncEnableHistoryDataType is enabled and HISTORY has replaced TYPED_URLS. + class TwoClientTypedUrlsSyncTest : public SyncTest { public: TwoClientTypedUrlsSyncTest() : SyncTest(TWO_CLIENT) {} @@ -102,6 +104,19 @@ } }; +class TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest + : public TwoClientTypedUrlsSyncTest { + public: + TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest() { + features_.InitAndDisableFeature(syncer::kSyncEnableHistoryDataType); + } + + ~TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest() override = default; + + private: + base::test::ScopedFeatureList features_; +}; + IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, E2E_ENABLED(Add)) { ResetSyncForPrimaryAccount(); // Use a randomized URL to prevent test collisions. @@ -122,7 +137,9 @@ ASSERT_EQ(new_url, urls.back().url()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddExpired) { +// Doesn't work with HISTORY because of CheckSyncHasURLMetadata(). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddExpired) { const std::u16string kHistoryUrl(u"http://www.add-one-history.google.com/"); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -154,7 +171,9 @@ EXPECT_FALSE(CheckSyncHasURLMetadata(1, new_url)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddExpiredThenUpdate) { +// Doesn't work with HISTORY because of CheckSyncHasURLMetadata(). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddExpiredThenUpdate) { const std::u16string kHistoryUrl(u"http://www.add-one-history.google.com/"); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -198,7 +217,8 @@ EXPECT_TRUE(CheckSyncHasURLMetadata(1, new_url)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, +// Doesn't work with HISTORY because of CheckSyncHasURLMetadata(). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, AddThenExpireOnSecondClient) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -239,7 +259,9 @@ EXPECT_TRUE(CheckSyncHasMetadataForURLID(0, url_id_on_first_client)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddThenExpireThenAddAgain) { +// Doesn't work with HISTORY because of CheckSyncHasURLMetadata(). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddThenExpireThenAddAgain) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; base::Time now = base::Time::Now(); @@ -291,7 +313,9 @@ EXPECT_TRUE(CheckSyncHasURLMetadata(0, url)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddThenExpireVisitByVisit) { +// Doesn't work with HISTORY because of CheckSyncHasURLMetadata(). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddThenExpireVisitByVisit) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; base::Time now = base::Time::Now(); @@ -371,7 +395,10 @@ EXPECT_TRUE(CheckSyncHasURLMetadata(1, url)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, E2E_ENABLED(AddThenDelete)) { +// Doesn't work with HISTORY because DeleteUrlFromHistory() deletes only +// locally (doesn't send a delete directive). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + E2E_ENABLED(AddThenDelete)) { ResetSyncForPrimaryAccount(); // Use a randomized URL to prevent test collisions. const std::u16string kHistoryUrl = ASCIIToUTF16(base::StringPrintf( @@ -398,7 +425,9 @@ ASSERT_EQ(initial_count, GetTypedUrlsFromClient(1).size()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, +// Doesn't work with HISTORY because it uses ExpireHistoryBetween() (rather than +// DeleteLocalAndRemoteHistoryBetween()). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, AddMultipleVisitsThenDeleteAllTypedVisits) { const std::u16string kHistoryUrl(u"http://history1.google.com/"); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -431,7 +460,9 @@ ASSERT_EQ(0u, GetTypedUrlsFromClient(1).size()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, DisableEnableSync) { +// Doesn't work with HISTORY because that doesn't sync retroactively. +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + DisableEnableSync) { ResetSyncForPrimaryAccount(); const std::u16string kUrl1(u"http://history1.google.com/"); const std::u16string kUrl2(u"http://history2.google.com/"); @@ -462,7 +493,10 @@ ASSERT_TRUE(ProfilesHaveSameTypedURLsChecker().Wait()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddOneDeleteOther) { +// Doesn't work with HISTORY because DeleteUrlFromHistory() deletes only +// locally (doesn't send a delete directive). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddOneDeleteOther) { const std::u16string kHistoryUrl( u"http://www.add-one-delete-history.google.com/"); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -486,7 +520,10 @@ ASSERT_TRUE(ProfilesHaveSameTypedURLsChecker().Wait()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, AddOneDeleteOtherAddAgain) { +// Doesn't work with HISTORY because DeleteUrlFromHistory() deletes only +// locally (doesn't send a delete directive). +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + AddOneDeleteOtherAddAgain) { const std::u16string kHistoryUrl( u"http://www.add-delete-add-history.google.com/"); ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; @@ -517,7 +554,8 @@ ASSERT_TRUE(ProfilesHaveSameTypedURLsChecker().Wait()); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, +// Doesn't work with HISTORY because that doesn't sync retroactively. +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, MergeTypedWithNonTypedDuringAssociation) { ASSERT_TRUE(SetupClients()); GURL new_url("http://history.com"); @@ -620,7 +658,8 @@ ASSERT_EQ(2, GetVisitCountForFirstURL(0)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, +// Doesn't work with HISTORY because that *does* sync non-typed visits. +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, E2E_ENABLED(DontSyncUpdatedNonTypedURLs)) { ResetSyncForPrimaryAccount(); // Checks if a non-typed URL that has been updated (modified) doesn't get @@ -706,7 +745,9 @@ ui::PAGE_TRANSITION_TYPED)); } -IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, SkipImportedVisits) { +// Doesn't work with HISTORY because that doesn't sync retroactively. +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest, + SkipImportedVisits) { GURL imported_url("http://imported_url.com"); GURL browsed_url("http://browsed_url.com"); GURL browsed_and_imported_url("http://browsed_and_imported_url.com"); @@ -771,8 +812,10 @@ ASSERT_EQ(1, GetVisitCountForFirstURL(0)); } +// ResetWithDuplicateMetadata doesn't work with HISTORY because it manually +// writes to the TypedURL metadata DB. class TwoClientTypedUrlsSyncTestWithoutLacrosSupport - : public TwoClientTypedUrlsSyncTest { + : public TwoClientTypedUrlsWithoutNewHistoryTypeSyncTest { public: TwoClientTypedUrlsSyncTestWithoutLacrosSupport() { #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/touch_to_fill/touch_to_fill_controller.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller.cc index 5a15ba1..67c4490b 100644 --- a/chrome/browser/touch_to_fill/touch_to_fill_controller.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller.cc
@@ -22,7 +22,6 @@ #include "components/password_manager/core/browser/password_manager_driver.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_util.h" -#include "components/password_manager/core/common/password_manager_features.h" #include "components/url_formatter/elide_url.h" #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" @@ -57,16 +56,6 @@ // the form's structure (submission_readiness). bool ShouldTriggerSubmission(SubmissionReadinessState submission_readiness, bool* ready_for_submission) { - bool submission_enabled = base::FeatureList::IsEnabled( - password_manager::features::kTouchToFillPasswordSubmission); - bool allow_non_conservative_heuristics = - submission_enabled && - !base::GetFieldTrialParamByFeatureAsBool( - password_manager::features::kTouchToFillPasswordSubmission, - password_manager::features:: - kTouchToFillPasswordSubmissionWithConservativeHeuristics, - false); - switch (submission_readiness) { case SubmissionReadinessState::kNoInformation: case SubmissionReadinessState::kError: @@ -78,12 +67,9 @@ case SubmissionReadinessState::kEmptyFields: case SubmissionReadinessState::kMoreThanTwoFields: - *ready_for_submission = true; - return allow_non_conservative_heuristics; - case SubmissionReadinessState::kTwoFields: *ready_for_submission = true; - return submission_enabled; + return true; } }
diff --git a/chrome/browser/touch_to_fill/touch_to_fill_controller.h b/chrome/browser/touch_to_fill/touch_to_fill_controller.h index 28b7b8a..27f56da2 100644 --- a/chrome/browser/touch_to_fill/touch_to_fill_controller.h +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller.h
@@ -134,9 +134,9 @@ // Whether a form is ready for submission. Similar to |trigger_submission_|, // but doesn't depend on flags. Used for dark launch metrics (e.g. time - // between filling and successful login with and without - // kTouchToFillPasswordSubmission enabled). TODO(crbug.com/1299394): remove - // after the launch. + // between filling and successful login with and without flags enabled). + // TODO(crbug.com/1299394): remove the field and the metrics if we are not + // going to use them for new launches, e.g. crbug.com/1393043. bool ready_for_submission_ = false; // Authenticator used to trigger a biometric auth before filling.
diff --git a/chrome/browser/touch_to_fill/touch_to_fill_controller_unittest.cc b/chrome/browser/touch_to_fill/touch_to_fill_controller_unittest.cc index 328e5213b..db0c756 100644 --- a/chrome/browser/touch_to_fill/touch_to_fill_controller_unittest.cc +++ b/chrome/browser/touch_to_fill/touch_to_fill_controller_unittest.cc
@@ -226,10 +226,6 @@ } TEST_F(TouchToFillControllerTest, Show_Fill_And_Submit) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - password_manager::features::kTouchToFillPasswordSubmission); - std::unique_ptr<MockTouchToFillView> mock_view = std::make_unique<MockTouchToFillView>(); MockTouchToFillView* weak_view = mock_view.get(); @@ -258,10 +254,6 @@ } TEST_F(TouchToFillControllerTest, Show_Fill_And_Dont_Submit) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - password_manager::features::kTouchToFillPasswordSubmission); - std::unique_ptr<MockTouchToFillView> mock_view = std::make_unique<MockTouchToFillView>(); MockTouchToFillView* weak_view = mock_view.get(); @@ -291,10 +283,6 @@ } TEST_F(TouchToFillControllerTest, Dont_Submit_With_Empty_Username) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - password_manager::features::kTouchToFillPasswordSubmission); - std::unique_ptr<MockTouchToFillView> mock_view = std::make_unique<MockTouchToFillView>(); MockTouchToFillView* weak_view = mock_view.get(); @@ -327,10 +315,6 @@ } TEST_F(TouchToFillControllerTest, Single_Credential_With_Empty_Username) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - password_manager::features::kTouchToFillPasswordSubmission); - std::unique_ptr<MockTouchToFillView> mock_view = std::make_unique<MockTouchToFillView>(); MockTouchToFillView* weak_view = mock_view.get(); @@ -701,9 +685,6 @@ TEST_P(TouchToFillControllerTestWithSubmissionReadinessVariationTest, SubmissionReadiness) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature( - password_manager::features::kTouchToFillPasswordSubmission); SubmissionReadinessState submission_readiness = GetParam(); UiCredential credentials[] = { @@ -726,36 +707,6 @@ } TEST_P(TouchToFillControllerTestWithSubmissionReadinessVariationTest, - SubmissionReadiness_ConservativeHeuristics) { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeatureWithParameters( - password_manager::features::kTouchToFillPasswordSubmission, - {{password_manager::features:: - kTouchToFillPasswordSubmissionWithConservativeHeuristics, - "true"}}); - SubmissionReadinessState submission_readiness = GetParam(); - - UiCredential credentials[] = { - MakeUiCredential({.username = "alice", .password = "p4ssw0rd"})}; - - // Submit the form iff there is only two fields. - bool submission_expected = - submission_readiness == SubmissionReadinessState::kTwoFields; - - EXPECT_CALL( - view(), - Show(Eq(GURL(kExampleCom)), IsOriginSecure(true), - ElementsAreArray(credentials), - ElementsAreArray(std::vector<TouchToFillWebAuthnCredential>()), - /*trigger_submission=*/submission_expected)); - touch_to_fill_controller().Show(credentials, {}, driver().AsWeakPtr(), - submission_readiness); - - EXPECT_CALL(driver(), TouchToFillClosed(ShowVirtualKeyboard(true))); - touch_to_fill_controller().OnDismiss(); -} - -TEST_P(TouchToFillControllerTestWithSubmissionReadinessVariationTest, SubmissionReadinessMetrics) { SubmissionReadinessState submission_readiness = GetParam();
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index da7ab556..5234c339 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -1132,6 +1132,9 @@ <message name="IDS_PRIVACY_SANDBOX_M1_CONSENT_DESCRIPTION_4" translateable="false" desc="Privacy Sandbox dialog consent EEA: Fourth section of the body, below the collapsed section."> Vestibulum pretium placerat justo vel suscipit. Quisque urna arcu, elementum ut venenatis ornare, consequat ac turpis. </message> + <message name="IDS_PRIVACY_SANDBOX_M1_CONSENT_SAVING_LABEL" translateable="false" desc="Privacy Sandbox dialog consent EEA: Saving text."> + Consectetur + </message> <message name="IDS_PRIVACY_SANDBOX_M1_CONSENT_ACCEPT_BUTTON" translateable="false" desc="Privacy Sandbox dialog consent EEA: Consent Yes button."> Quisque </message> @@ -1315,6 +1318,36 @@ <message name="IDS_SETTINGS_FLEDGE_PAGE_TITLE" translateable="false" desc="Title for the Fledge preferences page."> Aenean erat leo </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_TOGGLE_LABEL" translateable="false" desc="Title for the Fledge toggle."> + Nunc aliquam consequat felis non tincidunt + </message> + <!-- TODO(http://b/254412044): Format links.--> + <message name="IDS_SETTINGS_FLEDGE_PAGE_TOGGLE_SUB_LABEL" translateable="false" desc="Description for the Fledge toggle."> + Donec pretium non elit vitae ornare. Morbi arcu elit, rutrum nec sapien quis, <ph name="BEGIN_LINK"><link></ph>tristique tristique ante<ph name="END_LINK"></link></ph> + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_CURRENT_SITES_HEADING" translateable="false" desc="Section title for the current Fledge sites list."> + Aliquam + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_CURRENT_SITES_DESCRIPTION" translateable="false" desc="Section description for the current Fledge sites list."> + Nullam sollicitudin elit vitae hendrerit suscipit. Nunc mi leo, placerat sit amet lorem non, semper convallis sapien. + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_CURRENT_SITES_DESCRIPTION_DISABLED" translateable="false" desc="Description which appears when Fledge is disabled."> + Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_CURRENT_SITES_DESCRIPTION_EMPTY" translateable="false" desc="Description which appears when the Fledge sites list is empty."> + Morbi quis orci in mauris tempus rutrum. Curabitur blandit orci tortor, pellentesque tempor turpis lacinia ac. + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_SEE_ALL_SITES_LABEL" translateable="false" desc="Title for the all Fledge sites preference."> + Donec non mi + </message> + <message name="IDS_SETTINGS_FLEDGE_PAGE_BLOCKED_SITES_HEADING" translateable="false" desc="Title for the blocked Fledge sites preference."> + Curabitur a pharetra + </message> + <!-- TODO(http://b/254412044): Format links.--> + <message name="IDS_SETTINGS_FLEDGE_PAGE_FOOTER" translateable="false" desc=""> + Pellentesque sollicitudin purus sit amet felis fringilla blandit. Donec a eleifend ligula, <ph name="BEGIN_LINK_1"><link1></ph>et fringilla nunc<ph name="END_LINK_1"></link1></ph>. Vivamus sit amet <ph name="BEGIN_LINK_2"><link2></ph>cursus quam<ph name="END_LINK_2"></link2></ph>. Etiam ultricies rutrum orci, eget accumsan purus mattis in. + </message> + <!-- Privacy Sandbox v4 - Ad Measurement Page --> <message name="IDS_SETTINGS_AD_MEASUREMENT_PAGE_TITLE" translateable="false" desc="Title for the Ad Measurement preferences page."> Vestibulum augue erat
diff --git a/chrome/browser/ui/tabs/tab_strip_model_observer.cc b/chrome/browser/ui/tabs/tab_strip_model_observer.cc index c1ce72e..42ea438 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_observer.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_observer.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/check_op.h" +#include "base/trace_event/trace_event.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "content/public/browser/web_contents.h" #include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
diff --git a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc index 07ae713..9a991ae 100644 --- a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc +++ b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
@@ -1801,7 +1801,9 @@ // There is no known way to execute test-controlled tasks during // a drag-and-drop loop run by Windows OS. -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_CHROMEOS_ASH) && \ + (defined(ADDRESS_SANITIZER) || !defined(NDEBUG))) +// https://crbug.com/1393605: Flaky at ChromeOS ASAN and Debug builds #define MAYBE_CrossTabDrag DISABLED_CrossTabDrag #else #define MAYBE_CrossTabDrag CrossTabDrag
diff --git a/chrome/browser/ui/views/profiles/first_run_intro_browsertest.cc b/chrome/browser/ui/views/profiles/first_run_intro_browsertest.cc index 09a2920..3f36b19 100644 --- a/chrome/browser/ui/views/profiles/first_run_intro_browsertest.cc +++ b/chrome/browser/ui/views/profiles/first_run_intro_browsertest.cc
@@ -31,6 +31,7 @@ bool use_dark_theme = false; bool use_fixed_size = false; bool use_longer_strings = false; + bool use_right_to_left_language = false; }; // To be passed as 4th argument to `INSTANTIATE_TEST_SUITE_P()`, allows the test @@ -49,6 +50,11 @@ {.test_suffix = "LongerStringsFixedSize", .use_fixed_size = true, .use_longer_strings = true}, + + // This test will only be reproducible on Windows. You will need to change + // the language using LANGUAGE=ar (i.e LANGUAGE=ar out/Default/chrome) + // to be able to debug on Linux. + {.test_suffix = "RightToLeftLanguage", .use_right_to_left_language = true}, }; const char kMakeCardDescriptionLongerJsString[] = @@ -79,6 +85,9 @@ if (GetParam().use_dark_theme) { command_line->AppendSwitch(switches::kForceDarkMode); } + if (GetParam().use_right_to_left_language) { + command_line->AppendSwitchASCII(switches::kLang, "ar"); + } } void ShowUi(const std::string& name) override {
diff --git a/chrome/browser/ui/web_applications/lacros_web_app_browsertest.cc b/chrome/browser/ui/web_applications/lacros_web_app_browsertest.cc index 0008998..b44be0d 100644 --- a/chrome/browser/ui/web_applications/lacros_web_app_browsertest.cc +++ b/chrome/browser/ui/web_applications/lacros_web_app_browsertest.cc
@@ -68,16 +68,18 @@ LaunchWebAppBrowser(app_id); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/true)); AppReadinessWaiter(profile(), kOsSettingsAppId).Await(); // Settings should not yet exist in the shelf. - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false)); ASSERT_TRUE(selectContextMenu(app_id, kAppInfoIndex)); - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/true); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/true)); { // Get the Settings context menu. @@ -92,12 +94,13 @@ ASSERT_TRUE(selectContextMenu(kOsSettingsAppId, kCloseSettingsIndex)); // Settings should no longer exist in the shelf. - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false)); UninstallWebApp(app_id); // Wait for item to stop existing in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); } // Regression test for crbug.com/1335266 @@ -124,7 +127,7 @@ 6U); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/true)); auto selectContextMenu = [&](int index) { bool success = false;
diff --git a/chrome/browser/ui/web_applications/lacros_web_app_shelf_browsertest.cc b/chrome/browser/ui/web_applications/lacros_web_app_shelf_browsertest.cc index 29557f5..87527fa 100644 --- a/chrome/browser/ui/web_applications/lacros_web_app_shelf_browsertest.cc +++ b/chrome/browser/ui/web_applications/lacros_web_app_shelf_browsertest.cc
@@ -78,25 +78,25 @@ AppReadinessWaiter(profile(), app1_id).Await(); Browser* app_browser1 = LaunchWebAppBrowser(profile(), app1_id); EXPECT_TRUE(AppBrowserController::IsForWebApp(app_browser1, app1_id)); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kActive)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kActive))); AppReadinessWaiter(profile(), app2_id).Await(); LaunchWebAppBrowser(profile(), app2_id); - browser_test_util::WaitForShelfItemState( - app2_id, static_cast<uint32_t>(ShelfItemState::kActive)); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kRunning)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app2_id, static_cast<uint32_t>(ShelfItemState::kActive))); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kRunning))); CloseAndWait(app_browser1); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kNormal)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kNormal))); test::UninstallWebApp(profile(), app2_id); AppReadinessWaiter(profile(), app2_id, apps::Readiness::kUninstalledByUser) .Await(); - browser_test_util::WaitForShelfItemState( - app2_id, static_cast<uint32_t>(ShelfItemState::kNormal)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app2_id, static_cast<uint32_t>(ShelfItemState::kNormal))); test::UninstallWebApp(profile(), app1_id); } @@ -115,22 +115,22 @@ content::WebContents* const web_contents = app_browser->tab_strip_model()->GetActiveWebContents(); EXPECT_TRUE(AppBrowserController::IsForWebApp(app_browser, app_id)); - browser_test_util::WaitForShelfItemState( - app_id, static_cast<uint32_t>(ShelfItemState::kActive)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app_id, static_cast<uint32_t>(ShelfItemState::kActive))); ASSERT_TRUE(content::ExecuteScript(web_contents, "navigator.setAppBadge();")); - browser_test_util::WaitForShelfItemState( + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( app_id, static_cast<uint32_t>(ShelfItemState::kActive) | - static_cast<uint32_t>(ShelfItemState::kNotification)); + static_cast<uint32_t>(ShelfItemState::kNotification))); ASSERT_TRUE( content::ExecuteScript(web_contents, "navigator.clearAppBadge();")); - browser_test_util::WaitForShelfItemState( - app_id, static_cast<uint32_t>(ShelfItemState::kActive)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app_id, static_cast<uint32_t>(ShelfItemState::kActive))); test::UninstallWebApp(profile(), app_id); - browser_test_util::WaitForShelfItemState( - app_id, static_cast<uint32_t>(ShelfItemState::kNormal)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app_id, static_cast<uint32_t>(ShelfItemState::kNormal))); } IN_PROC_BROWSER_TEST_F(LacrosWebAppShelfBrowserTest, RunningInTab) { @@ -156,8 +156,8 @@ auto& sync_bridge = WebAppProvider::GetForTest(profile())->sync_bridge(); Browser* app_browser1 = LaunchWebAppBrowser(profile(), app1_id); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kActive)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kActive))); waiter.PinOrUnpinItemInShelf(app1_id, /*pin=*/true); CloseAndWait(app_browser1); sync_bridge.SetAppUserDisplayMode(app1_id, UserDisplayMode::kBrowser, @@ -165,8 +165,8 @@ AppWindowModeWaiter(profile(), app1_id, apps::WindowMode::kBrowser).Await(); Browser* app_browser2 = LaunchWebAppBrowser(profile(), app2_id); - browser_test_util::WaitForShelfItemState( - app2_id, static_cast<uint32_t>(ShelfItemState::kActive)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app2_id, static_cast<uint32_t>(ShelfItemState::kActive))); waiter.PinOrUnpinItemInShelf(app2_id, /*pin=*/true); CloseAndWait(app_browser2); sync_bridge.SetAppUserDisplayMode(app2_id, UserDisplayMode::kBrowser, @@ -174,34 +174,34 @@ AppWindowModeWaiter(profile(), app2_id, apps::WindowMode::kBrowser).Await(); } - browser_test_util::WaitForShelfItemState( + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( app_constants::kLacrosAppId, - static_cast<uint32_t>(ShelfItemState::kActive)); + static_cast<uint32_t>(ShelfItemState::kActive))); test_controller->LaunchAppFromAppList(app1_id); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kActive)); - browser_test_util::WaitForShelfItemState( + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kActive))); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( app_constants::kLacrosAppId, - static_cast<uint32_t>(ShelfItemState::kRunning)); + static_cast<uint32_t>(ShelfItemState::kRunning))); test_controller->LaunchAppFromAppList(app2_id); - browser_test_util::WaitForShelfItemState( - app2_id, static_cast<uint32_t>(ShelfItemState::kActive)); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kRunning)); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app2_id, static_cast<uint32_t>(ShelfItemState::kActive))); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kRunning))); EXPECT_EQ(BrowserList::GetInstance()->size(), 1U); TabStripModel* tab_strip_model = browser()->tab_strip_model(); tab_strip_model->CloseWebContentsAt(tab_strip_model->active_index(), TabCloseTypes::CLOSE_NONE); - browser_test_util::WaitForShelfItemState( - app2_id, static_cast<uint32_t>(ShelfItemState::kNormal)); - browser_test_util::WaitForShelfItemState( - app1_id, static_cast<uint32_t>(ShelfItemState::kActive)); - browser_test_util::WaitForShelfItemState( + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app2_id, static_cast<uint32_t>(ShelfItemState::kNormal))); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( + app1_id, static_cast<uint32_t>(ShelfItemState::kActive))); + ASSERT_TRUE(browser_test_util::WaitForShelfItemState( app_constants::kLacrosAppId, - static_cast<uint32_t>(ShelfItemState::kRunning)); + static_cast<uint32_t>(ShelfItemState::kRunning))); test::UninstallWebApp(profile(), app1_id); test::UninstallWebApp(profile(), app2_id);
diff --git a/chrome/browser/ui/web_applications/share_to_target_browsertest.cc b/chrome/browser/ui/web_applications/share_to_target_browsertest.cc index d47caf6..86afb845 100644 --- a/chrome/browser/ui/web_applications/share_to_target_browsertest.cc +++ b/chrome/browser/ui/web_applications/share_to_target_browsertest.cc
@@ -113,7 +113,7 @@ #if BUILDFLAG(IS_CHROMEOS_LACROS) // Wait for item to stop existing in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); #endif // BUILDFLAG(IS_CHROMEOS_LACROS) }
diff --git a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc index 7427d24e..a4cc49ee 100644 --- a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc +++ b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.cc
@@ -85,6 +85,8 @@ return "OneDrive Unavailable"; case FallbackReason::kErrorOpeningWeb: return "Error opening web"; + case FallbackReason::kInvalidGoogleDocsURL: + return "Invalid Google Docs URL"; } }
diff --git a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h index cfa40ea4..9c53073 100644 --- a/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h +++ b/chrome/browser/ui/webui/ash/office_fallback/office_fallback_dialog.h
@@ -15,12 +15,14 @@ using DialogChoiceCallback = base::OnceCallback<void(const std::string& choice)>; -// The reason for why the user's file can't open +// The reason for why the user's file can't open. The enum should be consistent +// with the FallbackReason enum in office_fallback_dialog.ts. enum class FallbackReason { kOffline, kDriveUnavailable, kOneDriveUnavailable, kErrorOpeningWeb, + kInvalidGoogleDocsURL, }; // Defines the web dialog used to allow users to choose what to do when failing @@ -37,9 +39,8 @@ const std::u16string& task_title, DialogChoiceCallback callback); - // Receives user's fallback choice and runs callback. Does nothing - // if they chose `cancel`. - void OnDialogClosed(const std::string& json_retval) override; + // Receives user's dialog choice and runs callback. + void OnDialogClosed(const std::string& choice) override; ~OfficeFallbackDialog() override;
diff --git a/chrome/browser/ui/webui/intro/intro_ui.cc b/chrome/browser/ui/webui/intro/intro_ui.cc index f371058..7b4f596 100644 --- a/chrome/browser/ui/webui/intro/intro_ui.cc +++ b/chrome/browser/ui/webui/intro/intro_ui.cc
@@ -12,7 +12,6 @@ #include "chrome/grit/chrome_unscaled_resources.h" #include "chrome/grit/intro_resources.h" #include "chrome/grit/intro_resources_map.h" -#include "components/grit/components_resources.h" #include "components/signin/public/base/signin_buildflags.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui_data_source.h" @@ -58,9 +57,9 @@ AddStrings(source); - source->AddResourcePath("product-logo.png", IDR_PRODUCT_LOGO_128); + source->AddResourcePath("product-logo.svg", IDR_PRODUCT_LOGO_SVG); source->AddResourcePath("product-logo-animation.svg", - IDR_FIRST_RUN_PRODUCT_LOGO_ANIMATION); + IDR_PRODUCT_LOGO_ANIMATION_SVG); // Unretained ok: `this` owns the handler. web_ui->AddMessageHandler(std::make_unique<IntroHandler>(base::BindRepeating(
diff --git a/chrome/browser/ui/webui/password_manager/password_manager_ui.cc b/chrome/browser/ui/webui/password_manager/password_manager_ui.cc index 96d05ee4..ca0c39a 100644 --- a/chrome/browser/ui/webui/password_manager/password_manager_ui.cc +++ b/chrome/browser/ui/webui/password_manager/password_manager_ui.cc
@@ -8,6 +8,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/managed_ui_handler.h" #include "chrome/browser/ui/webui/plural_string_handler.h" +#include "chrome/browser/ui/webui/sanitized_image_source.h" #include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/url_constants.h" #include "chrome/common/webui_url_constants.h" @@ -17,6 +18,7 @@ #include "chrome/grit/password_manager_resources_map.h" #include "components/grit/components_scaled_resources.h" #include "components/password_manager/content/common/web_ui_constants.h" +#include "content/public/browser/url_data_source.h" #include "content/public/browser/web_ui_data_source.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -109,6 +111,8 @@ "compromisedPasswords", IDS_PASSWORD_MANAGER_UI_COMPROMISED_PASSWORDS_COUNT); plural_string_handler->AddLocalizedString( + "numberOfAccounts", IDS_PASSWORD_MANAGER_UI_NUMBER_OF_ACCOUNTS); + plural_string_handler->AddLocalizedString( "reusedPasswords", IDS_PASSWORD_MANAGER_UI_REUSED_PASSWORDS_COUNT); plural_string_handler->AddLocalizedString( "weakPasswords", IDS_PASSWORD_MANAGER_UI_WEAK_PASSWORDS_COUNT); @@ -125,6 +129,8 @@ AddPluralStrings(web_ui); ManagedUIHandler::Initialize(web_ui, source); content::WebUIDataSource::Add(profile, source); + content::URLDataSource::Add(profile, + std::make_unique<SanitizedImageSource>(profile)); } // static
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc index b111071..fb1fdf7 100644 --- a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc +++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc
@@ -114,6 +114,8 @@ IDS_PRIVACY_SANDBOX_DIALOG_M1_CONSENT_LEARN_MORE_BULLET_3}, {"m1ConsentLearnMoreLink", IDS_PRIVACY_SANDBOX_DIALOG_M1_CONSENT_LEARN_MORE_LINK}, + {"m1ConsentBannerImageA11yDescription", + IDS_PRIVACY_SANDBOX_DIALOG_M1_CONSENT_BANNER_IMAGE_A11Y_DESCRIPTION}, // Strings for the notice step of the combined dialog (kM1NoticeEEA). {"m1NoticeEeaTitle", IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_EEA_TITLE}, @@ -180,7 +182,8 @@ IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_ROW_LEARN_MORE_DESCRIPTION_5}, {"m1NoticeRowLearnMoreDescription6", IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_ROW_LEARN_MORE_DESCRIPTION_6}, - }; + {"m1NoticeRowBannerImageA11yDescription", + IDS_PRIVACY_SANDBOX_DIALOG_M1_NOTICE_ROW_BANNER_IMAGE_A11Y_DESCRIPTION}}; source->AddLocalizedStrings(kStrings);
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc index cae967e..688abd17 100644 --- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc +++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -41,9 +41,9 @@ const char kSyncBenefitBookmarksStringName[] = "syncConfirmationBookmarks"; const char kSyncBenefitAutofillStringName[] = "syncConfirmationAutofill"; -const char kSyncBenefitHistoryStringName[] = "syncConfirmationHistory"; -const char kSyncBenefitExtensionsAndMoreStringName[] = - "syncConfirmationExtensionsAndMore"; +const char kSyncBenefitExtensionsStringName[] = "syncConfirmationExtensions"; +const char kSyncBenefitHistoryAndMoreStringName[] = + "syncConfirmationHistoryAndMore"; SyncConfirmationHandler::SyncConfirmationHandler( Profile* profile, @@ -153,16 +153,16 @@ autofill.Set(kSyncBenefitIconNameKey, "signin:assignment-outline"); sync_benefits_list.Append(std::move(autofill)); - base::Value::Dict history; - history.Set(kSyncBenefitTitleKey, kSyncBenefitHistoryStringName); - history.Set(kSyncBenefitIconNameKey, "signin:devices"); - sync_benefits_list.Append(std::move(history)); + base::Value::Dict extensions; + extensions.Set(kSyncBenefitTitleKey, kSyncBenefitExtensionsStringName); + extensions.Set(kSyncBenefitIconNameKey, "signin:extension-outline"); + sync_benefits_list.Append(std::move(extensions)); - base::Value::Dict extensions_and_more; - extensions_and_more.Set(kSyncBenefitTitleKey, - kSyncBenefitExtensionsAndMoreStringName); - extensions_and_more.Set(kSyncBenefitIconNameKey, "signin:extension-outline"); - sync_benefits_list.Append(std::move(extensions_and_more)); + base::Value::Dict history_and_more; + history_and_more.Set(kSyncBenefitTitleKey, + kSyncBenefitHistoryAndMoreStringName); + history_and_more.Set(kSyncBenefitIconNameKey, "signin:devices"); + sync_benefits_list.Append(std::move(history_and_more)); ResolveJavascriptCallback(callback_id, sync_benefits_list); }
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.h b/chrome/browser/ui/webui/signin/sync_confirmation_handler.h index 17ed5ff..9879648 100644 --- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.h +++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.h
@@ -21,8 +21,8 @@ extern const char kSyncBenefitBookmarksStringName[]; extern const char kSyncBenefitAutofillStringName[]; -extern const char kSyncBenefitHistoryStringName[]; -extern const char kSyncBenefitExtensionsAndMoreStringName[]; +extern const char kSyncBenefitExtensionsStringName[]; +extern const char kSyncBenefitHistoryAndMoreStringName[]; // WebUI message handler for the sync confirmation dialog. IdentityManager calls // in this class use signin::ConsentLevel::kSignin because the user hasn't
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc b/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc index d14f47b8..2300635 100644 --- a/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc +++ b/chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
@@ -203,10 +203,10 @@ IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_BOOKMARKS); AddStringResource(source, kSyncBenefitAutofillStringName, IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_AUTOFILL); - AddStringResource(source, kSyncBenefitHistoryStringName, - IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY); - AddStringResource(source, kSyncBenefitExtensionsAndMoreStringName, - IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS_AND_MORE); + AddStringResource(source, kSyncBenefitExtensionsStringName, + IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_EXTENSIONS); + AddStringResource(source, kSyncBenefitHistoryAndMoreStringName, + IDS_SYNC_CONFIRMATION_TANGIBLE_SYNC_HISTORY_AND_MORE); source->AddResourcePath(illustration_path, illustration_id); source->AddResourcePath(illustration_dark_path, illustration_dark_id);
diff --git a/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc b/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc index 4470e13..76fc28e 100644 --- a/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc +++ b/chrome/browser/ui/webui/sync_internals/sync_internals_message_handler.cc
@@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" +#include "base/values.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/sync_invalidations_service_factory.h" #include "chrome/browser/sync/sync_service_factory.h" @@ -30,7 +31,6 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_ui.h" -using base::DictionaryValue; using syncer::SyncInvalidationsService; using syncer::SyncService;
diff --git a/chrome/browser/web_applications/app_service/lacros_web_apps_controller_lacros_browsertest.cc b/chrome/browser/web_applications/app_service/lacros_web_apps_controller_lacros_browsertest.cc index 0a4fb07d..54e489c1 100644 --- a/chrome/browser/web_applications/app_service/lacros_web_apps_controller_lacros_browsertest.cc +++ b/chrome/browser/web_applications/app_service/lacros_web_apps_controller_lacros_browsertest.cc
@@ -37,12 +37,12 @@ const AppId app_id = test_web_app_id(); // No item should exist in the shelf before the web app is launched. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); OpenTestWebApp(); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/true)); // Get the context menu. crosapi::mojom::TestControllerAsyncWaiter waiter( @@ -65,7 +65,7 @@ } // Wait for item to stop existing in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); } // Test that ShowSiteSettings() launches the Settings SWA. @@ -80,15 +80,17 @@ ChromePageInfoDelegate delegate(web_contents); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/true)); // Settings should not yet exist in the shelf. - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false)); delegate.ShowSiteSettings(web_contents->GetVisibleURL()); // Settings should now exist in the shelf. - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/true); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/true)); base::RunLoop run_loop; auto* const lacros_service = chromeos::LacrosService::Get(); @@ -101,13 +103,14 @@ run_loop.Run(); // Settings should no longer exist in the shelf. - browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false); + ASSERT_TRUE( + browser_test_util::WaitForShelfItem(kOsSettingsAppId, /*exists=*/false)); // Close app window. browser->window()->Close(); // Wait for item to stop existing in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); } IN_PROC_BROWSER_TEST_F(LacrosWebAppsControllerBrowserTest, AppList) { @@ -124,19 +127,19 @@ const AppId app_id = test_web_app_id(); // No item should exist in the shelf before the web app is launched. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); chromeos::LacrosService::Get() ->GetRemote<crosapi::mojom::TestController>() ->LaunchAppFromAppList(app_id); // Wait for item to exist in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/true); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/true)); web_app::test::UninstallWebApp(profile(), app_id); // Wait for item to stop existing in shelf. - browser_test_util::WaitForShelfItem(app_id, /*exists=*/false); + ASSERT_TRUE(browser_test_util::WaitForShelfItem(app_id, /*exists=*/false)); } } // namespace web_app
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 4f6ec9d..0892a87 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1669549650-6598eb29fcfb91dad48d9ee5e773f6c29cd7352b.profdata +chrome-linux-main-1669615051-a62915db538f95448f00ffe3abc7fcde21747b27.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index b8007eb..56c0f45b 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1669571358-d01977323f09d8d28f0f3c9ccf2c97503a805d0b.profdata +chrome-mac-arm-main-1669615051-bb724daa6abf68bfa3a50c85d741b9d639481833.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index a1a54da..aa72257 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1669571358-9da2b73142cfd008d73129732f93dc38d516e5df.profdata +chrome-mac-main-1669615051-00894e61795e40568251a2de8f8d33906a953dd3.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index ad98bb8b..d782c2e 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1669571358-656b157be17fa20aab34ec7bd995bf6abbb0579a.profdata +chrome-win32-main-1669615051-0b6b97b565ac9839455ce947911b4b85d230fa99.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 3fe1f0b..5bb5d1f 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1669582497-f9ae30ba96329a4ad8fc8b31b4f8b28721ef79b1.profdata +chrome-win64-main-1669615051-af71f4b1a7250aab9555b9647111f9962d90f3b1.profdata
diff --git a/chrome/common/extensions/api/file_manager_private.idl b/chrome/common/extensions/api/file_manager_private.idl index 67cd544..e13fb1ad 100644 --- a/chrome/common/extensions/api/file_manager_private.idl +++ b/chrome/common/extensions/api/file_manager_private.idl
@@ -94,7 +94,7 @@ enum FormatFileSystemType { vfat, exfat, ntfs }; // File transfer progress state. -enum TransferState { in_progress, completed, failed }; +enum TransferState { in_progress, queued, completed, failed }; // The response when starting installing a Linux package. enum InstallLinuxPackageResponse { @@ -655,9 +655,9 @@ boolean shouldNotify; }; -// Payload data for file transfer status updates. +// Payload data for aggregate file transfer status updates. dictionary FileTransferStatus { - // URL of file that is being transfered. + // URL of file that is being transferred. DOMString fileUrl; // File transfer progress state. @@ -680,6 +680,21 @@ boolean hideWhenZeroJobs; }; +// Information about the transfer status of an individual file. +dictionary IndividualFileTransferStatus { + // File that is being transferred. + [instanceOf=Entry] object entry; + + // File transfer progress state. + TransferState transferState; + + // Number of bytes transferred so far. + double processed; + + // Total size of the file in bytes. + double total; +}; + // Error during the drive sync. dictionary DriveSyncErrorEvent { // Error type. @@ -864,6 +879,9 @@ // VM that this event relates to. DOMString vmName; + // Name of the container this event relates to. + DOMString containerName; + // Paths that have been shared or unshared. [instanceOf=Entry] object[] entries; }; @@ -1787,6 +1805,10 @@ static void onPinTransfersUpdated(FileTransferStatus event); + static void onIndividualFileTransfersUpdated(IndividualFileTransferStatus[] event); + + static void onIndividualPinTransfersUpdated(IndividualFileTransferStatus[] event); + static void onDirectoryChanged(FileWatchEvent event); static void onPreferencesChanged();
diff --git a/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js b/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js index 31dd80bc..6c14eff 100644 --- a/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js +++ b/chrome/renderer/resources/extensions/file_manager_private_custom_bindings.js
@@ -429,3 +429,23 @@ } dispatch(args); }); + +bindingUtil.registerEventArgumentMassager( + 'fileManagerPrivate.onIndividualFileTransfersUpdated', + function(args, dispatch) { + // Convert the entry arguments into real Entry objects. + args[0].forEach(fileStatus => { + fileStatus.entry = GetExternalFileEntry(fileStatus.entry); + }) + dispatch(args); + }); + +bindingUtil.registerEventArgumentMassager( + 'fileManagerPrivate.onIndividualPinTransfersUpdated', + function(args, dispatch) { + // Convert the entry arguments into real Entry objects. + args[0].forEach(fileStatus => { + fileStatus.entry = GetExternalFileEntry(fileStatus.entry); + }) + dispatch(args); + });
diff --git a/chrome/test/data/webui/password_manager/BUILD.gn b/chrome/test/data/webui/password_manager/BUILD.gn index fe370e4..3cfc4f9 100644 --- a/chrome/test/data/webui/password_manager/BUILD.gn +++ b/chrome/test/data/webui/password_manager/BUILD.gn
@@ -29,6 +29,7 @@ "passwords_section_test.ts", "password_details_section_test.ts", "settings_section_test.ts", + "site_favicon_test.ts", "test_password_manager_proxy.ts", "test_prefs_browser_proxy.ts", "test_util.ts",
diff --git a/chrome/test/data/webui/password_manager/password_manager_browsertest.js b/chrome/test/data/webui/password_manager/password_manager_browsertest.js index 91971405..b96e31d4 100644 --- a/chrome/test/data/webui/password_manager/password_manager_browsertest.js +++ b/chrome/test/data/webui/password_manager/password_manager_browsertest.js
@@ -25,12 +25,13 @@ }; [['App', 'password_manager_app_test.js'], - ['SideBar', 'password_manager_side_bar_test.js'], - ['Settings', 'settings_section_test.js'], - ['Routing', 'password_manager_routing_test.js'], - ['PasswordDetails', 'password_details_section_test.js'], ['Checkup', 'checkup_section_test.js'], + ['PasswordDetails', 'password_details_section_test.js'], ['PasswordsSection', 'passwords_section_test.js'], + ['Routing', 'password_manager_routing_test.js'], + ['Settings', 'settings_section_test.js'], + ['SideBar', 'password_manager_side_bar_test.js'], + ['SiteFavicon', 'site_favicon_test.js'], ].forEach(test => registerTest(...test));
diff --git a/chrome/test/data/webui/password_manager/passwords_section_test.ts b/chrome/test/data/webui/password_manager/passwords_section_test.ts index c43d9ef..b353fe48 100644 --- a/chrome/test/data/webui/password_manager/passwords_section_test.ts +++ b/chrome/test/data/webui/password_manager/passwords_section_test.ts
@@ -4,10 +4,12 @@ import 'chrome://password-manager/password_manager.js'; -import {Page, PasswordManagerImpl, PasswordsSectionElement, Router} from 'chrome://password-manager/password_manager.js'; +import {Page, PasswordListItemElement, PasswordManagerImpl, PasswordsSectionElement, Router} from 'chrome://password-manager/password_manager.js'; +import {PluralStringProxyImpl} from 'chrome://resources/js/plural_string_proxy.js'; import {IronListElement} from 'chrome://resources/polymer/v3_0/iron-list/iron-list.js'; import {assertArrayEquals, assertDeepEquals, assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {flushTasks} from 'chrome://webui-test/polymer_test_util.js'; +import {TestPluralStringProxy} from 'chrome://webui-test/test_plural_string_proxy.js'; import {isVisible} from 'chrome://webui-test/test_util.js'; import {TestPasswordManagerProxy} from './test_password_manager_proxy.js'; @@ -37,11 +39,14 @@ suite('PasswordsSectionTest', function() { let passwordManager: TestPasswordManagerProxy; + let pluralString: TestPluralStringProxy; setup(function() { document.body.innerHTML = window.trustedTypes!.emptyHTML; passwordManager = new TestPasswordManagerProxy(); PasswordManagerImpl.setInstance(passwordManager); + pluralString = new TestPluralStringProxy(); + PluralStringProxyImpl.setInstance(pluralString); return flushTasks(); }); @@ -126,9 +131,50 @@ section.shadowRoot!.querySelector<HTMLElement>('password-list-item'); assertTrue(!!listEntry); listEntry.click(); + // Without setRequestCredentialsDetailsResponse auth is considered failed. assertArrayEquals( [0, 1], await passwordManager.whenCalled('requestCredentialsDetails')); assertEquals(Page.PASSWORDS, Router.getInstance().currentRoute.page); }); + + test('number of accounts is shown', async function() { + passwordManager.data.groups = [ + createCredentialGroup({ + name: 'test.com', + credentials: [createPasswordEntry({username: 'user', id: 0})], + }), + createCredentialGroup({ + name: 'test2.com', + credentials: [ + createPasswordEntry({username: 'user1', id: 1}), + createPasswordEntry({username: 'user2', id: 2}), + ], + }), + ]; + pluralString.text = '2 accounts'; + + const section: PasswordsSectionElement = + document.createElement('passwords-section'); + document.body.appendChild(section); + await passwordManager.whenCalled('getCredentialGroups'); + await pluralString.whenCalled('getPluralString'); + await flushTasks(); + + const listEntries = + section.shadowRoot!.querySelectorAll<PasswordListItemElement>( + 'password-list-item'); + assertEquals(2, listEntries.length); + + // Since there is only 1 PasswordUIEntry in the group number of accounts is + // missing. + assertFalse( + !!listEntries[0]!.shadowRoot!.querySelector('#numberOfAccounts')); + // For group with 2 PasswordUIEntries |numberOfAccounts| is visible. + const numberOfAccounts = + listEntries[1]!.shadowRoot!.querySelector('#numberOfAccounts'); + assertTrue(!!numberOfAccounts); + assertTrue(isVisible(numberOfAccounts)); + assertEquals(pluralString.text, numberOfAccounts.textContent!.trim()); + }); });
diff --git a/chrome/test/data/webui/password_manager/site_favicon_test.ts b/chrome/test/data/webui/password_manager/site_favicon_test.ts new file mode 100644 index 0000000..4712655c --- /dev/null +++ b/chrome/test/data/webui/password_manager/site_favicon_test.ts
@@ -0,0 +1,50 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'chrome://password-manager/password_manager.js'; + +import {SiteFaviconElement} from 'chrome://password-manager/password_manager.js'; +import {assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {eventToPromise, isVisible} from 'chrome://webui-test/test_util.js'; + +suite('SiteFaviconTest', function() { + let icon: SiteFaviconElement; + + setup(function() { + document.body.innerHTML = window.trustedTypes!.emptyHTML; + icon = document.createElement('site-favicon'); + document.body.appendChild(icon); + }); + + test('on successful download', async function() { + icon.domain = 'https://test.com'; + icon.url = 'chrome://resources/images/chrome_logo_dark.svg'; + await eventToPromise('site-favicon-loaded', icon); + + assertTrue(isVisible(icon.$.downloadedFavicon)); + assertFalse(isVisible(icon.$.favicon)); + }); + + test('on failed download', async function() { + icon.domain = 'https://test.com'; + icon.url = 'chrome://resources/images/invalid_url'; + await eventToPromise('site-favicon-error', icon); + + assertFalse(isVisible(icon.$.downloadedFavicon)); + assertTrue(isVisible(icon.$.favicon)); + }); + + test('url change', async function() { + icon.domain = 'https://test.com'; + icon.url = 'chrome://resources/images/chrome_logo_dark.svg'; + await eventToPromise('site-favicon-loaded', icon); + + assertTrue(isVisible(icon.$.downloadedFavicon)); + assertFalse(isVisible(icon.$.favicon)); + + icon.url = ''; + assertFalse(isVisible(icon.$.downloadedFavicon)); + assertTrue(isVisible(icon.$.favicon)); + }); +});
diff --git a/chrome/test/interaction/README.md b/chrome/test/interaction/README.md index 5372650f..90059a4 100644 --- a/chrome/test/interaction/README.md +++ b/chrome/test/interaction/README.md
@@ -171,13 +171,17 @@ ### Modifiers -A modifier wraps around a step and changes its behavior. Currently there is only one modifier: -- **InAnyContext** allows the modified verb to find an element by its identifier - outside the test's default `ElementContext`. It has no effect on some versions of - `EnsureNotPresent()`, and is not compatible with named elements or with some - specific verbs. Use sparingly. +A modifier wraps around a step or steps and change their behavior. -Example: +- **InAnyContext** allows the modified verb to find an element outside the test's default + `ElementContext`. Unlike the other modifiers, there are a number of limitations on its use: + - It should not be used with `FlushEvents`, `EnsureNotPresent`, or any `Activate`, + `Event`, or `Mouse` verbs. + - This is a shortcoming in the underlying framework that will be fixed in the future. + - It should not be used with named elements, which can already be found in any context. + - For unsupported verbs, it is best to either use `InSameContext()` or `InContext()` instead. + - Example: + ```cpp RunTestSequence( // This button might be in a different window! @@ -185,6 +189,31 @@ InAnyContext(CheckView(kMyButton, ensure_pressed))); ``` +- **InSameContext** allows the modified verb (or verbs) to find an element in the same context + as the previous step. + - Has no effect on `EnsureNotPresent()` when the `in_any_context` parameter is set to true. + - Example: +```cpp +RunTestSequence( + InAnyContext(WaitForShow(kMyButton)), + InSameContext(PressButton(kMyButton))); +``` + +- **InContext** allows the modified verb (or verbs) to execute in the specified context instead of + the default context for the sequence. + - Has no effect on `EnsureNotPresent()` when the `in_any_context` parameter is set to true. + - Example: + +```cpp +Browser* const incognito = CreateIncognitoBrowser(); +RunTestSequence( + /* Do stuff in primary browser context here */ + /* ... */ + InContext(incognito->window()->GetElementContext(), Steps( + PressButton(kAppMenuButton), + WaitForShow(kDownloadsMenuItemElementId)))); +``` + ### WebContents Instrumentation A feature of `InteractiveBrowserTestApi` that it borrows from
diff --git a/chrome/test/interaction/interactive_browser_test_interactive_uitest.cc b/chrome/test/interaction/interactive_browser_test_interactive_uitest.cc index c981b3c..35bcb7b 100644 --- a/chrome/test/interaction/interactive_browser_test_interactive_uitest.cc +++ b/chrome/test/interaction/interactive_browser_test_interactive_uitest.cc
@@ -153,6 +153,77 @@ ReleaseMouse()); } +// TODO(dfried): Handle widget activation issue on Mac that makes this test +// flaky. +#if BUILDFLAG(IS_MAC) +#define MAYBE_MouseToIncognitoWindowAndDoActionsInSameContext \ + DISABLED_MouseToIncognitoWindowAndDoActionsInSameContext +#else +#define MAYBE_MouseToIncognitoWindowAndDoActionsInSameContext \ + MouseToIncognitoWindowAndDoActionsInSameContext +#endif +IN_PROC_BROWSER_TEST_F(InteractiveBrowserTest, + MAYBE_MouseToIncognitoWindowAndDoActionsInSameContext) { + constexpr char kIncognitoAppMenuButton[] = "AppMenu"; + auto* const incognito = CreateIncognitoBrowser(); + + RunTestSequence( + NameView(kIncognitoAppMenuButton, + base::BindLambdaForTesting([incognito]() -> views::View* { + return BrowserView::GetBrowserViewForBrowser(incognito) + ->toolbar() + ->app_menu_button(); + })), + MoveMouseTo(kIncognitoAppMenuButton), InSameContext(ClickMouse()), + InSameContext(Steps( + SelectMenuItem(AppMenuModel::kDownloadsMenuItem), + WaitForHide(AppMenuModel::kDownloadsMenuItem), + // These two types of actions use PostTask() internally and bounce off + // the pivot element. Make sure they still work in a "InSameContext". + FlushEvents(), EnsureNotPresent(AppMenuModel::kDownloadsMenuItem), + // Make sure this picks up the correct button, since it was after a + // string of non-element-specific actions. + WithElement(kAppMenuButtonElementId, + base::BindOnce(base::BindLambdaForTesting( + [incognito](ui::TrackedElement* el) { + EXPECT_EQ(incognito->window()->GetElementContext(), + el->context()); + })))))); +} + +// TODO(dfried): Handle widget activation issue on Mac that makes this test +// flaky. +#if BUILDFLAG(IS_MAC) +#define MAYBE_MouseToIncognitoWindowAndDoActionsInSpecificContext \ + DISABLED_MouseToIncognitoWindowAndDoActionsInSpecificContext +#else +#define MAYBE_MouseToIncognitoWindowAndDoActionsInSpecificContext \ + MouseToIncognitoWindowAndDoActionsInSpecificContext +#endif +IN_PROC_BROWSER_TEST_F( + InteractiveBrowserTest, + MAYBE_MouseToIncognitoWindowAndDoActionsInSpecificContext) { + auto* const incognito = CreateIncognitoBrowser(); + + RunTestSequence(InContext( + incognito->window()->GetElementContext(), + Steps( + MoveMouseTo(kAppMenuButtonElementId), ClickMouse(), + SelectMenuItem(AppMenuModel::kDownloadsMenuItem), + WaitForHide(AppMenuModel::kDownloadsMenuItem), + // These two types of actions use PostTask() internally and bounce off + // the pivot element. Make sure they still work in a "InSameContext". + FlushEvents(), EnsureNotPresent(AppMenuModel::kDownloadsMenuItem), + // Make sure this picks up the correct button, since it was after a + // string of non-element-specific actions. + WithElement(kAppMenuButtonElementId, + base::BindOnce(base::BindLambdaForTesting( + [incognito](ui::TrackedElement* el) { + EXPECT_EQ(incognito->window()->GetElementContext(), + el->context()); + })))))); +} + IN_PROC_BROWSER_TEST_F(InteractiveBrowserTestUiTest, WebPageNavigateStateAndLocation) { const GURL url = embedded_test_server()->GetURL(kDocumentWithNamedElement);
diff --git a/chromeos/ash/components/drivefs/BUILD.gn b/chromeos/ash/components/drivefs/BUILD.gn index 80df8b15e..e703bb0 100644 --- a/chromeos/ash/components/drivefs/BUILD.gn +++ b/chromeos/ash/components/drivefs/BUILD.gn
@@ -79,6 +79,7 @@ "drivefs_bootstrap_unittest.cc", "drivefs_host_unittest.cc", "drivefs_http_client_unittest.cc", + "drivefs_pin_manager_unittest.cc", "drivefs_search_unittest.cc", "drivefs_session_unittest.cc", "sync_status_tracker_unittest.cc",
diff --git a/chromeos/ash/components/drivefs/drivefs_host.cc b/chromeos/ash/components/drivefs/drivefs_host.cc index 4107c6f3..0405cba 100644 --- a/chromeos/ash/components/drivefs/drivefs_host.cc +++ b/chromeos/ash/components/drivefs/drivefs_host.cc
@@ -16,6 +16,8 @@ #include "chromeos/ash/components/drivefs/drivefs_host_observer.h" #include "chromeos/ash/components/drivefs/drivefs_http_client.h" #include "chromeos/ash/components/drivefs/drivefs_search.h" +#include "chromeos/ash/components/drivefs/mojom/drivefs.mojom.h" +#include "chromeos/ash/components/drivefs/sync_status_tracker.h" #include "components/drive/drive_notification_manager.h" #include "components/drive/drive_notification_observer.h" #include "mojo/public/cpp/bindings/callback_helpers.h" @@ -131,12 +133,17 @@ } switch (event->state) { case mojom::ItemEvent::State::kQueued: + sync_status_tracker_->AddSyncStatusForPath(path, + SyncStatus::kQueued); + break; case mojom::ItemEvent::State::kInProgress: sync_status_tracker_->AddSyncStatusForPath(path, SyncStatus::kInProgress); break; case mojom::ItemEvent::State::kFailed: - // TODO(msalomao): Post a delayed task to remove the path. + // This state only comes through for failed downloads of pinned + // files. Other transfer failures are reported through the OnError() + // event. sync_status_tracker_->AddSyncStatusForPath(path, SyncStatus::kError); break; @@ -172,6 +179,14 @@ } void OnError(mojom::DriveErrorPtr error) override { + base::FilePath path = host_->GetMountPath(); + if (base::FilePath("/").AppendRelativePath(base::FilePath(error->path), + &path)) { + sync_status_tracker_->AddSyncStatusForPath(path, SyncStatus::kError); + } else { + LOG(ERROR) << "Failed to make path relative to drive root"; + } + if (!IsKnownEnumValue(error->type)) { return; }
diff --git a/chromeos/ash/components/drivefs/drivefs_host_unittest.cc b/chromeos/ash/components/drivefs/drivefs_host_unittest.cc index 678e9758..5e6a00c 100644 --- a/chromeos/ash/components/drivefs/drivefs_host_unittest.cc +++ b/chromeos/ash/components/drivefs/drivefs_host_unittest.cc
@@ -929,6 +929,14 @@ host_->GetSyncStatusForPath(host_->GetMountPath().Append("foo/bar")), SyncStatus::kInProgress); + delegate_->OnError( + mojom::DriveError::New(mojom::DriveError::Type::kCantUploadStorageFull, + base::FilePath("/foo/bar/filename.txt"))); + delegate_.FlushForTesting(); + EXPECT_EQ(host_->GetSyncStatusForPath( + host_->GetMountPath().Append("foo/bar/filename.txt")), + SyncStatus::kError); + auto fourth_status = mojom::SyncingStatus::New(); fourth_status->item_events.emplace_back( absl::in_place, 12, 34, "relative/path.txt",
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager.cc b/chromeos/ash/components/drivefs/drivefs_pin_manager.cc index 286392e..08ee781 100644 --- a/chromeos/ash/components/drivefs/drivefs_pin_manager.cc +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager.cc
@@ -4,8 +4,159 @@ #include "chromeos/ash/components/drivefs/drivefs_pin_manager.h" +#include "base/logging.h" +#include "base/system/sys_info.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" +#include "components/drive/file_errors.h" + namespace drivefs::pinning { -DriveFsPinManager::DriveFsPinManager(bool enabled) : enabled_(enabled) {} +namespace { -} // namespace drivefs::pinning \ No newline at end of file +mojom::QueryParametersPtr CreateMyDriveQuery(int32_t page_size) { + mojom::QueryParametersPtr query = mojom::QueryParameters::New(); + query->page_size = page_size; + query->query_kind = mojom::QueryKind::kRegular; + query->query_source = mojom::QueryParameters::QuerySource::kCloudOnly; + // TODO(b/259454320): The query.proto for this says the C++ clients don't + // handle `false` for this boolean, need to investigate if that is true or + // not. + query->available_offline = false; + query->shared_with_me = false; + return query; +} + +class FreeDiskSpaceImpl : public FreeDiskSpaceDelegate { + public: + FreeDiskSpaceImpl() = default; + + FreeDiskSpaceImpl(const FreeDiskSpaceImpl&) = delete; + FreeDiskSpaceImpl& operator=(const FreeDiskSpaceImpl&) = delete; + + ~FreeDiskSpaceImpl() override = default; + + void AmountOfFreeDiskSpace( + const base::FilePath& path, + base::OnceCallback<void(int64_t)> callback) override { + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&base::SysInfo::AmountOfFreeDiskSpace, path), + std::move(callback)); + } +}; + +} // namespace + +constexpr char kGCacheFolderName[] = "GCache"; + +DriveFsPinManager::DriveFsPinManager(bool enabled, + const base::FilePath& profile_path, + mojom::DriveFs* drivefs_interface) + : enabled_(enabled), + free_disk_space_(std::make_unique<FreeDiskSpaceImpl>()), + profile_path_(profile_path), // The GCache directory is located in the + // users profile path. + drivefs_interface_(drivefs_interface) {} + +DriveFsPinManager::DriveFsPinManager( + bool enabled, + const base::FilePath& profile_path, + mojom::DriveFs* drivefs_interface, + std::unique_ptr<FreeDiskSpaceDelegate> free_disk_space) + : DriveFsPinManager(enabled, profile_path, drivefs_interface) { + free_disk_space_ = std::move(free_disk_space); +} + +DriveFsPinManager::~DriveFsPinManager() = default; + +// TODO(b/259454320): Pass through a `base::RepeatingCallback` here to enable +// the callsite to receive progress updates. +void DriveFsPinManager::Start( + base::OnceCallback<void(PinError)> complete_callback) { + if (!enabled_) { + LOG(ERROR) << "The pin manager is not enabled"; + std::move(complete_callback).Run(PinError::kManagerDisabled); + return; + } + + VLOG(1) << "Starting to search for items to calculate required space"; + timer_.Begin(); + complete_callback_ = std::move(complete_callback); + + base::FilePath gcache_path(profile_path_.AppendASCII(kGCacheFolderName)); + + free_disk_space_->AmountOfFreeDiskSpace( + gcache_path, base::BindOnce(&DriveFsPinManager::OnFreeDiskSpaceRetrieved, + weak_ptr_factory_.GetWeakPtr())); +} + +void DriveFsPinManager::OnFreeDiskSpaceRetrieved(int64_t free_space) { + if (free_space == -1) { + LOG(ERROR) << "Error calculating free disk space"; + std::move(complete_callback_).Run(PinError::kErrorCalculatingFreeDiskSpace); + return; + } + + free_space_ = free_space; + + VLOG(1) << "Starting to search for items to calculate required space"; + // TODO(b/259454320): 50 is chosen arbitrarily, this needs to be updated as + // different batch sizes are experimented with. + mojom::QueryParametersPtr query = CreateMyDriveQuery(50); + drivefs_interface_->StartSearchQuery( + search_query_.BindNewPipeAndPassReceiver(), std::move(query)); + search_query_->GetNextPage( + base::BindOnce(&DriveFsPinManager::OnSearchResultForSizeCalculation, + weak_ptr_factory_.GetWeakPtr())); +} + +void DriveFsPinManager::OnSearchResultForSizeCalculation( + drive::FileError error, + absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items) { + if (error != drive::FILE_ERROR_OK) { + LOG(ERROR) << "Error retrieving search results for size calculation: " + << error; + std::move(complete_callback_).Run(PinError::kErrorRetrievingSearchResults); + return; + } + + if (!items.has_value()) { + LOG(ERROR) << "Items returned are invalid"; + std::move(complete_callback_).Run(PinError::kErrorResultsReturnedInvalid); + return; + } + + if (items.value().size() == 0) { + VLOG(1) << "Iterated all files and calculated " << size_required_ + << " bytes required with " << free_space_ << " bytes available in " + << timer_.Elapsed().InMilliseconds() << "ms"; + std::move(complete_callback_).Run(PinError::kSuccess); + return; + } + + for (const auto& item : items.value()) { + if (item->metadata->pinned) { + VLOG(1) << "Item is already pinned, ignoring in space calculation"; + continue; + } + size_required_ += item->metadata->size; + } + + // TODO(b/259454320): This should really not use up all free space but instead + // include a buffer threshold. Update this once the thresholds have been + // identified. + if (size_required_ >= free_space_) { + LOG(ERROR) << "The required size (" << size_required_ + << " bytes) exceeds the available free space (" << free_space_ + << "bytes)"; + std::move(complete_callback_).Run(PinError::kErrorNotEnoughFreeSpace); + return; + } + + search_query_->GetNextPage( + base::BindOnce(&DriveFsPinManager::OnSearchResultForSizeCalculation, + weak_ptr_factory_.GetWeakPtr())); +} + +} // namespace drivefs::pinning
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager.h b/chromeos/ash/components/drivefs/drivefs_pin_manager.h index 0096c0a..349d420 100644 --- a/chromeos/ash/components/drivefs/drivefs_pin_manager.h +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager.h
@@ -5,10 +5,47 @@ #ifndef CHROMEOS_ASH_COMPONENTS_DRIVEFS_DRIVEFS_PIN_MANAGER_H_ #define CHROMEOS_ASH_COMPONENTS_DRIVEFS_DRIVEFS_PIN_MANAGER_H_ +#include <vector> + #include "base/component_export.h" +#include "base/functional/callback.h" +#include "base/memory/raw_ptr.h" +#include "base/memory/weak_ptr.h" +#include "base/timer/elapsed_timer.h" +#include "chromeos/ash/components/drivefs/mojom/drivefs.mojom.h" +#include "components/drive/file_errors.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace drivefs::pinning { +// Constant representing the GCache folder name. +extern const char kGCacheFolderName[]; + +// Errors that are returned via the completion callback that indicate either +// which stage the failure was at or whether the initial setup was a success. +enum class PinError { + kSuccess = 0, + kManagerDisabled = 1, + kErrorCalculatingFreeDiskSpace = 2, + kErrorRetrievingSearchResults = 3, + kErrorResultsReturnedInvalid = 4, + kErrorNotEnoughFreeSpace = 5, +}; + +// A delegate to aid in mocking the free disk scenarios for testing, in non-test +// scenarios this simply calls `base::SysInfo::AmountOfFreeDiskSpace`. +class FreeDiskSpaceDelegate { + public: + // Invokes the `base::SysInfo::AmountOfFreeDiskSpace` method on a blocking + // thread. + virtual void AmountOfFreeDiskSpace( + const base::FilePath& path, + base::OnceCallback<void(int64_t)> callback) = 0; + + virtual ~FreeDiskSpaceDelegate() = default; +}; + // Manages bulk pinning of items via DriveFS. This class handles the following: // - Manage batching of pin actions to avoid sending too many events at once. // - Ensure disk space is not being exceeded whilst pinning files. @@ -17,20 +54,55 @@ // bulk pinning event). class COMPONENT_EXPORT(CHROMEOS_ASH_COMPONENTS_DRIVEFS) DriveFsPinManager { public: - explicit DriveFsPinManager(bool enabled); + DriveFsPinManager(bool enabled, + const base::FilePath& profile_path, + mojom::DriveFs* drivefs_interface); + DriveFsPinManager(bool enabled, + const base::FilePath& profile_path, + mojom::DriveFs* drivefs_interface, + std::unique_ptr<FreeDiskSpaceDelegate> free_disk_space); DriveFsPinManager(const DriveFsPinManager&) = delete; DriveFsPinManager& operator=(const DriveFsPinManager&) = delete; - ~DriveFsPinManager() = default; + ~DriveFsPinManager(); // Enable or disable the bulk pinning. void SetBulkPinningEnabled(bool enabled) { enabled_ = enabled; } + // Start up the manager, which will first search for any unpinned items and + // pin them (within the users My drive) then turn to a "monitoring" phase + // which will ensure any new files created and switched to pinned state + // automatically. The complete callback will be called once the initial + // pinning has completed. + void Start(base::OnceCallback<void(PinError)> complete_callback); + private: + // Invoked on retrieval of available space in the `~/GCache` directory. + void OnFreeDiskSpaceRetrieved(int64_t free_space); + + // Once the free disk space has been retrieved, this method will be invoked + // after every batch of searches to Drive complete. This is required as the + // user may already have files pinned (which the `GetQuotaUsage` will include + // in it's calculation). + void OnSearchResultForSizeCalculation( + drive::FileError error, + absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items); + bool enabled_ = false; + int64_t size_required_ = 0; + int64_t free_space_ = 0; + base::OnceCallback<void(PinError)> complete_callback_; + std::unique_ptr<FreeDiskSpaceDelegate> free_disk_space_; + + base::FilePath profile_path_; + raw_ptr<mojom::DriveFs> drivefs_interface_; + mojo::Remote<mojom::SearchQuery> search_query_; + base::ElapsedTimer timer_; + + base::WeakPtrFactory<DriveFsPinManager> weak_ptr_factory_{this}; }; } // namespace drivefs::pinning -#endif // CHROMEOS_ASH_COMPONENTS_DRIVEFS_DRIVEFS_PIN_MANAGER_H_ \ No newline at end of file +#endif // CHROMEOS_ASH_COMPONENTS_DRIVEFS_DRIVEFS_PIN_MANAGER_H_
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc b/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc new file mode 100644 index 0000000..85f0b0e --- /dev/null +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc
@@ -0,0 +1,277 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/ash/components/drivefs/drivefs_pin_manager.h" + +#include <memory> + +#include "base/files/file_path.h" +#include "base/files/scoped_temp_dir.h" +#include "base/notreached.h" +#include "base/run_loop.h" +#include "base/test/gmock_callback_support.h" +#include "base/test/mock_callback.h" +#include "base/test/task_environment.h" +#include "chromeos/ash/components/drivefs/mojom/drivefs.mojom-forward.h" +#include "chromeos/ash/components/drivefs/mojom/drivefs.mojom-test-utils.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace drivefs::pinning { + +namespace { + +using ::base::test::RunClosure; +using ::base::test::RunOnceCallback; +using ::testing::_; +using ::testing::DoAll; +using ::testing::Return; + +// Shorthand way to represent drive files with the information that is relevant +// for the pinning manager. +struct DriveItem { + int64_t size; + bool pinned; +}; + +// An action that takes a `std::vector<DriveItem>` and is used to update the +// items that are returned via the `GetNextPage` callback. These shorthand items +// are converted to mojo types that represent the actual types returned. +// NOTE: `arg0` in the below represents the pointer passed via parameters to the +// `MOCK_METHOD` of `OnGetNextPage`. +ACTION_P(PopulateSearchItems, drive_items) { + std::vector<mojom::QueryItemPtr> items; + for (const auto& item : drive_items) { + items.emplace_back(mojom::QueryItem::New()); + items.back()->metadata = mojom::FileMetadata::New(); + items.back()->metadata->capabilities = mojom::Capabilities::New(); + items.back()->metadata->size = item.size; + items.back()->metadata->pinned = item.pinned; + } + *arg0 = std::move(items); +} + +// An action that populates no search results. This is required as the final +// `GetNextPage` query will return 0 items and this ensures the `MOCK_METHOD` +// returns the appropriate type (instead of `absl::nullopt`). +ACTION(PopulateNoSearchItems) { + std::vector<mojom::QueryItemPtr> items; + *arg0 = std::move(items); +} + +class MockDriveFs : public mojom::DriveFsInterceptorForTesting, + public mojom::SearchQuery { + public: + MockDriveFs() = default; + + MockDriveFs(const MockDriveFs&) = delete; + MockDriveFs& operator=(const MockDriveFs&) = delete; + + mojom::DriveFs* GetForwardingInterface() override { + NOTREACHED(); + return nullptr; + } + + MOCK_METHOD(void, OnStartSearchQuery, (const mojom::QueryParameters&)); + + void StartSearchQuery(mojo::PendingReceiver<mojom::SearchQuery> receiver, + mojom::QueryParametersPtr query_params) override { + search_receiver_.reset(); + OnStartSearchQuery(*query_params); + search_receiver_.Bind(std::move(receiver)); + } + + MOCK_METHOD(drive::FileError, + OnGetNextPage, + (absl::optional<std::vector<mojom::QueryItemPtr>> * items)); + + void GetNextPage(GetNextPageCallback callback) override { + absl::optional<std::vector<mojom::QueryItemPtr>> items; + auto error = OnGetNextPage(&items); + std::move(callback).Run(error, std::move(items)); + } + + private: + mojo::Receiver<mojom::SearchQuery> search_receiver_{this}; +}; + +class MockFreeDiskSpaceImpl : public FreeDiskSpaceDelegate { + public: + MockFreeDiskSpaceImpl() = default; + + MockFreeDiskSpaceImpl(const MockFreeDiskSpaceImpl&) = delete; + MockFreeDiskSpaceImpl& operator=(const MockFreeDiskSpaceImpl&) = delete; + + ~MockFreeDiskSpaceImpl() override = default; + + MOCK_METHOD(void, + AmountOfFreeDiskSpace, + (const base::FilePath&, base::OnceCallback<void(int64_t)>), + (override)); +}; + +class DriveFsPinManagerTest : public testing::Test { + public: + DriveFsPinManagerTest() = default; + + DriveFsPinManagerTest(const DriveFsPinManagerTest&) = delete; + DriveFsPinManagerTest& operator=(const DriveFsPinManagerTest&) = delete; + + protected: + void SetUp() override { + ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); + + gcache_dir_ = temp_dir_.GetPath().Append("GCache"); + } + + base::test::TaskEnvironment task_environment_; + base::ScopedTempDir temp_dir_; + base::FilePath gcache_dir_; + MockDriveFs mock_drivefs_; +}; + +TEST_F(DriveFsPinManagerTest, DisabledPinManagerShouldNotStartSearching) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(0); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)).Times(0); + EXPECT_CALL(mock_callback, Run(PinError::kManagerDisabled)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(_, _)).Times(0); + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/false, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +TEST_F(DriveFsPinManagerTest, OnFreeDiskSpaceFailingShouldNotSearchDrive) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(0); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)).Times(0); + EXPECT_CALL(mock_callback, Run(PinError::kErrorCalculatingFreeDiskSpace)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(gcache_dir_, _)) + .WillOnce(RunOnceCallback<1>(-1)); + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/true, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +TEST_F(DriveFsPinManagerTest, DriveReturningAnErrorShouldFail) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(1); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)) + .WillOnce(DoAll(PopulateNoSearchItems(), + Return(drive::FileError::FILE_ERROR_FAILED))); + EXPECT_CALL(mock_callback, Run(PinError::kErrorRetrievingSearchResults)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(gcache_dir_, _)) + .WillOnce(RunOnceCallback<1>(1024)); // 1 MB. + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/true, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +TEST_F(DriveFsPinManagerTest, DriveReturnedSuccessButInvalidResultsShouldFail) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(1); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)) + .WillOnce(Return(drive::FileError::FILE_ERROR_OK)); + EXPECT_CALL(mock_callback, Run(PinError::kErrorResultsReturnedInvalid)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(gcache_dir_, _)) + .WillOnce(RunOnceCallback<1>(1024)); // 1 MB. + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/true, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +TEST_F(DriveFsPinManagerTest, IfPinnedItemSizeExceedsFreeDiskSpaceShouldFail) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + // Mock Drive search to return 2 unpinned files that total to 1.5 MB which + // exceeds the mocked available space of 1 MB. + std::vector<DriveItem> expected_drive_items = {{.size = 768}, {.size = 768}}; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(1); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)) + .WillOnce(DoAll(PopulateSearchItems(expected_drive_items), + Return(drive::FileError::FILE_ERROR_OK))); + EXPECT_CALL(mock_callback, Run(PinError::kErrorNotEnoughFreeSpace)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(gcache_dir_, _)) + .WillOnce(RunOnceCallback<1>(1024)); // 1 MB. + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/true, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +TEST_F(DriveFsPinManagerTest, OnlyUnpinnedItemsContributeToTheRequiredSpace) { + base::MockOnceCallback<void(PinError)> mock_callback; + auto mock_free_disk_space = std::make_unique<MockFreeDiskSpaceImpl>(); + + base::RunLoop run_loop; + + // Mock Drive search to return 4 files of which the total will exceed the + // mocked available space of 1MB, however, 3 of them are pinned so this should + // not be a problem still pinning the remaining. + std::vector<DriveItem> expected_drive_items = {{.size = 768}, + {.size = 768, .pinned = true}, + {.size = 768, .pinned = true}, + {.size = 768, .pinned = true}}; + + EXPECT_CALL(mock_drivefs_, OnStartSearchQuery(_)).Times(1); + EXPECT_CALL(mock_drivefs_, OnGetNextPage(_)) + .WillOnce(DoAll(PopulateSearchItems(expected_drive_items), + Return(drive::FileError::FILE_ERROR_OK))) + .WillOnce(DoAll(PopulateNoSearchItems(), + Return(drive::FileError::FILE_ERROR_OK))); + EXPECT_CALL(mock_callback, Run(PinError::kSuccess)) + .WillOnce(RunClosure(run_loop.QuitClosure())); + EXPECT_CALL(*mock_free_disk_space, AmountOfFreeDiskSpace(gcache_dir_, _)) + .WillOnce(RunOnceCallback<1>(1024)); // 1 MB. + + auto manager = std::make_unique<DriveFsPinManager>( + /*enabled=*/true, temp_dir_.GetPath(), &mock_drivefs_, + std::move(mock_free_disk_space)); + manager->Start(mock_callback.Get()); + run_loop.Run(); +} + +} // namespace + +} // namespace drivefs::pinning
diff --git a/chromeos/ash/components/drivefs/sync_status_tracker.h b/chromeos/ash/components/drivefs/sync_status_tracker.h index 4928613a..4fb50b3 100644 --- a/chromeos/ash/components/drivefs/sync_status_tracker.h +++ b/chromeos/ash/components/drivefs/sync_status_tracker.h
@@ -20,6 +20,7 @@ enum SyncStatus { kNotFound, kInProgress, + kQueued, kError, };
diff --git a/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom b/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom index b0bc0ca..4e6bcbb 100644 --- a/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom +++ b/chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom
@@ -1192,7 +1192,7 @@ // The info related to usb. // -// NextMinVersion: 2, NextIndex: 7 +// NextMinVersion: 3, NextIndex: 9 [Stable] struct UsbBusInfo { // These fields can be used to classify / identify the usb devices. See the @@ -1209,6 +1209,11 @@ array<UsbBusInterfaceInfo> interfaces@5; // The firmware version obtained from fwupd. [MinVersion=1] FwupdFirmwareVersionInfo? fwupd_firmware_version_info@6; + // The recognized usb version. It may not be the highest USB version supportrd + // by the hardware. + [MinVersion=2] UsbVersion version@7; + // The spec usb speed. + [MinVersion=2] UsbSpecSpeed spec_speed@8; }; // The info related to firmware version obtained from fwupd. @@ -1258,6 +1263,55 @@ kHex = 13, }; +// An enumeration of the usb version. +// +// NextMinVersion: 1, NextIndex: 5 +[Stable, Extensible] +enum UsbVersion { + // This is for mojo compatibility between two versions. It won't be used in + // our code base. + [Default] kUnmappedEnumField = 0, + // Can't determine the usb version. + kUnknown = 1, + // Usb 1. + kUsb1 = 2, + // Usb 2. + kUsb2 = 3, + // Usb 3. + kUsb3 = 4, +}; + +// An enumeration of the usb spec speed in Mbps. +// Source: +// - https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-usb +// - https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-bus-usb +// - https://en.wikipedia.org/wiki/USB +// +// NextMinVersion: 1, NextIndex: 9 +[Stable, Extensible] +enum UsbSpecSpeed { + // This is for mojo compatibility between two versions. It won't be used in + // our code base. + [Default] kUnmappedEnumField = 0, + // Unknown speed. + kUnknown = 1, + // Low speed. + k1_5Mbps = 2, + // Full speed. + k12Mbps = 3, + // Deprecate. Should be a typo in + // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-usb. + kDeprecateSpeed = 4, + // High Speed. + k480Mbps = 5, + // Super Speed. + k5Gbps = 6, + // Super Speed+. + k10Gbps = 7, + // Super Speed+ Gen 2x2. + k20Gbps = 8, +}; + // The info related to usb interfaces. // // NextMinVersion: 1, NextIndex: 5
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 700da2c..9059de2 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -466,6 +466,11 @@ // Returns a prediction whether the form that contains |username_element| and // |password_element| will be ready for submission after filling these two // elements. +// TODO(crbug/1393271): Consider to reduce |SubmissionReadinessState| to a +// boolean value (ready or not). The non-binary state is not needed for +// auto-submission (crbug.com/1283004), but showing TTF proactively +// (crbug.com/1393043) may need to check whether or not a given form comprises +// only two fields. mojom::SubmissionReadinessState CalculateSubmissionReadiness( const FormData& form_data, WebInputElement& username_element,
diff --git a/components/autofill/core/browser/autofill_profile_import_process.cc b/components/autofill/core/browser/autofill_profile_import_process.cc index 7e014c5..7918761 100644 --- a/components/autofill/core/browser/autofill_profile_import_process.cc +++ b/components/autofill/core/browser/autofill_profile_import_process.cc
@@ -10,6 +10,7 @@ #include "components/autofill/core/browser/metrics/autofill_metrics.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/common/autofill_clock.h" +#include "components/autofill/core/common/autofill_features.h" namespace autofill { @@ -100,10 +101,10 @@ int number_of_unchanged_profiles = 0; - // TODO(crbug.com/1348294): Consider `kAccount` profiles to detect duplicates. + // We don't offer an import if `observed_profile_` is a duplicate of an + // existing profile. For `kAccount` profiles, only silent updates are allowed. const std::vector<AutofillProfile*> existing_profiles = - personal_data_manager_->GetProfilesFromSource( - AutofillProfile::Source::kLocalOrSyncable); + personal_data_manager_->GetProfiles(); // If we have reason to believe that the country was complemented incorrectly, // remove it. @@ -136,14 +137,16 @@ continue; } - // At this point, the observed profile was merged with the existing profile - // which changed in some way. + // At this point, the observed profile was merged with (a copy of) the + // existing profile which changed in some way. // Now, determine if the merge alters any settings-visible value, or if the // merge can be considered as a silent update that does not need to get // user confirmation. + // Setting-visible updates are not offered for `kAccount` profiles. if (AutofillProfileComparator::ProfilesHaveDifferentSettingsVisibleValues( *existing_profile, merged_profile, app_locale_)) { - if (allow_only_silent_updates_) { + if (allow_only_silent_updates_ || + existing_profile->source() == AutofillProfile::Source::kAccount) { ++number_of_unchanged_profiles; continue; } @@ -175,8 +178,12 @@ } // If the profile changed but all settings-visible values are maintained, // the profile can be updated silently. - merged_profile.set_modification_date(AutofillClock::Now()); - updated_profiles_.emplace_back(merged_profile); + if (existing_profile->source() == + AutofillProfile::Source::kLocalOrSyncable || + features::kAutofillEnableSilentUpdatesForAccountProfiles.Get()) { + merged_profile.set_modification_date(AutofillClock::Now()); + updated_profiles_.emplace_back(merged_profile); + } } // If the profile is not mergeable with an existing profile, the import
diff --git a/components/autofill/core/browser/autofill_profile_import_process_unittest.cc b/components/autofill/core/browser/autofill_profile_import_process_unittest.cc index cdb8b3fc..2e2f092f4 100644 --- a/components/autofill/core/browser/autofill_profile_import_process_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_import_process_unittest.cc
@@ -271,6 +271,103 @@ distinct_existing_profile)); } +// Tests that importing a profile that is an exact duplicate of a kAccount +// profile is rejected as a duplicate. +TEST_F(AutofillProfileImportProcessTest, ImportDuplicateProfile_kAccount) { + AutofillProfile account_profile = test::StandardProfile(); + account_profile.set_source_for_testing(AutofillProfile::Source::kAccount); + std::vector<AutofillProfile> existing_profiles = {account_profile}; + personal_data_manager_.SetProfiles(&existing_profiles); + + ProfileImportProcess import_data( + /*observed_profile=*/test::StandardProfile(), "en_US", url_, + &personal_data_manager_, + /*allow_only_silent_updates=*/false); + + EXPECT_EQ(import_data.import_type(), + AutofillProfileImportType::kDuplicateImport); + import_data.AcceptWithoutPrompt(); + EXPECT_FALSE(import_data.ProfilesChanged()); + EXPECT_THAT(import_data.GetResultingProfiles(), + testing::ElementsAreArray(existing_profiles)); +} + +// Tests that importing a profile that is a subset of a kAccount profile is +// rejected as a duplicate. +TEST_F(AutofillProfileImportProcessTest, ImportSubsetProfile_kAccount) { + AutofillProfile account_profile = test::StandardProfile(); + account_profile.set_source_for_testing(AutofillProfile::Source::kAccount); + std::vector<AutofillProfile> existing_profiles = {account_profile}; + personal_data_manager_.SetProfiles(&existing_profiles); + + ProfileImportProcess import_data( + /*observed_profile=*/test::SubsetOfStandardProfile(), "en_US", url_, + &personal_data_manager_, + /*allow_only_silent_updates=*/false); + + EXPECT_EQ(import_data.import_type(), + AutofillProfileImportType::kDuplicateImport); + import_data.AcceptWithoutPrompt(); + EXPECT_FALSE(import_data.ProfilesChanged()); + EXPECT_THAT(import_data.GetResultingProfiles(), + testing::ElementsAreArray(existing_profiles)); +} + +// Tests that importing a profile that is a superset of a kAccount profile is +// rejected as a duplicate. +TEST_F(AutofillProfileImportProcessTest, ImportSupersetProfile_kAccount) { + AutofillProfile account_profile = test::SubsetOfStandardProfile(); + account_profile.set_source_for_testing(AutofillProfile::Source::kAccount); + std::vector<AutofillProfile> existing_profiles = {account_profile}; + personal_data_manager_.SetProfiles(&existing_profiles); + + ProfileImportProcess import_data( + /*observed_profile=*/test::StandardProfile(), "en_US", url_, + &personal_data_manager_, + /*allow_only_silent_updates=*/false); + + EXPECT_EQ(import_data.import_type(), + AutofillProfileImportType::kDuplicateImport); + import_data.AcceptWithoutPrompt(); + EXPECT_FALSE(import_data.ProfilesChanged()); + EXPECT_THAT(import_data.GetResultingProfiles(), + testing::ElementsAreArray(existing_profiles)); +} + +// Tests that an import can cause a silent update of a `kAccount` profile, if +// the feature parameter is enabled. +TEST_F(AutofillProfileImportProcessTest, ImportSilentUpdate_kAccount) { + base::test::ScopedFeatureList feature; + feature.InitAndEnableFeatureWithParameters( + features::kAutofillAccountProfilesUnionView, + {{features::kAutofillEnableSilentUpdatesForAccountProfiles.name, + "true"}}); + + AutofillProfile account_profile = test::UpdateableStandardProfile(); + account_profile.set_source_for_testing(AutofillProfile::Source::kAccount); + std::vector<AutofillProfile> existing_profiles = {account_profile}; + personal_data_manager_.SetProfiles(&existing_profiles); + + // The `observed_profile` is of type `kLocalOrSyncable`. This should not + // prevent silent-updating a `kAccount` profile. + ProfileImportProcess import_data( + /*observed_profile=*/test::StandardProfile(), "en_US", url_, + &personal_data_manager_, + /*allow_only_silent_updates=*/true); + + EXPECT_EQ(import_data.import_type(), + AutofillProfileImportType::kSilentUpdateForIncompleteProfile); + import_data.AcceptWithoutPrompt(); + EXPECT_TRUE(import_data.ProfilesChanged()); + // Expect that the existing profiles was updated to the standard profile, + // while maintaining it's `kAccount` status. + AutofillProfile expected_profile = test::StandardProfile(); + expected_profile.set_source_for_testing(AutofillProfile::Source::kAccount); + expected_profile.set_guid(account_profile.guid()); + EXPECT_THAT(import_data.GetResultingProfiles(), + testing::ElementsAre(expected_profile)); +} + // Tests the accepted import of a profile that is mergeable with an already // existing profile. TEST_F(AutofillProfileImportProcessTest, MergeWithExistingProfile_Accepted) {
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc index 1bc9837..66f56dc 100644 --- a/components/autofill/core/browser/personal_data_manager.cc +++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -387,10 +387,6 @@ database_helper_->SetUseAccountStorageForServerData( sync_service && !sync_service_->IsSyncFeatureEnabled()); } - -#if BUILDFLAG(IS_CHROMEOS_ASH) - MigrateUserOptedInWalletSyncTransportIfNeeded(); -#endif } void PersonalDataManager::OnURLsDeleted( @@ -2437,70 +2433,6 @@ pending_offer_data_query_ != 0; } -#if BUILDFLAG(IS_CHROMEOS_ASH) -void PersonalDataManager::MigrateUserOptedInWalletSyncTransportIfNeeded() { - if (!sync_service_) - return; - - CoreAccountInfo primary_account = sync_service_->GetAccountInfo(); - if (primary_account.IsEmpty()) - return; - - if (identity_manager_->GetAccountIdMigrationState() == - signin::IdentityManager::MIGRATION_NOT_STARTED) { - return; - } - - CoreAccountId primary_account_id = primary_account.account_id; - - // When migration is started or done, the primary account is created from a - // Gaia ID. - if (primary_account_id.IsEmail()) { - DLOG(ERROR) << "Unexpected primary account id from an email [" - << primary_account_id << "]."; - base::UmaHistogramEnumeration( - "Autofill.MigrateUserOptedInToWalletSync", - MigrateUserOptedInWalletSyncType:: - kNotMigratedUnexpectedPrimaryAccountIdWithEmail); - return; - } - - CoreAccountId legacy_account_id_from_email = - CoreAccountId::FromEmail(gaia::CanonicalizeEmail(primary_account.email)); - - MigrateUserOptedInWalletSyncType migrate = - prefs::IsUserOptedInWalletSyncTransport(pref_service_, - legacy_account_id_from_email) - ? MigrateUserOptedInWalletSyncType::kMigratedFromCanonicalEmail - : MigrateUserOptedInWalletSyncType::kNotMigrated; - - if (migrate == MigrateUserOptedInWalletSyncType::kNotMigrated && - prefs::IsUserOptedInWalletSyncTransport( - pref_service_, CoreAccountId::FromEmail(primary_account.email))) { - // Only canonicalized emails should be used to create CoreAccountId objects - // by the IdentityManager. Be overly caution and also check whether - // the non-canonical email was used when the user opted in to wallet sync. - legacy_account_id_from_email = - CoreAccountId::FromEmail(primary_account.email); - migrate = MigrateUserOptedInWalletSyncType::kMigratedFromNonCanonicalEmail; - } - - base::UmaHistogramEnumeration("Autofill.MigrateUserOptedInToWalletSync", - migrate); - - if (migrate == MigrateUserOptedInWalletSyncType::kNotMigrated) - return; - - DCHECK(prefs::IsUserOptedInWalletSyncTransport(pref_service_, - legacy_account_id_from_email)); - prefs::SetUserOptedInWalletSyncTransport(pref_service_, - legacy_account_id_from_email, - /*opted_in=*/false); - prefs::SetUserOptedInWalletSyncTransport(pref_service_, primary_account_id, - /*opted_in=*/true); -} -#endif - bool PersonalDataManager::IsSyncEnabledFor(syncer::ModelType model_type) { return sync_service_ != nullptr && sync_service_->CanSyncFeatureStart() && sync_service_->GetPreferredDataTypes().Has(model_type);
diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index 93fe1595..9c57b3c 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h
@@ -846,12 +846,6 @@ // Returns if there are any pending queries to the web database. bool HasPendingQueries(); -#if BUILDFLAG(IS_CHROMEOS_ASH) - // Migrates the user opted in to wallet sync transport. This is needed while - // migrating from using email to Gaia ID as th account identifier. - void MigrateUserOptedInWalletSyncTransportIfNeeded(); -#endif - // Returns true if the sync is enabled for |model_type|. bool IsSyncEnabledFor(syncer::ModelType model_type);
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc index 787ce1c..99a5ba7b 100644 --- a/components/autofill/core/browser/personal_data_manager_unittest.cc +++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -403,19 +403,6 @@ void TearDown() override { TearDownTest(); } }; -#if BUILDFLAG(IS_CHROMEOS_ASH) -class PersonalDataManagerMigrationTest : public PersonalDataManagerHelper, - public testing::Test { - public: - PersonalDataManagerMigrationTest() - : PersonalDataManagerHelper({::switches::kAccountIdMigration}) {} - - protected: - void SetUp() override { SetUpTest(); } - void TearDown() override { TearDownTest(); } -}; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - class PersonalDataManagerMockTest : public PersonalDataManagerTestBase, public testing::Test { protected: @@ -5548,27 +5535,6 @@ EXPECT_TRUE(personal_data_->IsNewProfileImportBlockedForDomain(second_url)); } -#if BUILDFLAG(IS_CHROMEOS_ASH) -TEST_F(PersonalDataManagerMigrationTest, - MigrateUserOptedInWalletSyncTransportIfNeeded) { - ASSERT_EQ( - signin::IdentityManager::MIGRATION_DONE, - identity_test_env_.identity_manager()->GetAccountIdMigrationState()); - - ::autofill::prefs::SetUserOptedInWalletSyncTransport( - prefs_.get(), CoreAccountId::FromEmail(kPrimaryAccountEmail), true); - ASSERT_TRUE(::autofill::prefs::IsUserOptedInWalletSyncTransport( - prefs_.get(), CoreAccountId::FromEmail(kPrimaryAccountEmail))); - - ResetPersonalDataManager(USER_MODE_NORMAL); - - EXPECT_FALSE(::autofill::prefs::IsUserOptedInWalletSyncTransport( - prefs_.get(), CoreAccountId::FromEmail(kPrimaryAccountEmail))); - EXPECT_TRUE(::autofill::prefs::IsUserOptedInWalletSyncTransport( - prefs_.get(), sync_service_.GetAccountInfo().account_id)); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - #if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_CHROMEOS_ASH) TEST_F(PersonalDataManagerSyncTransportModeTest, ShouldShowCardsFromAccountOption) {
diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc index 47abae0e..a6949cf 100644 --- a/components/autofill/core/common/autofill_features.cc +++ b/components/autofill/core/common/autofill_features.cc
@@ -34,6 +34,10 @@ BASE_FEATURE(kAutofillAccountProfilesUnionView, "AutofillAccountProfilesUnionView", base::FEATURE_DISABLED_BY_DEFAULT); +// Account profiles are not considered for regular updates on import, but if +// this parameter is enabeld, they are considered for silent updates. +const base::FeatureParam<bool> kAutofillEnableSilentUpdatesForAccountProfiles{ + &kAutofillAccountProfilesUnionView, "enable_silent_updates", true}; // TODO(crbug.com/1135188): Remove this feature flag after the explicit save // prompts for address profiles is complete.
diff --git a/components/autofill/core/common/autofill_features.h b/components/autofill/core/common/autofill_features.h index e15fc8f8..98d8999 100644 --- a/components/autofill/core/common/autofill_features.h +++ b/components/autofill/core/common/autofill_features.h
@@ -23,6 +23,9 @@ COMPONENT_EXPORT(AUTOFILL) BASE_DECLARE_FEATURE(kAutofillAccountProfilesUnionView); COMPONENT_EXPORT(AUTOFILL) +extern const base::FeatureParam<bool> + kAutofillEnableSilentUpdatesForAccountProfiles; +COMPONENT_EXPORT(AUTOFILL) BASE_DECLARE_FEATURE(kAutofillAddressProfileSavePromptNicknameSupport); COMPONENT_EXPORT(AUTOFILL) BASE_DECLARE_FEATURE(kAutofillAllowDuplicateFormSubmissions);
diff --git a/components/gwp_asan/client/guarded_page_allocator.cc b/components/gwp_asan/client/guarded_page_allocator.cc index 1d003603..4eac1304 100644 --- a/components/gwp_asan/client/guarded_page_allocator.cc +++ b/components/gwp_asan/client/guarded_page_allocator.cc
@@ -9,7 +9,9 @@ #include <random> #include <utility> +#include "base/allocator/buildflags.h" #include "base/allocator/partition_allocator/gwp_asan_support.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/bits.h" #include "base/debug/stack_trace.h" #include "base/logging.h"
diff --git a/components/gwp_asan/client/gwp_asan.cc b/components/gwp_asan/client/gwp_asan.cc index 5bc64d2..e34fc64 100644 --- a/components/gwp_asan/client/gwp_asan.cc +++ b/components/gwp_asan/client/gwp_asan.cc
@@ -10,6 +10,7 @@ #include <tuple> #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/callback_helpers.h" #include "base/debug/crash_logging.h" #include "base/feature_list.h"
diff --git a/components/history/core/browser/sync/history_model_type_controller.cc b/components/history/core/browser/sync/history_model_type_controller.cc index 24416dd..69fef4e 100644 --- a/components/history/core/browser/sync/history_model_type_controller.cc +++ b/components/history/core/browser/sync/history_model_type_controller.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/check_is_test.h" #include "components/history/core/browser/history_service.h" #include "components/signin/public/identity_manager/account_info.h" #include "components/signin/public/identity_manager/account_managed_status_finder.h" @@ -159,8 +160,13 @@ base::Unretained(this))); } - history_service_->SetSyncTransportState( - helper_.sync_service()->GetTransportState()); + // `history_service_` is null in many unit tests. + if (history_service_) { + history_service_->SetSyncTransportState( + helper_.sync_service()->GetTransportState()); + } else { + CHECK_IS_TEST(); + } // Most of these calls will be no-ops but SyncService handles that just fine. helper_.sync_service()->DataTypePreconditionChanged(type());
diff --git a/components/password_manager/core/common/password_manager_features.cc b/components/password_manager/core/common/password_manager_features.cc index 3603525..a2fda40a 100644 --- a/components/password_manager/core/common/password_manager_features.cc +++ b/components/password_manager/core/common/password_manager_features.cc
@@ -251,14 +251,6 @@ "ShowUpmErrorNotification", base::FEATURE_DISABLED_BY_DEFAULT); -// Enables the experiment to automatically submit a form after filling by -// TouchToFill -// TODO(crbug/1283004): Clean up the flag once the feature is completely landed -// in Stable. -BASE_FEATURE(kTouchToFillPasswordSubmission, - "TouchToFillPasswordSubmission", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enables the intent fetching for the credential manager in Google Mobile // Services. It does not enable launching the credential manager. BASE_FEATURE(kUnifiedCredentialManagerDryRun, @@ -369,12 +361,6 @@ const char kPasswordChangeInSettingsWithForcedWarningForEverySite[] = "should_force_warning_for_every_site_in_settings"; -#if BUILDFLAG(IS_ANDROID) -// Enables using conservative heuristics to calculate submission readiness. -const char kTouchToFillPasswordSubmissionWithConservativeHeuristics[] = - "should_use_conservative_heuristics"; -#endif // IS_ANDROID - bool IsPasswordScriptsFetchingEnabled() { return base::FeatureList::IsEnabled(kPasswordDomainCapabilitiesFetching); }
diff --git a/components/password_manager/core/common/password_manager_features.h b/components/password_manager/core/common/password_manager_features.h index e7886132..77258d1 100644 --- a/components/password_manager/core/common/password_manager_features.h +++ b/components/password_manager/core/common/password_manager_features.h
@@ -73,7 +73,6 @@ #if BUILDFLAG(IS_ANDROID) BASE_DECLARE_FEATURE(kPasswordEditDialogWithDetails); BASE_DECLARE_FEATURE(kShowUPMErrorNotification); -BASE_DECLARE_FEATURE(kTouchToFillPasswordSubmission); BASE_DECLARE_FEATURE(kUnifiedCredentialManagerDryRun); BASE_DECLARE_FEATURE(kUnifiedPasswordManagerAndroid); BASE_DECLARE_FEATURE(kUnifiedPasswordManagerErrorMessages);
diff --git a/components/policy/core/common/management/management_service.cc b/components/policy/core/common/management/management_service.cc index 61aee90..99723a1 100644 --- a/components/policy/core/common/management/management_service.cc +++ b/components/policy/core/common/management/management_service.cc
@@ -4,6 +4,7 @@ #include "components/policy/core/common/management/management_service.h" +#include <ostream> #include <tuple> #include "base/barrier_closure.h"
diff --git a/components/privacy_sandbox/privacy_sandbox_settings.cc b/components/privacy_sandbox/privacy_sandbox_settings.cc index c272073..4db84e6 100644 --- a/components/privacy_sandbox/privacy_sandbox_settings.cc +++ b/components/privacy_sandbox/privacy_sandbox_settings.cc
@@ -97,7 +97,8 @@ bool PrivacySandboxSettings::IsTopicsAllowed() const { // M1 specific if (base::FeatureList::IsEnabled(privacy_sandbox::kPrivacySandboxSettings4)) { - return pref_service_->GetBoolean(prefs::kPrivacySandboxM1TopicsEnabled); + return !incognito_profile_ && + pref_service_->GetBoolean(prefs::kPrivacySandboxM1TopicsEnabled); } // Topics API calculation should be prevented if the user has blocked 3PC
diff --git a/components/resources/components_resources.grd b/components/resources/components_resources.grd index fc5dff7d..03e7665 100644 --- a/components/resources/components_resources.grd +++ b/components/resources/components_resources.grd
@@ -17,7 +17,6 @@ <part file="commerce_resources.grdp" /> <part file="dom_distiller_resources.grdp" /> <part file="flags_ui_resources.grdp" /> - <part file="first_run_resources.grdp" /> <part file="management_resources.grdp" /> <part file="neterror_resources.grdp" /> <part file="ntp_tiles_resources.grdp" />
diff --git a/components/resources/first_run_resources.grdp b/components/resources/first_run_resources.grdp deleted file mode 100644 index 9d48a32f7..0000000 --- a/components/resources/first_run_resources.grdp +++ /dev/null
@@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<grit-part> - <if expr="_google_chrome"> - <then> - <include name="IDR_FIRST_RUN_PRODUCT_LOGO_ANIMATION" file="default_100_percent/google_chrome/first_run/chrome_logo_animation.svg" type="BINDATA" /> - </then> - <else> - <include name="IDR_FIRST_RUN_PRODUCT_LOGO_ANIMATION" file="default_100_percent/chromium/first_run/chromium_logo_animation.svg" type="BINDATA" /> - </else> - </if> -</grit-part>
diff --git a/components/test/data/web_package/generate-test-wbns.sh b/components/test/data/web_package/generate-test-wbns.sh index bf3f9a6..a15358c 100755 --- a/components/test/data/web_package/generate-test-wbns.sh +++ b/components/test/data/web_package/generate-test-wbns.sh
@@ -9,7 +9,7 @@ for cmd in gen-bundle sign-bundle; do if ! command -v $cmd > /dev/null 2>&1; then echo "$cmd is not installed. Please run:" - echo " go get -u github.com/WICG/webpackage/go/bundle/cmd/..." + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" echo ' export PATH=$PATH:$(go env GOPATH)/bin' exit 1 fi @@ -35,7 +35,7 @@ -har 24_responses.har \ -o 24_responses.wbn -sign-bundle \ +sign-bundle signatures-section \ -i hello_b2.wbn \ -certificate $sxg_test_data_dir/test.example.org.public.pem.cbor \ -privateKey $sxg_test_data_dir/prime256v1.key \ @@ -44,9 +44,8 @@ -validityUrl https://test.example.org/resource.validity.msg \ -o hello_vouched_subsets.wbn -sign-bundle \ +sign-bundle integrity-block \ -i simple_b2.wbn \ - -signType integrityblock \ -privateKey signed_web_bundle_private_key.pem \ -o simple_b2_signed.swbn
diff --git a/content/browser/back_forward_cache_basics_browsertest.cc b/content/browser/back_forward_cache_basics_browsertest.cc index 80322abd..f66d9e7 100644 --- a/content/browser/back_forward_cache_basics_browsertest.cc +++ b/content/browser/back_forward_cache_basics_browsertest.cc
@@ -1681,6 +1681,41 @@ EXPECT_EQ(rfh_c->GetVisibilityState(), PageVisibilityState::kVisible); } +// Server redirect happens when doing history navigation, causing a SiteInstance +// swap and a new navigation entry. Ensure that the reasons from the old entry +// are copied to the new one and reported. +IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, ServerRedirect) { + ASSERT_TRUE(embedded_test_server()->Start()); + + GURL url_a(embedded_test_server()->GetURL("a.com", "/title1.html")); + GURL url_b(embedded_test_server()->GetURL("b.com", "/title1.html")); + GURL url_c(embedded_test_server()->GetURL("c.com", "/title1.html")); + + // Navigate to a.com. This time the redirect does not happen. + ASSERT_TRUE(NavigateToURL(web_contents(), url_a)); + RenderFrameHostImplWrapper rfh_a(current_frame_host()); + EXPECT_EQ(url_a, rfh_a->GetLastCommittedURL()); + // Replace the history URL to server-redirect. + std::string replace_state = + "window.history.replaceState(null, '', '/server-redirect?" + + url_b.spec() + "');"; + EXPECT_TRUE(ExecJs(rfh_a.get(), replace_state)); + + // Navigate to c.com. + EXPECT_TRUE(NavigateToURL(shell(), url_c)); + RenderFrameHostImplWrapper rfh_b(current_frame_host()); + EvictByJavaScript(rfh_a.get()); + + // Navigate back, going back to b.com instead of a.com because of server + // redirect. + ASSERT_TRUE(HistoryGoBack(web_contents())); + RenderFrameHostImplWrapper rfh_a_redirect(current_frame_host()); + EXPECT_EQ(url_b, rfh_a_redirect->GetLastCommittedURL()); + // Make sure that the eviction reason is recorded. + ExpectNotRestored({NotRestoredReason::kJavaScriptExecution}, {}, {}, {}, {}, + FROM_HERE); +} + class BackForwardCacheBrowsingContextStateBrowserTest : public BackForwardCacheBrowserTest, public ::testing::WithParamInterface<bool> {
diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index 52cd66e..979c418 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc
@@ -175,6 +175,10 @@ EnableFeatureAndSetParams(blink::features::kLoadingTasksUnfreezable, "grace_period_to_finish_loading_in_seconds", base::NumberToString(INT_MAX)); + // Enable capturing not-restored-reasons tree. + EnableFeatureAndSetParams( + blink::features::kBackForwardCacheSendNotRestoredReasons, "", ""); + // Do not trigger NotReached() for JavaScript execution. DisableFeature( blink::features::kBackForwardCacheNotReachedOnJavaScriptExecution); @@ -385,6 +389,53 @@ ASSERT_TRUE(current_frame_host()->IsErrorDocument()); } +ReasonsMatcher BackForwardCacheBrowserTest::MatchesNotRestoredReasons( + const testing::Matcher<blink::mojom::BFCacheBlocked>& blocked, + const absl::optional<SameOriginMatcher>& same_origin_details) { + return testing::Pointee(testing::AllOf( + testing::Field("blocked", + &blink::mojom::BackForwardCacheNotRestoredReasons::blocked, + blocked), + testing::Field( + "same_origin_details", + &blink::mojom::BackForwardCacheNotRestoredReasons:: + same_origin_details, + same_origin_details.has_value() + ? same_origin_details.value() + : testing::Property( + "is_null", + &blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr:: + is_null, + true)))); +} + +SameOriginMatcher BackForwardCacheBrowserTest::MatchesSameOriginDetails( + const testing::Matcher<std::string>& id, + const testing::Matcher<std::string>& name, + const testing::Matcher<std::string>& src, + const testing::Matcher<std::string>& url, + const std::vector<testing::Matcher<std::string>>& reasons, + const std::vector<ReasonsMatcher>& children) { + return testing::Pointee(testing::AllOf( + testing::Field( + "id", &blink::mojom::SameOriginBfcacheNotRestoredDetails::id, id), + testing::Field("name", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::name, + name), + testing::Field( + "src", &blink::mojom::SameOriginBfcacheNotRestoredDetails::src, src), + testing::Field( + "url", &blink::mojom::SameOriginBfcacheNotRestoredDetails::url, url), + testing::Field( + "reasons", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::reasons, + testing::UnorderedElementsAreArray(reasons)), + testing::Field( + "children", + &blink::mojom::SameOriginBfcacheNotRestoredDetails::children, + testing::ElementsAreArray(children)))); +} + std::initializer_list<RenderFrameHostImpl*> Elements( std::initializer_list<RenderFrameHostImpl*> t) { return t;
diff --git a/content/browser/back_forward_cache_browsertest.h b/content/browser/back_forward_cache_browsertest.h index da314308..b0340f3 100644 --- a/content/browser/back_forward_cache_browsertest.h +++ b/content/browser/back_forward_cache_browsertest.h
@@ -23,6 +23,7 @@ #include "content/public/test/content_mock_cert_verifier.h" #include "content/test/content_browser_test_utils_internal.h" #include "testing/gmock/include/gmock/gmock.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom-blink.h" namespace content { @@ -31,6 +32,11 @@ BackForwardCacheCanStoreDocumentResult::NotRestoredReasons; using NotRestoredReason = BackForwardCacheMetrics::NotRestoredReason; +using ReasonsMatcher = testing::Matcher< + const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&>; +using SameOriginMatcher = testing::Matcher< + const blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr&>; + // Match RenderFrameHostImpl* that are in the BackForwardCache. MATCHER(InBackForwardCache, "") { return arg->IsInBackForwardCache(); @@ -125,13 +131,9 @@ MatchesDocumentResult(testing::Matcher<NotRestoredReasons> not_stored, BlockListedFeatures block_listed); - using ReasonsMatcher = testing::Matcher< - const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&>; - using SameOriginMatcher = testing::Matcher< - const blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr&>; ReasonsMatcher MatchesNotRestoredReasons( const testing::Matcher<blink::mojom::BFCacheBlocked>& blocked, - const SameOriginMatcher* same_origin_details); + const absl::optional<SameOriginMatcher>& same_origin_details); SameOriginMatcher MatchesSameOriginDetails( const testing::Matcher<std::string>& id, const testing::Matcher<std::string>& name,
diff --git a/content/browser/back_forward_cache_internal_browsertest.cc b/content/browser/back_forward_cache_internal_browsertest.cc index 5c754e5..48bc38a 100644 --- a/content/browser/back_forward_cache_internal_browsertest.cc +++ b/content/browser/back_forward_cache_internal_browsertest.cc
@@ -3831,18 +3831,20 @@ // Navigate back to a.com. ASSERT_TRUE(HistoryGoBack(web_contents())); ASSERT_TRUE(rfh_b.WaitUntilRenderFrameDeleted()); + ExpectRestored(FROM_HERE); // Navigate forward to b.com again with no error. ASSERT_TRUE(HistoryGoForward(web_contents())); - // We would normally confirm that the blocking reasons are correct, however, - // when performing a history navigations back to an error document, a new - // entry is created and the reasons in the old entry are not recorded. - // // Check that we indeed got a new history entry. ASSERT_NE( history_entry_id, web_contents()->GetController().GetLastCommittedEntry()->GetUniqueID()); + // The reasons from the old entry should be copied to the new entry. + ExpectNotRestored( + {NotRestoredReason::kHTTPStatusNotOK, NotRestoredReason::kNoResponseHead, + NotRestoredReason::kErrorDocument}, + {}, {}, {}, {}, FROM_HERE); } class BackForwardCacheBrowserTestWithFencedFrames
diff --git a/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc b/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc index d2d9bc91..157b1087 100644 --- a/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc +++ b/content/browser/back_forward_cache_not_restored_reasons_browsertest.cc
@@ -18,66 +18,9 @@ using NotRestoredReasons = BackForwardCacheCanStoreDocumentResult::NotRestoredReasons; +// Exists to group the tests and for test history. class BackForwardCacheBrowserTestWithNotRestoredReasons - : public BackForwardCacheBrowserTest { - protected: - void SetUpCommandLine(base::CommandLine* command_line) override { - EnableFeatureAndSetParams( - blink::features::kBackForwardCacheSendNotRestoredReasons, "", ""); - BackForwardCacheBrowserTest::SetUpCommandLine(command_line); - } -}; - -using ReasonsMatcher = testing::Matcher< - const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&>; -using SameOriginMatcher = testing::Matcher< - const blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr&>; -ReasonsMatcher BackForwardCacheBrowserTest::MatchesNotRestoredReasons( - const testing::Matcher<blink::mojom::BFCacheBlocked>& blocked, - const SameOriginMatcher* same_origin_details) { - return testing::Pointee(testing::AllOf( - testing::Field("blocked", - &blink::mojom::BackForwardCacheNotRestoredReasons::blocked, - blocked), - testing::Field( - "same_origin_details", - &blink::mojom::BackForwardCacheNotRestoredReasons:: - same_origin_details, - same_origin_details - ? *same_origin_details - : testing::Property( - "is_null", - &blink::mojom::SameOriginBfcacheNotRestoredDetailsPtr:: - is_null, - true)))); -} - -SameOriginMatcher BackForwardCacheBrowserTest::MatchesSameOriginDetails( - const testing::Matcher<std::string>& id, - const testing::Matcher<std::string>& name, - const testing::Matcher<std::string>& src, - const testing::Matcher<std::string>& url, - const std::vector<testing::Matcher<std::string>>& reasons, - const std::vector<ReasonsMatcher>& children) { - return testing::Pointee(testing::AllOf( - testing::Field( - "id", &blink::mojom::SameOriginBfcacheNotRestoredDetails::id, id), - testing::Field("name", - &blink::mojom::SameOriginBfcacheNotRestoredDetails::name, - name), - testing::Field( - "src", &blink::mojom::SameOriginBfcacheNotRestoredDetails::src, src), - testing::Field( - "url", &blink::mojom::SameOriginBfcacheNotRestoredDetails::url, url), - testing::Field( - "reasons", - &blink::mojom::SameOriginBfcacheNotRestoredDetails::reasons, - testing::UnorderedElementsAreArray(reasons)), - testing::Field( - "children", - &blink::mojom::SameOriginBfcacheNotRestoredDetails::children, - testing::ElementsAreArray(children)))); -} + : public BackForwardCacheBrowserTest {}; // NotRestoredReasons are not reported when the page is successfully restored // from back/forward cache. @@ -122,11 +65,11 @@ {blink::scheduler::WebSchedulerTrackedFeature::kDummy}, {}, {}, {}, FROM_HERE); // Expect that NotRestoredReasons are reported. - auto rfh_a_details = MatchesSameOriginDetails( - /*id=*/"", /*name=*/"", /*src=*/"", - /*url=*/rfh_a_url, /*reasons=*/{"Dummy"}, /*children=*/{}); auto rfh_a_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kYes, &rfh_a_details); + blink::mojom::BFCacheBlocked::kYes, + MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", + /*url=*/rfh_a_url, /*reasons=*/{"Dummy"}, /*children=*/{})); EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), rfh_a_result); EXPECT_TRUE(rfh_b->IsInBackForwardCache()); @@ -180,19 +123,20 @@ // Expect that id and name are masked for |rfh_b|, but reported for |rfh_a_2|. // Note that |rfh_a_3| is masked because it's a child of |rfh_b|. - auto rfh_a_2_details = MatchesSameOriginDetails( - /*id=*/"rfh_a_2_id", /*name=*/"rfh_a_2_name", /*src=*/rfh_a_2_url, - /*url=*/rfh_a_2_url, /*reasons=*/{}, /*children=*/{}); auto rfh_b_result = - MatchesNotRestoredReasons(blink::mojom::BFCacheBlocked::kYes, nullptr); + MatchesNotRestoredReasons(blink::mojom::BFCacheBlocked::kYes, + /*same_origin_details=*/absl::nullopt); auto rfh_a_2_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kNo, &rfh_a_2_details); - auto rfh_a_1_details = MatchesSameOriginDetails( - /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, - /*reasons=*/{}, - /*children=*/{rfh_a_2_result, rfh_b_result}); + blink::mojom::BFCacheBlocked::kNo, + MatchesSameOriginDetails( + /*id=*/"rfh_a_2_id", /*name=*/"rfh_a_2_name", /*src=*/rfh_a_2_url, + /*url=*/rfh_a_2_url, /*reasons=*/{}, /*children=*/{})); auto rfh_a_1_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kNo, &rfh_a_1_details); + blink::mojom::BFCacheBlocked::kNo, + MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, + /*reasons=*/{}, + /*children=*/{rfh_a_2_result, rfh_b_result})); EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), rfh_a_1_result); @@ -234,30 +178,33 @@ {blink::scheduler::WebSchedulerTrackedFeature::kDummy}, {}, {}, {}, FROM_HERE); - auto rfh_a_2_details = MatchesSameOriginDetails( - /*id=*/"child-0", /*name=*/"", /*src=*/rfh_a_2_url, /*url=*/rfh_a_2_url, - /*reasons=*/{"Dummy"}, - /*children=*/{}); - auto rfh_a_2_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kYes, &rfh_a_2_details); - auto rfh_a_4_details = MatchesSameOriginDetails( - /*id=*/"child-0", /*name=*/"", /*src=*/rfh_a_4_url, /*url=*/rfh_a_4_url, - /*reasons=*/{"Dummy"}, - /*children=*/{}); - auto rfh_a_4_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kYes, &rfh_a_4_details); - auto rfh_a_3_details = MatchesSameOriginDetails( - /*id=*/"child-1", /*name=*/"", /*src=*/rfh_a_3_url, /*url=*/rfh_a_3_url, - /*reasons=*/{}, /*children=*/ - {rfh_a_4_result}); - auto rfh_a_3_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kNo, &rfh_a_3_details); - auto rfh_a_1_details = MatchesSameOriginDetails( - /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, - /*reasons=*/{"Dummy"}, - /*children=*/{rfh_a_2_result, rfh_a_3_result}); + auto rfh_a_2_result = + MatchesNotRestoredReasons(blink::mojom::BFCacheBlocked::kYes, + MatchesSameOriginDetails( + /*id=*/"child-0", /*name=*/"", + /*src=*/rfh_a_2_url, /*url=*/rfh_a_2_url, + /*reasons=*/{"Dummy"}, + /*children=*/{})); + auto rfh_a_4_result = + MatchesNotRestoredReasons(blink::mojom::BFCacheBlocked::kYes, + MatchesSameOriginDetails( + /*id=*/"child-0", /*name=*/"", + /*src=*/rfh_a_4_url, /*url=*/rfh_a_4_url, + /*reasons=*/{"Dummy"}, + /*children=*/{})); + auto rfh_a_3_result = + MatchesNotRestoredReasons(blink::mojom::BFCacheBlocked::kNo, + MatchesSameOriginDetails( + /*id=*/"child-1", /*name=*/"", + /*src=*/rfh_a_3_url, /*url=*/rfh_a_3_url, + /*reasons=*/{}, /*children=*/ + {rfh_a_4_result})); auto rfh_a_1_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kYes, &rfh_a_1_details); + blink::mojom::BFCacheBlocked::kYes, + MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_1_url, + /*reasons=*/{"Dummy"}, + /*children=*/{rfh_a_2_result, rfh_a_3_result})); EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), rfh_a_1_result); } @@ -355,12 +302,12 @@ // Both reasons are recorded and sent to the renderer. // BrowsingInstanceNotSwapped is masked as internal error. - auto rfh_a_details = MatchesSameOriginDetails( - /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_url, - /*reasons=*/{"Related active contents", "Internal error"}, - /*children=*/{}); auto rfh_a_result = MatchesNotRestoredReasons( - blink::mojom::BFCacheBlocked::kYes, &rfh_a_details); + blink::mojom::BFCacheBlocked::kYes, + MatchesSameOriginDetails( + /*id=*/"", /*name=*/"", /*src=*/"", /*url=*/rfh_a_url, + /*reasons=*/{"Related active contents", "Internal error"}, + /*children=*/{})); EXPECT_THAT(current_frame_host()->NotRestoredReasonsForTesting(), rfh_a_result); }
diff --git a/content/browser/browser_interface_binders.cc b/content/browser/browser_interface_binders.cc index a626b94cf..cb3c2db 100644 --- a/content/browser/browser_interface_binders.cc +++ b/content/browser/browser_interface_binders.cc
@@ -128,6 +128,7 @@ #include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom.h" #include "third_party/blink/public/mojom/filesystem/file_system.mojom.h" #include "third_party/blink/public/mojom/font_access/font_access.mojom.h" +#include "third_party/blink/public/mojom/frame/frame.mojom.h" #include "third_party/blink/public/mojom/frame/pending_beacon.mojom.h" #include "third_party/blink/public/mojom/geolocation/geolocation_service.mojom.h" #include "third_party/blink/public/mojom/idle/idle_manager.mojom.h" @@ -983,6 +984,10 @@ base::BindRepeating(&RenderFrameHostImpl::BindRenderAccessibilityHost, base::Unretained(host))); + map->Add<blink::mojom::NonAssociatedLocalFrameHost>( + base::BindRepeating(&RenderFrameHostImpl::BindNonAssociatedLocalFrameHost, + base::Unretained(host))); + #if BUILDFLAG(IS_FUCHSIA) map->Add<media::mojom::FuchsiaMediaCodecProvider>( base::BindRepeating(&RenderProcessHost::BindMediaCodecProvider,
diff --git a/content/browser/cross_origin_opener_policy_browsertest.cc b/content/browser/cross_origin_opener_policy_browsertest.cc index 609c512..0e5d79f 100644 --- a/content/browser/cross_origin_opener_policy_browsertest.cc +++ b/content/browser/cross_origin_opener_policy_browsertest.cc
@@ -3518,14 +3518,8 @@ } // This test is a reproducer for https://crbug.com/1305394. -// This test is flaky on Mac: https://crbug.com/1319301 -#if BUILDFLAG(IS_MAC) -#define MAYBE_CrossOriginIframeCoopBypass DISABLED_CrossOriginIframeCoopBypass -#else -#define MAYBE_CrossOriginIframeCoopBypass CrossOriginIframeCoopBypass -#endif IN_PROC_BROWSER_TEST_P(CrossOriginOpenerPolicyBrowserTest, - MAYBE_CrossOriginIframeCoopBypass) { + CrossOriginIframeCoopBypass) { // This test requires that a cross-origin iframe be placed in its own // process. It is irrelevant without strict site isolation. if (!SiteIsolationPolicy::UseDedicatedProcessesForAllSites()) @@ -3555,15 +3549,19 @@ EXPECT_EQ(initial_main_si, popup_si); RenderProcessHost* process_A = initial_main_si->GetProcess(); - // The popup then navigates the opener to a COOP page. + // The popup then navigates the opener to a COOP page. This should trigger a + // BrowsingInstance swap. The main frame gets a new unrelated SiteInstance, + // and clears the opener. + RenderFrameDeletedObserver swapped_out_main_rfh(initial_main_rfh); EXPECT_TRUE(ExecJs(popup_rfh, JsReplace("opener.location = $1", coop_page))); EXPECT_TRUE(WaitForLoadStop(web_contents())); - // This should trigger a BrowsingInstance swap. The main frame gets a new - // unrelated BrowsingInstance, and clears the opener. // Note: We need to wait for the `blink::WebView` deletion to be propagated in - // the renderer for window.opener to be cleared. To avoid flakes, we check the - // opener at the end of this test. + // the renderer for window.opener to be cleared. This should be done once the + // main RenderFrameHost gets deleted. + swapped_out_main_rfh.WaitUntilDeleted(); + EXPECT_EQ(true, EvalJs(popup_rfh, "opener == null")); + RenderFrameHostImpl* main_rfh = current_frame_host(); SiteInstanceImpl* main_si = main_rfh->GetSiteInstance(); RenderProcessHost* process_B = main_si->GetProcess(); @@ -3615,9 +3613,7 @@ ->GetAllProxyHostsForTesting() .size()); - // The opener should not be reachable either from the popup main frame nor the - // popup iframe. - EXPECT_EQ(true, EvalJs(popup_rfh, "opener == null")); + // The opener should not be reachable from the popup iframe. EXPECT_EQ(true, EvalJs(iframe_rfh, "parent.opener == null")); }
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 95ab3cd3..9567261 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -376,10 +376,12 @@ DCHECK(mojo::Equals(lhs->critical_ch, rhs->critical_ch)); DCHECK_EQ(lhs->xfo, rhs->xfo); DCHECK(mojo::Equals(lhs->link_headers, rhs->link_headers)); + DCHECK(mojo::Equals(lhs->supports_loading_mode, rhs->supports_loading_mode)); DCHECK(mojo::Equals(lhs->timing_allow_origin, rhs->timing_allow_origin)); DCHECK(mojo::Equals(lhs->reporting_endpoints, rhs->reporting_endpoints)); DCHECK(mojo::Equals(lhs->variants_headers, rhs->variants_headers)); DCHECK(mojo::Equals(lhs->content_language, rhs->content_language)); + DCHECK(mojo::Equals(lhs->no_vary_search, rhs->no_vary_search)); NOTREACHED() << "The parsed headers don't match, but we don't know which " "field does not match. Please add a DCHECK before this one " "checking for the missing field.";
diff --git a/content/browser/picture_in_picture/picture_in_picture_session.cc b/content/browser/picture_in_picture/picture_in_picture_session.cc index 3c707eea..ee6ee794 100644 --- a/content/browser/picture_in_picture/picture_in_picture_session.cc +++ b/content/browser/picture_in_picture/picture_in_picture_session.cc
@@ -107,6 +107,12 @@ } void PictureInPictureSession::OnConnectionError() { + // There is possibility that OnConnectionError arrives between StopInternal() + // is called and |this| is deleted. As a result, DCHECK in StopInternal() + // will fail. + if (is_stopping_) + return; + // StopInternal() will self destruct which will close the bindings. StopInternal(base::NullCallback()); }
diff --git a/content/browser/preloading/prerender/prerender_host_registry.h b/content/browser/preloading/prerender/prerender_host_registry.h index 28791ee..1d2199a 100644 --- a/content/browser/preloading/prerender/prerender_host_registry.h +++ b/content/browser/preloading/prerender/prerender_host_registry.h
@@ -54,8 +54,8 @@ // The time to allow prerendering kept alive in the background. All the hosts // that this PrerenderHostRegistry holds will be terminated with // kTimeoutBackgrounded when the timer exceeds this. The value was determined - // to align with the default value of BFCache's eviction timer. - static constexpr base::TimeDelta kTimeToLiveInBackground = base::Seconds(180); + // by PageLoad.Clients.Prerender.NavigationToActivation.*. + static constexpr base::TimeDelta kTimeToLiveInBackground = base::Seconds(19); using PassKey = base::PassKey<PrerenderHostRegistry>;
diff --git a/content/browser/renderer_host/back_forward_cache_impl.cc b/content/browser/renderer_host/back_forward_cache_impl.cc index bb3a33a..6f17840 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.cc +++ b/content/browser/renderer_host/back_forward_cache_impl.cc
@@ -854,9 +854,10 @@ result.No(BackForwardCacheMetrics::NotRestoredReason::kDomainNotAllowed); } -void BackForwardCacheImpl::PopulateStickyReasonsForDocument( - BackForwardCacheCanStoreDocumentResult& result, - RenderFrameHostImpl* rfh) { +void BackForwardCacheImpl::NotRestoredReasonBuilder:: + PopulateStickyReasonsForDocument( + BackForwardCacheCanStoreDocumentResult& result, + RenderFrameHostImpl* rfh) { // If the rfh has ever granted media access, prevent it from entering cache. // TODO(crbug.com/989379): Consider only blocking when there's an active // media stream. @@ -905,9 +906,10 @@ } } -void BackForwardCacheImpl::PopulateNonStickyReasonsForDocument( - BackForwardCacheCanStoreDocumentResult& result, - RenderFrameHostImpl* rfh) { +void BackForwardCacheImpl::NotRestoredReasonBuilder:: + PopulateNonStickyReasonsForDocument( + BackForwardCacheCanStoreDocumentResult& result, + RenderFrameHostImpl* rfh) { if (!rfh->IsDOMContentLoaded()) result.No(BackForwardCacheMetrics::NotRestoredReason::kLoading); @@ -931,7 +933,7 @@ } } -void BackForwardCacheImpl::PopulateReasonsForDocument( +void BackForwardCacheImpl::NotRestoredReasonBuilder::PopulateReasonsForDocument( BackForwardCacheCanStoreDocumentResult& result, RenderFrameHostImpl* rfh, bool include_non_sticky) { @@ -1022,8 +1024,7 @@ } } else { // Populate |result_for_rfh| by checking the bfcache eligibility of |rfh|. - bfcache_->PopulateReasonsForDocument(result_for_rfh, rfh, - include_non_sticky_); + PopulateReasonsForDocument(result_for_rfh, rfh, include_non_sticky_); } bfcache_->UpdateCanStoreToIncludeCacheControlNoStore(result_for_rfh, rfh); flattened_result_.AddReasonsFrom(result_for_rfh); @@ -1425,10 +1426,18 @@ // static void BackForwardCacheImpl::VlogUnexpectedRendererToBrowserMessage( const char* interface_name, - uint32_t message_name) { + uint32_t message_name, + RenderFrameHostImpl* rfh) { VLOG(1) << "BackForwardCacheMessageFilter::WillDispatch bad_message " - << "interface_name " << interface_name << "message_name " + << "interface_name " << interface_name << " message_name " << message_name; + // TODO(https://crbug.com/1379490): Remove these when bug is fixed. + PageLifecycleStateManager* page_lifecycle_state_manager = + rfh->render_view_host()->GetPageLifecycleStateManager(); + VLOG(1) << "URL: " << rfh->GetLastCommittedURL() << " current " + << page_lifecycle_state_manager->IsInBackForwardCache() << " acked " + << page_lifecycle_state_manager->last_acknowledged_state() + .is_in_back_forward_cache; } BackForwardCache::DisabledReason::DisabledReason( @@ -1472,17 +1481,13 @@ url_(url) {} BackForwardCacheCanStoreTreeResult::BackForwardCacheCanStoreTreeResult( - BackForwardCacheCanStoreDocumentResult& result_for_this_document, bool is_same_origin, - const std::string& id, - const std::string& name, - const std::string& src, const GURL& url) - : document_result_(std::move(result_for_this_document)), + : document_result_(BackForwardCacheCanStoreDocumentResult()), is_same_origin_(is_same_origin), - id_(id), - name_(name), - src_(src), + id_(""), + name_(""), + src_(""), url_(url) {} BackForwardCacheCanStoreTreeResult::~BackForwardCacheCanStoreTreeResult() = @@ -1514,6 +1519,18 @@ } std::unique_ptr<BackForwardCacheCanStoreTreeResult> +BackForwardCacheCanStoreTreeResult::CreateEmptyTreeForNavigation( + NavigationRequest* navigation) { + DCHECK(!navigation->GetRenderFrameHost()->IsNestedWithinFencedFrame()); + DCHECK(BackForwardCacheMetrics::IsCrossDocumentMainFrameHistoryNavigation( + navigation)); + std::unique_ptr<BackForwardCacheCanStoreTreeResult> empty_tree( + new BackForwardCacheCanStoreTreeResult( + /*is_same_origin=*/true, navigation->GetURL())); + return empty_tree; +} + +std::unique_ptr<BackForwardCacheCanStoreTreeResult> BackForwardCacheCanStoreTreeResult::CreateEmptyTree(RenderFrameHostImpl* rfh) { BackForwardCacheCanStoreDocumentResult empty_result; std::unique_ptr<BackForwardCacheCanStoreTreeResult> empty_tree( @@ -1523,25 +1540,6 @@ return empty_tree; } -std::unique_ptr<BackForwardCacheCanStoreTreeResult> -BackForwardCacheCanStoreTreeResult::CreateEmptyTreeBeforeCommit( - NavigationRequest* navigation) { - // This method should only be called when a RenderFrameHostImpl is in the - // process of committing a navigation. - DCHECK_GE(navigation->state(), NavigationRequest::WILL_PROCESS_RESPONSE); - RenderFrameHostImpl* frame = navigation->GetRenderFrameHost(); - DCHECK(frame); - // Non-null `frame` indicates a non-`nullopt` `origin`. - absl::optional<url::Origin> origin = navigation->GetOriginToCommit(); - DCHECK(origin.has_value()); - - BackForwardCacheCanStoreDocumentResult empty_result; - std::unique_ptr<BackForwardCacheCanStoreTreeResult> empty_tree( - new BackForwardCacheCanStoreTreeResult( - frame, origin.value(), navigation->GetURL(), empty_result)); - return empty_tree; -} - blink::mojom::BackForwardCacheNotRestoredReasonsPtr BackForwardCacheCanStoreTreeResult::GetWebExposedNotRestoredReasons() { uint32_t count = GetCrossOriginReachableFrameCount();
diff --git a/content/browser/renderer_host/back_forward_cache_impl.h b/content/browser/renderer_host/back_forward_cache_impl.h index 0a57cf72..804cadb0 100644 --- a/content/browser/renderer_host/back_forward_cache_impl.h +++ b/content/browser/renderer_host/back_forward_cache_impl.h
@@ -207,7 +207,8 @@ // corresponds to this the value. static void VlogUnexpectedRendererToBrowserMessage( const char* interface_name_, - uint32_t message_name); + uint32_t message_name, + RenderFrameHostImpl* rfh); // Returns the reasons (if any) why this document and its children cannot // enter the back/forward cache. Depends on the |render_frame_host| and its @@ -372,13 +373,6 @@ BackForwardCacheCanStoreDocumentResult& result, RenderFrameHostImpl* render_frame_host); - // Populates `result` with the blocking reasons for this document. If - // "include_non_sticky" is true, it includes non-sticky reasons. - void PopulateReasonsForDocument( - BackForwardCacheCanStoreDocumentResult& result, - RenderFrameHostImpl* rfh, - bool include_non_sticky); - // Populates the reasons why this |rfh| and its subframes cannot enter the // back/forward cache in a flat list through |flattened_result| and as a tree // through its return value. @@ -389,20 +383,6 @@ BackForwardCacheCanStoreDocumentResult& flattened_result, bool include_non_sticky); - // Populates the sticky reasons for `rfh` without recursing into subframes. - // Sticky features can't be unregistered and remain active for the rest of the - // lifetime of the page. - void PopulateStickyReasonsForDocument( - BackForwardCacheCanStoreDocumentResult& result, - RenderFrameHostImpl* rfh); - - // Populates the non-sticky reasons for `rfh` without recursing into - // subframes. Non-sticky reasons mean the reasons that may be resolved later - // such as when the page releases blocking resources in pagehide. - void PopulateNonStickyReasonsForDocument( - BackForwardCacheCanStoreDocumentResult& result, - RenderFrameHostImpl* rfh); - // Updates the result to include CacheControlNoStore reasons if the flag is // on. void UpdateCanStoreToIncludeCacheControlNoStore( @@ -524,6 +504,27 @@ return std::move(tree_result_); } + // Populates `result` with the blocking reasons for this document. If + // "include_non_sticky" is true, it includes non-sticky reasons. + void PopulateReasonsForDocument( + BackForwardCacheCanStoreDocumentResult& result, + RenderFrameHostImpl* rfh, + bool include_non_sticky); + + // Populates the sticky reasons for `rfh` without recursing into subframes. + // Sticky features can't be unregistered and remain active for the rest of + // the lifetime of the page. + void PopulateStickyReasonsForDocument( + BackForwardCacheCanStoreDocumentResult& result, + RenderFrameHostImpl* rfh); + + // Populates the non-sticky reasons for `rfh` without recursing into + // subframes. Non-sticky reasons mean the reasons that may be resolved later + // such as when the page releases blocking resources in pagehide. + void PopulateNonStickyReasonsForDocument( + BackForwardCacheCanStoreDocumentResult& result, + RenderFrameHostImpl* rfh); + private: // Populate NotRestoredReasons for the `rfh` by // iterating the frame tree and populating NotRestoredReasons in @@ -622,9 +623,8 @@ // Creates and returns an empty tree. static std::unique_ptr<BackForwardCacheCanStoreTreeResult> CreateEmptyTree( RenderFrameHostImpl* rfh); - // Creates and returns an empty tree before committing navigation. static std::unique_ptr<BackForwardCacheCanStoreTreeResult> - CreateEmptyTreeBeforeCommit(NavigationRequest* navigation); + CreateEmptyTreeForNavigation(NavigationRequest* navigation); private: friend class BackForwardCacheImplTest; @@ -633,19 +633,16 @@ FRIEND_TEST_ALL_PREFIXES(BackForwardCacheImplTest, FirstCrossOriginReachable); FRIEND_TEST_ALL_PREFIXES(BackForwardCacheImplTest, SecondCrossOriginReachable); + // This constructor is for creating a tree for |rfh| as the subtree's root + // document's frame. BackForwardCacheCanStoreTreeResult( RenderFrameHostImpl* rfh, const url::Origin& main_document_origin, const GURL& url, BackForwardCacheCanStoreDocumentResult& result_for_this_document); - BackForwardCacheCanStoreTreeResult( - BackForwardCacheCanStoreDocumentResult& result_for_this_document, - bool is_same_origin, - const std::string& id, - const std::string& name, - const std::string& src, - const GURL& url); + // Creates an empty placeholder tree with the empty result. + BackForwardCacheCanStoreTreeResult(bool is_same_origin, const GURL& url); // Helper function for |GetWebExposedNotRestoredReasons()|. |index| is the // random index of the cross-origin iframe that we decided to report @@ -674,6 +671,7 @@ const bool is_same_origin_; // The id, name and src attribute of the frame owner of this subtree's root // document. + // TODO(yuzus): Make them optional. const std::string id_; const std::string name_; const std::string src_; @@ -683,4 +681,4 @@ } // namespace content -#endif // CONTENT_BROWSER_RENDERER_HOST_BACK_FORWARD_CACHE_IMPL_H_ +#endif // CONTENT_BROWSER_RENDERER_HOST_BACK_FORWARD_CACHE_IMPL_H_ \ No newline at end of file
diff --git a/content/browser/renderer_host/back_forward_cache_impl_unittest.cc b/content/browser/renderer_host/back_forward_cache_impl_unittest.cc index 7e2d8bb..2a5c2e2 100644 --- a/content/browser/renderer_host/back_forward_cache_impl_unittest.cc +++ b/content/browser/renderer_host/back_forward_cache_impl_unittest.cc
@@ -31,11 +31,8 @@ private: std::unique_ptr<BackForwardCacheCanStoreTreeResult> CreateSameOriginTree() { - BackForwardCacheCanStoreDocumentResult result; std::unique_ptr<BackForwardCacheCanStoreTreeResult> tree( - new BackForwardCacheCanStoreTreeResult(result, /*is_same_origin=*/true, - /*id=*/"a", /*name=*/"a", - /*src=*/"a", + new BackForwardCacheCanStoreTreeResult(/*is_same_origin=*/true, GURL("https://a.com/test"))); return tree; } @@ -43,9 +40,7 @@ std::unique_ptr<BackForwardCacheCanStoreTreeResult> CreateCrossOriginTree() { BackForwardCacheCanStoreDocumentResult result; std::unique_ptr<BackForwardCacheCanStoreTreeResult> tree( - new BackForwardCacheCanStoreTreeResult(result, /*is_same_origin=*/false, - /*id=*/"b", /*name=*/"b", - /*src=*/"b", + new BackForwardCacheCanStoreTreeResult(/*is_same_origin=*/false, GURL("https://b.com/test"))); return tree; }
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.cc b/content/browser/renderer_host/back_forward_cache_metrics.cc index ac880c7..b59f46fc 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.cc +++ b/content/browser/renderer_host/back_forward_cache_metrics.cc
@@ -134,10 +134,11 @@ // Record metrics for history navigation, if applicable. if (IsCrossDocumentMainFrameHistoryNavigation(navigation)) { // We have to update not restored reasons even though we already did in - // |SendCommitNavigation()|, because at the commit we might create a new - // metrics object. - UpdateNotRestoredReasonsForNavigation(navigation, /*before_commit=*/false); - + // |SendCommitNavigation()|, because the NavigationEntry and + // the BackForwardCacheMetrics object might not exist anymore, e.g. when the + // NavigationEntry got pruned by another navigation committing before the + // history navigation committed. + UpdateNotRestoredReasonsForNavigation(navigation); bool can_restore = page_store_result_->CanRestore(); bool did_store = navigation->IsServedFromBackForwardCache(); DCHECK_EQ(can_restore, did_store) << page_store_result_->ToString(); @@ -375,8 +376,7 @@ } void BackForwardCacheMetrics::UpdateNotRestoredReasonsForNavigation( - NavigationRequest* navigation, - bool before_commit) { + NavigationRequest* navigation) { DCHECK(IsCrossDocumentMainFrameHistoryNavigation(navigation)); BackForwardCacheCanStoreDocumentResult new_blocking_reasons; // |last_committed_cross_document_main_frame_navigation_id_| is -1 even though @@ -388,6 +388,8 @@ new_blocking_reasons.No(NotRestoredReason::kSessionRestored); } + // TODO(rakina): Remove this call from here and move it to + // |SetNotRestoredReasons()| that is called from |UnloadOldFrame()|. if (!DidSwapBrowsingInstance()) { new_blocking_reasons.No(NotRestoredReason::kBrowsingInstanceNotSwapped); } @@ -407,11 +409,8 @@ // Initialize the empty tree result if nothing is set. if (!page_store_tree_result_) { page_store_tree_result_ = - before_commit - ? BackForwardCacheCanStoreTreeResult::CreateEmptyTreeBeforeCommit( - navigation) - : BackForwardCacheCanStoreTreeResult::CreateEmptyTree( - navigation->GetRenderFrameHost()); + BackForwardCacheCanStoreTreeResult::CreateEmptyTreeForNavigation( + navigation); } // Add the same reason to the root node of the tree once we update the // flattened list of reasons.
diff --git a/content/browser/renderer_host/back_forward_cache_metrics.h b/content/browser/renderer_host/back_forward_cache_metrics.h index 2d115e9..10a05cf 100644 --- a/content/browser/renderer_host/back_forward_cache_metrics.h +++ b/content/browser/renderer_host/back_forward_cache_metrics.h
@@ -177,6 +177,8 @@ bool is_main_frame_navigation, int64_t committing_document_sequence_number); + explicit BackForwardCacheMetrics(int64_t document_sequence_number); + BackForwardCacheMetrics(const BackForwardCacheMetrics&) = delete; BackForwardCacheMetrics& operator=(const BackForwardCacheMetrics&) = delete; @@ -238,13 +240,12 @@ blink::mojom::BackForwardCacheNotRestoredReasonsPtr GetWebExposedNotRestoredReasons(); - // Record additional reason why navigation was not served from bfcache which - // are known only at the commit time, such as BrowsingInstanceNotSwapped, - // SessionRestored, Unknown etc. |before_commit| indicates whether this is - // called before commit or after commit and will be used for recording the - // right values for URL and origin. - void UpdateNotRestoredReasonsForNavigation(NavigationRequest* navigation, - bool before_commit); + // Records additional reasons why a history navigation was not served from + // BFCache. The reasons are recorded only after the history navigation started + // because it's about the history navigation (e.g. kSessionRestored) or + // reasons that might not have been recorded yet (e.g. + // kBrowsingInstanceNotSwapped). + void UpdateNotRestoredReasonsForNavigation(NavigationRequest* navigation); // Exported for testing. // The DisabledReason's source and id combined to give a unique uint64. @@ -273,8 +274,6 @@ private: friend class base::RefCounted<BackForwardCacheMetrics>; - explicit BackForwardCacheMetrics(int64_t document_sequence_number); - ~BackForwardCacheMetrics(); // Recursively collects the feature usage information from the subtree
diff --git a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc index 4e510e5..21d8f08c 100644 --- a/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc +++ b/content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
@@ -98,6 +98,13 @@ BASE_FEATURE(kScreenCaptureKitMac, "ScreenCaptureKitMac", base::FEATURE_DISABLED_BY_DEFAULT); + +// If this feature is enabled, ScreenCaptureKit will be used for window +// capturing even if kScreenCaptureKitMac is disabled. Please note that this +// feature has no effect if kScreenCaptureKitMac is enabled. +BASE_FEATURE(kScreenCaptureKitMacWindow, + "ScreenCaptureKitMacWindow", + base::FEATURE_DISABLED_BY_DEFAULT); #endif void IncrementDesktopCaptureCounters(const DesktopMediaID& device_id) { @@ -491,7 +498,9 @@ // Prefer using ScreenCaptureKit. After that try DesktopCaptureDeviceMac, and // if both fail, use the generic DesktopCaptureDevice. if (!video_capture_device && - base::FeatureList::IsEnabled(kScreenCaptureKitMac)) { + (base::FeatureList::IsEnabled(kScreenCaptureKitMac) || + (desktop_id.type == DesktopMediaID::TYPE_WINDOW && + base::FeatureList::IsEnabled(kScreenCaptureKitMacWindow)))) { if ((video_capture_device = CreateScreenCaptureKitDeviceMac(desktop_id))) implementation = kScreenCaptureKitDeviceMac; }
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index d7ec392..51e339b9 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -2034,6 +2034,22 @@ replace_entry, previous_document_was_activated, request->IsRendererInitiated(), request->GetPreviousPageUkmSourceId()); + // If this is a history navigation and the old entry has an existing + // back/forward cache metrics object, keep using the old one so that the + // reasons logged from the last time the page navigated gets preserved. + if (BackForwardCacheMetrics::IsCrossDocumentMainFrameHistoryNavigation( + request)) { + // Use |request->GetNavigationEntry()| instead of |pending_entry_| here + // because some tests do not have a pending entry. + NavigationEntryImpl* entry = + static_cast<NavigationEntryImpl*>(request->GetNavigationEntry()); + if (entry && entry->back_forward_cache_metrics()) { + scoped_refptr<BackForwardCacheMetrics> metrics = + entry->TakeBackForwardCacheMetrics(); + new_entry->set_back_forward_cache_metrics(std::move(metrics)); + } + } + InsertOrReplaceEntry(std::move(new_entry), replace_entry, !request->post_commit_error_page_html().empty(), rfh->IsNestedWithinFencedFrame(), commit_details);
diff --git a/content/browser/renderer_host/navigation_entry_impl.h b/content/browser/renderer_host/navigation_entry_impl.h index 775ff57..30292e9 100644 --- a/content/browser/renderer_host/navigation_entry_impl.h +++ b/content/browser/renderer_host/navigation_entry_impl.h
@@ -434,6 +434,10 @@ return back_forward_cache_metrics_.get(); } + scoped_refptr<BackForwardCacheMetrics> TakeBackForwardCacheMetrics() { + return std::move(back_forward_cache_metrics_); + } + void set_back_forward_cache_metrics( scoped_refptr<BackForwardCacheMetrics> metrics) { DCHECK(metrics);
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 1b0c65f7..64bd2ff8 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -1545,8 +1545,6 @@ ? absl::make_optional( FencedFrameURLMapping::FencedFrameProperties()) : absl::nullopt) { - TRACE_EVENT1("navigation", "NavigationRequest::NavigationRequest", "url", - GetURL()); DCHECK(!blink::IsRendererDebugURL(common_params_->url)); DCHECK(common_params_->method == "POST" || !common_params_->post_data); DCHECK_EQ(common_params_->url, commit_params_->original_url); @@ -1588,6 +1586,8 @@ base::debug::DumpWithoutCrashing(); } + TRACE_EVENT1("navigation", "NavigationRequest::NavigationRequest", + "navigation_request", this); TRACE_EVENT_NESTABLE_ASYNC_BEGIN1("navigation", "NavigationRequest", navigation_id_, "navigation_request", this); TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("navigation", "Initializing",
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 05d6336..2afb5010 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -279,6 +279,28 @@ return false; } +// Creates a WebBundleHandleTracker from the WebBundleHandles attached to the +// current RenderFrameHost. There there are none, it is produced from the parent +// or the opener. +std::unique_ptr<WebBundleHandleTracker> MaybeCreateWebBundleHandleTracker( + FrameTreeNode* frame) { + std::unique_ptr<WebBundleHandleTracker> tracker = + frame->current_frame_host()->MaybeCreateWebBundleHandleTracker(); + if (tracker) + return tracker; + + if (frame->parent()) + return frame->parent()->MaybeCreateWebBundleHandleTracker(); + + if (frame->opener()) { + return frame->opener() + ->current_frame_host() + ->MaybeCreateWebBundleHandleTracker(); + } + + return nullptr; +} + } // namespace struct Navigator::NavigationMetricsData { @@ -964,7 +986,6 @@ mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client, scoped_refptr<PrefetchedSignedExchangeCache> prefetched_signed_exchange_cache, - std::unique_ptr<WebBundleHandleTracker> web_bundle_handle_tracker, mojo::PendingReceiver<mojom::NavigationRendererCancellationListener> renderer_cancellation_listener) { TRACE_EVENT0("navigation", "Navigator::OnBeginNavigation"); @@ -1019,7 +1040,7 @@ controller_.GetEntryCount(), override_user_agent, std::move(blob_url_loader_factory), std::move(navigation_client), std::move(prefetched_signed_exchange_cache), - std::move(web_bundle_handle_tracker), + MaybeCreateWebBundleHandleTracker(frame_tree_node), std::move(renderer_cancellation_listener))); NavigationRequest* navigation_request = frame_tree_node->navigation_request();
diff --git a/content/browser/renderer_host/navigator.h b/content/browser/renderer_host/navigator.h index 0708ad9..577f3dd 100644 --- a/content/browser/renderer_host/navigator.h +++ b/content/browser/renderer_host/navigator.h
@@ -44,7 +44,6 @@ class NavigatorDelegate; class PrefetchedSignedExchangeCache; class RenderFrameHostImpl; -class WebBundleHandleTracker; struct LoadCommittedDetails; struct UrlInfo; @@ -181,7 +180,6 @@ mojo::PendingAssociatedRemote<mojom::NavigationClient> navigation_client, scoped_refptr<PrefetchedSignedExchangeCache> prefetched_signed_exchange_cache, - std::unique_ptr<WebBundleHandleTracker> web_bundle_handle_tracker, mojo::PendingReceiver<mojom::NavigationRendererCancellationListener> renderer_cancellation_listener);
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index d27e145d..99f13a94 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -1120,6 +1120,18 @@ } } +// Helper function to get navgation entry if |request| is a history navigation +// that didn't get served from back/forward cache. +NavigationEntryImpl* GetNavigationEntryIfNonBackForwardCacheHistoryNavigation( + NavigationRequest* request) { + if (!request->IsServedFromBackForwardCache() && + BackForwardCacheMetrics::IsCrossDocumentMainFrameHistoryNavigation( + request)) { + return static_cast<NavigationEntryImpl*>(request->GetNavigationEntry()); + } + return nullptr; +} + } // namespace class RenderFrameHostImpl::SubresourceLoaderFactoriesConfig { @@ -3414,7 +3426,6 @@ std::move(pending_navigate_->blob_url_loader_factory), std::move(pending_navigate_->navigation_client), EnsurePrefetchedSignedExchangeCache(), - MaybeCreateWebBundleHandleTracker(), std::move(pending_navigate_->renderer_cancellation_listener)); pending_navigate_.reset(); } @@ -4353,6 +4364,27 @@ return BackForwardCacheDisablingFeatureHandle(this, feature); } +void RenderFrameHostImpl::UpdateBackForwardCacheNotRestoredReasons( + NavigationRequest* navigation_request) { + if (NavigationEntryImpl* entry = + GetNavigationEntryIfNonBackForwardCacheHistoryNavigation( + navigation_request)) { + if (!entry->back_forward_cache_metrics()) { + // Create a metrics if there is none. + FrameNavigationEntry* frame_navigation_entry = + entry->GetFrameEntry(navigation_request->frame_tree_node()); + scoped_refptr<BackForwardCacheMetrics> metrics = + base::WrapRefCounted(new BackForwardCacheMetrics( + frame_navigation_entry->document_sequence_number())); + entry->set_back_forward_cache_metrics(std::move(metrics)); + } + // Update NotRestoredReasons to include additional reasons only + // known at commit time, before reporting to the renderer. + entry->back_forward_cache_metrics()->UpdateNotRestoredReasonsForNavigation( + navigation_request); + } +} + bool RenderFrameHostImpl::IsFrozen() { // TODO(crbug.com/1081920): Account for non-bfcache freezing here as well. return lifecycle_state() == LifecycleStateImpl::kInBackForwardCache; @@ -5179,10 +5211,12 @@ std::move(dialog_closed_callback)); } -void RenderFrameHostImpl::WillPotentiallyStartNavigation(const GURL& url) { - TRACE_EVENT1("navigation", - "RenderFrameHostImpl::WillPotentiallyStartNavigation", "url", - url); +void RenderFrameHostImpl::WillPotentiallyStartOutermostMainFrameNavigation( + const GURL& url) { + TRACE_EVENT2( + "navigation", + "RenderFrameHostImpl::WillPotentiallyStartOutermostMainFrameNavigation", + "url", url, "render_frame_host", this); GURL filtered_url(url); GetProcess()->FilterURL(/*empty_allowed=*/false, &filtered_url); @@ -7830,7 +7864,6 @@ frame_tree_node(), std::move(validated_params), std::move(begin_params), std::move(blob_url_loader_factory), std::move(navigation_client), EnsurePrefetchedSignedExchangeCache(), - MaybeCreateWebBundleHandleTracker(), std::move(renderer_cancellation_listener)); } @@ -10244,6 +10277,11 @@ .WithArgs(std::move(receiver)); } +void RenderFrameHostImpl::BindNonAssociatedLocalFrameHost( + mojo::PendingReceiver<blink::mojom::NonAssociatedLocalFrameHost> receiver) { + non_associated_local_frame_host_receiver_.Bind(std::move(receiver)); +} + bool RenderFrameHostImpl::CancelPrerendering( const PrerenderCancellationReason& reason) { // A prerendered page is identified by its root FrameTreeNode id, so if this @@ -12042,30 +12080,29 @@ } blink::mojom::BackForwardCacheNotRestoredReasonsPtr not_restored_reasons; + UpdateBackForwardCacheNotRestoredReasons(navigation_request); // Only populate the web-exposed NotRestoredReasons when needed by the // NotRestoredReasons API, i.e. for cross-document main frame history - // navigations that are not served by back/forward cache. + // navigations that are not served by back/forward cache where back/forward + // cache flag and NotRestoredReasons flag are enabled. if (IsBackForwardCacheEnabled() && - !navigation_request->IsServedFromBackForwardCache() && - BackForwardCacheMetrics::IsCrossDocumentMainFrameHistoryNavigation( - navigation_request)) { - if (NavigationEntryImpl* entry = static_cast<NavigationEntryImpl*>( - navigation_request->GetNavigationEntry())) { - if (auto* metrics = entry->back_forward_cache_metrics()) { - // Update NotRestoredReasons to include additional reasons only known at - // commit time, before reporting to the renderer. - metrics->UpdateNotRestoredReasonsForNavigation(navigation_request, - /*before_commit=*/true); - if (base::FeatureList::IsEnabled( - blink::features::kBackForwardCacheSendNotRestoredReasons)) { - // Only populate the web-exposed NotRestoredReasons when needed by the - // NotRestoredReasons API, i.e. for cross-document main frame history - // navigations that are not served by back/forward cache. - not_restored_reasons = metrics->GetWebExposedNotRestoredReasons(); - } - } + base::FeatureList::IsEnabled( + blink::features::kBackForwardCacheSendNotRestoredReasons)) { + if (NavigationEntryImpl* entry = + GetNavigationEntryIfNonBackForwardCacheHistoryNavigation( + navigation_request)) { + auto* metrics = entry->back_forward_cache_metrics(); + // There must be a metrics object since if there's none + // |UpdateBackForwardCacheNotRestoredReasons| should have created one. + DCHECK(metrics); + // Only populate the web-exposed NotRestoredReasons when needed by the + // NotRestoredReasons API, i.e. for cross-document main frame history + // navigations that are not served by back/forward cache. + // TODO(yuzus): Do not set this when navigation gets redirected. + not_restored_reasons = metrics->GetWebExposedNotRestoredReasons(); } } + // Save the last sent NotRestoredReasons value for testing, so that we can // verify them in tests. not_restored_reasons_for_testing_ = not_restored_reasons.Clone(); @@ -12108,6 +12145,7 @@ DCHECK_NE(GURL(), common_params->url); DCHECK_NE(net::OK, error_code); IncreaseCommitNavigationCounter(); + UpdateBackForwardCacheNotRestoredReasons(navigation_request); navigation_client->CommitFailedNavigation( std::move(common_params), std::move(commit_params), has_stale_copy_in_cache, error_code, extended_error_code, @@ -12398,15 +12436,7 @@ RenderFrameHostImpl::MaybeCreateWebBundleHandleTracker() { if (web_bundle_handle_) return web_bundle_handle_->MaybeCreateTracker(); - FrameTreeNode* frame_owner = - frame_tree_node_->parent() ? frame_tree_node_->parent()->frame_tree_node() - : frame_tree_node_->opener(); - if (!frame_owner) - return nullptr; - RenderFrameHostImpl* frame_owner_host = frame_owner->current_frame_host(); - if (!frame_owner_host->web_bundle_handle_) - return nullptr; - return frame_owner_host->web_bundle_handle_->MaybeCreateTracker(); + return nullptr; } RenderWidgetHostImpl* RenderFrameHostImpl::GetLocalRenderWidgetHost() const {
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 1e423b2..340c9e0 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -288,6 +288,7 @@ public blink::mojom::AssociatedInterfaceProvider, public blink::mojom::BackForwardCacheControllerHost, public blink::mojom::LocalFrameHost, + public blink::mojom::NonAssociatedLocalFrameHost, public blink::mojom::LocalMainFrameHost, public ui::AXActionHandlerBase, public network::mojom::CookieAccessObserver, @@ -586,6 +587,14 @@ // BackForwardCacheBrowserTest::AddBlocklistedFeature should be used. void UseDummyStickyBackForwardCacheDisablingFeatureForTesting(); + // Update NotRestoredReasons for |navigation_request| if this is a + // cross-document main frame navigation and is not served from back/forward + // cache. This will create a metrics object if there is none. This can happen + // when we create a new navigation entry such as session restore. + // TODO(yuzus): Move this to NavigationEntry. + void UpdateBackForwardCacheNotRestoredReasons( + NavigationRequest* navigation_request); + const blink::mojom::BackForwardCacheNotRestoredReasonsPtr& NotRestoredReasonsForTesting() { return not_restored_reasons_for_testing_; @@ -1775,8 +1784,8 @@ // Clears the entries in the PrefetchedSignedExchangeCache if exists. void ClearPrefetchedSignedExchangeCache(); - // Creates a WebBundleHandleTracker from WebBundleHandles which are attached - // |this| or the parent frame or the opener frame. + // Creates a WebBundleHandleTracker from WebBundleHandles which is attached + // to `this`, if one exists. std::unique_ptr<WebBundleHandleTracker> MaybeCreateWebBundleHandleTracker(); void set_did_stop_loading_callback_for_testing(base::OnceClosure callback) { @@ -2000,6 +2009,10 @@ void BindRenderAccessibilityHost( mojo::PendingReceiver<blink::mojom::RenderAccessibilityHost> receiver); + void BindNonAssociatedLocalFrameHost( + mojo::PendingReceiver<blink::mojom::NonAssociatedLocalFrameHost> + receiver); + // Prerender2: // Tells PrerenderHostRegistry to cancel the prerendering of the page this // frame is in, which destroys this frame. @@ -2232,7 +2245,8 @@ RunModalPromptDialogCallback callback) override; void RunBeforeUnloadConfirm(bool is_reload, RunBeforeUnloadConfirmCallback callback) override; - void WillPotentiallyStartNavigation(const GURL& url) override; + void WillPotentiallyStartOutermostMainFrameNavigation( + const GURL& url) override; void UpdateFaviconURL( std::vector<blink::mojom::FaviconURLPtr> favicon_urls) override; void DownloadURL(blink::mojom::DownloadURLParamsPtr params) override; @@ -4069,6 +4083,8 @@ mojo::AssociatedRemote<mojom::FrameBindingsControl> frame_bindings_control_; mojo::AssociatedReceiver<blink::mojom::LocalFrameHost> local_frame_host_receiver_{this}; + mojo::Receiver<blink::mojom::NonAssociatedLocalFrameHost> + non_associated_local_frame_host_receiver_{this}; // Should only be bound when the frame is a swapped in main frame. mojo::AssociatedReceiver<blink::mojom::LocalMainFrameHost> local_main_frame_host_receiver_{this};
diff --git a/content/browser/renderer_host/render_frame_host_impl_interface_binders.cc b/content/browser/renderer_host/render_frame_host_impl_interface_binders.cc index 05a8d6d..cdfc1e7 100644 --- a/content/browser/renderer_host/render_frame_host_impl_interface_binders.cc +++ b/content/browser/renderer_host/render_frame_host_impl_interface_binders.cc
@@ -126,7 +126,7 @@ } BackForwardCacheImpl::VlogUnexpectedRendererToBrowserMessage( - interface_name_, message->name()); + interface_name_, message->name(), render_frame_host_); TRACE_EVENT2( "content", "BackForwardCacheMessageFilter::WillDispatch bad_message", @@ -388,6 +388,7 @@ frame_.reset(); frame_bindings_control_.reset(); local_frame_host_receiver_.reset(); + non_associated_local_frame_host_receiver_.reset(); local_main_frame_host_receiver_.reset(); broker_receiver_.reset();
diff --git a/content/browser/service_worker/service_worker_new_script_loader.cc b/content/browser/service_worker/service_worker_new_script_loader.cc index b3d3208..f97e1f0 100644 --- a/content/browser/service_worker/service_worker_new_script_loader.cc +++ b/content/browser/service_worker/service_worker_new_script_loader.cc
@@ -34,6 +34,11 @@ namespace content { +namespace { +constexpr char kServiceWorkerNewScriptLoaderScope[] = + "ServiceWorkerNewScriptLoader"; +} // namespace + // We chose this size because the AppCache uses this. const uint32_t ServiceWorkerNewScriptLoader::kReadBufferSize = 32768; @@ -86,7 +91,8 @@ int64_t cache_resource_id, bool is_throttle_needed, const GlobalRenderFrameHostId& requesting_frame_id) - : request_url_(original_request.url), + : request_id_(request_id), + request_url_(original_request.url), is_main_script_(original_request.destination == network::mojom::RequestDestination::kServiceWorker && original_request.mode == @@ -98,7 +104,16 @@ base::SequencedTaskRunner::GetCurrentDefault()), loader_factory_(std::move(loader_factory)), client_(std::move(client)), + client_producer_watcher_(FROM_HERE, + mojo::SimpleWatcher::ArmingPolicy::MANUAL, + base::SequencedTaskRunner::GetCurrentDefault()), requesting_frame_id_(requesting_frame_id) { + TRACE_EVENT_WITH_FLOW1( + "ServiceWorker", + "ServiceWorkerNewScriptLoader::ServiceWorkerNewScriptLoader", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_OUT, "request_url", request_url_); CHECK_NE(cache_resource_id, blink::mojom::kInvalidServiceWorkerResourceId); network::ResourceRequest resource_request(original_request); @@ -173,6 +188,12 @@ } ServiceWorkerNewScriptLoader::~ServiceWorkerNewScriptLoader() { + TRACE_EVENT_WITH_FLOW1( + "ServiceWorker", + "ServiceWorkerNewScriptLoader::~ServiceWorkerNewScriptLoader", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN, "request_url", request_url_); // This class is used as a SelfOwnedReceiver and its lifetime is tied to the // corresponding mojo connection. There could be cases where the mojo // connection is disconnected while writing the response to the storage. @@ -200,16 +221,34 @@ void ServiceWorkerNewScriptLoader::SetPriority(net::RequestPriority priority, int32_t intra_priority_value) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::SetPriority", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); if (network_loader_) network_loader_->SetPriority(priority, intra_priority_value); } void ServiceWorkerNewScriptLoader::PauseReadingBodyFromNet() { + TRACE_EVENT_WITH_FLOW1( + "ServiceWorker", "ServiceWorkerNewScriptLoader::PauseReadingBodyFromNet", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "request_url", + request_url_); if (network_loader_) network_loader_->PauseReadingBodyFromNet(); } void ServiceWorkerNewScriptLoader::ResumeReadingBodyFromNet() { + TRACE_EVENT_WITH_FLOW1( + "ServiceWorker", "ServiceWorkerNewScriptLoader::ResumeReadingBodyFromNet", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "request_url", + request_url_); if (network_loader_) network_loader_->ResumeReadingBodyFromNet(); } @@ -217,12 +256,25 @@ // URLLoaderClient for network loader ------------------------------------------ void ServiceWorkerNewScriptLoader::OnReceiveEarlyHints( - network::mojom::EarlyHintsPtr early_hints) {} + network::mojom::EarlyHintsPtr early_hints) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnReceiveEarlyHints", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); +} void ServiceWorkerNewScriptLoader::OnReceiveResponse( network::mojom::URLResponseHeadPtr response_head, mojo::ScopedDataPipeConsumerHandle body, absl::optional<mojo_base::BigBuffer> cached_metadata) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnReceiveResponse", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); CHECK_EQ(LoaderState::kLoadingHeader, network_loader_state_); if (!version_->context() || version_->is_redundant()) { CommitCompleted(network::URLLoaderCompletionStatus(net::ERR_FAILED), @@ -319,6 +371,11 @@ std::move(client_consumer), std::move(cached_metadata)); + client_producer_watcher_.Watch( + client_producer_.get(), MOJO_HANDLE_SIGNAL_WRITABLE, + base::BindRepeating(&ServiceWorkerNewScriptLoader::OnClientWritable, + weak_factory_.GetWeakPtr())); + network_consumer_ = std::move(body); network_loader_state_ = LoaderState::kLoadingBody; MaybeStartNetworkConsumerHandleWatcher(); @@ -327,6 +384,12 @@ void ServiceWorkerNewScriptLoader::OnReceiveRedirect( const net::RedirectInfo& redirect_info, network::mojom::URLResponseHeadPtr response_head) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnReceiveRedirect", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); // Resource requests for service worker scripts should not follow redirects. // // Step 9.5: "Set request's redirect mode to "error"." @@ -342,17 +405,35 @@ int64_t current_position, int64_t total_size, OnUploadProgressCallback ack_callback) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnUploadProgress", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); client_->OnUploadProgress(current_position, total_size, std::move(ack_callback)); } void ServiceWorkerNewScriptLoader::OnTransferSizeUpdated( int32_t transfer_size_diff) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnTransferSizeUpdated", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); client_->OnTransferSizeUpdated(transfer_size_diff); } void ServiceWorkerNewScriptLoader::OnComplete( const network::URLLoaderCompletionStatus& status) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnComplete", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); LoaderState previous_state = network_loader_state_; network_loader_state_ = LoaderState::kCompleted; if (status.error_code != net::OK) { @@ -389,6 +470,12 @@ void ServiceWorkerNewScriptLoader::WriteHeaders( network::mojom::URLResponseHeadPtr response_head) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::WriteHeaders", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); CHECK_EQ(WriterState::kNotStarted, header_writer_state_); header_writer_state_ = WriterState::kWriting; net::Error error = cache_writer_->MaybeWriteHeaders( @@ -405,6 +492,12 @@ } void ServiceWorkerNewScriptLoader::OnWriteHeadersComplete(net::Error error) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnWriteHeadersComplete", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); CHECK_EQ(WriterState::kWriting, header_writer_state_); CHECK_NE(net::ERR_IO_PENDING, error); if (error != net::OK) { @@ -429,6 +522,13 @@ } void ServiceWorkerNewScriptLoader::MaybeStartNetworkConsumerHandleWatcher() { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::" + "MaybeStartNetworkConsumerHandleWatcher", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); if (network_loader_state_ == LoaderState::kLoadingHeader) { // OnReceiveResponse() or OnComplete() will continue the sequence. return; @@ -459,6 +559,12 @@ uint32_t bytes_available = 0; MojoResult result = network::MojoToNetPendingBuffer::BeginRead( &network_consumer_, &pending_buffer, &bytes_available); + TRACE_EVENT_WITH_FLOW2( + "ServiceWorker", "ServiceWorkerNewScriptLoader::OnNetworkDataAvailable", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "request_url", + request_url_, "begin_read_result", result); switch (result) { case MOJO_RESULT_OK: WriteData(std::move(pending_buffer), bytes_available); @@ -486,6 +592,12 @@ pending_buffer ? pending_buffer->buffer() : nullptr); MojoResult result = client_producer_->WriteData( buffer->data(), &bytes_written, MOJO_WRITE_DATA_FLAG_NONE); + TRACE_EVENT_WITH_FLOW2( + "ServiceWorker", "ServiceWorkerNewScriptLoader::WriteData", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, "request_url", + request_url_, "write_data_result", result); switch (result) { case MOJO_RESULT_OK: break; @@ -497,11 +609,14 @@ nullptr); return; case MOJO_RESULT_SHOULD_WAIT: - // No data was written to |client_producer_| because the pipe was full. + DCHECK(pending_buffer); + DCHECK(!pending_network_buffer_); + DCHECK_EQ(pending_network_bytes_available_, 0u); + // No data was written to `client_producer_` because the pipe was full. // Retry when the pipe becomes ready again. - pending_buffer->CompleteRead(0); - network_consumer_ = pending_buffer->ReleaseHandle(); - network_watcher_.ArmOrNotify(); + pending_network_buffer_ = std::move(pending_buffer); + pending_network_bytes_available_ = bytes_available; + client_producer_watcher_.ArmOrNotify(); return; default: CHECK(false) << static_cast<int>(result); // NOTREACHED @@ -530,6 +645,12 @@ scoped_refptr<network::MojoToNetPendingBuffer> pending_buffer, uint32_t bytes_written, net::Error error) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnWriteDataComplete", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); CHECK_NE(net::ERR_IO_PENDING, error); if (error != net::OK) { ServiceWorkerMetrics::CountWriteResponseResult( @@ -565,6 +686,12 @@ const network::URLLoaderCompletionStatus& status, const std::string& status_message, const network::mojom::URLResponseHeadPtr response_head) { + TRACE_EVENT_WITH_FLOW1("ServiceWorker", + "ServiceWorkerNewScriptLoader::CommitCompleted", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_); net::Error error_code = static_cast<net::Error>(status.error_code); int bytes_written = -1; if (error_code == net::OK) { @@ -596,6 +723,7 @@ client_->OnComplete(status); client_producer_.reset(); + client_producer_watcher_.Cancel(); network_loader_.reset(); network_consumer_.reset(); @@ -606,4 +734,21 @@ body_writer_state_ = WriterState::kCompleted; } +void ServiceWorkerNewScriptLoader::OnClientWritable(MojoResult result) { + TRACE_EVENT_WITH_FLOW2("ServiceWorker", + "ServiceWorkerNewScriptLoader::OnClientWritable", + TRACE_ID_WITH_SCOPE(kServiceWorkerNewScriptLoaderScope, + TRACE_ID_LOCAL(request_id_)), + TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT, + "request_url", request_url_, "mojo_result", result); + DCHECK(pending_network_buffer_); + DCHECK_GT(pending_network_bytes_available_, 0u); + + scoped_refptr<network::MojoToNetPendingBuffer> pending_buffer = + std::move(pending_network_buffer_); + uint32_t bytes_available = pending_network_bytes_available_; + pending_network_bytes_available_ = 0; + WriteData(std::move(pending_buffer), bytes_available); +} + } // namespace content
diff --git a/content/browser/service_worker/service_worker_new_script_loader.h b/content/browser/service_worker/service_worker_new_script_loader.h index 72653fd..9be2cb2 100644 --- a/content/browser/service_worker/service_worker_new_script_loader.h +++ b/content/browser/service_worker/service_worker_new_script_loader.h
@@ -173,17 +173,17 @@ const std::string& status_message, network::mojom::URLResponseHeadPtr response_head); - // Called when |client_producer_| is writable. It writes |data_to_send_| - // to |client_producer_|. If all data is written, the observer has completed - // its work and |write_observer_complete_callback_| is called. Otherwise, - // |client_producer_watcher_| is armed to wait for |client_producer_| to be - // writable again. + // Called when `client_producer_` is writable. Must be called only when + // `pending_write_buffer_` is available. It writes + // `pending_write_buffer_` to `client_producer_` via WriteData(). void OnClientWritable(MojoResult); // Called when ServiceWorkerCacheWriter::Resume() completes its work. // If not all data are received, it continues to download from network. void OnCacheWriterResumed(net::Error error); + const int request_id_; + const GURL request_url_; const bool is_main_script_; @@ -210,6 +210,13 @@ // Used for responding with the fetched script to this loader's client. URLLoaderClientCheckedRemote client_; mojo::ScopedDataPipeProducerHandle client_producer_; + mojo::SimpleWatcher client_producer_watcher_; + + // Holds a part of body data from network that wasn't able to write to + // `client_producer_` since the data pipe was full. Only available when + // `client_producer_` gets blocked. + scoped_refptr<network::MojoToNetPendingBuffer> pending_network_buffer_; + uint32_t pending_network_bytes_available_ = 0; // Represents the state of |network_loader_|. // Corresponds to the steps described in the class comments.
diff --git a/content/browser/service_worker/service_worker_new_script_loader_unittest.cc b/content/browser/service_worker/service_worker_new_script_loader_unittest.cc index 34e29ec9..97c8ad1 100644 --- a/content/browser/service_worker/service_worker_new_script_loader_unittest.cc +++ b/content/browser/service_worker/service_worker_new_script_loader_unittest.cc
@@ -22,6 +22,7 @@ #include "content/browser/url_loader_factory_getter.h" #include "content/public/test/browser_task_environment.h" #include "content/public/test/url_loader_interceptor.h" +#include "mojo/public/cpp/system/data_pipe.h" #include "mojo/public/cpp/system/data_pipe_utils.h" #include "net/base/features.h" #include "net/base/load_flags.h" @@ -30,8 +31,11 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/url_request/redirect_info.h" +#include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/url_loader_completion_status.h" +#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" #include "services/network/public/mojom/parsed_headers.mojom.h" +#include "services/network/public/mojom/url_loader.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" #include "services/network/test/test_url_loader_client.h" #include "third_party/blink/public/common/features.h" @@ -361,6 +365,125 @@ ServiceWorkerMetrics::WRITE_OK, 3); } +namespace { + +// A URLLoaderFactory that provides access to a mojo data pipe for sending a +// response body. Can only handle one URLLoader, i.e, CreateLoaderAndStart() +// can be called only once. +class BodyDataPipeTestURLLoaderFactory final + : public network::mojom::URLLoaderFactory { + public: + BodyDataPipeTestURLLoaderFactory() = default; + + mojo::ScopedDataPipeProducerHandle TakeBody() { + DCHECK(body_producer_); + return std::move(body_producer_); + } + + private: + // mojom::URLLoaderFactory implementation. + void CreateLoaderAndStart( + mojo::PendingReceiver<network::mojom::URLLoader> receiver, + int32_t request_id, + uint32_t options, + const network::ResourceRequest& url_request, + mojo::PendingRemote<network::mojom::URLLoaderClient> pending_client, + const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) + override { + auto response_head = network::mojom::URLResponseHead::New(); + response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>( + net::HttpUtil::AssembleRawHeaders("HTTP/1.1 200 OK\n" + "Content-Type: text/javascript\r\n")); + response_head->headers->GetMimeType(&response_head->mime_type); + response_head->parsed_headers = network::mojom::ParsedHeaders::New(); + + mojo::ScopedDataPipeConsumerHandle body_consumer; + CHECK_EQ(MOJO_RESULT_OK, + mojo::CreateDataPipe(nullptr, body_producer_, body_consumer)); + + mojo::Remote<network::mojom::URLLoaderClient> client( + std::move(pending_client)); + + client->OnReceiveResponse(std::move(response_head), + std::move(body_consumer), + /*cached_metadata=*/absl::nullopt); + + network::URLLoaderCompletionStatus status; + status.error_code = net::OK; + client->OnComplete(status); + } + + void Clone(mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver) + override { + NOTREACHED(); + } + + mojo::ScopedDataPipeProducerHandle body_producer_; +}; + +} // namespace + +// Regression test for https://crbug.com/1312995. +TEST_F(ServiceWorkerNewScriptLoaderTest, Success_ClientConsumeBodyLater) { + const GURL kScriptURL("https://example.com/large-body.js"); + const std::string kBody(ServiceWorkerNewScriptLoader::kReadBufferSize, 'a'); + + SetUpRegistration(kScriptURL); + ASSERT_TRUE(registration_); + ASSERT_TRUE(version_); + + network::ResourceRequest request; + request.url = kScriptURL; + request.method = "GET"; + request.destination = network::mojom::RequestDestination::kServiceWorker; + request.mode = network::mojom::RequestMode::kSameOrigin; + + BodyDataPipeTestURLLoaderFactory loader_factory; + auto shared_loader_factory = + base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( + &loader_factory); + + network::TestURLLoaderClient client = network::TestURLLoaderClient(); + auto loader = ServiceWorkerNewScriptLoader::CreateAndStart( + /*request_id=*/10, /*options=*/0, request, client.CreateRemote(), + version_, shared_loader_factory, + net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS), + /*cache_resource_id=*/5, + /*is_throttle_needed=*/false, + /*requesting_frame_id=*/GlobalRenderFrameHostId()); + + client.RunUntilResponseReceived(); + ASSERT_TRUE(client.has_received_response()); + ASSERT_TRUE(client.response_body().is_valid()); + + // Keep writing body until ServiceWorkerNewScriptLoader's client producer + // data pipe becomes full. + mojo::ScopedDataPipeProducerHandle body_producer = loader_factory.TakeBody(); + uint32_t total_bytes_written = 0; + while (true) { + uint32_t bytes_written = ServiceWorkerNewScriptLoader::kReadBufferSize; + MojoResult result = body_producer->WriteData(kBody.data(), &bytes_written, + MOJO_WRITE_DATA_FLAG_NONE); + if (result != MOJO_RESULT_OK) { + ASSERT_EQ(result, MOJO_RESULT_SHOULD_WAIT); + break; + } + total_bytes_written += bytes_written; + // Make sure ServiceWorkerNewScriptLoader have a chance to write data to the + // client's producer data pipe. This should not enter an infinite loop. + base::RunLoop().RunUntilIdle(); + } + + // Close the body data pipe so that ReadDataPipe() can finish. + body_producer.reset(); + + std::string response = ReadDataPipe(client.response_body_release()); + ASSERT_EQ(response.size(), total_bytes_written); + + client.RunUntilComplete(); + ASSERT_EQ(net::OK, client.completion_status().error_code); +} + TEST_F(ServiceWorkerNewScriptLoaderTest, Error_404) { base::HistogramTester histogram_tester;
diff --git a/content/browser/service_worker/service_worker_updated_script_loader.cc b/content/browser/service_worker/service_worker_updated_script_loader.cc index af82f21b..c9ed6e79 100644 --- a/content/browser/service_worker/service_worker_updated_script_loader.cc +++ b/content/browser/service_worker/service_worker_updated_script_loader.cc
@@ -259,6 +259,16 @@ } void ServiceWorkerUpdatedScriptLoader::OnClientWritable(MojoResult) { + if (pending_network_buffer_) { + DCHECK_GT(pending_network_bytes_available_, 0u); + scoped_refptr<network::MojoToNetPendingBuffer> pending_buffer = + std::move(pending_network_buffer_); + uint32_t bytes_available = pending_network_bytes_available_; + pending_network_bytes_available_ = 0; + WriteData(std::move(pending_buffer), bytes_available); + return; + } + CHECK(data_to_send_); CHECK_GE(data_length_, bytes_sent_to_client_); CHECK(client_producer_); @@ -396,11 +406,14 @@ ServiceWorkerConsts::kServiceWorkerFetchScriptError); return; case MOJO_RESULT_SHOULD_WAIT: - // No data was written to |client_producer_| because the pipe was full. + DCHECK(pending_buffer); + DCHECK(!pending_network_buffer_); + DCHECK_EQ(pending_network_bytes_available_, 0u); + // No data was written to `client_producer_` because the pipe was full. // Retry when the pipe becomes ready again. - pending_buffer->CompleteRead(0); - network_consumer_ = pending_buffer->ReleaseHandle(); - network_watcher_.ArmOrNotify(); + pending_network_buffer_ = std::move(pending_buffer); + pending_network_bytes_available_ = bytes_available; + client_producer_watcher_.ArmOrNotify(); return; default: CHECK(false) << static_cast<int>(result); // NOTREACHED
diff --git a/content/browser/service_worker/service_worker_updated_script_loader.h b/content/browser/service_worker/service_worker_updated_script_loader.h index e21dac38..6f27d8af 100644 --- a/content/browser/service_worker/service_worker_updated_script_loader.h +++ b/content/browser/service_worker/service_worker_updated_script_loader.h
@@ -189,6 +189,12 @@ URLLoaderClientCheckedRemote client_; mojo::ScopedDataPipeProducerHandle client_producer_; + // Holds a part of body data from network that wasn't able to write to + // `client_producer_` since the data pipe was full. Only available when + // `client_producer_` gets blocked. + scoped_refptr<network::MojoToNetPendingBuffer> pending_network_buffer_; + uint32_t pending_network_bytes_available_ = 0; + // Represents the state of |network_loader_|. // Corresponds to the steps of calls as a URLLoaderClient. //
diff --git a/content/browser/service_worker/service_worker_updated_script_loader_unittest.cc b/content/browser/service_worker/service_worker_updated_script_loader_unittest.cc index 1d1e2de..edbc4e2b 100644 --- a/content/browser/service_worker/service_worker_updated_script_loader_unittest.cc +++ b/content/browser/service_worker/service_worker_updated_script_loader_unittest.cc
@@ -388,6 +388,50 @@ LookupResourceId(kScriptURL)); } +// Regression test for https://crbug.com/1312995. +TEST_P(ServiceWorkerUpdatedScriptLoaderTest, ClientConsumeNetworkLater) { + const std::string kNewHeaders = + "HTTP/1.1 200 OK\0Content-Type: text/javascript\0\0"; + const std::string kSameBlock = kOldData; + const std::string kDiffBlock = "|diff-block|"; + const std::string kNetworkBlock( + ServiceWorkerUpdatedScriptLoader::kReadBufferSize, 'a'); + std::string new_data = kSameBlock + kDiffBlock; + + SetUpComparedScriptInfo( + kSameBlock.length(), kNewHeaders, kDiffBlock, + ServiceWorkerUpdatedScriptLoader::LoaderState::kLoadingBody, + ServiceWorkerUpdatedScriptLoader::WriterState::kWriting); + + DoRequest(kScriptURL, &client_, &loader_); + + // Keep writing body until ServiceWorkerUpdatedScriptLoader's client producer + // data pipe becomes full. + while (true) { + uint32_t bytes_written = kNetworkBlock.size(); + MojoResult result = network_producer_->WriteData( + kNetworkBlock.data(), &bytes_written, MOJO_WRITE_DATA_FLAG_NONE); + if (result != MOJO_RESULT_OK) { + ASSERT_EQ(result, MOJO_RESULT_SHOULD_WAIT); + break; + } + new_data += kNetworkBlock.substr(0, bytes_written); + // Make sure ServiceWorkerUpdatedScriptLoader have a chance to write data to + // the client's producer data pipe. This should not enter an infinite loop. + base::RunLoop().RunUntilIdle(); + } + + // Notify the completion of network loader. + network_producer_.reset(); + NotifyLoaderCompletion(net::OK); + + std::string response = ReadDataPipe(client_->response_body_release()); + ASSERT_EQ(response, new_data); + + client_->RunUntilComplete(); + ASSERT_EQ(net::OK, client_->completion_status().error_code); +} + INSTANTIATE_TEST_SUITE_P(All, ServiceWorkerUpdatedScriptLoaderTest, testing::Values(blink::mojom::ScriptType::kClassic,
diff --git a/content/browser/webrtc/resources/BUILD.gn b/content/browser/webrtc/resources/BUILD.gn index a1569e5..69a98f8 100644 --- a/content/browser/webrtc/resources/BUILD.gn +++ b/content/browser/webrtc/resources/BUILD.gn
@@ -24,6 +24,7 @@ "stats_table.js", "tab_view.js", "timeline_graph_view.js", + "user_media.js", "webrtc_internals.html", "webrtc_internals.css", "webrtc_internals.js",
diff --git a/content/browser/webrtc/resources/stats_table.js b/content/browser/webrtc/resources/stats_table.js index 2f9f30f7..b803f16 100644 --- a/content/browser/webrtc/resources/stats_table.js +++ b/content/browser/webrtc/resources/stats_table.js
@@ -195,7 +195,7 @@ * @private */ filterStats(event, container) { - const filter = event.target.value; + const filter = event.target.value; const filters = filter.split(','); container.childNodes.forEach(node => { if (node.nodeName !== 'DETAILS') {
diff --git a/content/browser/webrtc/resources/user_media.js b/content/browser/webrtc/resources/user_media.js new file mode 100644 index 0000000..fa2a2df6 --- /dev/null +++ b/content/browser/webrtc/resources/user_media.js
@@ -0,0 +1,178 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {$} from 'chrome://resources/js/util.js'; +const USER_MEDIA_TAB_ID = 'user-media-tab-id'; + +/** + * A helper function for appending a child element to |parent|. + * + * @param {!Element} parent The parent element. + * @param {string} tag The child element tag. + * @param {string} text The textContent of the new DIV. + * @return {!Element} the new DIV element. + */ + function appendChildWithText(parent, tag, text) { + const child = document.createElement(tag); + child.textContent = text; + parent.appendChild(child); + return child; +} + +export class UserMediaTable { + /** + * @param {Object} tabView the TabView object to add the user media tab to. + */ + constructor(tabView) { + this.tabView = tabView; + } + + /** + * Populate the tab view with a getUserMedia/getDisplayMedia tab. + */ + createTab() { + const container = this.tabView.addTab(USER_MEDIA_TAB_ID, + 'GetUserMedia/GetDisplayMedia Requests'); + // Create the filter input field and label. + appendChildWithText(container, 'label', 'Filter by origin including '); + const input = document.createElement('input'); + input.size = 30; + input.oninput = this.filterUserMedia.bind(this); + container.appendChild(input); + } + + /** + * Apply a filter to the user media table. + * @param event InputEvent from the filter input field. + * @private + */ + filterUserMedia(event) { + const filter = event.target.value; + const requests = $(USER_MEDIA_TAB_ID).childNodes; + for (let i = 0; i < requests.length; ++i) { + if (!requests[i]['data-origin']) { + continue; + } + if (requests[i]['data-origin'].includes(filter)) { + requests[i].style.display = 'block'; + } else { + requests[i].style.display = 'none'; + } + } + } + + /** + * Adds a getUserMedia/getDisplayMedia request. + * @param {!Object} data The object containing rid {number}, pid {number}, + * origin {string}, request_id {number}, request_type {string}, + * audio {string}, video {string}. + */ + addMedia(data) { + if (!$(USER_MEDIA_TAB_ID)) { + this.createTab(); + } + + const requestDiv = document.createElement('div'); + requestDiv.className = 'user-media-request-div-class'; + requestDiv.id = ['gum', data.rid, data.pid, data.request_id].join('-'); + requestDiv['data-rid'] = data.rid; + requestDiv['data-origin'] = data.origin; + $(USER_MEDIA_TAB_ID).appendChild(requestDiv); + + appendChildWithText(requestDiv, 'div', 'Caller origin: ' + data.origin); + appendChildWithText(requestDiv, 'div', 'Caller process id: ' + data.pid); + + const el = appendChildWithText(requestDiv, 'span', + data.request_type + ' call'); + el.style.fontWeight = 'bold'; + appendChildWithText(el, 'div', 'Time: ' + + (new Date(data.timestamp).toTimeString())) + .style.fontWeight = 'normal'; + if (data.audio !== undefined) { + appendChildWithText(el, 'div', 'Audio constraints: ' + + (data.audio || 'true')) + .style.fontWeight = 'normal'; + } + if (data.video !== undefined) { + appendChildWithText(el, 'div', 'Video constraints: ' + + (data.video || 'true')) + .style.fontWeight = 'normal'; + } + } + + /** + * Update a getUserMedia/getDisplayMedia request with a result or error. + * + * @param {!Object} data The object containing rid {number}, pid {number}, + * request_id {number}, request_type {string}. + * For results there is also the + * stream_id {string}, audio_track_info {string} and + * video_track_info {string}. + * For errors the error {string} and + * error_message {string} fields are set. + */ + updateMedia(data) { + if (!$(USER_MEDIA_TAB_ID)) { + this.createTab(); + } + + const requestDiv = document.getElementById( + ['gum', data.rid, data.pid, data.request_id].join('-')); + if (!requestDiv) { + console.error('Could not update ' + data.request_type + ' request', data); + return; + } + + if (data.error) { + const el = appendChildWithText(requestDiv, 'span', 'Error'); + el.style.fontWeight = 'bold'; + appendChildWithText(el, 'div', 'Time: ' + + (new Date(data.timestamp).toTimeString())) + .style.fontWeight = 'normal'; + appendChildWithText(el, 'div', 'Error: ' + data.error) + .style.fontWeight = 'normal'; + appendChildWithText(el, 'div', 'Error message: ' + data.error_message) + .style.fontWeight = 'normal'; + return; + } + + const el = appendChildWithText(requestDiv, 'span', + data.request_type + ' result'); + el.style.fontWeight = 'bold'; + appendChildWithText(el, 'div', 'Time: ' + + (new Date(data.timestamp).toTimeString())) + .style.fontWeight = 'normal'; + appendChildWithText(el, 'div', 'Stream id: ' + data.stream_id) + .style.fontWeight = 'normal'; + if (data.audio_track_info) { + appendChildWithText(el, 'div', 'Audio track: ' + data.audio_track_info) + .style.fontWeight = 'normal'; + } + if (data.video_track_info) { + appendChildWithText(el, 'div', 'Video track: ' + data.video_track_info) + .style.fontWeight = 'normal'; + } + } + + /** + * Removes the getUserMedia/getDisplayMedia requests from the specified |rid|. + * + * @param {!Object} data The object containing rid {number}, the render id. + */ + removeMediaForRenderer(data) { + const requests = $(USER_MEDIA_TAB_ID).childNodes; + for (let i = 0; i < requests.length; ++i) { + if (!requests[i]['data-origin']) { + continue; + } + if (requests[i]['data-rid'] === data.rid) { + $(USER_MEDIA_TAB_ID).removeChild(requests[i]); + } + } + // Remove the tab when only the search field and its label are left. + if ($(USER_MEDIA_TAB_ID).childNodes.length === 2) { + this.tabView.removeTab(USER_MEDIA_TAB_ID); + } + } +}
diff --git a/content/browser/webrtc/resources/webrtc_internals.js b/content/browser/webrtc/resources/webrtc_internals.js index aebd1a1..f368533 100644 --- a/content/browser/webrtc/resources/webrtc_internals.js +++ b/content/browser/webrtc/resources/webrtc_internals.js
@@ -14,8 +14,7 @@ import {StatsTable} from './stats_table.js'; import {TabView} from './tab_view.js'; import {createIceCandidateGrid, updateIceCandidateGrid} from './candidate_grid.js'; - -const USER_MEDIA_TAB_ID = 'user-media-tab-id'; +import {UserMediaTable} from './user_media.js'; const OPTION_GETSTATS_STANDARD = 'Standardized (promise-based) getStats() API'; const OPTION_GETSTATS_LEGACY = @@ -26,6 +25,7 @@ let ssrcInfoManager = null; let peerConnectionUpdateTable = null; let statsTable = null; +let userMediaTable = null; let dumpCreator = null; // Exporting these on window since they are directly accessed by tests. @@ -113,6 +113,7 @@ window.ssrcInfoManager = ssrcInfoManager; peerConnectionUpdateTable = new PeerConnectionUpdateTable(); statsTable = new StatsTable(ssrcInfoManager); + userMediaTable = new UserMediaTable(tabView, userMediaRequests); // Add listeners for all the updates that get sent from webrtc_internals.cc. addWebUiListener('add-peer-connection', addPeerConnection); @@ -121,10 +122,22 @@ addWebUiListener('remove-peer-connection', removePeerConnection); addWebUiListener('add-standard-stats', addStandardStats); addWebUiListener('add-legacy-stats', addLegacyStats); - addWebUiListener('add-get-user-media', addGetUserMedia); - addWebUiListener('update-get-user-media', updateGetUserMedia); - addWebUiListener( - 'remove-get-user-media-for-renderer', removeGetUserMediaForRenderer); + addWebUiListener('add-media', (data) => { + userMediaRequests.push(data); + userMediaTable.addMedia(data) + }); + addWebUiListener('update-media', (data) => { + userMediaRequests.push(data); + userMediaTable.updateMedia(data); + }); + addWebUiListener('remove-media-for-renderer', (data) => { + for (let i = userMediaRequests.length - 1; i >= 0; --i) { + if (userMediaRequests[i].rid === data.rid) { + userMediaRequests.splice(i, 1); + } + } + userMediaTable.removeMediaForRenderer(data); + }); addWebUiListener( 'event-log-recordings-file-selection-cancelled', eventLogRecordingsFileSelectionCancelled); @@ -554,127 +567,6 @@ } /** - * Adds a getUserMedia/getDisplayMedia request. - * - * @param {!Object} data The object containing rid {number}, pid {number}, - * origin {string}, request_id {number}, request_type {string}, - * audio {string}, video {string}. - */ -function addGetUserMedia(data) { - userMediaRequests.push(data); - - if (!$(USER_MEDIA_TAB_ID)) { - tabView.addTab(USER_MEDIA_TAB_ID, 'GetUserMedia/GetDisplayMedia Requests'); - } - - const requestDiv = document.createElement('div'); - requestDiv.className = 'user-media-request-div-class'; - requestDiv.id = ['gum', data.rid, data.pid, data.request_id].join('-'); - requestDiv.rid = data.rid; - $(USER_MEDIA_TAB_ID).appendChild(requestDiv); - - appendChildWithText(requestDiv, 'div', 'Caller origin: ' + data.origin); - appendChildWithText(requestDiv, 'div', 'Caller process id: ' + data.pid); - - const el = appendChildWithText(requestDiv, 'span', - data.request_type + ' call'); - el.style.fontWeight = 'bold'; - appendChildWithText(el, 'div', 'Time: ' + - (new Date(data.timestamp).toTimeString())) - .style.fontWeight = 'normal'; - if (data.audio !== undefined) { - appendChildWithText(el, 'div', 'Audio constraints: ' + - (data.audio || 'true')) - .style.fontWeight = 'normal'; - } - if (data.video !== undefined) { - appendChildWithText(el, 'div', 'Video constraints: ' + - (data.video || 'true')) - .style.fontWeight = 'normal'; - } -} - -/** - * Update a getUserMedia/getDisplayMedia request with a result or error. - * - * @param {!Object} data The object containing rid {number}, pid {number}, - * request_id {number}, request_type {string}. - * For results there is also the - * stream_id {string}, audio_track_info {string} and - * video_track_info {string}. - * For errors the error {string} and - * error_message {string} fields are set. - */ -function updateGetUserMedia(data) { - userMediaRequests.push(data); - - if (!$(USER_MEDIA_TAB_ID)) { - tabView.addTab(USER_MEDIA_TAB_ID, 'GetUserMedia/GetDisplayMedia Requests'); - } - - const requestDiv = document.getElementById( - ['gum', data.rid, data.pid, data.request_id].join('-')); - if (!requestDiv) { - console.error('Could not update ' + data.request_type + ' request', data); - return; - } - - if (data.error) { - const el = appendChildWithText(requestDiv, 'span', 'Error'); - el.style.fontWeight = 'bold'; - appendChildWithText(el, 'div', 'Time: ' + - (new Date(data.timestamp).toTimeString())) - .style.fontWeight = 'normal'; - appendChildWithText(el, 'div', 'Error: ' + data.error) - .style.fontWeight = 'normal'; - appendChildWithText(el, 'div', 'Error message: ' + data.error_message) - .style.fontWeight = 'normal'; - return; - } - - const el = appendChildWithText(requestDiv, 'span', - data.request_type + ' result'); - el.style.fontWeight = 'bold'; - appendChildWithText(el, 'div', 'Time: ' + - (new Date(data.timestamp).toTimeString())) - .style.fontWeight = 'normal'; - appendChildWithText(el, 'div', 'Stream id: ' + data.stream_id) - .style.fontWeight = 'normal'; - if (data.audio_track_info) { - appendChildWithText(el, 'div', 'Audio track: ' + data.audio_track_info) - .style.fontWeight = 'normal'; - } - if (data.video_track_info) { - appendChildWithText(el, 'div', 'Video track: ' + data.video_track_info) - .style.fontWeight = 'normal'; - } -} - -/** - * Removes the getUserMedia requests from the specified |rid|. - * - * @param {!Object} data The object containing rid {number}, the render id. - */ -function removeGetUserMediaForRenderer(data) { - for (let i = userMediaRequests.length - 1; i >= 0; --i) { - if (userMediaRequests[i].rid === data.rid) { - userMediaRequests.splice(i, 1); - } - } - - const requests = $(USER_MEDIA_TAB_ID).childNodes; - for (let i = 0; i < requests.length; ++i) { - if (requests[i].rid === data.rid) { - $(USER_MEDIA_TAB_ID).removeChild(requests[i]); - } - } - if ($(USER_MEDIA_TAB_ID).childNodes.length === 0) { - tabView.removeTab(USER_MEDIA_TAB_ID); - } -} - - -/** * Notification that the audio debug recordings file selection dialog was * cancelled, i.e. recordings have not been enabled. */
diff --git a/content/browser/webrtc/webrtc_internals.cc b/content/browser/webrtc/webrtc_internals.cc index d2a9c5b..43f7dfd8 100644 --- a/content/browser/webrtc/webrtc_internals.cc +++ b/content/browser/webrtc/webrtc_internals.cc
@@ -311,8 +311,7 @@ if (get_user_media_requests_.size() >= kMaxMediaEntries) { LOG(WARNING) << "Maximum number of tracked getUserMedia/getDisplayMedia " - "requests reached " - "in webrtc-internals."; + "requests reached in webrtc-internals."; return; } @@ -333,7 +332,7 @@ dict.Set("video", video_constraints); if (!observers_.empty()) - SendUpdate("add-get-user-media", dict.Clone()); + SendUpdate("add-media", dict.Clone()); get_user_media_requests_.Append(std::move(dict)); @@ -355,8 +354,7 @@ if (get_user_media_requests_.size() >= kMaxMediaEntries) { LOG(WARNING) << "Maximum number of tracked getUserMedia/getDisplayMedia " - "requests reached " - "in webrtc-internals."; + "requests reached in webrtc-internals."; return; } @@ -373,7 +371,7 @@ dict.Set("video_track_info", video_track_info); if (!observers_.empty()) - SendUpdate("update-get-user-media", dict.Clone()); + SendUpdate("update-media", dict.Clone()); get_user_media_requests_.Append(std::move(dict)); @@ -393,9 +391,8 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); if (get_user_media_requests_.size() >= kMaxMediaEntries) { - LOG(WARNING) - << "Maximum number of tracked /getDisplayMedia requests reached " - "in webrtc-internals."; + LOG(WARNING) << "Maximum number of tracked /getDisplayMedia " + "requests reached in webrtc-internals."; return; } @@ -409,7 +406,7 @@ dict.Set("error_message", error_message); if (!observers_.empty()) - SendUpdate("update-get-user-media", dict.Clone()); + SendUpdate("update-media", dict.Clone()); get_user_media_requests_.Append(std::move(dict)); @@ -529,9 +526,9 @@ // If there is a stream_id key or an error key this is an update. if (request.GetDict().FindString("stream_id") || request.GetDict().FindString("error")) { - observer->OnUpdate("update-get-user-media", &request); + observer->OnUpdate("update-media", &request); } else { - observer->OnUpdate("add-get-user-media", &request); + observer->OnUpdate("add-media", &request); } } } @@ -748,7 +745,7 @@ if (found_any && !observers_.empty()) { base::Value::Dict update; update.Set("rid", render_process_id); - SendUpdate("remove-get-user-media-for-renderer", std::move(update)); + SendUpdate("remove-media-for-renderer", std::move(update)); } }
diff --git a/content/browser/webrtc/webrtc_internals_browsertest.cc b/content/browser/webrtc/webrtc_internals_browsertest.cc index 77739fd..c2bee72 100644 --- a/content/browser/webrtc/webrtc_internals_browsertest.cc +++ b/content/browser/webrtc/webrtc_internals_browsertest.cc
@@ -195,24 +195,24 @@ ");")); } - // Execute the javascript of addGetUserMedia. - void ExecuteAddGetUserMediaJs(const UserMediaRequestEntry& request) { + // Execute the javascript of addMedia. + void ExecuteAddMediaJs(const UserMediaRequestEntry& request) { std::stringstream ss; ss << "{rid:" << request.rid << ", pid:" << request.pid << ", origin:'" << request.origin << "', audio:'" << request.audio_constraints << "', video:'" << request.video_constraints << "'}"; - ASSERT_TRUE(ExecuteJavascript( - "cr.webUIListenerCallback('add-get-user-media', " + ss.str() + ");")); + ASSERT_TRUE(ExecuteJavascript("cr.webUIListenerCallback('add-media', " + + ss.str() + ");")); } - // Execute the javascript of removeGetUserMediaForRenderer. - void ExecuteRemoveGetUserMediaForRendererJs(int rid) { + // Execute the javascript of removeMediaForRenderer. + void ExecuteRemoveMediaForRendererJs(int rid) { std::stringstream ss; ss << "{rid:" << rid << "}"; ASSERT_TRUE(ExecuteJavascript( - "cr.webUIListenerCallback('remove-get-user-media-for-renderer', " + - ss.str() + ");")); + "cr.webUIListenerCallback('remove-media-for-renderer', " + ss.str() + + ");")); } // Verifies that the DOM element with id |id| exists. @@ -238,8 +238,7 @@ } // Verifies the JS Array of userMediaRequests matches |requests|. - void VerifyUserMediaRequest( - const std::vector<UserMediaRequestEntry>& requests) { + void VerifyMediaRequest(const std::vector<UserMediaRequestEntry>& requests) { string json_requests; ASSERT_TRUE( ExecuteScriptAndExtractString(shell(), @@ -292,7 +291,9 @@ " document.querySelector('#user-media-tab-id')" " .childNodes.length);", &user_media_request_count)); - ASSERT_EQ(requests.size(), static_cast<size_t>(user_media_request_count)); + // The list of childnodes includes the input field and its label. + ASSERT_EQ(requests.size(), + static_cast<size_t>(user_media_request_count) - 2); } } @@ -825,27 +826,27 @@ VerifyStatsDump(dump.get(), pc_0, type, id, stats); } -IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, UpdateGetUserMedia) { +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcInternalsBrowserTest, UpdateMedia) { GURL url("chrome://webrtc-internals"); EXPECT_TRUE(NavigateToURL(shell(), url)); UserMediaRequestEntry request1(1, 1, "origin", "ac", "vc"); UserMediaRequestEntry request2(2, 2, "origin2", "ac2", "vc2"); - ExecuteAddGetUserMediaJs(request1); - ExecuteAddGetUserMediaJs(request2); + ExecuteAddMediaJs(request1); + ExecuteAddMediaJs(request2); std::vector<UserMediaRequestEntry> list; list.push_back(request1); list.push_back(request2); - VerifyUserMediaRequest(list); + VerifyMediaRequest(list); - ExecuteRemoveGetUserMediaForRendererJs(1); + ExecuteRemoveMediaForRendererJs(1); list.erase(list.begin()); - VerifyUserMediaRequest(list); + VerifyMediaRequest(list); - ExecuteRemoveGetUserMediaForRendererJs(2); + ExecuteRemoveMediaForRendererJs(2); list.erase(list.begin()); - VerifyUserMediaRequest(list); + VerifyMediaRequest(list); } // Tests that the received propagation delta values are converted and drawn
diff --git a/content/browser/webrtc/webrtc_internals_unittest.cc b/content/browser/webrtc/webrtc_internals_unittest.cc index 2a071671..a661597 100644 --- a/content/browser/webrtc/webrtc_internals_unittest.cc +++ b/content/browser/webrtc/webrtc_internals_unittest.cc
@@ -400,7 +400,7 @@ loop.Run(); - ASSERT_EQ("add-get-user-media", observer.event_name()); + ASSERT_EQ("add-media", observer.event_name()); VerifyGetUserMediaData("getUserMedia", observer.event_data(), kFrameId, kPid, kRequestId, kAudioConstraint, kVideoConstraint); webrtc_internals.RemoveObserver(&observer); @@ -421,7 +421,7 @@ loop.Run(); - ASSERT_EQ("update-get-user-media", observer.event_name()); + ASSERT_EQ("update-media", observer.event_name()); VerifyGetUserMediaSuccessData(observer.event_data(), kFrameId, kPid, kRequestId, kStreamId, kAudioTrackInfo, kVideoTrackInfo); @@ -445,7 +445,7 @@ loop.Run(); - ASSERT_EQ("update-get-user-media", observer.event_name()); + ASSERT_EQ("update-media", observer.event_name()); VerifyGetUserMediaFailureData(observer.event_data(), kFrameId, kPid, kRequestId, kGetUserMediaError, kGetUserMediaErrorMessage); @@ -469,7 +469,7 @@ loop.Run(); - ASSERT_EQ("add-get-user-media", observer.event_name()); + ASSERT_EQ("add-media", observer.event_name()); VerifyGetUserMediaData("getDisplayMedia", observer.event_data(), kFrameId, kPid, kRequestId, kAudioConstraint, kVideoConstraint); webrtc_internals.RemoveObserver(&observer); @@ -490,7 +490,7 @@ loop.Run(); - ASSERT_EQ("update-get-user-media", observer.event_name()); + ASSERT_EQ("update-media", observer.event_name()); VerifyGetUserMediaSuccessData(observer.event_data(), kFrameId, kPid, kRequestId, kStreamId, kAudioTrackInfo, kVideoTrackInfo); @@ -514,7 +514,7 @@ loop.Run(); - ASSERT_EQ("update-get-user-media", observer.event_name()); + ASSERT_EQ("update-media", observer.event_name()); VerifyGetUserMediaFailureData(observer.event_data(), kFrameId, kPid, kRequestId, kGetUserMediaError, kGetUserMediaErrorMessage); @@ -535,7 +535,7 @@ webrtc_internals.AddObserver(&observer); webrtc_internals.UpdateObserver(&observer); - EXPECT_EQ("add-get-user-media", observer.event_name()); + EXPECT_EQ("add-media", observer.event_name()); VerifyGetUserMediaData("getUserMedia", observer.event_data(), kFrameId, kPid, kRequestId, kAudioConstraint, kVideoConstraint); @@ -555,7 +555,7 @@ webrtc_internals.AddObserver(&observer); webrtc_internals.UpdateObserver(&observer); - EXPECT_EQ("add-get-user-media", observer.event_name()); + EXPECT_EQ("add-media", observer.event_name()); VerifyGetUserMediaData("getDisplayMedia", observer.event_data(), kFrameId, kPid, kRequestId, kAudioConstraint, kVideoConstraint);
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 7bb5ad2..c42c1fa 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -5172,10 +5172,10 @@ } } - if (IsTopLevelNavigation(frame_) && url.SchemeIsHTTPOrHTTPS() && + if (frame_->IsOutermostMainFrame() && url.SchemeIsHTTPOrHTTPS() && !url.is_empty() && base::FeatureList::IsEnabled(kSpeculativeServiceWorkerStartup)) { - frame_->WillPotentiallyStartNavigation(url); + frame_->WillPotentiallyStartOutermostMainFrameNavigation(url); } if (info->navigation_policy == blink::kWebNavigationPolicyCurrentTab) {
diff --git a/content/test/data/web_bundle/generate-test-wbns.sh b/content/test/data/web_bundle/generate-test-wbns.sh index bec99fe..b6ca9d87 100755 --- a/content/test/data/web_bundle/generate-test-wbns.sh +++ b/content/test/data/web_bundle/generate-test-wbns.sh
@@ -8,7 +8,7 @@ if ! command -v gen-bundle > /dev/null 2>&1; then echo "gen-bundle is not installed. Please run:" - echo " go get -u github.com/WICG/webpackage/go/bundle/cmd/..." + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" echo ' export PATH=$PATH:$(go env GOPATH)/bin' exit 1 fi
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc index 7b895bc..b34ee36b 100644 --- a/content/test/navigation_simulator_impl.cc +++ b/content/test/navigation_simulator_impl.cc
@@ -709,6 +709,10 @@ browser_interface_broker_receiver_.reset(); } + // Update back/forward cache NotRestoredReasons. + if (previous_rfh) + previous_rfh->UpdateBackForwardCacheNotRestoredReasons(request_); + // The initial `navigation_url_` may have been mapped to a new URL at this // point. Overwrite it here with the desired value to correctly mock the // DidCommitProvisionalLoadParams. @@ -866,6 +870,10 @@ if (!previous_rfh->IsRenderFrameLive()) drop_unload_ack_ = true; + // Update back/forward cache NotRestoredReasons. + if (previous_rfh) + previous_rfh->UpdateBackForwardCacheNotRestoredReasons(request_); + auto params = BuildDidCommitProvisionalLoadParams( false /* same_document */, true /* failed_navigation */, render_frame_host_->last_http_status_code());
diff --git a/extensions/browser/api/alarms/alarms_api_unittest.cc b/extensions/browser/api/alarms/alarms_api_unittest.cc index 4c2eefb..95e36cf 100644 --- a/extensions/browser/api/alarms/alarms_api_unittest.cc +++ b/extensions/browser/api/alarms/alarms_api_unittest.cc
@@ -80,8 +80,11 @@ // Takes a JSON result from a function and converts it to a vector of // JsAlarms. - std::vector<std::unique_ptr<JsAlarm>> ToAlarmList(base::Value* value) { + std::vector<std::unique_ptr<JsAlarm>> ToAlarmList( + const absl::optional<base::Value>& value) { std::vector<std::unique_ptr<JsAlarm>> list; + if (!value) + return list; for (const auto& item : value->GetList()) { std::unique_ptr<JsAlarm> alarm(new JsAlarm()); @@ -105,10 +108,9 @@ "[\"0\", {\"delayInMinutes\": 0}]", }; for (size_t i = 0; i < num_alarms; ++i) { - std::unique_ptr<base::DictionaryValue> result( - RunFunctionAndReturnDictionary(new AlarmsCreateFunction(&test_clock_), - kCreateArgs[i])); - EXPECT_FALSE(result.get()); + absl::optional<base::Value> result = RunFunctionAndReturnValue( + new AlarmsCreateFunction(&test_clock_), kCreateArgs[i]); + EXPECT_FALSE(result); } } @@ -342,9 +344,9 @@ // Get the default one. { JsAlarm alarm; - std::unique_ptr<base::DictionaryValue> result( - RunFunctionAndReturnDictionary(new AlarmsGetFunction(), "[null]")); - ASSERT_TRUE(result.get()); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsGetFunction(), "[null]"); + ASSERT_TRUE(result); EXPECT_TRUE(JsAlarm::Populate(*result, &alarm)); EXPECT_EQ("", alarm.name); EXPECT_DOUBLE_EQ(4060, alarm.scheduled_time); @@ -354,9 +356,9 @@ // Get "7". { JsAlarm alarm; - std::unique_ptr<base::DictionaryValue> result( - RunFunctionAndReturnDictionary(new AlarmsGetFunction(), "[\"7\"]")); - ASSERT_TRUE(result.get()); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsGetFunction(), "[\"7\"]"); + ASSERT_TRUE(result); EXPECT_TRUE(JsAlarm::Populate(*result, &alarm)); EXPECT_EQ("7", alarm.name); EXPECT_EQ(424000, alarm.scheduled_time); @@ -365,19 +367,18 @@ // Get a non-existent one. { - std::unique_ptr<base::DictionaryValue> result( - RunFunctionAndReturnDictionary(new AlarmsGetFunction(), - "[\"nobody\"]")); - ASSERT_FALSE(result.get()); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsGetFunction(), "[\"nobody\"]"); + ASSERT_FALSE(result); } } TEST_F(ExtensionAlarmsTest, GetAll) { // Test getAll with 0 alarms. { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnList(new AlarmsGetAllFunction(), "[]")); - std::vector<std::unique_ptr<JsAlarm>> alarms = ToAlarmList(result.get()); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsGetAllFunction(), "[]"); + std::vector<std::unique_ptr<JsAlarm>> alarms = ToAlarmList(result); EXPECT_EQ(0u, alarms.size()); } @@ -385,9 +386,9 @@ CreateAlarms(2); { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnList(new AlarmsGetAllFunction(), "[null]")); - std::vector<std::unique_ptr<JsAlarm>> alarms = ToAlarmList(result.get()); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsGetAllFunction(), "[null]"); + std::vector<std::unique_ptr<JsAlarm>> alarms = ToAlarmList(result); EXPECT_EQ(2u, alarms.size()); // Test the "7" alarm. @@ -432,8 +433,8 @@ TEST_F(ExtensionAlarmsTest, Clear) { // Clear a non-existent one. { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"nobody\"]")); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"nobody\"]"); ASSERT_TRUE(result->is_bool()); EXPECT_FALSE(result->GetBool()); } @@ -443,14 +444,14 @@ // Clear all but the 0.001-minute alarm. { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"7\"]")); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"7\"]"); ASSERT_TRUE(result->is_bool()); EXPECT_TRUE(result->GetBool()); } { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"0\"]")); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"0\"]"); ASSERT_TRUE(result->is_bool()); EXPECT_TRUE(result->GetBool()); } @@ -481,8 +482,8 @@ TEST_F(ExtensionAlarmsTest, ClearAll) { // ClearAll with no alarms set. { - std::unique_ptr<base::Value> result( - RunFunctionAndReturnValue(new AlarmsClearAllFunction(), "[]")); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(new AlarmsClearAllFunction(), "[]"); ASSERT_TRUE(result->is_bool()); EXPECT_TRUE(result->GetBool()); }
diff --git a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api_unittest.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api_unittest.cc index 5cd3707..220ef97 100644 --- a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api_unittest.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api_unittest.cc
@@ -69,9 +69,10 @@ auto create_function = base::MakeRefCounted<api::BluetoothSocketCreateFunction>(); - std::unique_ptr<base::DictionaryValue> result = - RunFunctionAndReturnDictionary(create_function.get(), "[]"); + absl::optional<base::Value> result = + RunFunctionAndReturnValue(create_function.get(), "[]"); ASSERT_TRUE(result); + ASSERT_TRUE(result->is_dict()); api::bluetooth_socket::CreateInfo create_info; EXPECT_TRUE(
diff --git a/extensions/browser/api/feedback_private/feedback_private_api_chromeos_unittest.cc b/extensions/browser/api/feedback_private/feedback_private_api_chromeos_unittest.cc index 227c68b..73f0502 100644 --- a/extensions/browser/api/feedback_private/feedback_private_api_chromeos_unittest.cc +++ b/extensions/browser/api/feedback_private/feedback_private_api_chromeos_unittest.cc
@@ -86,7 +86,7 @@ scoped_refptr<FeedbackPrivateReadLogSourceFunction> function = base::MakeRefCounted<FeedbackPrivateReadLogSourceFunction>(); - std::unique_ptr<base::Value> result_value = + absl::optional<base::Value> result_value = RunFunctionAndReturnValue(function.get(), ParamsToJSON(params)); if (!result_value) return testing::AssertionFailure() << "No result"; @@ -137,7 +137,7 @@ auto function = base::MakeRefCounted<FeedbackPrivateSendFeedbackFunction>(); - std::unique_ptr<base::Value> result_value = + absl::optional<base::Value> result_value = RunFunctionAndReturnValue(function.get(), args); EXPECT_TRUE(result_value);
diff --git a/extensions/browser/api/idle/idle_api_unittest.cc b/extensions/browser/api/idle/idle_api_unittest.cc index 3afb2bc3..0d8f60a 100644 --- a/extensions/browser/api/idle/idle_api_unittest.cc +++ b/extensions/browser/api/idle/idle_api_unittest.cc
@@ -104,7 +104,7 @@ idle_provider_->set_locked(true); idle_provider_->set_idle_time(0); - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]")); ASSERT_TRUE(result->is_string()); @@ -116,7 +116,7 @@ idle_provider_->set_locked(true); idle_provider_->set_idle_time(INT_MAX); - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]")); ASSERT_TRUE(result->is_string()); @@ -132,7 +132,7 @@ SCOPED_TRACE(time); idle_provider_->set_idle_time(time); - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]")); ASSERT_TRUE(result->is_string()); @@ -149,7 +149,7 @@ SCOPED_TRACE(time); idle_provider_->set_idle_time(time); - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]")); ASSERT_TRUE(result->is_string()); @@ -169,7 +169,7 @@ idle_provider_->set_idle_time(time); std::string args = "[" + base::NumberToString(threshold) + "]"; - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), args)); int real_threshold = (threshold < 15) ? 15 : threshold; @@ -196,7 +196,7 @@ idle_provider_->set_idle_time(time); std::string args = "[" + base::NumberToString(threshold) + "]"; - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleQueryStateFunction(), args)); int real_threshold = @@ -345,7 +345,7 @@ ScopedListen listen_default(idle_manager_, "default"); ScopedListen listen_extension(idle_manager_, extension()->id()); - std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue( + absl::optional<base::Value> result(RunFunctionAndReturnValue( new IdleSetDetectionIntervalFunction(), "[45]")); idle_provider_->set_locked(false); @@ -368,7 +368,7 @@ // Verifies that setting the detection interval before creating the listener // works correctly. TEST_F(IdleTest, SetDetectionIntervalBeforeListener) { - std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue( + absl::optional<base::Value> result(RunFunctionAndReturnValue( new IdleSetDetectionIntervalFunction(), "[45]")); ScopedListen listen_extension(idle_manager_, extension()->id()); @@ -388,7 +388,7 @@ TEST_F(IdleTest, SetDetectionIntervalMaximum) { ScopedListen listen_extension(idle_manager_, extension()->id()); - std::unique_ptr<base::Value> result( + absl::optional<base::Value> result( RunFunctionAndReturnValue(new IdleSetDetectionIntervalFunction(), "[18000]")); // five hours in seconds @@ -407,7 +407,7 @@ TEST_F(IdleTest, SetDetectionIntervalMinimum) { ScopedListen listen_extension(idle_manager_, extension()->id()); - std::unique_ptr<base::Value> result(RunFunctionAndReturnValue( + absl::optional<base::Value> result(RunFunctionAndReturnValue( new IdleSetDetectionIntervalFunction(), "[10]")); idle_provider_->set_locked(false); @@ -425,7 +425,7 @@ { ScopedListen listen(idle_manager_, extension()->id()); - std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue( + absl::optional<base::Value> result(RunFunctionAndReturnValue( new IdleSetDetectionIntervalFunction(), "[15]")); }
diff --git a/extensions/browser/api/networking_private/networking_private_chromeos_unittest.cc b/extensions/browser/api/networking_private/networking_private_chromeos_unittest.cc index f20923f..2ee25b0 100644 --- a/extensions/browser/api/networking_private/networking_private_chromeos_unittest.cc +++ b/extensions/browser/api/networking_private/networking_private_chromeos_unittest.cc
@@ -538,7 +538,7 @@ "Security": "None" } })"; - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( create_network.get(), base::StringPrintf("[true, %s]", kNetworkConfig)); ASSERT_TRUE(result); @@ -563,7 +563,7 @@ "Security": "WPA-PSK" } })"; - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( new NetworkingPrivateCreateNetworkFunction(), base::StringPrintf("[false, %s]", kNetworkConfig)); @@ -676,7 +676,7 @@ new NetworkingPrivateCreateNetworkFunction(); create_network->set_source_context_type(Feature::WEBUI_CONTEXT); create_network->set_source_url(GURL("chrome://os-settings/networkDetail")); - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( create_network.get(), base::StringPrintf("[false, %s]", kL2tpIpsecConfig)); @@ -736,7 +736,7 @@ new NetworkingPrivateCreateNetworkFunction(); create_network->set_source_context_type(Feature::WEBUI_CONTEXT); create_network->set_source_url(GURL("chrome://os-settings/networkDetail")); - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( create_network.get(), base::StringPrintf("[false, %s]", kOpenVpnConfig)); ASSERT_TRUE(result); @@ -887,7 +887,7 @@ new NetworkingPrivateCreateNetworkFunction(); create_network->set_source_context_type(Feature::WEBUI_CONTEXT); create_network->set_source_url(GURL("chrome://os-settings/networkDetail")); - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( create_network.get(), base::StringPrintf("[false, %s]", kNetworkConfig)); ASSERT_TRUE(result); ASSERT_TRUE(result->is_string()); @@ -921,7 +921,7 @@ } })"; - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( new NetworkingPrivateCreateNetworkFunction(), base::StringPrintf( "[false, %s]", @@ -1070,7 +1070,7 @@ TEST_F(NetworkingPrivateApiTest, GetCellularProperties) { SetUpCellular(); - std::unique_ptr<base::Value> result = + absl::optional<base::Value> result = RunFunctionAndReturnValue(new NetworkingPrivateGetPropertiesFunction(), base::StringPrintf(R"(["%s"])", kCellularGuid)); @@ -1114,7 +1114,7 @@ get_properties->set_source_context_type(Feature::WEBUI_CONTEXT); get_properties->set_source_url(GURL("chrome://os-settings/networkDetail")); - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( get_properties.get(), base::StringPrintf(R"(["%s"])", kCellularGuid)); ASSERT_TRUE(result);
diff --git a/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc b/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc index 6588fd5..1f57da1 100644 --- a/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc +++ b/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc
@@ -41,9 +41,10 @@ SocketsTcpCreateFunction* function = new SocketsTcpCreateFunction(); // Run tests - std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( - function, "[{\"persistent\": true, \"name\": \"foo\"}]")); - ASSERT_TRUE(result.get()); + absl::optional<base::Value> result = RunFunctionAndReturnValue( + function, "[{\"persistent\": true, \"name\": \"foo\"}]"); + ASSERT_TRUE(result); + ASSERT_TRUE(result->is_dict()); } } // namespace api
diff --git a/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc b/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc index 3f265d0..b37832f8 100644 --- a/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc +++ b/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc
@@ -40,9 +40,10 @@ SocketsUdpCreateFunction* function = new SocketsUdpCreateFunction(); // Run tests - std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( - function, "[{\"persistent\": true, \"name\": \"foo\"}]")); - ASSERT_TRUE(result.get()); + absl::optional<base::Value> result = RunFunctionAndReturnValue( + function, "[{\"persistent\": true, \"name\": \"foo\"}]"); + ASSERT_TRUE(result); + ASSERT_TRUE(result->is_dict()); } } // namespace api
diff --git a/extensions/browser/api/storage/storage_api_unittest.cc b/extensions/browser/api/storage/storage_api_unittest.cc index 102feb3..ca2ea33 100644 --- a/extensions/browser/api/storage/storage_api_unittest.cc +++ b/extensions/browser/api/storage/storage_api_unittest.cc
@@ -83,16 +83,15 @@ // |out_value| with the string result. testing::AssertionResult RunGetFunction(const std::string& key, std::string* out_value) { - std::unique_ptr<base::Value> result = RunFunctionAndReturnValue( + absl::optional<base::Value> result = RunFunctionAndReturnValue( new StorageStorageAreaGetFunction(), base::StringPrintf("[\"local\", \"%s\"]", key.c_str())); - if (!result.get()) + if (!result) return testing::AssertionFailure() << "No result"; const base::Value::Dict* dict = result->GetIfDict(); if (!dict) { - return testing::AssertionFailure() << result.get() - << " was not a dictionary."; + return testing::AssertionFailure() << *result << " was not a dictionary."; } const std::string* dict_value = dict->FindString(key);
diff --git a/extensions/browser/api_unittest.cc b/extensions/browser/api_unittest.cc index 9b80e10..534613f 100644 --- a/extensions/browser/api_unittest.cc +++ b/extensions/browser/api_unittest.cc
@@ -57,46 +57,14 @@ } } -std::unique_ptr<base::Value> ApiUnitTest::RunFunctionAndReturnValue( +absl::optional<base::Value> ApiUnitTest::RunFunctionAndReturnValue( ExtensionFunction* function, const std::string& args) { function->set_extension(extension()); if (contents_) function->SetRenderFrameHost(contents_->GetPrimaryMainFrame()); - absl::optional<base::Value> result = utils::RunFunctionAndReturnSingleResult( - function, args, browser_context()); - if (result) - return std::make_unique<base::Value>(std::move(*result)); - return nullptr; -} - -std::unique_ptr<base::DictionaryValue> -ApiUnitTest::RunFunctionAndReturnDictionary(ExtensionFunction* function, - const std::string& args) { - base::Value* value = RunFunctionAndReturnValue(function, args).release(); - base::DictionaryValue* dict = nullptr; - - if (value && !value->GetAsDictionary(&dict)) - delete value; - - // We expect to either have successfully retrieved a dictionary from the - // value, or the value to have been NULL. - EXPECT_TRUE(dict || !value); - return std::unique_ptr<base::DictionaryValue>(dict); -} - -std::unique_ptr<base::Value> ApiUnitTest::RunFunctionAndReturnList( - ExtensionFunction* function, - const std::string& args) { - base::Value* value = RunFunctionAndReturnValue(function, args).release(); - - // We expect to either have successfully gotten a list value, or the value to - // have been NULL. - EXPECT_TRUE(!value || value->is_list()); - if (value && !value->is_list()) - delete value; - - return std::unique_ptr<base::Value>(value); + return utils::RunFunctionAndReturnSingleResult(function, args, + browser_context()); } std::string ApiUnitTest::RunFunctionAndReturnError(ExtensionFunction* function,
diff --git a/extensions/browser/api_unittest.h b/extensions/browser/api_unittest.h index 5259103..4f39e1f7 100644 --- a/extensions/browser/api_unittest.h +++ b/extensions/browser/api_unittest.h
@@ -11,10 +11,10 @@ #include "base/memory/scoped_refptr.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "extensions/browser/extensions_test.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace base { class Value; -class DictionaryValue; } namespace content { @@ -58,22 +58,7 @@ // See also the RunFunction* methods in extension_function_test_utils.h. // Return the function result as a base::Value. - // TODO(crbug.com/1187001): Return absl::optional<base::Value> instead. - std::unique_ptr<base::Value> RunFunctionAndReturnValue( - ExtensionFunction* function, - const std::string& args); - - // Return the function result as a base::DictionaryValue, or NULL. - // This will EXPECT-fail if the result is not a DictionaryValue. - // TODO(crbug.com/1187061): Return absl::optional<base::Value> instead. - std::unique_ptr<base::DictionaryValue> RunFunctionAndReturnDictionary( - ExtensionFunction* function, - const std::string& args); - - // Return the function result as a base::Value, or NULL. - // This will EXPECT-fail if the result Value is not a list. - // TODO(crbug.com/1187001): Return absl::optional<base::Value> instead. - std::unique_ptr<base::Value> RunFunctionAndReturnList( + absl::optional<base::Value> RunFunctionAndReturnValue( ExtensionFunction* function, const std::string& args);
diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc index c2f6e59..cfd40ff 100644 --- a/extensions/browser/updater/extension_downloader.cc +++ b/extensions/browser/updater/extension_downloader.cc
@@ -327,9 +327,6 @@ } void ExtensionDownloader::DoStartAllPending() { - ReportStats(); - url_stats_ = URLStats(); - if (g_test_delegate) { g_test_delegate->StartUpdateCheck(this, delegate_, std::move(pending_tasks_)); @@ -375,38 +372,6 @@ return manifests_queue_.active_request(); } -void ExtensionDownloader::UpdateURLStats(const GURL& update_url, - Manifest::Type extension_type) { - if (update_url.DomainIs(kGoogleDotCom)) { - url_stats_.google_url_count++; - } else if (update_url.is_empty()) { - url_stats_.no_url_count++; - } else { - url_stats_.other_url_count++; - } - - switch (extension_type) { - case Manifest::TYPE_THEME: - ++url_stats_.theme_count; - break; - case Manifest::TYPE_EXTENSION: - case Manifest::TYPE_USER_SCRIPT: - ++url_stats_.extension_count; - break; - case Manifest::TYPE_HOSTED_APP: - case Manifest::TYPE_LEGACY_PACKAGED_APP: - ++url_stats_.app_count; - break; - case Manifest::TYPE_PLATFORM_APP: - ++url_stats_.platform_app_count; - break; - case Manifest::TYPE_UNKNOWN: - default: - ++url_stats_.pending_count; - break; - } -} - bool ExtensionDownloader::AddExtensionData(ExtensionDownloaderTask task) { // Skip extensions with non-empty invalid update URLs. if (!task.update_url.is_empty() && !task.update_url.is_valid()) { @@ -428,7 +393,6 @@ return false; } - UpdateURLStats(task.update_url, task.type); if (task.update_url.is_empty()) { // Fill in default update URL. task.update_url = extension_urls::GetWebstoreUpdateUrl(); @@ -442,24 +406,6 @@ return true; } -void ExtensionDownloader::ReportStats() const { - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckExtension", - url_stats_.extension_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckTheme", - url_stats_.theme_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckApp", url_stats_.app_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckPackagedApp", - url_stats_.platform_app_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckPending", - url_stats_.pending_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckGoogleUrl", - url_stats_.google_url_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckOtherUrl", - url_stats_.other_url_count); - UMA_HISTOGRAM_COUNTS_100("Extensions.UpdateCheckNoUrl", - url_stats_.no_url_count); -} - void ExtensionDownloader::StartUpdateCheck( std::unique_ptr<ManifestFetchData> fetch_data) { const ExtensionIdSet extension_ids = fetch_data->GetExtensionIds();
diff --git a/extensions/browser/updater/extension_downloader.h b/extensions/browser/updater/extension_downloader.h index 44dc33d2..9b43d17f 100644 --- a/extensions/browser/updater/extension_downloader.h +++ b/extensions/browser/updater/extension_downloader.h
@@ -239,15 +239,9 @@ kBadUpdateSpecification, }; - // Updates |url_stats_| for a single extension download requests. - void UpdateURLStats(const GURL& update_url, Manifest::Type extension_type); - // Helper for AddExtension() and AddPendingExtension(). bool AddExtensionData(ExtensionDownloaderTask task); - // Adds all recorded stats taken so far to histogram counts. - void ReportStats() const; - // Begins an update check. void StartUpdateCheck(std::unique_ptr<ManifestFetchData> fetch_data); @@ -430,9 +424,6 @@ // The profile path used to load file:// URLs. It can be invalid. base::FilePath profile_path_for_url_loader_factory_; - // Collects UMA samples that are reported when ReportStats() is called. - URLStats url_stats_; - // List of update requests added to the downloader but not started yet. std::vector<ExtensionDownloaderTask> pending_tasks_;
diff --git a/extensions/browser/updater/extension_downloader_unittest.cc b/extensions/browser/updater/extension_downloader_unittest.cc index 11d57437..9a0782c1 100644 --- a/extensions/browser/updater/extension_downloader_unittest.cc +++ b/extensions/browser/updater/extension_downloader_unittest.cc
@@ -30,7 +30,6 @@ const char kTestExtensionId[] = "test_app"; const char kTestExtensionId2[] = "test_app2"; -const char kTestExtensionId3[] = "test_app3"; } // namespace @@ -66,10 +65,6 @@ helper->StartUpdateCheck(std::move(fetch)); } - const URLStats& GetDownloaderURLStats(ExtensionDownloaderTestHelper* helper) { - return helper->downloader().url_stats_; - } - const std::vector<ExtensionDownloaderTask>& GetDownloaderPendingTasks( ExtensionDownloaderTestHelper* helper) { return helper->downloader().pending_tasks_; @@ -422,25 +417,6 @@ testing::Mock::VerifyAndClearExpectations(&delegate); } -// Tests that stats for UMA is collected correctly. -TEST_F(ExtensionDownloaderTest, TestURLStats) { - ExtensionDownloaderTestHelper helper; - GURL kUpdateUrl("http://localhost/manifest1"); - const URLStats& stats = GetDownloaderURLStats(&helper); - - helper.downloader().AddPendingExtension(CreateDownloaderTask( - kTestExtensionId, extension_urls::GetWebstoreUpdateUrl())); - EXPECT_EQ(1, stats.google_url_count); - - helper.downloader().AddPendingExtension( - CreateDownloaderTask(kTestExtensionId2, GURL())); - EXPECT_EQ(1, stats.no_url_count); - - helper.downloader().AddPendingExtension( - CreateDownloaderTask(kTestExtensionId3, kUpdateUrl)); - EXPECT_EQ(1, stats.other_url_count); -} - // Tests edge-cases related to the update URL. TEST_F(ExtensionDownloaderTest, TestUpdateURLHandle) { ExtensionDownloaderTestHelper helper;
diff --git a/gin/public/v8_platform.h b/gin/public/v8_platform.h index 334e702..c4f2df96 100644 --- a/gin/public/v8_platform.h +++ b/gin/public/v8_platform.h
@@ -5,7 +5,7 @@ #ifndef GIN_PUBLIC_V8_PLATFORM_H_ #define GIN_PUBLIC_V8_PLATFORM_H_ -#include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/compiler_specific.h" #include "base/lazy_instance.h" #include "gin/gin_export.h"
diff --git a/gin/v8_platform.cc b/gin/v8_platform.cc index 0e03069b..37970eb 100644 --- a/gin/v8_platform.cc +++ b/gin/v8_platform.cc
@@ -6,6 +6,7 @@ #include <algorithm> +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/bind.h" #include "base/bit_cast.h" #include "base/check_op.h"
diff --git a/gin/v8_platform_page_allocator.h b/gin/v8_platform_page_allocator.h index d5a769e8..583e912 100644 --- a/gin/v8_platform_page_allocator.h +++ b/gin/v8_platform_page_allocator.h
@@ -8,7 +8,7 @@ #include "build/build_config.h" #include "build/buildflag.h" -#include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #if BUILDFLAG(USE_PARTITION_ALLOC)
diff --git a/infra/config/generated/luci/luci-analysis-dev.cfg b/infra/config/generated/luci/luci-analysis-dev.cfg index e013c8c7..e13bdd76 100644 --- a/infra/config/generated/luci/luci-analysis-dev.cfg +++ b/infra/config/generated/luci/luci-analysis-dev.cfg
@@ -2,9 +2,6 @@ # https://luci-config.appspot.com/schemas/projects:luci-analysis.cfg bug_filing_threshold { - presubmit_runs_failed { - one_day: 5 - } critical_failures_exonerated { three_day: 75 }
diff --git a/infra/config/generated/luci/luci-analysis.cfg b/infra/config/generated/luci/luci-analysis.cfg index 6a5497f..95012c8 100644 --- a/infra/config/generated/luci/luci-analysis.cfg +++ b/infra/config/generated/luci/luci-analysis.cfg
@@ -2,9 +2,6 @@ # https://luci-config.appspot.com/schemas/projects:luci-analysis.cfg bug_filing_threshold { - presubmit_runs_failed { - one_day: 5 - } critical_failures_exonerated { three_day: 75 }
diff --git a/infra/config/luci-analysis-dev.cfg b/infra/config/luci-analysis-dev.cfg index e013c8c7..e13bdd76 100644 --- a/infra/config/luci-analysis-dev.cfg +++ b/infra/config/luci-analysis-dev.cfg
@@ -2,9 +2,6 @@ # https://luci-config.appspot.com/schemas/projects:luci-analysis.cfg bug_filing_threshold { - presubmit_runs_failed { - one_day: 5 - } critical_failures_exonerated { three_day: 75 }
diff --git a/infra/config/luci-analysis.cfg b/infra/config/luci-analysis.cfg index 6a5497f..95012c8 100644 --- a/infra/config/luci-analysis.cfg +++ b/infra/config/luci-analysis.cfg
@@ -2,9 +2,6 @@ # https://luci-config.appspot.com/schemas/projects:luci-analysis.cfg bug_filing_threshold { - presubmit_runs_failed { - one_day: 5 - } critical_failures_exonerated { three_day: 75 }
diff --git a/ios/chrome/browser/ui/icons/symbol_names.h b/ios/chrome/browser/ui/icons/symbol_names.h index 05adaed..dcae686 100644 --- a/ios/chrome/browser/ui/icons/symbol_names.h +++ b/ios/chrome/browser/ui/icons/symbol_names.h
@@ -69,6 +69,7 @@ extern NSString* const kClipboardActionSymbol; extern NSString* const kDeleteActionSymbol; extern NSString* const kEditActionSymbol; +extern NSString* const kMarkAsUnreadActionSymbol; extern NSString* const kMarkAsReadActionSymbol; extern NSString* const kReadLaterActionSymbol; extern NSString* const kAddBookmarkActionSymbol;
diff --git a/ios/chrome/browser/ui/icons/symbol_names.mm b/ios/chrome/browser/ui/icons/symbol_names.mm index b98ac7c0..16e22079 100644 --- a/ios/chrome/browser/ui/icons/symbol_names.mm +++ b/ios/chrome/browser/ui/icons/symbol_names.mm
@@ -62,6 +62,7 @@ NSString* const kClipboardActionSymbol = @"doc.on.clipboard"; NSString* const kDeleteActionSymbol = @"trash"; NSString* const kEditActionSymbol = @"pencil"; +NSString* const kMarkAsUnreadActionSymbol = @"text.badge.minus"; NSString* const kMarkAsReadActionSymbol = @"text.badge.checkmark"; NSString* const kReadLaterActionSymbol = @"text.badge.plus"; NSString* const kAddBookmarkActionSymbol = @"star";
diff --git a/ios/chrome/browser/ui/menu/action_factory.mm b/ios/chrome/browser/ui/menu/action_factory.mm index dd73502..029a5a5 100644 --- a/ios/chrome/browser/ui/menu/action_factory.mm +++ b/ios/chrome/browser/ui/menu/action_factory.mm
@@ -168,9 +168,10 @@ } - (UIAction*)actionToMarkAsUnreadWithBlock:(ProceduralBlock)block { - UIImage* image = UseSymbols() ? DefaultSymbolWithPointSize( - kHideActionSymbol, kSymbolActionPointSize) - : [UIImage imageNamed:@"remove"]; + UIImage* image = UseSymbols() + ? DefaultSymbolWithPointSize(kMarkAsUnreadActionSymbol, + kSymbolActionPointSize) + : [UIImage imageNamed:@"remove"]; return [self actionWithTitle:l10n_util::GetNSString( IDS_IOS_READING_LIST_MARK_AS_UNREAD_ACTION) image:image
diff --git a/ios/chrome/browser/ui/menu/action_factory_unittest.mm b/ios/chrome/browser/ui/menu/action_factory_unittest.mm index 8d54029..b0c6c656 100644 --- a/ios/chrome/browser/ui/menu/action_factory_unittest.mm +++ b/ios/chrome/browser/ui/menu/action_factory_unittest.mm
@@ -275,8 +275,8 @@ ActionFactory* factory = [[ActionFactory alloc] initWithScenario:kTestMenuScenario]; - UIImage* expectedImage = - DefaultSymbolWithPointSize(kHideActionSymbol, kSymbolActionPointSize); + UIImage* expectedImage = DefaultSymbolWithPointSize(kMarkAsUnreadActionSymbol, + kSymbolActionPointSize); NSString* expectedTitle = l10n_util::GetNSString(IDS_IOS_READING_LIST_MARK_AS_UNREAD_ACTION);
diff --git a/ios/chrome/browser/ui/popup_menu/public/popup_menu_view_controller.mm b/ios/chrome/browser/ui/popup_menu/public/popup_menu_view_controller.mm index 5e30b4bc..9c6ae0b9 100644 --- a/ios/chrome/browser/ui/popup_menu/public/popup_menu_view_controller.mm +++ b/ios/chrome/browser/ui/popup_menu/public/popup_menu_view_controller.mm
@@ -56,8 +56,8 @@ - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - // Let the view controller become first responder to handle the ESC key - // command. See `-keyCommands` and `-keyCommand_close`. + // Let the view controller become first responder to handle key commands. + // See `-keyCommands`. [self becomeFirstResponder]; } @@ -78,7 +78,7 @@ } - (NSArray*)keyCommands { - return @[ UIKeyCommand.cr_close ]; + return @[ UIKeyCommand.cr_close, UIKeyCommand.cr_stop ]; } - (void)keyCommand_close { @@ -86,6 +86,13 @@ [self.delegate popupMenuViewControllerWillDismiss:self]; } +- (void)keyCommand_stop { + // Forward to the keyCommand_close action. Usually this is done by the OS + // implicitly, but since BVC handles the stop action for stopping loading the + // page, the PopupMenuViewController needs to explicitly catch it before. + [self keyCommand_close]; +} + #pragma mark - Private // Sets the content container view up.
diff --git a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_image_detail_text_item.mm b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_image_detail_text_item.mm index 91ca6f3..d3d0db2 100644 --- a/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_image_detail_text_item.mm +++ b/ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_image_detail_text_item.mm
@@ -5,8 +5,10 @@ #import "ios/chrome/browser/ui/send_tab_to_self/send_tab_to_self_image_detail_text_item.h" #import "base/check.h" +#import "ios/chrome/browser/ui/icons/symbols.h" #import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_cell.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/table_view/table_view_cells_constants.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -28,6 +30,9 @@ [super configureCell:cell withStyler:styler]; cell.textLabel.text = self.text; cell.detailTextLabel.text = self.detailText; + if (UseSymbols()) { + [cell setImageViewTintColor:[UIColor colorNamed:kGrey400Color]]; + } DCHECK(self.iconImage); cell.image = self.iconImage; if (self.selected) {
diff --git a/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm index c607b48..25e76027 100644 --- a/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm
@@ -321,7 +321,6 @@ } item.textFieldPlaceholder = l10n_util::GetNSString( IDS_IOS_PASSWORD_SETTINGS_USERNAME_PLACEHOLDER_TEXT); - item.hideIcon = NO; return item; } @@ -402,6 +401,9 @@ l10n_util::GetNSString(IDS_IOS_CHANGE_COMPROMISED_PASSWORD_DESCRIPTION); } item.image = [self compromisedIcon]; + if (UseSymbols()) { + item.imageViewTintColor = [UIColor colorNamed:kRedColor]; + } return item; } @@ -829,8 +831,8 @@ // Applies tint colour and resizes image. - (UIImage*)compromisedIcon { if (UseSymbols()) { - return DefaultSymbolWithPointSize(kWarningFillSymbol, - kCompromisedPasswordSymbolSize); + return DefaultSymbolTemplateWithPointSize(kWarningFillSymbol, + kCompromisedPasswordSymbolSize); } if (base::FeatureList::IsEnabled( password_manager::features::
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_page_control.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_page_control.mm index 9d39b80..028ee5e 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_page_control.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_page_control.mm
@@ -115,6 +115,7 @@ // Sizes for the labels and their selected counterparts. const CGFloat kLabelSize = 20.0; const CGFloat kSelectedLabelSize = 23.0; +const CGFloat kLabelSizeToFontSize = 0.6; // Maximum duration of slider motion animation. const NSTimeInterval kSliderMoveDuration = 0.2; @@ -347,10 +348,8 @@ // visible when the slider is over a segment), and an ivar to store values that // are set before the labels are created. - (void)setRegularTabCount:(NSUInteger)regularTabCount { - NSString* regularText = TextForTabCount(regularTabCount); - self.regularLabel.text = regularText; - self.regularSelectedLabel.text = regularText; _regularTabCount = regularTabCount; + [self updateRegularLabels]; } #pragma mark - Public methods @@ -800,20 +799,12 @@ self.tapRecognizer = tapRecognizer; } -// Returns the font to be used for the Tab Number label, in the `selected` state -// or not. -- (UIFont*)fontForLabelSelected:(BOOL)selected { - CGFloat size = selected ? kSelectedLabelSize : kLabelSize; - if (!UseSymbols()) - return [UIFont systemFontOfSize:size * .6 weight:UIFontWeightBold]; - - UIFontWeight weight = - UIAccessibilityIsBoldTextEnabled() ? UIFontWeightHeavy : UIFontWeightBold; - CGFloat fontSize = size * .6; - UIFont* font = [UIFont systemFontOfSize:fontSize weight:weight]; - UIFontDescriptor* descriptor = [font.fontDescriptor - fontDescriptorWithDesign:UIFontDescriptorSystemDesignRounded]; - return font = [UIFont fontWithDescriptor:descriptor size:fontSize]; +// Updates the labels displaying the regular tab count. +- (void)updateRegularLabels { + self.regularLabel.attributedText = + TextForTabCount(self.regularTabCount, kLabelSize * kLabelSizeToFontSize); + self.regularSelectedLabel.attributedText = TextForTabCount( + self.regularTabCount, kSelectedLabelSize * kLabelSizeToFontSize); } // Creates a label for use in this control. @@ -832,7 +823,6 @@ label.backgroundColor = UIColor.clearColor; label.textAlignment = NSTextAlignmentCenter; label.textColor = color; - label.font = [self fontForLabelSelected:selected]; return label; } @@ -886,8 +876,7 @@ // Callback for the notification that the user changed the bold status. - (void)accessibilityBoldTextStatusDidChange { - self.regularLabel.font = [self fontForLabelSelected:NO]; - self.regularSelectedLabel.font = [self fontForLabelSelected:YES]; + [self updateRegularLabels]; } #pragma mark UIPointerInteractionDelegate
diff --git a/ios/chrome/browser/ui/table_view/cells/BUILD.gn b/ios/chrome/browser/ui/table_view/cells/BUILD.gn index dfaa47e..0e84d8b 100644 --- a/ios/chrome/browser/ui/table_view/cells/BUILD.gn +++ b/ios/chrome/browser/ui/table_view/cells/BUILD.gn
@@ -55,6 +55,7 @@ ] deps = [ + ":features", "resources:table_view_cell_chevron", "resources:table_view_cell_edit_icon", "resources:table_view_cell_error_icon",
diff --git a/ios/chrome/browser/ui/table_view/cells/table_view_image_item.mm b/ios/chrome/browser/ui/table_view/cells/table_view_image_item.mm index 7212762..653ec86a 100644 --- a/ios/chrome/browser/ui/table_view/cells/table_view_image_item.mm +++ b/ios/chrome/browser/ui/table_view/cells/table_view_image_item.mm
@@ -6,6 +6,7 @@ #import "base/i18n/rtl.h" #import "base/mac/foundation_util.h" +#import "ios/chrome/browser/ui/table_view/cells/features.h" #import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" @@ -86,6 +87,9 @@ _textLabel = [[UILabel alloc] init]; _textLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; _textLabel.adjustsFontForContentSizeCategory = YES; + if (IsTruncateTableViewCellTitleEnabled()) { + _textLabel.numberOfLines = 2; + } [_textLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis: @@ -138,9 +142,11 @@ heightConstraint, ]]; - [self configureTextLabelForAccessibility: - UIContentSizeCategoryIsAccessibilityCategory( - self.traitCollection.preferredContentSizeCategory)]; + if (!IsTruncateTableViewCellTitleEnabled()) { + [self configureTextLabelForAccessibility: + UIContentSizeCategoryIsAccessibilityCategory( + self.traitCollection.preferredContentSizeCategory)]; + } } return self; } @@ -149,6 +155,7 @@ // Configures -TableViewImageCell.textLabel for accessibility or not. - (void)configureTextLabelForAccessibility:(BOOL)accessibility { + DCHECK(!IsTruncateTableViewCellTitleEnabled()); if (accessibility) { self.textLabel.numberOfLines = 2; } else { @@ -167,6 +174,9 @@ - (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; + if (IsTruncateTableViewCellTitleEnabled()) { + return; + } BOOL isCurrentCategoryAccessibility = UIContentSizeCategoryIsAccessibilityCategory( self.traitCollection.preferredContentSizeCategory);
diff --git a/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.h b/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.h index d52ddfb..6a05807 100644 --- a/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.h +++ b/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.h
@@ -24,12 +24,18 @@ // Button text color. @property(nonatomic, strong) UIColor* buttonTextColor; -// Whether the button text will be bold or not. Default is YES. -@property(nonatomic, assign) BOOL boldButtonText; - // Button background color. Default is custom blue color. @property(nonatomic, strong) UIColor* buttonBackgroundColor; +// If yes, adds a 50% alpha to the background in disabled state. +// Otherwise, colors in disabled state are the same as in enabled +// state and it is the responsibility of the owner to update color +// before calling `configureCell:withStyler:` (default YES). +@property(nonatomic, assign) BOOL dimBackgroundWhenDisabled; + +// Whether the button text will be bold or not. Default is YES. +@property(nonatomic, assign) BOOL boldButtonText; + // Accessibility identifier that will assigned to the button. @property(nonatomic, strong) NSString* buttonAccessibilityIdentifier;
diff --git a/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.mm b/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.mm index af292492..06cb0e6 100644 --- a/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.mm +++ b/ios/chrome/browser/ui/table_view/cells/table_view_text_button_item.mm
@@ -102,7 +102,7 @@ cell.button.backgroundColor = [UIColor colorNamed:kBlueColor]; } cell.button.enabled = self.enabled; - if (!self.enabled) { + if (!self.enabled && self.dimBackgroundWhenDisabled) { cell.button.backgroundColor = [cell.button.backgroundColor colorWithAlphaComponent:kDisabledButtonAlpha]; }
diff --git a/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm index 67d55fc..28de4e29 100644 --- a/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm +++ b/ios/chrome/browser/ui/toolbar/buttons/toolbar_tab_grid_button.mm
@@ -36,7 +36,8 @@ // the button's title may be empty or contain an easter egg, but the // accessibility value will always be equal to `tabCount`. NSString* tabStripButtonValue = [NSString stringWithFormat:@"%d", tabCount]; - self.tabCountLabel.text = TextForTabCount(tabCount); + self.tabCountLabel.attributedText = + TextForTabCount(tabCount, kTabGridButtonFontSize); [self setAccessibilityValue:tabStripButtonValue]; } @@ -68,7 +69,6 @@ ]]; AddSameCenterConstraints(self, _tabCountLabel); - _tabCountLabel.font = [self labelFont]; _tabCountLabel.adjustsFontSizeToFitWidth = YES; _tabCountLabel.minimumScaleFactor = 0.1; _tabCountLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters; @@ -80,16 +80,11 @@ #pragma mark - Private -// Returns the font for the label. -- (UIFont*)labelFont { - UIFontWeight weight = - UIAccessibilityIsBoldTextEnabled() ? UIFontWeightHeavy : UIFontWeightBold; - return [UIFont systemFontOfSize:kTabGridButtonFontSize weight:weight]; -} - // Callback for the notification that the user changed the bold status. - (void)accessibilityBoldTextStatusDidChange { - self.tabCountLabel.font = [self labelFont]; + // Reset the attributed string to pick up the new font. + self.tabCountLabel.attributedText = + TextForTabCount(self.tabCount, kTabGridButtonFontSize); } @end
diff --git a/ios/chrome/browser/ui/util/BUILD.gn b/ios/chrome/browser/ui/util/BUILD.gn index bc52443..5fc1ee6 100644 --- a/ios/chrome/browser/ui/util/BUILD.gn +++ b/ios/chrome/browser/ui/util/BUILD.gn
@@ -51,6 +51,7 @@ "//ios/chrome/app/strings", "//ios/chrome/browser/flags:system_flags", "//ios/chrome/browser/ui:feature_flags", + "//ios/chrome/browser/ui/icons:symbols", "//ios/chrome/common:timing", "//ios/chrome/common/ui/util", "//ios/chrome/common/ui/util:dynamic_type_util",
diff --git a/ios/chrome/browser/ui/util/uikit_ui_util.h b/ios/chrome/browser/ui/util/uikit_ui_util.h index dd8da523..8dc07002 100644 --- a/ios/chrome/browser/ui/util/uikit_ui_util.h +++ b/ios/chrome/browser/ui/util/uikit_ui_util.h
@@ -181,10 +181,10 @@ // `type` represent the type of notification associated with this feedback. void TriggerHapticFeedbackForNotification(UINotificationFeedbackType type); -// Returns the text for tabs count to be displayed in toolbar and tab_grid. -// As an easter egg, show a smiley face instead of the count if the user has -// more than 99 tabs open. -NSString* TextForTabCount(long count); +// Returns the attributed text for tabs count to be displayed in toolbar and +// TabGrid, with the correct font. As an easter egg, show a smiley face instead +// of the count if the user has more than 99 tabs open. +NSAttributedString* TextForTabCount(int count, CGFloat font_size); // Adds `item` to the global Edit Menu configuration (UIMenuController). No-op // if a UIMenuItem with the same selector as `item` has already been registered.
diff --git a/ios/chrome/browser/ui/util/uikit_ui_util.mm b/ios/chrome/browser/ui/util/uikit_ui_util.mm index 0875c25..f9c4e59 100644 --- a/ios/chrome/browser/ui/util/uikit_ui_util.mm +++ b/ios/chrome/browser/ui/util/uikit_ui_util.mm
@@ -19,6 +19,7 @@ #import "base/notreached.h" #import "base/numerics/math_constants.h" #import "ios/chrome/browser/flags/system_flags.h" +#import "ios/chrome/browser/ui/icons/symbols.h" #import "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/util/dynamic_type_util.h" #import "ios/chrome/browser/ui/util/rtl_geometry.h" @@ -334,12 +335,34 @@ } } -NSString* TextForTabCount(long count) { - if (count <= 0) - return @""; - if (count > 99) - return @":)"; - return [NSString stringWithFormat:@"%ld", count]; +NSAttributedString* TextForTabCount(int count, CGFloat font_size) { + NSString* string; + if (count <= 0) { + string = @""; + } else if (count > 99) { + string = @":)"; + } else { + string = [NSString stringWithFormat:@"%d", count]; + } + + if (UseSymbols()) { + UIFontWeight weight = UIAccessibilityIsBoldTextEnabled() ? UIFontWeightHeavy + : UIFontWeightBold; + UIFont* font = [UIFont systemFontOfSize:font_size weight:weight]; + UIFontDescriptor* descriptor = [font.fontDescriptor + fontDescriptorWithDesign:UIFontDescriptorSystemDesignRounded]; + font = [UIFont fontWithDescriptor:descriptor size:font_size]; + + return [[NSAttributedString alloc] initWithString:string + attributes:@{ + NSFontAttributeName : font, + NSKernAttributeName : @(-0.8), + }]; + } + UIFont* font = [UIFont systemFontOfSize:font_size weight:UIFontWeightBold]; + return + [[NSAttributedString alloc] initWithString:string + attributes:@{NSFontAttributeName : font}]; } void RegisterEditMenuItem(UIMenuItem* item) {
diff --git a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 index 889bb1f..a07cba9 100644 --- a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -fe5dc8d93a240feaef5bf721f5c445145e1e2c94 \ No newline at end of file +2d14d0d4ce9591d466d76309ac0770d32af6ea58 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 index 733541b..b2cadeb9 100644 --- a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -1873af14643e4de1f9f3c71df833e59baeea8f60 \ No newline at end of file +92ea37c18faa44f354fdedbcc90d0d023ffadb23 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 0fed11e..592ee03 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -8d1667f37c7f4083e2cf940e961e47d1aee23956 \ No newline at end of file +cb2099bc15f74192fa01c1fbe44944f6e02845c9 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 6f06571..787caacf 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -cf9ed6a8120d8e7ee4aec96a12208a9f41635276 \ No newline at end of file +e4ab7e7b589e22a836d0f7bac49783d5a841b1a6 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index 25d607f..082dd22 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -cc9de35b715435f4dc51f1b5ec64762c7571f4ce \ No newline at end of file +6148d36030991155525f216ee6a64ace7847b0e8 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index cf7eb2576..41482b02 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -01d951dbb17e03b5734f4de58a847f558c552968 \ No newline at end of file +c90ff1bc575a62096b852cb9092c6e9d73d0f730 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 index e8fc4b79..2f34826 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -9ad02b339f2967e27c32b849ae34b3caccfce9f4 \ No newline at end of file +3d6de19090f4bec69f0ce6d64519787f579ddacf \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 index 2879070..3ff6214 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -d34dbaaaa73b0b50a548eeaced31b8bc595113c1 \ No newline at end of file +62dc40eb1141f45d5d62037570b3e7d31c899efb \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 3135fddc..34bf09a 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -831fecf950810c64502f6a99dfaa9d86225cb883 \ No newline at end of file +be6481907b31cad010f2c433b55df2be51305cee \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index 21a61c9..ebacd70 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -c9472d500fabcd05f4fe896cb6d88f60202ddb70 \ No newline at end of file +bf2029bebb2266af0b8f246e9cf062561a5af4a9 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 567ac5a..f1c0f45a 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -aa0050e78d6b0fe9bae4dd4c2d8e26c207514fe5 \ No newline at end of file +7c9c957ca8696a3759569bf5931e30c2a45f14e6 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index 89cea38..1904dcc2 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -e192bf3538ec0c9f49bdb0fa082a72caca449025 \ No newline at end of file +a395e836cb8b44eac6e457e9eb0af4f6ccf438df \ No newline at end of file
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc index 87ae9a09..d600d4fa 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.cc
@@ -129,36 +129,6 @@ mojo::Remote<cros::mojom::CameraHalClient> client_; }; -cros::mojom::EffectsConfigPtr GetCameraEffectState() { - cros::mojom::EffectsConfigPtr effects_state = - cros::mojom::EffectsConfig::New(); - - std::string blur_level = GetFieldTrialParamValueByFeature( - ash::features::kVCBackgroundBlur, "blur_level"); - if (blur_level == "lowest") { - effects_state->blur_level = cros::mojom::BlurLevel::kLowest; - } else if (blur_level == "light") { - effects_state->blur_level = cros::mojom::BlurLevel::kLight; - } else if (blur_level == "medium") { - effects_state->blur_level = cros::mojom::BlurLevel::kMedium; - } else if (blur_level == "heavy") { - effects_state->blur_level = cros::mojom::BlurLevel::kHeavy; - } else if (blur_level == "maximum") { - effects_state->blur_level = cros::mojom::BlurLevel::kMaximum; - } - - effects_state->effect = ash::features::IsVCBackgroundBlurEnabled() - ? cros::mojom::CameraEffect::kBackgroundBlur - : cros::mojom::CameraEffect::kNone; - effects_state->effect = ash::features::IsVCBackgroundReplaceEnabled() - ? cros::mojom::CameraEffect::kBackgroundReplace - : effects_state->effect; - effects_state->effect = ash::features::IsVCPortraitRelightingEnabled() - ? cros::mojom::CameraEffect::kPortraitRelight - : effects_state->effect; - return effects_state; -} - } // namespace CameraClientObserver::~CameraClientObserver() = default; @@ -311,7 +281,9 @@ if (!base::DeleteFile(disable_file_path)) { LOG(WARNING) << "Could not delete " << kForceDisableEffectsPath; } - base::File file(ash::features::IsVCBackgroundBlurEnabled() + base::File file(ash::features::IsVCBackgroundBlurEnabled() || + ash::features::IsVCBackgroundReplaceEnabled() || + ash::features::IsVCPortraitRelightingEnabled() ? enable_file_path : disable_file_path, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); @@ -507,12 +479,25 @@ std::move(auto_framing_supported_callback_)); } camera_hal_server_->SetAutoFramingState(current_auto_framing_state_); - camera_hal_server_->SetCameraEffect( - GetCameraEffectState(), - base::BindOnce([](cros::mojom::SetEffectResult result) { - if (result == cros::mojom::SetEffectResult::kError) - LOG(ERROR) << "SetCameraEffect failed."; - })); + + // Should only be called when current_effects_ is set before. + if (!current_effects_.is_null()) { + cros::mojom::EffectsConfigPtr config = current_effects_.Clone(); + + // We want to reset current_effects_ so that: + // (1) if SetCameraEffect succeeds, current_effects_ will be assigned as + // config in the callback; so that its value is kept. + // (2) if SetCameraEffect fails, current_effects_ stays as null; + // which is also consistent with the real camera effects. + current_effects_.reset(); + + camera_hal_server_->SetCameraEffect( + config.Clone(), + base::BindOnce( + &CameraHalDispatcherImpl::OnSetCameraEffectsCompleteOnProxyThread, + base::Unretained(this), config.Clone())); + } + CAMERA_LOG(EVENT) << "Camera HAL server registered"; std::move(callback).Run( 0, camera_hal_server_callbacks_.BindNewPipeAndPassRemote()); @@ -1041,6 +1026,70 @@ camera_hal_server_->GetAutoFramingSupported(std::move(callback)); } +void CameraHalDispatcherImpl::SetCameraEffectsControllerCallback( + CameraHalDispatcherImpl::CameraEffectsControllerCallback + camera_effects_controller_callback) { + camera_effects_controller_callback_ = + std::move(camera_effects_controller_callback); +} + +void CameraHalDispatcherImpl::SetCameraEffects( + cros::mojom::EffectsConfigPtr config) { + // `camera_effects_controller_callback_` should be set before calling + // SetCameraEffects. + if (camera_effects_controller_callback_.is_null()) + return; + + if (!proxy_thread_.IsRunning()) { + // The camera hal dispatcher is not running, ignore the request. + camera_effects_controller_callback_.Run( + current_effects_.Clone(), cros::mojom::SetEffectResult::kError); + return; + } + + proxy_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&CameraHalDispatcherImpl::SetCameraEffectsOnProxyThread, + base::Unretained(this), std::move(config))); +} + +void CameraHalDispatcherImpl::SetCameraEffectsOnProxyThread( + cros::mojom::EffectsConfigPtr config) { + DCHECK(proxy_task_runner_->BelongsToCurrentThread()); + + if (camera_hal_server_) { + camera_hal_server_->SetCameraEffect( + config.Clone(), + base::BindOnce( + &CameraHalDispatcherImpl::OnSetCameraEffectsCompleteOnProxyThread, + base::Unretained(this), config.Clone())); + + } else { + OnSetCameraEffectsCompleteOnProxyThread( + std::move(config), cros::mojom::SetEffectResult::kError); + } +} + +void CameraHalDispatcherImpl::OnSetCameraEffectsCompleteOnProxyThread( + cros::mojom::EffectsConfigPtr config, + cros::mojom::SetEffectResult result) { + DCHECK(proxy_task_runner_->BelongsToCurrentThread()); + + // Directly return if SetCameraEffect failed. + if (result == cros::mojom::SetEffectResult::kError) { + LOG(ERROR) << "SetCameraEffect failed."; + camera_effects_controller_callback_.Run( + current_effects_.Clone(), cros::mojom::SetEffectResult::kError); + return; + } + + // Record latest successful camera effects. + current_effects_ = std::move(config); + + camera_effects_controller_callback_.Run(current_effects_.Clone(), + cros::mojom::SetEffectResult::kOk); +} + std::string CameraHalDispatcherImpl::GetDeviceIdFromCameraId( int32_t camera_id) { base::AutoLock lock(camera_id_to_device_id_lock_);
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl.h b/media/capture/video/chromeos/camera_hal_dispatcher_impl.h index 5d809ab..024348d 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl.h +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl.h
@@ -42,6 +42,12 @@ } // namespace base +namespace ash { + +class CameraEffectsController; + +} // namespace ash + namespace media { using MojoJpegEncodeAcceleratorFactoryCB = base::RepeatingCallback<void( @@ -150,6 +156,10 @@ : public cros::mojom::CameraHalDispatcher, public cros::mojom::CameraHalServerCallbacks { public: + using CameraEffectsControllerCallback = + base::RepeatingCallback<void(cros::mojom::EffectsConfigPtr, + cros::mojom::SetEffectResult)>; + static CameraHalDispatcherImpl* GetInstance(); CameraHalDispatcherImpl(const CameraHalDispatcherImpl&) = delete; @@ -252,6 +262,16 @@ void GetAutoFramingSupported( cros::mojom::CameraHalServer::GetAutoFramingSupportedCallback callback); + // This function needs to be called first before `SetCameraEffects`. + void SetCameraEffectsControllerCallback( + CameraEffectsControllerCallback camera_effects__controller_callback); + + // Sets camera effects through `SetCameraEffectsOnProxyThread`. + // This function should not be called by any client except + // `CameraEffectsController`. Clients should always use + // `CameraEffectsController` instead. + void SetCameraEffects(cros::mojom::EffectsConfigPtr config); + private: friend struct base::DefaultSingletonTraits<CameraHalDispatcherImpl>; // Allow the test to construct the class directly. @@ -313,6 +333,14 @@ void GetAutoFramingSupportedOnProxyThread( cros::mojom::CameraHalServer::GetAutoFramingSupportedCallback callback); + // Calls the `camera_hal_server_` to set the camera effects. + void SetCameraEffectsOnProxyThread(cros::mojom::EffectsConfigPtr config); + + // Called when camera_hal_server_->SetCameraEffect returns. + void OnSetCameraEffectsCompleteOnProxyThread( + cros::mojom::EffectsConfigPtr config, + cros::mojom::SetEffectResult result); + std::string GetDeviceIdFromCameraId(int32_t camera_id); base::flat_set<std::string> GetDeviceIdsFromCameraIds( base::flat_set<int32_t> camera_ids); @@ -366,6 +394,13 @@ cros::mojom::CameraHalServer::GetAutoFramingSupportedCallback auto_framing_supported_callback_; + // Records current successfully set camera effects. + // Used inside RegisterServerWithToken. + cros::mojom::EffectsConfigPtr current_effects_; + + // Called when `SetCameraEffects` succeeds or fails. + CameraEffectsControllerCallback camera_effects_controller_callback_; + scoped_refptr<base::ObserverListThreadSafe<CameraPrivacySwitchObserver>> privacy_switch_observers_;
diff --git a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc index 151ba884..6ac80d9 100644 --- a/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc +++ b/media/capture/video/chromeos/camera_hal_dispatcher_impl_unittest.cc
@@ -29,6 +29,15 @@ namespace media { namespace { +// Returns a EffectsConfigPtr for the testing purpose only. +cros::mojom::EffectsConfigPtr GetDefaultCameraEffectsConfigForTesting() { + cros::mojom::EffectsConfigPtr config = cros::mojom::EffectsConfig::New(); + config->blur_enabled = false; + config->replace_enabled = true; + config->relight_enabled = true; + return config; +} + class MockCameraHalServer : public cros::mojom::CameraHalServer { public: MockCameraHalServer() = default; @@ -134,6 +143,13 @@ void SetUp() override { dispatcher_ = new CameraHalDispatcherImpl(); dispatcher_->AddCameraIdToDeviceIdEntry(0, "0"); + + // Initialize camera effects parameters. + dispatcher_->current_effects_ = GetDefaultCameraEffectsConfigForTesting(); + dispatcher_->SetCameraEffectsControllerCallback(base::BindRepeating( + &CameraHalDispatcherImplTest::SetCameraEffectsCallback, + base::Unretained(this))); + EXPECT_TRUE(dispatcher_->StartThreads()); } @@ -200,6 +216,26 @@ register_client_event_.Signal(); } + // Sets camera effects with dispatcher_. + // This helper function is needed because SetCameraEffects is a private + // function. + void SetCameraEffectsWithExpect(cros::mojom::EffectsConfigPtr config) { + dispatcher_->SetCameraEffects(std::move(config)); + } + + // Callback that is called when dispatcher_->SetCameraEffects is complete. + // A caller should first set `expected_camera_effects_result_` and + // `expected_camera_effects_config_`, this function will then compare that + // the callback is indeed called on these expected values. + // This function also has QuitRunLoop so that we can wait until it finishes. + void SetCameraEffectsCallback(cros::mojom::EffectsConfigPtr config, + cros::mojom::SetEffectResult result) { + EXPECT_EQ(expected_camera_effects_result_, result); + EXPECT_TRUE( + expected_camera_effects_config_.Equals(dispatcher_->current_effects_)); + QuitRunLoop(); + } + protected: // We can't use std::unique_ptr here because the constructor and destructor of // CameraHalDispatcherImpl are private. @@ -208,6 +244,11 @@ int32_t last_register_client_result_; int quit_count_ = 0; + cros::mojom::SetEffectResult expected_camera_effects_result_ = + cros::mojom::SetEffectResult::kOk; + cros::mojom::EffectsConfigPtr expected_camera_effects_config_ = + GetDefaultCameraEffectsConfigForTesting(); + private: base::test::TaskEnvironment task_environment_; std::unique_ptr<base::RunLoop> run_loop_; @@ -226,6 +267,10 @@ dispatcher_->CameraDeviceActivityChange( /*camera_id=*/0, /*opened=*/true, cros::mojom::CameraClientType::TESTING); + // We mock the mock_serve->SetCameraEffect to have an error; because of that + // the expected result should be kError and the config should be reset. + expected_camera_effects_result_ = cros::mojom::SetEffectResult::kError; + expected_camera_effects_config_.reset(); EXPECT_CALL(*mock_server, DoCreateChannel(_, _)) .Times(1) .WillOnce( @@ -242,7 +287,7 @@ .Times(1) .WillOnce([this](::cros::mojom::EffectsConfigPtr, MockCameraHalServer::SetCameraEffectCallback callback) { - std::move(callback).Run(::cros::mojom::SetEffectResult::kOk); + std::move(callback).Run(::cros::mojom::SetEffectResult::kError); this->QuitRunLoop(); }); EXPECT_CALL(observer, @@ -273,7 +318,7 @@ // Wait until the client gets the established Mojo channel, and that // all expected mojo calls have been invoked. - DoLoop(5); + DoLoop(6); // The client registration callback may be called after // CameraHalClient::SetUpChannel(). Use a waitable event to make sure we have @@ -308,13 +353,9 @@ .Times(1) .WillOnce( InvokeWithoutArgs(this, &CameraHalDispatcherImplTest::QuitRunLoop)); - EXPECT_CALL(*mock_server, SetCameraEffect(_, _)) - .Times(1) - .WillOnce([this](::cros::mojom::EffectsConfigPtr, - MockCameraHalServer::SetCameraEffectCallback callback) { - std::move(callback).Run(::cros::mojom::SetEffectResult::kOk); - this->QuitRunLoop(); - }); + // mock_server->SetCameraEffect should not be called because the internal + // current_effects_ is reset. + EXPECT_CALL(*mock_server, SetCameraEffect(_, _)).Times(0); server = mock_server->GetPendingRemote(); GetProxyTaskRunner()->PostTask( @@ -327,7 +368,7 @@ // Wait until the client gets the established Mojo channel, and that // all expected mojo calls have been invoked. - DoLoop(4); + DoLoop(3); } // Test that the CameraHalDisptcherImpl correctly re-establishes a Mojo channel @@ -379,7 +420,7 @@ // Wait until the client gets the established Mojo channel, and that // all expected mojo calls have been invoked. - DoLoop(4); + DoLoop(5); // The client registration callback may be called after // CameraHalClient::SetUpChannel(). Use a waitable event to make sure we have @@ -462,7 +503,7 @@ this->QuitRunLoop(); }); // These above calls only happen on the first client connection - DoLoop(2); + DoLoop(3); } auto client = mock_client->GetPendingRemote(); @@ -553,4 +594,66 @@ DoLoop(1); } +// Test that SetCameraEffects behave correctly. +TEST_F(CameraHalDispatcherImplTest, SetCameraEffects) { + // Case (1) SetCameraEffects should fail if server is not initialized. + cros::mojom::EffectsConfigPtr config = cros::mojom::EffectsConfig::New(); + expected_camera_effects_result_ = cros::mojom::SetEffectResult::kError; + SetCameraEffectsWithExpect(config.Clone()); + DoLoop(1); + + auto mock_server = std::make_unique<MockCameraHalServer>(); + + // Case (2) Connect mock_server will trigger a mock_server->SetCameraEffect + // call, and we want let this one to succeed. + expected_camera_effects_result_ = cros::mojom::SetEffectResult::kOk; + EXPECT_CALL(*mock_server, SetCameraEffect(_, _)) + .Times(1) + .WillOnce([this](::cros::mojom::EffectsConfigPtr, + MockCameraHalServer::SetCameraEffectCallback callback) { + std::move(callback).Run(::cros::mojom::SetEffectResult::kOk); + this->QuitRunLoop(); + }); + + auto server = mock_server->GetPendingRemote(); + GetProxyTaskRunner()->PostTask( + FROM_HERE, + base::BindOnce( + &CameraHalDispatcherImplTest::RegisterServer, + base::Unretained(dispatcher_), std::move(server), + base::BindOnce(&CameraHalDispatcherImplTest::OnRegisteredServer, + base::Unretained(this)))); + DoLoop(2); + + // Case (3) if mock_server->SetCameraEffect succeeds, the expected camera + // effects should be updated. + EXPECT_CALL(*mock_server, SetCameraEffect(_, _)) + .Times(1) + .WillOnce([this](::cros::mojom::EffectsConfigPtr config, + MockCameraHalServer::SetCameraEffectCallback callback) { + std::move(callback).Run(::cros::mojom::SetEffectResult::kOk); + this->QuitRunLoop(); + }); + + expected_camera_effects_result_ = cros::mojom::SetEffectResult::kOk; + expected_camera_effects_config_ = config.Clone(); + SetCameraEffectsWithExpect(config.Clone()); + DoLoop(2); + + // Case (4) if mock_server->SetCameraEffect fails, the expected camera effects + // should not be updated. + EXPECT_CALL(*mock_server, SetCameraEffect(_, _)) + .Times(1) + .WillOnce([this](::cros::mojom::EffectsConfigPtr config, + MockCameraHalServer::SetCameraEffectCallback callback) { + std::move(callback).Run(::cros::mojom::SetEffectResult::kError); + this->QuitRunLoop(); + }); + + expected_camera_effects_result_ = cros::mojom::SetEffectResult::kError; + config = GetDefaultCameraEffectsConfigForTesting(); + SetCameraEffectsWithExpect(config.Clone()); + DoLoop(2); +} + } // namespace media
diff --git a/media/capture/video/chromeos/mojom/effects_pipeline.mojom b/media/capture/video/chromeos/mojom/effects_pipeline.mojom index ebd04709..b99a2d1 100644 --- a/media/capture/video/chromeos/mojom/effects_pipeline.mojom +++ b/media/capture/video/chromeos/mojom/effects_pipeline.mojom
@@ -57,4 +57,13 @@ // Maximum number of frames allowed in flight. uint16 graph_max_frames_in_flight = 2; + + // Whether background background blur should be enabled. + [MinVersion=1] bool blur_enabled; + + // Whether background replacement should be enabled. + [MinVersion=1] bool replace_enabled; + + // Whether portrait relighting should be enabled. + [MinVersion=1] bool relight_enabled; };
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index af18fcf..a642de4 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc
@@ -126,6 +126,9 @@ UMA_HISTOGRAM_ENUMERATION("HttpCache.Pattern" type, cache_entry_status_, \ CacheEntryStatus::ENTRY_MAX) +#define IS_NO_STORE_HISTOGRAMS(type, is_no_store) \ + base::UmaHistogramBoolean("HttpCache.IsNoStore" type, is_no_store) + struct HeaderNameAndValue { const char* name; const char* value; @@ -3872,6 +3875,8 @@ std::string mime_type; HttpResponseHeaders* response_headers = GetResponseInfo()->headers.get(); + const bool is_no_store = response_headers && response_headers->HasHeaderValue( + "cache-control", "no-store"); if (response_headers && response_headers->GetMimeType(&mime_type)) { // Record the cache pattern by resource type. The type is inferred by // response header mime type, which could be incorrect, so this is just an @@ -3879,6 +3884,7 @@ if (mime_type == "text/html" && (effective_load_flags_ & LOAD_MAIN_FRAME_DEPRECATED)) { CACHE_STATUS_HISTOGRAMS(".MainFrameHTML"); + IS_NO_STORE_HISTOGRAMS(".MainFrameHTML", is_no_store); } else if (mime_type == "text/html") { CACHE_STATUS_HISTOGRAMS(".NonMainFrameHTML"); } else if (mime_type == "text/css") { @@ -3918,6 +3924,8 @@ } CACHE_STATUS_HISTOGRAMS(""); + IS_NO_STORE_HISTOGRAMS("", is_no_store); + if (validation_request) { UMA_HISTOGRAM_ENUMERATION("HttpCache.ValidationCause", validation_cause_, VALIDATION_CAUSE_MAX);
diff --git a/services/network/p2p/socket_udp.cc b/services/network/p2p/socket_udp.cc index 800c303..e9f7fe3 100644 --- a/services/network/p2p/socket_udp.cc +++ b/services/network/p2p/socket_udp.cc
@@ -361,8 +361,6 @@ TRACE_EVENT_NESTABLE_ASYNC_END0("p2p", "UdpAsyncSendTo", packet_id); TRACE_EVENT_NESTABLE_ASYNC_END1("p2p", "Send", packet_id, "result", result); if (result < 0) { - ReportSocketError(result, "WebRTC.ICE.UdpSocketWriteErrorCode"); - if (!IsTransientError(result)) { LOG(ERROR) << "Error when sending data in UDP socket: " << result; OnError(); @@ -373,11 +371,6 @@ << GetTransientErrorName(result) << ". Dropping the packet."; } - // UMA to track the histograms from 1ms to 1 sec for how long a packet spends - // in the browser process. - UMA_HISTOGRAM_TIMES("WebRTC.SystemSendPacketDuration_UDP" /* name */, - base::Milliseconds(rtc::TimeMillis() - send_time_ms)); - client_->SendComplete( P2PSendPacketMetrics(packet_id, transport_sequence_number, send_time_ms));
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 3fafd83..8a9aa267 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5748,9 +5748,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -5762,8 +5762,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -5919,9 +5919,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -5933,8 +5933,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -6071,9 +6071,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -6085,8 +6085,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 665ecf8..d9ef8d46 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -85345,9 +85345,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -85359,8 +85359,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", @@ -85486,9 +85486,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -85500,8 +85500,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" @@ -85613,9 +85613,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -85627,8 +85627,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com", @@ -86961,9 +86961,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -86974,8 +86974,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -87132,9 +87132,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -87145,8 +87145,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -87284,9 +87284,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -87297,8 +87297,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -88822,9 +88822,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -88835,8 +88835,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -88993,9 +88993,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -89006,8 +89006,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -89145,9 +89145,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -89158,8 +89158,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -89931,9 +89931,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -89944,8 +89944,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 32ce2f9..f3eb8a6 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -18614,11 +18614,11 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter;../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -18630,8 +18630,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -18799,11 +18799,11 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -18815,8 +18815,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [ @@ -18961,11 +18961,11 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots" ], - "description": "Run with ash-chrome version 110.0.5444.0", + "description": "Run with ash-chrome version 110.0.5445.0", "isolate_profile_data": true, "merge": { "args": [], @@ -18977,8 +18977,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v110.0.5444.0", - "revision": "version:110.0.5444.0" + "location": "lacros_version_skew_tests_v110.0.5445.0", + "revision": "version:110.0.5445.0" } ], "dimension_sets": [
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index a8457f5..76bb2369 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,16 +22,16 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5444.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v110.0.5445.0/test_ash_chrome', ], - 'description': 'Run with ash-chrome version 110.0.5444.0', + 'description': 'Run with ash-chrome version 110.0.5445.0', 'identifier': 'Lacros version skew testing ash canary', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v110.0.5444.0', - 'revision': 'version:110.0.5444.0', + 'location': 'lacros_version_skew_tests_v110.0.5445.0', + 'revision': 'version:110.0.5445.0', }, ], },
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom index e00c4c0..38f8a8d 100644 --- a/third_party/blink/public/mojom/frame/frame.mojom +++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -410,15 +410,6 @@ [Sync] RunBeforeUnloadConfirm(bool is_reload) => (bool success); - // Notifies that a renderer-initiated navigation to |url| will - // potentially start soon. This is fired before the beforeunload event - // (if it's needed) gets dispatched in the renderer, so that the - // browser can speculatively start service worker before processing - // beforeunload event, which might take a long time. Note that the - // navigation might not actually start, e.g. if it gets canceled by - // beforeunload. - WillPotentiallyStartNavigation(url.mojom.Url url); - // Notifies that the urls for the favicon of a site has been determined. UpdateFaviconURL(array<FaviconURL> favicon_urls); @@ -622,6 +613,26 @@ mojo_base.mojom.UnguessableToken devtools_frame_token); }; +// Implemented in Browser, this interface defines frame-specific methods +// that will be invoked from the renderer process +// (e.g. blink::LocalFrame) but processed at a higher priority than +// methods invoked on the LocalFrameHost interface. +// +// Note this interface is not a channel-associated interface and as such +// there are no ordering guarantees for messages sent on this interface +// against the messages sent on LocalFrameHost. This interface is for +// experimental purposes (https://crbug.com/1377753). +interface NonAssociatedLocalFrameHost { + // Notifies that a renderer-initiated navigation to |url| will + // potentially start soon. This is fired before the beforeunload event + // (if it's needed) gets dispatched in the renderer, so that the + // browser can speculatively start service worker before processing + // beforeunload event, which might take a long time. Note that the + // navigation might not actually start, e.g. if it gets canceled by + // beforeunload. + WillPotentiallyStartOutermostMainFrameNavigation(url.mojom.Url url); +}; + // Implemented in Blink, this interface defines frame-specific methods that will // be invoked from the browser process (e.g. content::RenderFrameHostImpl). //
diff --git a/third_party/blink/public/web/web_navigation_control.h b/third_party/blink/public/web/web_navigation_control.h index bf7e962..e66afe9 100644 --- a/third_party/blink/public/web/web_navigation_control.h +++ b/third_party/blink/public/web/web_navigation_control.h
@@ -32,7 +32,7 @@ ~WebNavigationControl() override {} // Runs beforeunload handlers for this frame and its local descendants. - // Returns |true| if all the frames agreed to proceed with unloading + // Returns `true` if all the frames agreed to proceed with unloading // from their respective event handlers. // Note: this may lead to the destruction of the frame. virtual bool DispatchBeforeUnloadEvent(bool is_reload) = 0; @@ -47,7 +47,7 @@ std::unique_ptr<WebDocumentLoader::ExtraData> extra_data) = 0; // Commits a same-document navigation in the frame. For history navigations, - // a valid WebHistoryItem should be provided. |initiator_origin| is null + // a valid WebHistoryItem should be provided. `initiator_origin` is null // for browser-initiated navigations. Returns CommitResult::Ok if the // navigation has actually committed. virtual mojom::CommitResult CommitSameDocumentNavigation( @@ -67,7 +67,15 @@ virtual void SetIsNotOnInitialEmptyDocument() = 0; virtual bool IsOnInitialEmptyDocument() = 0; - virtual void WillPotentiallyStartNavigation(const WebURL&) const = 0; + // Notifies that a renderer-initiated navigation to `url` will + // potentially start soon. This is fired before the beforeunload event + // (if it's needed) gets dispatched in the renderer, so that the + // browser can speculatively start service worker before processing + // beforeunload event, which might take a long time. Note that the + // navigation might not actually start, e.g. if it gets canceled by + // beforeunload. + virtual void WillPotentiallyStartOutermostMainFrameNavigation( + const WebURL&) const = 0; // Marks the frame as loading, before WebLocalFrameClient issues a navigation // request through the browser process on behalf of the frame.
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc index 321bcb2..efe6d9f 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -501,15 +501,13 @@ CSSAnimationUpdate& update, Element& animating_element, const ComputedStyleBuilder& style_builder) { - const Vector<AtomicString>& names = style_builder.ViewTimelineName(); - const Vector<TimelineAxis>& axes = style_builder.ViewTimelineAxis(); - const Vector<TimelineInset>& insets = style_builder.ViewTimelineInset(); - const CSSAnimations::TimelineData* timeline_data = GetTimelineData(animating_element); - if (names.empty() && (!timeline_data || timeline_data->IsEmpty())) + if (!style_builder.ViewTimelineName() && + (!timeline_data || timeline_data->IsEmpty())) { return; + } CSSViewTimelineMap changed_timelines; @@ -521,10 +519,20 @@ } } + const HeapVector<Member<const ScopedCSSName>>& names = + style_builder.ViewTimelineName() + ? style_builder.ViewTimelineName()->GetNames() + : HeapVector<Member<const ScopedCSSName>>(); + const Vector<TimelineAxis>& axes = style_builder.ViewTimelineAxis(); + const Vector<TimelineInset>& insets = style_builder.ViewTimelineInset(); + for (wtf_size_t i = 0; i < names.size(); ++i) { - const AtomicString& name = names[i]; - if (name.empty()) + if (!names[i]) { + // A value of nullptr means "none". continue; + } + // TODO(crbug.com/1382876): Handle TreeScopes. + const AtomicString& name = names[i]->GetName(); TimelineAxis axis = axes.empty() ? TimelineAxis::kBlock : axes[std::min(i, axes.size() - 1)]; const TimelineInset& inset = insets.empty()
diff --git a/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.h b/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.h index ef09af37..a526d704 100644 --- a/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.h +++ b/third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.h
@@ -38,7 +38,8 @@ class MutableCSSPropertyValueSet; class StyleSheetContents; -class AbstractPropertySetCSSStyleDeclaration : public CSSStyleDeclaration { +class CORE_EXPORT AbstractPropertySetCSSStyleDeclaration + : public CSSStyleDeclaration { public: virtual Element* ParentElement() const { return nullptr; } StyleSheetContents* ContextStyleSheet() const;
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index d71398b..be53c4f 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -5088,8 +5088,10 @@ property_methods: ["ParseSingleValue", "CSSValueFromComputedStyleInternal", "InitialValue"], field_group: "*->timeline", field_template: "external", - default_value: "Vector<AtomicString>()", - type_name: "Vector<AtomicString>", + default_value: "nullptr", + type_name: "ScopedCSSNameList", + wrapper_pointer_name: "Persistent", + tree_scoped_value: true, converter: "ConvertViewTimelineName", separator: ",", runtime_flag: "CSSViewTimeline",
diff --git a/third_party/blink/renderer/core/css/css_style_declaration.cc b/third_party/blink/renderer/core/css/css_style_declaration.cc index d4c5b47..0cfd79e 100644 --- a/third_party/blink/renderer/core/css/css_style_declaration.cc +++ b/third_party/blink/renderer/core/css/css_style_declaration.cc
@@ -37,6 +37,7 @@ #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css/css_style_declaration.h" #include "third_party/blink/renderer/core/css/css_value.h" +#include "third_party/blink/renderer/core/css/known_exposed_properties.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" @@ -143,7 +144,14 @@ ParseCSSPropertyID(execution_context, name); if (unresolved_property == CSSPropertyID::kVariable) unresolved_property = CSSPropertyID::kInvalid; - map.insert(name, unresolved_property); + // Only cache known-exposed properties (i.e. properties without any + // associated runtime flag). This is because the web-exposure of properties + // that are not known-exposed can change dynamically, for example when + // different ExecutionContexts are provided with different origin trial + // settings. + if (kKnownExposedProperties.Has(unresolved_property)) { + map.insert(name, unresolved_property); + } DCHECK(!IsValidCSSPropertyID(unresolved_property) || CSSProperty::Get(ResolveCSSPropertyID(unresolved_property)) .IsWebExposed(execution_context));
diff --git a/third_party/blink/renderer/core/css/css_style_declaration_test.cc b/third_party/blink/renderer/core/css/css_style_declaration_test.cc index ae3e8c4e..854a533a 100644 --- a/third_party/blink/renderer/core/css/css_style_declaration_test.cc +++ b/third_party/blink/renderer/core/css/css_style_declaration_test.cc
@@ -5,11 +5,18 @@ #include "third_party/blink/renderer/core/css/css_style_declaration.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/bindings/core/v8/script_value.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/core/css/css_computed_style_declaration.h" +#include "third_party/blink/renderer/core/css/css_property_value_set.h" #include "third_party/blink/renderer/core/css/css_rule_list.h" #include "third_party/blink/renderer/core/css/css_style_rule.h" #include "third_party/blink/renderer/core/css/css_test_helpers.h" +#include "third_party/blink/renderer/core/css/property_set_css_style_declaration.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/security_context.h" +#include "third_party/blink/renderer/platform/bindings/v8_binding.h" +#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" namespace blink { @@ -53,4 +60,47 @@ EXPECT_FALSE(exception_state.HadException()); } +// CSSStyleDeclaration has a cache which maps e.g. backgroundPositionY to +// its associated CSSPropertyID. +// +// See CssPropertyInfo in css_style_declaration.cc. +TEST(CSSStyleDeclarationTest, ExposureCacheLeak) { + V8TestingScope v8_testing_scope; + + auto* property_value_set = MakeGarbageCollected<MutableCSSPropertyValueSet>( + CSSParserMode::kHTMLStandardMode); + auto* style = MakeGarbageCollected<PropertySetCSSStyleDeclaration>( + v8_testing_scope.GetExecutionContext(), *property_value_set); + + ScriptState* script_state = v8_testing_scope.GetScriptState(); + v8::Isolate* isolate = v8_testing_scope.GetIsolate(); + + ScriptValue normal(isolate, V8String(isolate, "normal")); + + DummyExceptionStateForTesting exception_state; + + { + ScopedOriginTrialsSampleAPIForTest scoped_feature(true); + EXPECT_TRUE( + style->NamedPropertyQuery("originTrialTestProperty", exception_state)); + EXPECT_EQ(NamedPropertySetterResult::kIntercepted, + style->AnonymousNamedSetter(script_state, + "originTrialTestProperty", normal)); + EXPECT_EQ("normal", style->AnonymousNamedGetter("originTrialTestProperty")); + } + + { + ScopedOriginTrialsSampleAPIForTest scoped_feature(false); + // Now that the feature is disabled, 'originTrialTestProperty' must not + // be usable just because it was enabled and accessed previously. + EXPECT_FALSE( + style->NamedPropertyQuery("originTrialTestProperty", exception_state)); + EXPECT_EQ(NamedPropertySetterResult::kDidNotIntercept, + style->AnonymousNamedSetter(script_state, + "originTrialTestProperty", normal)); + EXPECT_EQ(g_null_atom, + style->AnonymousNamedGetter("originTrialTestProperty")); + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc index 2665d5b..70d79b2 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.cc +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.cc
@@ -2057,7 +2057,7 @@ } CSSValue* ComputedStyleUtils::SingleValueForViewTimelineShorthand( - const AtomicString& name, + const ScopedCSSName* name, TimelineAxis axis) { CSSValueList* list = CSSValueList::CreateSpaceSeparated(); list->Append(*ValueForCustomIdentOrNone(name)); @@ -3293,6 +3293,11 @@ return MakeGarbageCollected<CSSCustomIdentValue>(ident); } +CSSValue* ComputedStyleUtils::ValueForCustomIdentOrNone( + const ScopedCSSName* name) { + return ValueForCustomIdentOrNone(name ? name->GetName() : g_null_atom); +} + const CSSValue* ComputedStyleUtils::ValueForStyleAutoColor( const ComputedStyle& style, const StyleAutoColor& color,
diff --git a/third_party/blink/renderer/core/css/properties/computed_style_utils.h b/third_party/blink/renderer/core/css/properties/computed_style_utils.h index 13b1bea..51eb1ac 100644 --- a/third_party/blink/renderer/core/css/properties/computed_style_utils.h +++ b/third_party/blink/renderer/core/css/properties/computed_style_utils.h
@@ -164,8 +164,9 @@ static CSSValue* ValueForAnimationTimingFunctionList(const CSSTimingData*); static CSSValue* ValueForAnimationTimelineList(const CSSAnimationData*); - static CSSValue* SingleValueForViewTimelineShorthand(const AtomicString& name, - TimelineAxis); + static CSSValue* SingleValueForViewTimelineShorthand( + const ScopedCSSName* name, + TimelineAxis); static CSSValueList* ValuesForBorderRadiusCorner(const LengthSize&, const ComputedStyle&); static CSSValue* ValueForBorderRadiusCorner(const LengthSize&, @@ -287,6 +288,7 @@ static CSSValue* ValueForStyleName(const StyleName&); static CSSValue* ValueForStyleNameOrKeyword(const StyleNameOrKeyword&); static CSSValue* ValueForCustomIdentOrNone(const AtomicString&); + static CSSValue* ValueForCustomIdentOrNone(const ScopedCSSName*); static const CSSValue* ValueForStyleAutoColor(const ComputedStyle&, const StyleAutoColor&, CSSValuePhase);
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index 7d4a60c..e4b6809 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -7923,12 +7923,12 @@ const ComputedStyle& style, const LayoutObject* layout_object, bool allow_visited_style) const { - const Vector<AtomicString>& vector = style.ViewTimelineName(); - if (vector.empty()) + if (!style.ViewTimelineName()) return InitialValue(); CSSValueList* list = CSSValueList::CreateCommaSeparated(); - for (const AtomicString& name : vector) { - list->Append(*ComputedStyleUtils::ValueForCustomIdentOrNone(name)); + for (const Member<const ScopedCSSName>& name : + style.ViewTimelineName()->GetNames()) { + list->Append(*ComputedStyleUtils::ValueForCustomIdentOrNone(name.Get())); } return list; }
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index da2a24e..262378e 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc
@@ -3000,7 +3000,9 @@ const ComputedStyle& style, const LayoutObject*, bool allow_visited_style) const { - const Vector<AtomicString>& name_vector = style.ViewTimelineName(); + const HeapVector<Member<const ScopedCSSName>>& name_vector = + style.ViewTimelineName() ? style.ViewTimelineName()->GetNames() + : HeapVector<Member<const ScopedCSSName>>{}; const Vector<TimelineAxis>& axis_vector = style.ViewTimelineAxis(); CSSValueList* list = CSSValueList::CreateCommaSeparated(); @@ -3008,7 +3010,7 @@ if (name_vector.size() == axis_vector.size()) { for (wtf_size_t i = 0; i < name_vector.size(); ++i) { list->Append(*ComputedStyleUtils::SingleValueForViewTimelineShorthand( - name_vector[i], axis_vector[i])); + name_vector[i].Get(), axis_vector[i])); } }
diff --git a/third_party/blink/renderer/core/css/property_set_css_style_declaration.h b/third_party/blink/renderer/core/css/property_set_css_style_declaration.h index 0c820fd..4a8dcc5e 100644 --- a/third_party/blink/renderer/core/css/property_set_css_style_declaration.h +++ b/third_party/blink/renderer/core/css/property_set_css_style_declaration.h
@@ -32,7 +32,7 @@ class MutableCSSPropertyValueSet; -class PropertySetCSSStyleDeclaration +class CORE_EXPORT PropertySetCSSStyleDeclaration : public AbstractPropertySetCSSStyleDeclaration { public: PropertySetCSSStyleDeclaration(ExecutionContext* execution_context,
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc index 0ee4431f..4879d76 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
@@ -2854,14 +2854,16 @@ return insets; } -Vector<AtomicString> StyleBuilderConverter::ConvertViewTimelineName( +ScopedCSSNameList* StyleBuilderConverter::ConvertViewTimelineName( StyleResolverState& state, - const CSSValue& value) { - Vector<AtomicString> names; - for (const Member<const CSSValue>& item : To<CSSValueList>(value)) { - names.push_back(ConvertNoneOrCustomIdent(state, *item)); + const ScopedCSSValue& value) { + HeapVector<Member<const ScopedCSSName>> names; + for (const Member<const CSSValue>& item : + To<CSSValueList>(value.GetCSSValue())) { + names.push_back(ConvertNoneOrCustomIdent( + state, ScopedCSSValue(*item, value.GetTreeScope()))); } - return names; + return MakeGarbageCollected<ScopedCSSNameList>(std::move(names)); } } // namespace blink
diff --git a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h index 89f60f8..d8ebcce 100644 --- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.h +++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.h
@@ -362,8 +362,8 @@ const CSSValue&); static Vector<TimelineInset> ConvertViewTimelineInset(StyleResolverState&, const CSSValue&); - static Vector<AtomicString> ConvertViewTimelineName(StyleResolverState&, - const CSSValue&); + static ScopedCSSNameList* ConvertViewTimelineName(StyleResolverState&, + const ScopedCSSValue&); }; template <typename T>
diff --git a/third_party/blink/renderer/core/css/resolver/style_resolver.cc b/third_party/blink/renderer/core/css/resolver/style_resolver.cc index 23cf4f07..cfce4b8 100644 --- a/third_party/blink/renderer/core/css/resolver/style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/style_resolver.cc
@@ -195,7 +195,7 @@ bool HasTimelines(const StyleResolverState& state) { if (!state.StyleBuilder().ScrollTimelineName().empty()) return true; - if (!state.StyleBuilder().ViewTimelineName().empty()) + if (state.StyleBuilder().ViewTimelineName()) return true; if (ElementAnimations* element_animations = GetElementAnimations(state)) return element_animations->CssAnimations().HasTimelines();
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.h b/third_party/blink/renderer/core/frame/local_dom_window.h index cbd9cf6..6a4686e 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/third_party/blink/renderer/core/frame/local_dom_window.h
@@ -504,6 +504,9 @@ NavigationApi* navigation(); + // Is this a Document Picture in Picture window? + bool IsPictureInPictureWindow() const; + protected: // EventTarget overrides. void AddedEventListener(const AtomicString& event_type, @@ -528,8 +531,6 @@ void DispatchLoadEvent(); - // Is this a Document Picture in Picture window? - bool IsPictureInPictureWindow() const; void SetIsPictureInPictureWindow(); // Return the viewport size including scrollbars.
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index da090a7..0656f6a6 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -1873,10 +1873,13 @@ return false; } -void LocalFrame::WillPotentiallyStartNavigation(const KURL& url) const { - TRACE_EVENT1("navigation", "LocalFrame::WillPotentiallyStartNavigation", +void LocalFrame::WillPotentiallyStartOutermostMainFrameNavigation( + const KURL& url) const { + TRACE_EVENT1("navigation", + "LocalFrame::WillPotentiallyStartOutermostMainFrameNavigation", "url", url); - GetLocalFrameHostRemote().WillPotentiallyStartNavigation(url); + mojo_handler_->NonAssociatedLocalFrameHostRemote() + .WillPotentiallyStartOutermostMainFrameNavigation(url); } ContentCaptureManager* LocalFrame::GetOrResetContentCaptureManager() {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index ba5c5723..4c2e96f 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -431,7 +431,7 @@ // navigation at a later time. bool CanNavigate(const Frame&, const KURL& destination_url = KURL()); - void WillPotentiallyStartNavigation(const KURL& url) const; + void WillPotentiallyStartOutermostMainFrameNavigation(const KURL& url) const; // Whether a navigation should replace the current history entry or not. // Note this isn't exhaustive; there are other cases where a navigation does a
diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc index 7f212290..bb5ac73 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
@@ -402,6 +402,10 @@ frame.GetTaskRunner(TaskType::kInternalDefault))); #endif + frame.GetBrowserInterfaceBroker().GetInterface( + non_associated_local_frame_host_remote_.BindNewPipeAndPassReceiver( + frame.GetTaskRunner(TaskType::kInternalHighPriorityLocalFrame))); + frame.GetRemoteNavigationAssociatedInterfaces()->GetInterface( local_frame_host_remote_.BindNewEndpointAndPassReceiver( frame.GetTaskRunner(TaskType::kInternalDefault))); @@ -428,6 +432,7 @@ visitor->Trace(reporting_service_); visitor->Trace(device_posture_provider_service_); visitor->Trace(local_frame_host_remote_); + visitor->Trace(non_associated_local_frame_host_remote_); visitor->Trace(local_frame_receiver_); visitor->Trace(main_frame_receiver_); visitor->Trace(high_priority_frame_receiver_);
diff --git a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h index d13c3012..6228bdb4 100644 --- a/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h +++ b/third_party/blink/renderer/core/frame/local_frame_mojo_handler.h
@@ -56,10 +56,15 @@ void ClosePageForTesting(); - mojom::blink::LocalFrameHost& LocalFrameHostRemote() const { + mojom::blink::LocalFrameHost& LocalFrameHostRemote() { return *local_frame_host_remote_.get(); } + mojom::blink::NonAssociatedLocalFrameHost& + NonAssociatedLocalFrameHostRemote() { + return *non_associated_local_frame_host_remote_.get(); + } + mojom::blink::ReportingServiceProxy* ReportingService(); mojom::blink::BackForwardCacheControllerHost& BackForwardCacheControllerHostRemote(); @@ -262,6 +267,9 @@ HeapMojoAssociatedRemote<mojom::blink::LocalFrameHost> local_frame_host_remote_{nullptr}; + HeapMojoRemote<mojom::blink::NonAssociatedLocalFrameHost> + non_associated_local_frame_host_remote_{nullptr}; + // LocalFrameMojoHandler can be reused by multiple ExecutionContext. HeapMojoAssociatedReceiver<mojom::blink::LocalFrame, LocalFrameMojoHandler> local_frame_receiver_{this, nullptr};
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index 2724ac04..e6d3952 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -2723,9 +2723,9 @@ std::move(blob_url_token)); } -void WebLocalFrameImpl::WillPotentiallyStartNavigation( +void WebLocalFrameImpl::WillPotentiallyStartOutermostMainFrameNavigation( const WebURL& url) const { - GetFrame()->WillPotentiallyStartNavigation(url); + GetFrame()->WillPotentiallyStartOutermostMainFrameNavigation(url); } bool WebLocalFrameImpl::WillStartNavigation(const WebNavigationInfo& info) {
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h index cc6ffed3..2988100d 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -381,7 +381,8 @@ soft_navigation_heuristics_task_id) override; void SetIsNotOnInitialEmptyDocument() override; bool IsOnInitialEmptyDocument() override; - void WillPotentiallyStartNavigation(const WebURL&) const override; + void WillPotentiallyStartOutermostMainFrameNavigation( + const WebURL&) const override; bool WillStartNavigation(const WebNavigationInfo&) override; void DidDropNavigation() override; void DownloadURL(
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.cc index 842e7544..4d4a8404 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.cc
@@ -171,62 +171,65 @@ } // namespace -FontHeight AdjustInitialLetterInTextPosition(const NGLineInfo& line_info, - const FontHeight& line_box_metrics, +FontHeight AdjustInitialLetterInTextPosition(const FontHeight& line_box_metrics, NGLogicalLineItems* line_box) { - // TODO(crbug.com/1276900): Once we get a sample having more than one - // `NGLogicalLinteItem` in `line_box`, we should support it. - DCHECK_EQ(line_box->size(), 1u); + FontHeight font_height = FontHeight::Empty(); + for (NGLogicalLineItem& line_item : *line_box) { + const ShapeResultView* const shape_result = line_item.shape_result.get(); + if (!shape_result || !line_item.inline_item || + line_item.inline_item->Type() != NGInlineItem::kText) + continue; - NGLogicalLineItem& line_item = *line_box->begin(); - DCHECK(line_item.shape_result); + LayoutUnit baseline; + const ComputedStyle& style = *line_item.Style(); + const LogicalRect text_ink_bounds = + ComputeTextInkBounds(*shape_result, style, &baseline); - LayoutUnit baseline; - const ComputedStyle& style = *line_item.Style(); - const LogicalRect text_ink_bounds = - ComputeTextInkBounds(*line_item.shape_result, style, &baseline); + // Set `line_item.rect`, text paint origin, to left-top of + // `text_ink_bounds`. Note: ` NGTextFragmentPainter::Paint()` adds font + // ascent to block offset. + line_item.rect.offset.inline_offset += + -text_ink_bounds.offset.inline_offset; + line_item.rect.offset.block_offset = -style.GetFontHeight().ascent; + line_item.inline_size = text_ink_bounds.size.inline_size; - // Set `line_item.rect`, text paint origin, to left-top of `text_ink_bounds`. - // Note: ` NGTextFragmentPainter::Paint()` adds font ascent to block offset. - line_item.rect.offset.inline_offset += -text_ink_bounds.offset.inline_offset; - line_item.rect.offset.block_offset = -style.GetFontHeight().ascent; + if (style.IsHorizontalWritingMode() || + style.GetTextOrientation() == ETextOrientation::kSideways) { + const LayoutUnit line_height = text_ink_bounds.size.block_size; + const LayoutUnit ascent = baseline - text_ink_bounds.offset.block_offset; + font_height.Unite(FontHeight(ascent, line_height - ascent)); + continue; + } - if (style.IsHorizontalWritingMode() || - style.GetTextOrientation() == ETextOrientation::kSideways) { const LayoutUnit line_height = text_ink_bounds.size.block_size; - const LayoutUnit ascent = baseline - text_ink_bounds.offset.block_offset; - return FontHeight(ascent, LayoutUnit(line_height - ascent)); + const LayoutUnit ascent = LayoutUnit::FromFloatFloor(line_height / 2); + font_height.Unite(FontHeight(ascent, line_height - ascent)); } - - const LayoutUnit line_height = text_ink_bounds.size.block_size; - const LayoutUnit ascent = LayoutUnit::FromFloatFloor(line_height / 2); - return FontHeight(LayoutUnit(ascent), LayoutUnit(line_height - ascent)); + return font_height; } LayoutUnit CalculateInitialLetterBoxInlineSize(const NGLineInfo& line_info) { - // TODO(crbug.com/1276900): Once we get a sample having more than one - // `NGInlineItemResult` in `line_info`, we should support it. - DCHECK_EQ(line_info.Results().size(), 1u); + LayoutUnit inline_size = line_info.TextIndent(); + for (const NGInlineItemResult& item_result : line_info.Results()) { + const ShapeResultView* const shape_result = item_result.shape_result.get(); + if (!shape_result || item_result.item->Type() != NGInlineItem::kText) { + inline_size += item_result.inline_size; + continue; + } + const auto& style = *item_result.item->Style(); + const LogicalRect text_ink_bounds = + ComputeTextInkBounds(*shape_result, style); - const NGInlineItemResult& initial_letter_text_item_result = - line_info.Results().front(); - const ShapeResultView* const shape_result = - initial_letter_text_item_result.shape_result.get(); - if (!shape_result) - return LayoutUnit(); - - const auto& style = *initial_letter_text_item_result.item->Style(); - const LogicalRect text_ink_bounds = - ComputeTextInkBounds(*shape_result, style); - - // Example of `text_ink_bounds` - // - <i>f</i> -16,18+59x81 - // - <i>T</i> 6,21+53x59 - // - T 2,21+51x59 - // - U+05E9 2,20+50x79 (HEBREW) - // - U+3042 5,10+80x73 (HIRAGANA LETTER) - // See also `AdjustInitialLetterInTextPosition()`. - return text_ink_bounds.size.inline_size + line_info.TextIndent(); + // Example of `text_ink_bounds` + // - <i>f</i> -16,18+59x81 + // - <i>T</i> 6,21+53x59 + // - T 2,21+51x59 + // - U+05E9 2,20+50x79 (HEBREW) + // - U+3042 5,10+80x73 (HIRAGANA LETTER) + // See also `AdjustInitialLetterInTextPosition()`. + inline_size += text_ink_bounds.size.inline_size; + } + return inline_size; } const NGExclusion* PostPlaceInitialLetterBox(
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.h b/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.h index a63bb15..5095814b 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_initial_letter_utils.h
@@ -19,8 +19,7 @@ // Adjust text position of texts in inline text box and returns adjusted // `FontHeight` to fit initial letter box in block direction. // Note: `NGLineBreaker::NextLine()` adjust inline size. -FontHeight AdjustInitialLetterInTextPosition(const NGLineInfo& line_info, - const FontHeight& line_box_metrics, +FontHeight AdjustInitialLetterInTextPosition(const FontHeight& line_box_metrics, NGLogicalLineItems* line_box); // Calculate inline size of initial letter text.
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc index 0b39331e..1988631 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -527,10 +527,12 @@ const auto one_em = Node().Style().ComputedFontSizeAsFixed(); inline_size = std::min(inline_size, one_em); } else if (UNLIKELY(Node().IsInitialLetterBox())) { - const FontHeight& adjusted_metrics = AdjustInitialLetterInTextPosition( - *line_info, line_box_metrics, line_box); - container_builder_.SetMetrics(adjusted_metrics); - line_box->MoveInBlockDirection(adjusted_metrics.ascent); + const FontHeight& adjusted_metrics = + AdjustInitialLetterInTextPosition(line_box_metrics, line_box); + if (!adjusted_metrics.IsEmpty()) { + container_builder_.SetMetrics(adjusted_metrics); + line_box->MoveInBlockDirection(adjusted_metrics.ascent); + } } else if (LIKELY(!Node().IsSvgText())) { // Convert baseline relative block offset of `NGLogicalLineItem::rect` to // to line box relative block offset.
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc index 55b30b25..3efe0ce5 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.cc
@@ -1815,10 +1815,16 @@ }; if (UNLIKELY(node.IsInitialLetterBox())) { - NGLineInfo line_info; - line_breaker.NextLine(&line_info); - DCHECK(line_breaker.IsFinished()); - return CalculateInitialLetterBoxInlineSize(line_info); + LayoutUnit inline_size = LayoutUnit(); + do { + NGLineInfo line_info; + line_breaker.NextLine(&line_info); + if (line_info.Results().empty()) + break; + inline_size = + std::max(CalculateInitialLetterBoxInlineSize(line_info), inline_size); + } while (!line_breaker.IsFinished()); + return inline_size; } FloatsMaxSize floats_max_size(float_input);
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc index 5b5e0f0..c15446c 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
@@ -9,6 +9,7 @@ #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text_combine.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_bidi_paragraph.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_break_token.h" +#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_item_segment.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_node.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_line_info.h" @@ -35,6 +36,114 @@ namespace { +// Returns smallest negative left and right bearing in `box_fragment`. +// This function is used for calculating side bearing. +NGLineBoxStrut ComputeNegativeSideBearings( + const NGPhysicalBoxFragment& box_fragment) { + const auto get_shape_result = + [](const NGInlineCursor cursor) -> const ShapeResultView* { + if (!cursor) + return nullptr; + const NGFragmentItem& item = *cursor.CurrentItem(); + if (item.Type() != NGFragmentItem::kText && + item.Type() != NGFragmentItem::kGeneratedText) + return nullptr; + if (item.IsFlowControl()) + return nullptr; + return item.TextShapeResult(); + }; + + NGLineBoxStrut side_bearing; + + for (NGInlineCursor cursor(box_fragment); cursor; cursor.MoveToNextLine()) { + // Take left/right bearing from the first/last child in the line if it has + // `ShapeResult`. The first/last child can be non text item, e.g. image. + // Note: Items in the line are in visual order. So, first=left, last=right. + // + // Example: If we have three text item "[", "T", "]", we should take left + // baring from "[" and right bearing from "]". The text ink bounds of "T" + // is not involved with side bearing calculation. + DCHECK(cursor.Current().IsLineBox()); + + // `gfx::RectF` returned from `ShapeResult::ComputeInkBounds()` is in + // text origin coordinate aka baseline. Y-coordinate of points above + // baseline are negative. + // + // Text Ink Bounds: + // * left bearing = text_ink_bounds.X() + // * right bearing = width - text_ink_bounds.InlineEndOffset() + // + // <--> left bearing (positive) + // ...+---------+ + // ...|*********|..< + // ...|....*....|..< + // ...|....*....|<-> right bearing (positive) + // ...|....*....|..< + // ...|....*....|..< + // >..+----*----+..< baseline + // ^text origin + // <---------------> width/advance + // + // left bearing (negative) + // <--> <--> right bearing (negative) + // +----------------+ + // |... *****..*****| + // |......*.....*<..| + // |.....*.....*.<..| + // |....*******..<..| + // |...*.....*...<..| + // |..*.....*....<..| + // +****..*****..<..+ + // ^ text origin + // <----------> width/advance + // + // When `NGFragmentItem` has `ShapeTesult`, its `rect` is + // * `rect.offset.left = X` + // * `rect.size.width = shape_result.SnappedWidth() // advance + // where `X` is the original item offset. + // For the initial letter text, its `rect` is[1] + // * `rect.offset.left = X - text_ink_bounds.X()` + // * `rect.size.width = text_ink_bounds.Width()` + // [1] https://drafts.csswg.org/css-inline/#initial-letter-box-size + // Sizeing the Initial Letter Box + NGInlineCursor child_at_left_edge = cursor; + child_at_left_edge.MoveToFirstChild(); + if (auto* shape_result = get_shape_result(child_at_left_edge)) { + const LayoutUnit left_bearing = + LogicalRect::EnclosingRect(shape_result->ComputeInkBounds()) + .offset.inline_offset; + side_bearing.inline_start = + std::min(side_bearing.inline_start, left_bearing); + } + + NGInlineCursor child_at_right_edge = cursor; + child_at_right_edge.MoveToLastChild(); + if (auto* shape_result = get_shape_result(child_at_right_edge)) { + const LayoutUnit width = shape_result->SnappedWidth(); + const LogicalRect text_ink_bounds = + LogicalRect::EnclosingRect(shape_result->ComputeInkBounds()); + const LayoutUnit right_bearing = + width - text_ink_bounds.InlineEndOffset(); + side_bearing.inline_end = + std::min(side_bearing.inline_end, right_bearing); + } + } + + return side_bearing; +} + +// This rule comes from the spec[1]. +// Note: We don't apply inline kerning for vertical writing mode with text +// orientation other than `sideways` because characters are laid out vertically. +// [1] https://drafts.csswg.org/css-inline/#initial-letter-inline-position +bool ShouldApplyInlineKerning(const NGPhysicalBoxFragment& box_fragment) { + if (!box_fragment.Borders().IsZero() || !box_fragment.Padding().IsZero()) + return false; + const ComputedStyle& style = box_fragment.Style(); + return style.IsHorizontalWritingMode() || + style.GetTextOrientation() == ETextOrientation::kSideways; +} + // CSS-defined white space characters, excluding the newline character. // In most cases, the line breaker consider break opportunities are before // spaces because it handles trailing spaces differently from other normal @@ -1973,12 +2082,14 @@ if (UNLIKELY(HasHyphen())) position_ -= RemoveHyphen(line_info->MutableResults()); + const bool is_initial_letter_box = + item.Type() == NGInlineItem::kInitialLetterBox; // When we're just computing min/max content sizes, we can skip the full // layout and just compute those sizes. On the other hand, for regular // layout we need to do the full layout and get the layout result. // Doing a full layout for min/max content can also have undesirable // side effects when that falls back to legacy layout. - if (mode_ == NGLineBreakerMode::kContent) { + if (mode_ == NGLineBreakerMode::kContent || UNLIKELY(is_initial_letter_box)) { // https://drafts.csswg.org/css-pseudo-4/#first-text-line // > The first line of a table-cell or inline-block cannot be the first // > formatted line of an ancestor element. @@ -1986,10 +2097,29 @@ NGBlockNode(To<LayoutBox>(item.GetLayoutObject())) .LayoutAtomicInline(constraint_space_, node_.Style(), /* use_first_line_style */ false); + + const auto& physical_box_fragment = To<NGPhysicalBoxFragment>( + item_result->layout_result->PhysicalFragment()); item_result->inline_size = NGFragment(constraint_space_.GetWritingDirection(), - item_result->layout_result->PhysicalFragment()) + physical_box_fragment) .InlineSize(); + + if (UNLIKELY(is_initial_letter_box) && + ShouldApplyInlineKerning(physical_box_fragment)) { + // Apply "Inline Kerning" to the initial letter box[1]. + // [1] https://drafts.csswg.org/css-inline/#initial-letter-inline-position + const NGLineBoxStrut side_bearing = + ComputeNegativeSideBearings(physical_box_fragment); + if (IsLtr(base_direction_)) { + item_result->margins.inline_start += side_bearing.inline_start; + inline_margins += side_bearing.inline_start; + } else { + item_result->margins.inline_end += side_bearing.inline_end; + inline_margins += side_bearing.inline_end; + } + } + item_result->inline_size += inline_margins; } else { DCHECK(mode_ == NGLineBreakerMode::kMaxContent ||
diff --git a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc index 61b8f90..e3dad75 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_absolute_utils_test.cc
@@ -106,9 +106,10 @@ NGLogicalAnchorQuery anchor_query; NGAnchorEvaluatorImpl anchor_evaluator( anchor_query, container_converter, + /* self_writing_direction */ + {WritingMode::kHorizontalTb, TextDirection::kLtr}, /* offset_to_padding_box */ - PhysicalOffset(), - /* self_writing_mode */ WritingMode::kHorizontalTb); + PhysicalOffset()); const NGLogicalOutOfFlowInsets insets = ComputeOutOfFlowInsets( node.Style(), space.AvailableSize(), &anchor_evaluator); LogicalSize computed_available_size = @@ -133,9 +134,10 @@ NGLogicalAnchorQuery anchor_query; NGAnchorEvaluatorImpl anchor_evaluator( anchor_query, container_converter, + /* self_writing_direction */ + {WritingMode::kHorizontalTb, TextDirection::kLtr}, /* offset_to_padding_box */ - PhysicalOffset(), - /* self_writing_mode */ WritingMode::kHorizontalTb); + PhysicalOffset()); const NGLogicalOutOfFlowInsets insets = ComputeOutOfFlowInsets( node.Style(), space.AvailableSize(), &anchor_evaluator); LogicalSize computed_available_size =
diff --git a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc index 0728766..ad0acce 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.cc
@@ -13,6 +13,56 @@ namespace blink { +namespace { + +AnchorValue PhysicalAnchorValueUsing(AnchorValue x, + AnchorValue flipped_x, + AnchorValue y, + AnchorValue flipped_y, + WritingDirectionMode writing_direction, + bool is_y_axis) { + if (is_y_axis) { + if (writing_direction.IsHorizontal()) { + DCHECK(!writing_direction.IsFlippedBlocks()); + return y; + } + return writing_direction.IsLtr() ? y : flipped_y; + } + if (writing_direction.IsHorizontal()) + return writing_direction.IsLtr() ? x : flipped_x; + return writing_direction.IsFlippedBlocks() ? flipped_x : x; +} + +// The logical <anchor-side> keywords map to one of the physical keywords +// depending on the property the function is being used in and the writing mode. +// https://drafts.csswg.org/css-anchor-1/#anchor-pos +AnchorValue PhysicalAnchorValueFromLogical( + AnchorValue anchor_value, + WritingDirectionMode writing_direction, + WritingDirectionMode self_writing_direction, + bool is_y_axis) { + switch (anchor_value) { + case AnchorValue::kSelfStart: + writing_direction = self_writing_direction; + [[fallthrough]]; + case AnchorValue::kStart: + return PhysicalAnchorValueUsing(AnchorValue::kLeft, AnchorValue::kRight, + AnchorValue::kTop, AnchorValue::kBottom, + writing_direction, is_y_axis); + case AnchorValue::kSelfEnd: + writing_direction = self_writing_direction; + [[fallthrough]]; + case AnchorValue::kEnd: + return PhysicalAnchorValueUsing(AnchorValue::kRight, AnchorValue::kLeft, + AnchorValue::kBottom, AnchorValue::kTop, + writing_direction, is_y_axis); + default: + return anchor_value; + } +} + +} // namespace + NGPhysicalAnchorReference::NGPhysicalAnchorReference( const NGLogicalAnchorReference& logical_reference, const WritingModeConverter& converter) @@ -191,6 +241,7 @@ AnchorValue anchor_value, LayoutUnit available_size, const WritingModeConverter& container_converter, + WritingDirectionMode self_writing_direction, const PhysicalOffset& offset_to_padding_box, bool is_y_axis, bool is_right_or_bottom) const { @@ -203,6 +254,9 @@ return absl::nullopt; // No targets. const PhysicalRect anchor = container_converter.ToPhysical(reference->rect); + anchor_value = PhysicalAnchorValueFromLogical( + anchor_value, container_converter.GetWritingDirection(), + self_writing_direction, is_y_axis); LayoutUnit value; switch (anchor_value) { case AnchorValue::kLeft: @@ -231,7 +285,17 @@ // See |AnchorValue::kLeft|. value = anchor.Bottom() - offset_to_padding_box.top; break; - default: + case AnchorValue::kStart: + case AnchorValue::kEnd: + case AnchorValue::kSelfStart: + case AnchorValue::kSelfEnd: + // These logical values should have been converted to corresponding + // physical values in `PhysicalAnchorValueFromLogical`. + NOTREACHED(); + return absl::nullopt; + case AnchorValue::kCenter: + case AnchorValue::kPercentage: + // TODO(crbug.com/1382524): Not implemented yet. NOTREACHED(); return absl::nullopt; } @@ -318,7 +382,8 @@ if (const NGLogicalAnchorQuery* anchor_query = AnchorQuery()) { return anchor_query->EvaluateAnchor( anchor_name, anchor_value, available_size_, container_converter_, - offset_to_padding_box_, is_y_axis_, is_right_or_bottom_); + self_writing_direction_, offset_to_padding_box_, is_y_axis_, + is_right_or_bottom_); } return absl::nullopt; } @@ -330,7 +395,7 @@ if (const NGLogicalAnchorQuery* anchor_query = AnchorQuery()) { return anchor_query->EvaluateSize(anchor_name, anchor_size_value, container_converter_.GetWritingMode(), - self_writing_mode_); + self_writing_direction_.GetWritingMode()); } return absl::nullopt; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h index 296ef80..ec4d708 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h +++ b/third_party/blink/renderer/core/layout/ng/ng_anchor_query.h
@@ -131,6 +131,7 @@ AnchorValue anchor_value, LayoutUnit available_size, const WritingModeConverter& container_converter, + WritingDirectionMode self_writing_direction, const PhysicalOffset& offset_to_padding_box, bool is_y_axis, bool is_right_or_bottom) const; @@ -158,12 +159,12 @@ NGAnchorEvaluatorImpl(const NGLogicalAnchorQuery& anchor_query, const WritingModeConverter& container_converter, - const PhysicalOffset& offset_to_padding_box, - WritingMode self_writing_mode) + WritingDirectionMode self_writing_direction, + const PhysicalOffset& offset_to_padding_box) : anchor_query_(&anchor_query), container_converter_(container_converter), - offset_to_padding_box_(offset_to_padding_box), - self_writing_mode_(self_writing_mode) { + self_writing_direction_(self_writing_direction), + offset_to_padding_box_(offset_to_padding_box) { DCHECK(anchor_query_); } @@ -172,13 +173,13 @@ NGAnchorEvaluatorImpl(const NGLogicalAnchorQueryMap& anchor_queries, const LayoutObject& containing_block, const WritingModeConverter& container_converter, - const PhysicalOffset& offset_to_padding_box, - WritingMode self_writing_mode) + WritingDirectionMode self_writing_direction, + const PhysicalOffset& offset_to_padding_box) : anchor_queries_(&anchor_queries), containing_block_(&containing_block), container_converter_(container_converter), - offset_to_padding_box_(offset_to_padding_box), - self_writing_mode_(self_writing_mode) { + self_writing_direction_(self_writing_direction), + offset_to_padding_box_(offset_to_padding_box) { DCHECK(anchor_queries_); DCHECK(containing_block_); } @@ -213,8 +214,9 @@ const LayoutObject* containing_block_ = nullptr; const WritingModeConverter container_converter_{ {WritingMode::kHorizontalTb, TextDirection::kLtr}}; + WritingDirectionMode self_writing_direction_{WritingMode::kHorizontalTb, + TextDirection::kLtr}; PhysicalOffset offset_to_padding_box_; - WritingMode self_writing_mode_; LayoutUnit available_size_; bool is_y_axis_ = false; bool is_right_or_bottom_ = false;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc index d922dcba..faf27cc 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.cc
@@ -1648,15 +1648,14 @@ DCHECK(css_containing_block); anchor_evaluator_storage.emplace( *anchor_queries, *css_containing_block, container_converter, - container_converter.ToPhysical(node_info.container_info.rect).offset, - candidate_writing_direction.GetWritingMode()); + candidate_writing_direction, + container_converter.ToPhysical(node_info.container_info.rect).offset); } else if (const NGLogicalAnchorQuery* anchor_query = container_builder_->AnchorQuery()) { // Otherwise the |container_builder_| is the containing block. anchor_evaluator_storage.emplace( - *anchor_query, container_converter, - container_converter.ToPhysical(node_info.container_info.rect).offset, - candidate_writing_direction.GetWritingMode()); + *anchor_query, container_converter, candidate_writing_direction, + container_converter.ToPhysical(node_info.container_info.rect).offset); } else { anchor_evaluator_storage.emplace(); }
diff --git a/third_party/blink/renderer/core/layout/svg/svg_content_container.cc b/third_party/blink/renderer/core/layout/svg/svg_content_container.cc index 2c64d744..34a314a8 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_content_container.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_content_container.cc
@@ -42,14 +42,12 @@ return false; if (child.IsSVGInline() || child.IsSVGInlineText()) return false; - // The above IsSVG() check is not enough for foreign elements with - // `display: contents`. We ignore SVG descendants in a foreign element. + // The above IsSVG() check is not enough for a <svg> in a foreign element + // with `display: contents` because SVGSVGElement::LayoutObjectIsNeeded() + // doesn't check HasSVGParent(). if (RuntimeEnabledFeatures:: SvgContainersRejectSvgInDisplayContentsEnabled()) { - if (const Node* node = child.GetNode()) { - if (const Element* parent_element = node->parentElement()) - return parent_element->IsSVGElement(); - } + return !child.IsSVGRoot(); } return true; }
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index 1c7929d..7fb46a8 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -279,11 +279,11 @@ static bool AffectsScrollAnimations(const ComputedStyle* old_style, const ComputedStyle* new_style) { if (old_style && !(old_style->ScrollTimelineName().empty() && - old_style->ViewTimelineName().empty())) { + !old_style->ViewTimelineName())) { return true; } if (new_style && !(new_style->ScrollTimelineName().empty() && - new_style->ViewTimelineName().empty())) { + !new_style->ViewTimelineName())) { return true; } return false;
diff --git a/third_party/blink/renderer/core/style/scoped_css_name.cc b/third_party/blink/renderer/core/style/scoped_css_name.cc index 76797b7e..4839db4f 100644 --- a/third_party/blink/renderer/core/style/scoped_css_name.cc +++ b/third_party/blink/renderer/core/style/scoped_css_name.cc
@@ -8,4 +8,8 @@ visitor->Trace(tree_scope_); } +void ScopedCSSNameList::Trace(Visitor* visitor) const { + visitor->Trace(names_); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/style/scoped_css_name.h b/third_party/blink/renderer/core/style/scoped_css_name.h index fddb9bf..68fae82 100644 --- a/third_party/blink/renderer/core/style/scoped_css_name.h +++ b/third_party/blink/renderer/core/style/scoped_css_name.h
@@ -6,7 +6,9 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_SCOPED_CSS_NAME_H_ #include "base/memory/values_equivalent.h" +#include "base/ranges/algorithm.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/wtf/hash_functions.h" @@ -55,6 +57,38 @@ WeakMember<const TreeScope> tree_scope_; }; +// Represents a list of tree-scoped names (or tree-scoped references). +// +// https://drafts.csswg.org/css-scoping/#css-tree-scoped-name +// https://drafts.csswg.org/css-scoping/#css-tree-scoped-reference +class CORE_EXPORT ScopedCSSNameList + : public GarbageCollected<ScopedCSSNameList> { + public: + explicit ScopedCSSNameList(HeapVector<Member<const ScopedCSSName>> names) + : names_(std::move(names)) { + DCHECK(!names_.empty()); + } + + const HeapVector<Member<const ScopedCSSName>>& GetNames() const { + return names_; + } + + bool operator==(const ScopedCSSNameList& other) const { + return base::ranges::equal(names_, other.names_, + [](const auto& a, const auto& b) { + return base::ValuesEquivalent(a, b); + }); + } + bool operator!=(const ScopedCSSNameList& other) const { + return !operator==(other); + } + + void Trace(Visitor* visitor) const; + + private: + HeapVector<Member<const ScopedCSSName>> names_; +}; + } // namespace blink namespace WTF {
diff --git a/third_party/blink/renderer/core/testing/fake_local_frame_host.h b/third_party/blink/renderer/core/testing/fake_local_frame_host.h index 3818dd6..e392886 100644 --- a/third_party/blink/renderer/core/testing/fake_local_frame_host.h +++ b/third_party/blink/renderer/core/testing/fake_local_frame_host.h
@@ -104,7 +104,6 @@ RunModalPromptDialogCallback callback) override; void RunBeforeUnloadConfirm(bool is_reload, RunBeforeUnloadConfirmCallback callback) override; - void WillPotentiallyStartNavigation(const KURL& url) override {} void UpdateFaviconURL( WTF::Vector<blink::mojom::blink::FaviconURLPtr> favicon_urls) override; void DownloadURL(mojom::blink::DownloadURLParamsPtr params) override;
diff --git a/third_party/blink/renderer/modules/document_picture_in_picture/document_picture_in_picture.cc b/third_party/blink/renderer/modules/document_picture_in_picture/document_picture_in_picture.cc index d9436d3..45790c8 100644 --- a/third_party/blink/renderer/modules/document_picture_in_picture/document_picture_in_picture.cc +++ b/third_party/blink/renderer/modules/document_picture_in_picture/document_picture_in_picture.cc
@@ -54,6 +54,13 @@ return ScriptPromise(); } + if (dom_window->IsPictureInPictureWindow()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kNotAllowedError, + "Opening a PiP window from a PiP window is not allowed"); + return ScriptPromise(); + } + // TODO(https://crbug.com/1253970): Check if PiP is allowed (e.g. user // gesture, permissions, etc). auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph.cc b/third_party/blink/renderer/modules/ml/webnn/ml_graph.cc index a39789e..ec67718 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph.cc +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph.cc
@@ -114,6 +114,31 @@ ComputeAsyncImpl(inputs, outputs, resolver); } +void MLGraph::ComputeSync(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state) { + // The MLGraph object should be initialized before computing. + DCHECK(resources_info_initialized_); + + // Validate the input and output MLNamedArrayBufferViews. + String error_message; + if (!ValidateNamedArrayBufferViews(inputs, input_resources_info_, + error_message)) { + exception_state.ThrowDOMException(DOMExceptionCode::kDataError, + "Invalid inputs: " + error_message); + return; + } + if (!ValidateNamedArrayBufferViews(outputs, output_resources_info_, + error_message)) { + exception_state.ThrowDOMException(DOMExceptionCode::kDataError, + "Invalid outputs: " + error_message); + return; + } + + // Call ComputeSyncImpl() implemented by an MLGraph backend. + ComputeSyncImpl(inputs, outputs, exception_state); +} + void MLGraph::BuildAsync(const MLNamedOperands& named_outputs, ScriptPromiseResolver* resolver) { String error_message;
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph.h b/third_party/blink/renderer/modules/ml/webnn/ml_graph.h index b6970579..08489d8 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph.h +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph.h
@@ -66,6 +66,15 @@ const MLNamedArrayBufferViews& outputs, ScriptPromiseResolver* resolver); + // ComputeSync() has the similar function as ComputeAsync(). The difference is + // if there are no validation errors, it calls ComputeSyncImpl() implemented + // by an MLGraph backend that binds the array buffer views and executes the + // compiled platform graph synchronously in the caller's thread. This method + // is called by MLContext to implement MLContext.computeSync() method. + void ComputeSync(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state); + protected: explicit MLGraph(MLContext* context); @@ -102,15 +111,23 @@ ExceptionState& exception_state) = 0; // An MLGraph backend should implement this method to execute the compiled - // platform graph asynchronously. The actual graph execution work - // should be handled by a worker thread without blocking the main thread. Once - // the execution of the platform graph is completed, the results should be - // produeced into the output buffers and the resolver should be resolved. - // Otherwise, the resolver should be rejected with a DOMException accordingly. + // platform graph asynchronously. The actual graph execution work should be + // handled by a worker thread without blocking the main thread. If no errors + // occurred, the resolver will be resolved and results will be stored in + // output buffers. Otherwise, the resolver will be rejected with a + // DOMException accordingly. virtual void ComputeAsyncImpl(const MLNamedArrayBufferViews& inputs, const MLNamedArrayBufferViews& outputs, ScriptPromiseResolver* resolver) = 0; + // An MLGraph backend should implement this method to execute the compiled + // platform graph synchronously in the caller's thread. Results will be stored + // in output buffers if no errors occurred. Otherwise, this method will throw + // a DOMException accordingly. + virtual void ComputeSyncImpl(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state) = 0; + Member<MLContext> ml_context_; bool resources_info_initialized_{false}; HashMap<String, ResourceInfo> input_resources_info_;
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.cc b/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.cc index 8cb2da30..8aad276 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.cc +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.cc
@@ -2068,6 +2068,14 @@ ScriptPromiseResolver* resolver) override { resolver->Resolve(); } + + // Just return for testing the validation of inputs and outputs in + // MLGraph::ComputeSync(). + void ComputeSyncImpl(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state) override { + return; + } }; FakeMLGraphBackend* ToFakeMLGraphBackend(V8TestingScope* scope, @@ -2130,6 +2138,40 @@ } } +DOMException* MLGraphTestBase::ComputeGraph( + V8TestingScope& scope, + MLGraph* graph, + const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs) { + switch (GetParam()) { + case ExecutionMode::kAsync: { + auto* resolver = + MakeGarbageCollected<ScriptPromiseResolver>(scope.GetScriptState()); + ScriptPromiseTester tester(scope.GetScriptState(), resolver->Promise()); + graph->ComputeAsync(inputs, outputs, resolver); + tester.WaitUntilSettled(); + if (tester.IsFulfilled()) { + return nullptr; + } else { + return V8DOMException::ToImplWithTypeCheck(scope.GetIsolate(), + tester.Value().V8Value()); + } + } + case ExecutionMode::kSync: { + graph->ComputeSync(inputs, outputs, scope.GetExceptionState()); + if (scope.GetExceptionState().HadException()) { + return MakeGarbageCollected<DOMException>( + scope.GetExceptionState().CodeAs<DOMExceptionCode>(), + scope.GetExceptionState().Message()); + } else { + return nullptr; + } + } + default: + NOTREACHED(); + } +} + namespace { // Helper class to create the FakeMLGraphBackend that is intended to test @@ -2281,12 +2323,6 @@ } } -INSTANTIATE_TEST_SUITE_P(All, - FakeMLGraphTest, - ::testing::Values(ExecutionMode::kAsync, - ExecutionMode::kSync), - ExecutionModeParamToString); - // Helper struct to create an ArrayBufferView for MLNamedArrayBufferViews test. struct ArrayBufferViewInfo { size_t number_of_elements; @@ -2306,38 +2342,24 @@ CreateDOMArrayBufferView(operand->NumberOfElements(), operand->Type())); } -TEST_F(MLGraphBuilderTest, MLNamedArrayBufferViewsValidationTest) { +TEST_P(FakeMLGraphTest, ComputeTest) { V8TestingScope scope; auto* builder = CreateMLGraphBuilder(scope); - auto* script_state = scope.GetScriptState(); // Build a fake graph represents computation 'c = a * b'; auto* a = BuildInput(scope, builder, "a", {3, 4}, V8MLOperandType::Enum::kFloat32); auto* b = BuildInput(scope, builder, "b", {4, 3}, V8MLOperandType::Enum::kFloat32); auto* c = BuildGemm(scope, builder, a, b); - auto* graph_build_resolver = - MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester graph_build_tester(script_state, - graph_build_resolver->Promise()); - FakeMLGraphBackend::ValidateAndBuildAsync(builder->GetContext(), {{"c", c}}, - graph_build_resolver); - graph_build_tester.WaitUntilSettled(); - DCHECK(graph_build_tester.IsFulfilled()); - auto* graph = ToFakeMLGraphBackend(&scope, graph_build_tester.Value()); + auto [graph, build_exception] = BuildGraph(scope, builder, {{"c", c}}); DCHECK_NE(graph, nullptr); + DCHECK_EQ(build_exception, nullptr); { // Test throwing exception if the inputs is empty. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2347,17 +2369,11 @@ } { // Test throwing exception if the number of inputs doesn't match. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2367,17 +2383,11 @@ } { // Test throwing exception if the outputs is empty. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2387,19 +2397,13 @@ } { // Test throwing exception if the number of outputs doesn't match. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); outputs.emplace_back("d", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2409,19 +2413,13 @@ } { // Test throwing exception if the input name is unknown. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("invalid-input-name", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2431,19 +2429,13 @@ } { // Test throwing exception if the output name is unknown. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; outputs.emplace_back("invalid-output-name", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2453,8 +2445,6 @@ } { // Test throwing exception if the input array buffer view type is wrong. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back( "a", ArrayBufferViewInfo{.number_of_elements = 12, @@ -2463,11 +2453,7 @@ inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2477,8 +2463,6 @@ } { // Test throwing exception if the input array buffer view size is wrong. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back( "a", ArrayBufferViewInfo{.number_of_elements = 10, @@ -2487,11 +2471,7 @@ inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2501,8 +2481,6 @@ } { // Test throwing exception if the output array buffer view type is wrong. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); @@ -2511,11 +2489,7 @@ "c", ArrayBufferViewInfo{.number_of_elements = 9, .type = V8MLOperandType::Enum::kInt32} .ToArrayBufferView()); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2525,8 +2499,6 @@ } { // Test throwing exception if the output array buffer view size is wrong. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); @@ -2535,11 +2507,7 @@ "c", ArrayBufferViewInfo{.number_of_elements = 8, .type = V8MLOperandType::Enum::kFloat32} .ToArrayBufferView()); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2549,8 +2517,6 @@ } { // Test throwing exception if the input is not an array buffer view object. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back( @@ -2559,11 +2525,7 @@ ->buffer())); MLNamedArrayBufferViews outputs; outputs.emplace_back("c", CreateArrayBufferViewForOperand(c)); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2573,8 +2535,6 @@ } { // Test throwing exception if the output is not an array buffer view object. - auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); - ScriptPromiseTester tester(script_state, resolver->Promise()); MLNamedArrayBufferViews inputs; inputs.emplace_back("a", CreateArrayBufferViewForOperand(a)); inputs.emplace_back("b", CreateArrayBufferViewForOperand(b)); @@ -2583,11 +2543,7 @@ "c", MakeGarbageCollected<V8UnionArrayBufferOrArrayBufferView>( CreateDOMArrayBufferView(9, V8MLOperandType::Enum::kFloat32) ->buffer())); - graph->ComputeAsync(inputs, outputs, resolver); - tester.WaitUntilSettled(); - EXPECT_TRUE(tester.IsRejected()); - auto* exception = V8DOMException::ToImplWithTypeCheck( - scope.GetIsolate(), tester.Value().V8Value()); + auto* exception = ComputeGraph(scope, graph, inputs, outputs); EXPECT_NE(exception, nullptr); EXPECT_EQ(exception->name(), DOMException::GetErrorName(DOMExceptionCode::kDataError)); @@ -2597,4 +2553,10 @@ } } +INSTANTIATE_TEST_SUITE_P(All, + FakeMLGraphTest, + ::testing::Values(ExecutionMode::kAsync, + ExecutionMode::kSync), + ExecutionModeParamToString); + } // namespace blink
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.h b/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.h index b0b0e85..2b649bb 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.h +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph_builder_test.h
@@ -101,6 +101,16 @@ BuildResult BuildGraph(V8TestingScope& scope, MLGraphBuilder* builder, const MLNamedOperands& named_operands); + + // Helper method for testinh both ComputeAsync() and ComputeSync() with the + // same input/output buffers and expected results. If the graph computes + // successfully, it returns nullptr and the results are produced into the + // output buffers. Otherwise, it returns the pointer to the DOMException + // thrown by the graph computing. + DOMException* ComputeGraph(V8TestingScope& scope, + MLGraph* graph, + const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs); }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.cc b/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.cc index d02fd3c..7a037cb 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.cc +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.cc
@@ -308,8 +308,20 @@ // TODO(ningxin.hu@intel.com): Implement this method by posting the inputs and // outputs to a background thread and invoking XNNPACK Runtime object in the // background thread. + resolver->Reject(MakeGarbageCollected<DOMException>( DOMExceptionCode::kNotSupportedError, "Not implemented.")); } +void MLGraphXnnpack::ComputeSyncImpl(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state) { + // TODO(ningxin.hu@intel.com): Setup the external values of the XNNPACK + // Runtime object by input and output buffers, and invoke the XNNPACK Runtime + // object for accelerated execution in the caller's thread. + + exception_state.ThrowDOMException(DOMExceptionCode::kNotSupportedError, + "Not implemented."); +} + } // namespace blink
diff --git a/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.h b/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.h index 10fa304..38b58ca6 100644 --- a/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.h +++ b/third_party/blink/renderer/modules/ml/webnn/ml_graph_xnnpack.h
@@ -81,6 +81,11 @@ const MLNamedArrayBufferViews& outputs, ScriptPromiseResolver* resolver) override; + // Invoke the XNNPACK Runtime object in the caller's thread. + void ComputeSyncImpl(const MLNamedArrayBufferViews& inputs, + const MLNamedArrayBufferViews& outputs, + ExceptionState& exception_state) override; + // The SharedXnnpackContext is shared and reference-counted by all instances // of MLGraphXnnpack. It initializes (and also deinitializes) the XNNPACK // library for graph building and execution.
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng index d4b9a88..a1e67669 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -3469,6 +3469,7 @@ # The initial-letter implements only in LayoutNG. crbug.com/1276900 external/wpt/css/css-inline/initial-letter/* [ Skip ] +crbug.com/1276900 fast/inline/initial-letter-inline-kerning.html [ Skip ] # crbug.com/1339051: some ref tests generate output with minor differences. crbug.com/1339051 external/wpt/css/css-transforms/perspective-split-by-zero-w.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index d0f03c2..9beb405bb 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -7450,11 +7450,6 @@ crbug.com/1356118 [ Mac ] virtual/async-script-scheduling-finished-parsing/wpt_internal/async-script-scheduling/execution-order.sub.html [ Failure Pass ] crbug.com/1356118 [ Linux ] virtual/async-script-scheduling-finished-parsing/wpt_internal/async-script-scheduling/execution-order.sub.html [ Failure Pass ] -# Sheriff 2022-08-26 -crbug.com/1356118 [ Linux ] external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.html [ Failure Pass ] -crbug.com/1356118 [ Linux ] virtual/fenced-frame-mparch/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.html [ Failure Pass ] -crbug.com/1356118 [ Linux ] virtual/partitioned-cookies/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.html [ Failure Pass ] - # Sheriff 2022-08-30 # TODO(crbug.com/1358147): Re-enable this test
diff --git a/third_party/blink/web_tests/external/wpt/css/css-anchor-position/anchor-position-writing-modes-002.html b/third_party/blink/web_tests/external/wpt/css/css-anchor-position/anchor-position-writing-modes-002.html new file mode 100644 index 0000000..15a9a63 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-anchor-position/anchor-position-writing-modes-002.html
@@ -0,0 +1,102 @@ +<!DOCTYPE html> +<title>Tests logical `anchor` function for `writing-mode`/`direction`s</title> +<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-pos"> +<link rel="author" href="mailto:kojii@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script><style> +<style> +.htb-ltr { writing-mode: horizontal-tb; direction: ltr; } +.htb-rtl { writing-mode: horizontal-tb; direction: rtl; } +.vlr-ltr { writing-mode: vertical-lr; direction: ltr; } +.vlr-rtl { writing-mode: vertical-lr; direction: rtl; } +.vrl-ltr { writing-mode: vertical-rl; direction: ltr; } +.vrl-rtl { writing-mode: vertical-rl; direction: rtl; } +.relpos { + position: relative; + outline: blue 1px solid; +} +.spacer { + width: 10px; + height: 10px; + background: yellow; +} +.anchor { + anchor-name: --a1; + margin: 5px; + width: 30px; + height: 30px; + background: orange; +} +.target { + position: absolute; + outline: 5px solid lime; +} +</style> +<body> + <template id="template"> + <div class="relpos"> + <div class="spacer"></div> + <div class="anchor"></div> + </div> + </template> +<script> +// Generate tests for all combinations. +// The first two entries are the side `start` and `end` should match in x-axis. +// The next two entries are the side `start` and `end` should match in y-axis. +const writingDirs = { + 'htb-ltr':['l', 'r', 't', 'b'], + 'htb-rtl':['r', 'l', 't', 'b'], + 'vrl-ltr':['r', 'l', 't', 'b'], + 'vrl-rtl':['r', 'l', 'b', 't'], + 'vlr-ltr':['l', 'r', 't', 'b'], + 'vlr-rtl':['l', 'r', 'b', 't'], +}; +const container = document.body; +const cb_template = template.content.firstElementChild; +for (const [writingDir, matches] of Object.entries(writingDirs)) { + const cb = cb_template.cloneNode(true); + cb.classList.add(writingDir); + createTarget(null, 'left: anchor(--a1 start)', matches[0], cb); + createTarget(null, 'left: anchor(--a1 end)', matches[1], cb); + createTarget(null, 'top: anchor(--a1 start)', matches[2], cb); + createTarget(null, 'top: anchor(--a1 end)', matches[3], cb); + createTarget(writingDir, 'left: anchor(--a1 self-start)', matches[0], cb); + createTarget(writingDir, 'left: anchor(--a1 self-end)', matches[1], cb); + createTarget(writingDir, 'top: anchor(--a1 self-start)', matches[2], cb); + createTarget(writingDir, 'top: anchor(--a1 self-end)', matches[3], cb); + container.appendChild(cb); +} + +function createTarget(className, style, match, cb) { + const target = document.createElement('div'); + target.classList.add('target'); + if (className) + target.classList.add(className); + target.style = style; + target.dataset.match = match; + cb.appendChild(target); +} + +// Test all `.target`s. +for (const target of document.querySelectorAll('.target')) { + const cb = target.parentElement; + const anchor = cb.querySelector('.anchor'); + test(() => { + switch (target.dataset.match) { + case 'l': + assert_equals(anchor.offsetLeft, target.offsetLeft); + break; + case 'r': + assert_equals(anchor.offsetLeft + anchor.offsetWidth, target.offsetLeft); + break; + case 't': + assert_equals(anchor.offsetTop, target.offsetTop); + break; + case 'b': + assert_equals(anchor.offsetTop + anchor.offsetHeight, target.offsetTop); + break; + } + }, `${cb.classList}/${target.classList}/${target.style.cssText}`); +} +</script> +</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-ref.html b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-ref.html new file mode 100644 index 0000000..43cba30 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-ref.html
@@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html> +<head> +<title>Tests initial letter should handle tabular character</title> +<link rel="author" title="Google LLC" href="https://www.google.com/"> +<link rel="help" href="https://drafts.csswg.org/css-inline/#initial-letter-styling"> +<meta name="flags" content="ahem"> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" > +<style> + .sample { + font-family: Ahem; + font-size: 20px; + line-height: 24px; + } + + .fake-initial-letter { + background: lime; + float: left; + height: 80px; + margin-top: 14px; + width: 80px; + } + + .fake-initial-letter-tab { + background: yellow; + float: left; + height: 80px; + margin-top: 14px; + width: 640px; + } +</style> +</head> +<body> +<div class="sample"><div class="fake-initial-letter-tab"></div> +<div class="fake-initial-letter"></div> +bc<br>def<br>ghi<br>jkl<br>mno<br> +</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl-ref.html b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl-ref.html new file mode 100644 index 0000000..13f633a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl-ref.html
@@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> +<head> +<title>Tests initial letter should handle tabular character</title> +<link rel="author" title="Google LLC" href="https://www.google.com/"> +<link rel="help" href="https://drafts.csswg.org/css-inline/#initial-letter-styling"> +<meta name="flags" content="ahem"> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" > +<style> + .sample { + direction: rtl; + font-family: Ahem; + font-size: 20px; + line-height: 24px; + } + + .fake-initial-letter { + background: lime; + float: right; + height: 80px; + margin-top: 14px; + width: 80px; + } + + .fake-initial-letter-tab { + background: yellow; + float: right; + height: 80px; + margin-top: 14px; + width: 640px; + } +</style> +</head> +<body> +<div class="sample"><div class="fake-initial-letter-tab"></div> +<div class="fake-initial-letter"></div> +bc<br>def<br>ghi<br>jkl<br>mno<br> +</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl.html b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl.html new file mode 100644 index 0000000..f8a2d7a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab-rtl.html
@@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> +<head> +<title>Tests initial letter should handle tabular character</title> +<link rel="author" title="Google LLC" href="https://www.google.com/"> +<link rel="help" href="https://drafts.csswg.org/css-inline/#initial-letter-styling"> +<meta name="flags" content="ahem"> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" > +<link rel="match" href="initial-letter-with-tab-rtl-ref.html"> +<style> + .sample { + direction: rtl; + font-family: Ahem; + font-size: 20px; + line-height: 24px; + } + + .initial-letter::first-letter { + initial-letter: 3 drop; + color: lime; + font-size: 100px; /* should be ignored in rendering */ + line-height: 50px; /* should be ignored in rendering */ + } + + .sample { white-space: pre; } + .initial-letter::first-letter { background: yellow; } +</style> +</head> +<body> +<div class="sample initial-letter">	Abc +def +ghi +jkl +mno</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab.html b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab.html new file mode 100644 index 0000000..49b1f6b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-inline/initial-letter/initial-letter-with-tab.html
@@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> +<title>Tests initial letter should handle tabular character</title> +<link rel="author" title="Google LLC" href="https://www.google.com/"> +<link rel="help" href="https://drafts.csswg.org/css-inline/#initial-letter-styling"> +<meta name="flags" content="ahem"> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" > +<link rel="match" href="initial-letter-with-tab-ref.html"> +<style> + .sample { + font-family: Ahem; + font-size: 20px; + line-height: 24px; + } + + .initial-letter::first-letter { + initial-letter: 3 drop; + color: lime; + font-size: 100px; /* should be ignored in rendering */ + line-height: 50px; /* should be ignored in rendering */ + } + + .sample { white-space: pre; } + .initial-letter::first-letter { background: yellow; } +</style> +</head> +<body> +<div class="sample initial-letter">	Abc +def +ghi +jkl +mno</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.js b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.js index fc58aae..37678ff 100644 --- a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.js +++ b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.js
@@ -60,11 +60,15 @@ send("${queue_C}", value_E); `); - // Verify the credentialless iframe and the normal one do not have access to each - // other. - assert_equals(await receive(queue_B), value_D); // key_D - assert_equals(await receive(queue_B), ""); // key_E - assert_equals(await receive(queue_C), ""); // key_D - assert_equals(await receive(queue_C), value_E); // key_E -}, "Local storage is correctly partitioned with regards to credentialless iframe " + - "in initial empty documents."); + // Verify the credentialless iframe and the normal one do not have access to + // each other. + assert_equals(await receive(queue_B), value_D, // key_D + "Credentialless iframe can access credentialless context"); + assert_equals(await receive(queue_B), "", // key_E + "Credentialless iframe can't access credentialled context"); + assert_equals(await receive(queue_C), "", // key_D + "Credentialled iframe can't access credentialless context"); + assert_equals(await receive(queue_C), value_E, // key_E + "Credentialled iframe can access credentialled context"); +}, "Local storage is correctly partitioned with regards to credentialless " + + "iframe in initial empty documents.");
diff --git a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-non-successful.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-non-successful.html index 00701f1..14997171 100644 --- a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-non-successful.html +++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-non-successful.html
@@ -1,5 +1,11 @@ <!DOCTYPE html> <title>Check that non-successful responses result in discarding the prerender</title> +<meta name="variant" content="?code=204"> +<meta name="variant" content="?code=205"> +<meta name="variant" content="?code=402"> +<meta name="variant" content="?code=404"> +<meta name="variant" content="?code=500"> +<meta name="variant" content="?code=503"> <meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -11,17 +17,14 @@ setup(() => assertSpeculationRulesIsSupported()); -function test_prerender_response_code(code) { - promise_test(async t => { - const {exec, tryToActivate} = await create_prerendered_page(t, {code}); - const result = await tryToActivate(); - assert_equals(result, 'discarded'); - },`Responses with code ${code} should be discarded`); -} +const params = new URLSearchParams(window.location.search); +const code = params.get('code'); -for (const code of [204, 205, 402, 404, 500, 503]) { - test_prerender_response_code(code); -} +promise_test(async t => { + const {exec, tryToActivate} = await create_prerendered_page(t, {code}); + const result = await tryToActivate(); + assert_equals(result, 'discarded'); +},`Responses with code ${code} should be discarded`); </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-successful.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-successful.html index cc70b8c6..adf8a89 100644 --- a/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-successful.html +++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/response-code-successful.html
@@ -1,5 +1,9 @@ <!DOCTYPE html> <title>Check that successful responses result in activating the prerender</title> +<meta name="variant" content="?code=200"> +<meta name="variant" content="?code=201"> +<meta name="variant" content="?code=202"> +<meta name="variant" content="?code=203"> <meta name="timeout" content="long"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -11,17 +15,14 @@ setup(() => assertSpeculationRulesIsSupported()); -function test_prerender_response_code(code) { - promise_test(async t => { - const {exec, tryToActivate} = await create_prerendered_page(t, {code}); - const result = await tryToActivate(); - assert_equals(result, 'activated'); - },`Responses with code ${code} should be activated`); -} +const params = new URLSearchParams(window.location.search); +const code = params.get('code'); -for (const code of [200, 201, 202, 203]) { - test_prerender_response_code(code); -} +promise_test(async t => { + const {exec, tryToActivate} = await create_prerendered_page(t, {code}); + const result = await tryToActivate(); + assert_equals(result, 'activated'); +},`Responses with code ${code} should be activated`); </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/svg/struct/reftests/nested-svg-through-display-contents.svg b/third_party/blink/web_tests/external/wpt/svg/struct/reftests/nested-svg-through-display-contents.svg index f544030..1be64d5 100644 --- a/third_party/blink/web_tests/external/wpt/svg/struct/reftests/nested-svg-through-display-contents.svg +++ b/third_party/blink/web_tests/external/wpt/svg/struct/reftests/nested-svg-through-display-contents.svg
@@ -2,26 +2,12 @@ <svg viewBox="0 0 400 400" width="400" height="400" stroke="none" id="s1" xmlns="http://www.w3.org/2000/svg" xmlns:h="http://www.w3.org/1999/xhtml"> - <h:link rel="match" href="reference/nested-svg-through-display-contents-ref.svg"/> + <h:link rel="match" href="reference/green-100x100.svg"/> <h:link rel="help" href="https://svgwg.org/svg2-draft/struct.html#ForeignNamespaces"/> - <rect x="90" y="100" width="300" height="100" fill="rgba(255,0,0,0.5)"></rect> - <script><![CDATA[ -const SVG_NS = 'http://www.w3.org/2000/svg'; -const XHTML_NS = 'http://www.w3.org/1999/xhtml'; - -const div1 = document.createElementNS(XHTML_NS, 'div'); -div1.style.display = 'contents'; -div1.innerHTML = `<svg xmlns="${SVG_NS}" width="70%" height="70%"> - <rect x="50" y="50" width="300" height="100" fill="rgba(0,0,255,0.5)"></rect> -</svg>`; - -const div2 = document.createElementNS(XHTML_NS, 'div'); -div2.style.display = 'contents'; -div2.innerHTML = `<svg xmlns="${SVG_NS}" width="300" height="200"> - <rect x="70" y="75" width="300" height="100" fill="rgba(0,255,0,0.5)"></rect> -</svg>`; - -document.documentElement.insertBefore(div2, document.documentElement.firstChild); -document.documentElement.insertBefore(div1, div2); -]]></script> + <rect x="0" y="0" width="100" height="100" fill="green"></rect> + <h:div style="display: contents"> + <svg width="300" height="300"> + <rect x="5" y="5" width="100" height="100" fill="red"></rect> + </svg> + </h:div> </svg>
diff --git a/third_party/blink/web_tests/external/wpt/svg/struct/reftests/reference/nested-svg-through-display-contents-ref.svg b/third_party/blink/web_tests/external/wpt/svg/struct/reftests/reference/nested-svg-through-display-contents-ref.svg deleted file mode 100644 index 622978f..0000000 --- a/third_party/blink/web_tests/external/wpt/svg/struct/reftests/reference/nested-svg-through-display-contents-ref.svg +++ /dev/null
@@ -1,4 +0,0 @@ -<?xml version="1.0"?> -<svg viewBox="0 0 400 400" width="400" height="400" stroke="none" xmlns="http://www.w3.org/2000/svg"> - <rect x="90" y="100" width="300" height="100" fill="rgba(255,0,0,0.5)"></rect> -</svg>
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/README.md b/third_party/blink/web_tests/external/wpt/web-bundle/README.md index 90c13069..3e30081 100644 --- a/third_party/blink/web_tests/external/wpt/web-bundle/README.md +++ b/third_party/blink/web_tests/external/wpt/web-bundle/README.md
@@ -5,6 +5,6 @@ [webpackage repository](https://github.com/WICG/webpackage). To install them, run: ``` -go get -u github.com/WICG/webpackage/go/bundle/cmd/... +go install github.com/WICG/webpackage/go/bundle/cmd/...@latest export PATH=$PATH:$(go env GOPATH)/bin ```
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/resources/generate-test-wbns.sh b/third_party/blink/web_tests/external/wpt/web-bundle/resources/generate-test-wbns.sh index be85434..418a56e 100755 --- a/third_party/blink/web_tests/external/wpt/web-bundle/resources/generate-test-wbns.sh +++ b/third_party/blink/web_tests/external/wpt/web-bundle/resources/generate-test-wbns.sh
@@ -4,7 +4,7 @@ if ! command -v gen-bundle > /dev/null 2>&1; then echo "gen-bundle is not installed. Please run:" - echo " go get -u github.com/WICG/webpackage/go/bundle/cmd/..." + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" echo ' export PATH=$PATH:$(go env GOPATH)/bin' exit 1 fi
diff --git a/third_party/blink/web_tests/external/wpt/web-share/disabled-by-permissions-policy-cross-origin.https.sub.html b/third_party/blink/web_tests/external/wpt/web-share/disabled-by-permissions-policy-cross-origin.https.sub.html index 78562419..773da84 100644 --- a/third_party/blink/web_tests/external/wpt/web-share/disabled-by-permissions-policy-cross-origin.https.sub.html +++ b/third_party/blink/web_tests/external/wpt/web-share/disabled-by-permissions-policy-cross-origin.https.sub.html
@@ -33,7 +33,7 @@ async function loadIframe(t, src, allowList) { const iframe = document.createElement("iframe"); - if (allowList !== null) iframe.allow = allowList; + if (allowList !== undefined) iframe.allow = allowList; t.add_cleanup(() => { iframe.remove(); }); @@ -58,7 +58,7 @@ promise_test(async (t) => { assert_true("share" in navigator, "navigator.share is exposed"); - const iframe = await loadIframe(t, crossOriginSrc, "web-share=()"); + const iframe = await loadIframe(t, crossOriginSrc, "web-share 'none'"); const iframeWindow = iframe.contentWindow; iframeWindow.postMessage({ action: "share", data: shareData }, "*"); const data = await waitForMessage("share"); @@ -68,7 +68,7 @@ promise_test(async (t) => { assert_true("share" in navigator, "navigator.share is exposed"); - const iframe = await loadIframe(t, crossOriginSrc, "web-share=(self)"); + const iframe = await loadIframe(t, crossOriginSrc, "web-share 'self'"); const iframeWindow = iframe.contentWindow; iframeWindow.postMessage({ action: "share", data: shareData }, "*"); const data = await waitForMessage("share"); @@ -106,7 +106,7 @@ promise_test(async (t) => { assert_true("canShare" in navigator, "navigator.canShare is exposed"); - const iframe = await loadIframe(t, sameOriginPath, "web-share=(self)"); + const iframe = await loadIframe(t, sameOriginPath, "web-share 'self'"); iframe.contentWindow.postMessage( { action: "canShare", data: shareData }, "*"
diff --git a/third_party/blink/web_tests/fast/inline/initial-letter-inline-kerning.html b/third_party/blink/web_tests/fast/inline/initial-letter-inline-kerning.html new file mode 100644 index 0000000..2f0ab9a4 --- /dev/null +++ b/third_party/blink/web_tests/fast/inline/initial-letter-inline-kerning.html
@@ -0,0 +1,72 @@ +<!doctype html> +<html> +<head> +<title>Tests Initial Letter with Inline Kerning</title> +<link rel="author" title="Google LLC" href="https://www.google.com/"> +<link rel="help" href="https://drafts.csswg.org/css-inline/#initial-letter-inline-position"> +<style> +.sample { + font-size: 20px; + margin-left: 20px; + margin-right: 30px; + margin-bottom: 30px; + border: solid 1px blue; + float: left; +} + +.sample::first-letter { + background: yellow; + initial-letter: 3; + font-style: italic; + color: green; +} + +.border::first-letter { border: solid 1px cyan; } +.padding::first-letter { padding: 10px; } + + +.ltr { + direction: ltr; + width: 10ch; +} + +.rtl { + direction: rtl; + width: 10ch; +} + +.vlr { + writing-mode: vertical-lr; + height: 5ch; +} + +.vrl { + writing-mode: vertical-rl; + height: 5ch; +} + +.sideways { text-orientation: sideways; } +</style> +</head> +<body> +<div class="sample ltr">fine thank you and you?</div> +<div class="sample rtl">fine thank you and you?</div> +<!-- Inline kerning is applied if zero padding and border. --> +<div class="sample ltr border">fine thank you and you?</div> +<div class="sample rtl border">fine thank you and you?</div> +<br style="clear:both"> +<!-- Inline kerning is applied if zero padding and border. --> +<div class="sample ltr padding" style="width: 20ch">fine thank you and you? fine thank you and you? fine thank you and you? fine thank you and you?</div> +<div class="sample rtl padding" style="width: 20ch">fine thank you and you? fine thank you and you? fine thank you and you? fine thank you and you?</div> +<br style="clear:both"> +<!-- Inline kerning is not applied vertical writing mode --> +<div class="sample vlr">fine thank you and you?</div> +<div class="sample vrl">fine thank you and you?</div> +<br style="clear:both"> +<!-- Inline kerning is applied sideways in vertical writing mode --> +<div style="margin-bottom: 10px">text-orientation: sideways</div> +<br style="clear:both"> +<div class="sample vlr sideways">fine thank you and you?</div> +<div class="sample vrl sideways">fine thank you and you?</div> +</body> +</html>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/resources/generate-test-wbns.sh b/third_party/blink/web_tests/http/tests/inspector-protocol/network/resources/generate-test-wbns.sh index 044bf30..2631645c 100755 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/resources/generate-test-wbns.sh +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/resources/generate-test-wbns.sh
@@ -5,7 +5,7 @@ if ! command -v gen-bundle > /dev/null 2>&1; then echo "gen-bundle is not installed. Please run:" - echo " go get -u github.com/WICG/webpackage/go/bundle/cmd/..." + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" echo ' export PATH=$PATH:$(go env GOPATH)/bin' exit 1 fi
diff --git a/third_party/blink/web_tests/http/tests/loading/wbn/resources/generate-test-wbns.sh b/third_party/blink/web_tests/http/tests/loading/wbn/resources/generate-test-wbns.sh index 7fe5e70..667c057 100755 --- a/third_party/blink/web_tests/http/tests/loading/wbn/resources/generate-test-wbns.sh +++ b/third_party/blink/web_tests/http/tests/loading/wbn/resources/generate-test-wbns.sh
@@ -8,7 +8,7 @@ if ! command -v gen-bundle > /dev/null 2>&1; then echo "gen-bundle is not installed. Please run:" - echo " go get -u github.com/WICG/webpackage/go/bundle/cmd/..." + echo " go install github.com/WICG/webpackage/go/bundle/cmd/...@latest" echo ' export PATH=$PATH:$(go env GOPATH)/bin' exit 1 fi
diff --git a/third_party/blink/web_tests/platform/linux/fast/inline/initial-letter-inline-kerning-expected.png b/third_party/blink/web_tests/platform/linux/fast/inline/initial-letter-inline-kerning-expected.png new file mode 100644 index 0000000..5d7692f --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/fast/inline/initial-letter-inline-kerning-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/inline/initial-letter-inline-kerning-expected.png b/third_party/blink/web_tests/platform/mac/fast/inline/initial-letter-inline-kerning-expected.png new file mode 100644 index 0000000..10f70f5 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/fast/inline/initial-letter-inline-kerning-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/inline/initial-letter-inline-kerning-expected.png b/third_party/blink/web_tests/platform/win/fast/inline/initial-letter-inline-kerning-expected.png new file mode 100644 index 0000000..59a8a555 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/fast/inline/initial-letter-inline-kerning-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/document-pip/open-pip-window-from-pip-window.html b/third_party/blink/web_tests/virtual/document-pip/open-pip-window-from-pip-window.html new file mode 100644 index 0000000..ecd095e --- /dev/null +++ b/third_party/blink/web_tests/virtual/document-pip/open-pip-window-from-pip-window.html
@@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>Test that documentPictureInPicture.requestWindow() + rejects from a PiP window</title> +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../../resources/user-gesture-utils.js"></script> +<body> +<script> +async_test((t) => { + focusWithUserGesture(window); + documentPictureInPicture.requestWindow().then(t.step_func_done( + (pipWindow) => { + focusWithUserGesture(pipWindow); + return promise_rejects_dom(t, 'NotAllowedError', pipWindow.DOMException, + pipWindow.documentPictureInPicture.requestWindow()); + })); +}); +</script> +</body>
diff --git a/third_party/closure_compiler/externs/file_manager_private.js b/third_party/closure_compiler/externs/file_manager_private.js index d5058a1..339634d 100644 --- a/third_party/closure_compiler/externs/file_manager_private.js +++ b/third_party/closure_compiler/externs/file_manager_private.js
@@ -100,6 +100,7 @@ /** @enum {string} */ chrome.fileManagerPrivate.TransferState = { IN_PROGRESS: 'in_progress', + QUEUED: 'queued', COMPLETED: 'completed', FAILED: 'failed', }; @@ -494,6 +495,16 @@ /** * @typedef {{ + * entry: !Entry, + * transferState: !chrome.fileManagerPrivate.TransferState, + * processed: number, + * total: number, + * }} + */ +chrome.fileManagerPrivate.IndividualFileTransferStatus; + +/** + * @typedef {{ * type: !chrome.fileManagerPrivate.DriveSyncErrorType, * fileUrl: string, * showNotification: boolean @@ -632,6 +643,7 @@ * @typedef {{ * eventType: chrome.fileManagerPrivate.CrostiniEventType, * vmName: string, + * containerName: string, * entries: !Array<!Entry>, * }} */ @@ -1549,6 +1561,12 @@ chrome.fileManagerPrivate.onPinTransfersUpdated; /** @type {!ChromeEvent} */ +chrome.fileManagerPrivate.onIndividualFileTransfersUpdated; + +/** @type {!ChromeEvent} */ +chrome.fileManagerPrivate.onIndividualPinTransfersUpdated; + +/** @type {!ChromeEvent} */ chrome.fileManagerPrivate.onDirectoryChanged; /** @type {!ChromeEvent} */
diff --git a/third_party/libaom/README.chromium b/third_party/libaom/README.chromium index 60a64e84..95b0691 100644 --- a/third_party/libaom/README.chromium +++ b/third_party/libaom/README.chromium
@@ -2,8 +2,8 @@ Short Name: libaom URL: https://aomedia.googlesource.com/aom/ Version: 3.5.0 -Date: Wednesday November 09 2022 -Revision: 407ee57e289d3ed907c57de16275c7615a93f9d9 +Date: Wednesday November 23 2022 +Revision: d7fc49b8b6b5663ec93b6850839e3451e3dd0339 CPEPrefix: cpe:/a:aomedia:aomedia:3.5.0 License: BSD License File: source/libaom/LICENSE
diff --git a/third_party/libaom/libaom_srcs.gni b/third_party/libaom/libaom_srcs.gni index e397023..f7d6c21 100644 --- a/third_party/libaom/libaom_srcs.gni +++ b/third_party/libaom/libaom_srcs.gni
@@ -96,6 +96,7 @@ "//third_party/libaom/source/libaom/av1/common/cfl.c", "//third_party/libaom/source/libaom/av1/common/cfl.h", "//third_party/libaom/source/libaom/av1/common/common.h", + "//third_party/libaom/source/libaom/av1/common/common_data.c", "//third_party/libaom/source/libaom/av1/common/common_data.h", "//third_party/libaom/source/libaom/av1/common/convolve.c", "//third_party/libaom/source/libaom/av1/common/convolve.h", @@ -123,6 +124,7 @@ "//third_party/libaom/source/libaom/av1/common/quant_common.h", "//third_party/libaom/source/libaom/av1/common/reconinter.c", "//third_party/libaom/source/libaom/av1/common/reconinter.h", + "//third_party/libaom/source/libaom/av1/common/reconinter_template.inc", "//third_party/libaom/source/libaom/av1/common/reconintra.c", "//third_party/libaom/source/libaom/av1/common/reconintra.h", "//third_party/libaom/source/libaom/av1/common/resize.c",
diff --git a/third_party/libaom/source/config/config/aom_version.h b/third_party/libaom/source/config/config/aom_version.h index 6959bed..33f0c71 100644 --- a/third_party/libaom/source/config/config/aom_version.h +++ b/third_party/libaom/source/config/config/aom_version.h
@@ -12,8 +12,8 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 5 #define VERSION_PATCH 0 -#define VERSION_EXTRA "401-g407ee57e2" +#define VERSION_EXTRA "472-gd7fc49b8b" #define VERSION_PACKED \ ((VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | (VERSION_PATCH)) -#define VERSION_STRING_NOSP "3.5.0-401-g407ee57e2" -#define VERSION_STRING " 3.5.0-401-g407ee57e2" +#define VERSION_STRING_NOSP "3.5.0-472-gd7fc49b8b" +#define VERSION_STRING " 3.5.0-472-gd7fc49b8b"
diff --git a/third_party/libaom/source/config/ios/arm-neon/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/ios/arm-neon/config/aom_dsp_rtcd.h index 2bcce10..1122512 100644 --- a/third_party/libaom/source/config/ios/arm-neon/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/ios/arm-neon/config/aom_dsp_rtcd.h
@@ -2631,7 +2631,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x128_avg aom_sad128x128_avg_neon void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2668,7 +2673,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x64_avg aom_sad128x64_avg_neon void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2713,7 +2723,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x16_avg aom_sad16x16_avg_neon void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2750,7 +2765,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x32_avg aom_sad16x32_avg_neon void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2787,7 +2807,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x8_avg aom_sad16x8_avg_neon void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2832,7 +2857,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x16_avg aom_sad32x16_avg_neon void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2869,7 +2899,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x32_avg aom_sad32x32_avg_neon void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2906,7 +2941,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x64_avg aom_sad32x64_avg_neon void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2951,7 +2991,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x4_avg aom_sad4x4_avg_neon void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2988,7 +3033,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x8_avg aom_sad4x8_avg_neon void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3033,7 +3083,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x128_avg aom_sad64x128_avg_neon void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3070,7 +3125,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x32_avg aom_sad64x32_avg_neon void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3107,7 +3167,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x64_avg aom_sad64x64_avg_neon void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3152,7 +3217,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x16_avg aom_sad8x16_avg_neon void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3189,7 +3259,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x4_avg aom_sad8x4_avg_neon void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3226,7 +3301,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x8_avg aom_sad8x8_avg_neon void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4225,7 +4305,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_neon uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -4235,7 +4323,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_neon uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -4245,7 +4341,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_neon uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -4255,7 +4359,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_neon uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -4265,7 +4377,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_neon uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -4275,7 +4395,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_neon uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -4285,7 +4413,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_neon uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -4295,7 +4431,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_neon uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -4305,7 +4449,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_neon uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -4315,7 +4467,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_neon uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -4325,7 +4485,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_neon uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -4335,7 +4503,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_neon uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -4345,7 +4521,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_neon uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -4355,7 +4539,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_neon uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -4365,7 +4557,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_neon uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -4375,7 +4575,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_neon uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride,
diff --git a/third_party/libaom/source/config/ios/arm64/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/ios/arm64/config/aom_dsp_rtcd.h index 2bcce10..1122512 100644 --- a/third_party/libaom/source/config/ios/arm64/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/ios/arm64/config/aom_dsp_rtcd.h
@@ -2631,7 +2631,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x128_avg aom_sad128x128_avg_neon void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2668,7 +2673,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x64_avg aom_sad128x64_avg_neon void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2713,7 +2723,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x16_avg aom_sad16x16_avg_neon void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2750,7 +2765,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x32_avg aom_sad16x32_avg_neon void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2787,7 +2807,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x8_avg aom_sad16x8_avg_neon void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2832,7 +2857,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x16_avg aom_sad32x16_avg_neon void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2869,7 +2899,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x32_avg aom_sad32x32_avg_neon void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2906,7 +2941,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x64_avg aom_sad32x64_avg_neon void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2951,7 +2991,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x4_avg aom_sad4x4_avg_neon void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2988,7 +3033,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x8_avg aom_sad4x8_avg_neon void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3033,7 +3083,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x128_avg aom_sad64x128_avg_neon void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3070,7 +3125,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x32_avg aom_sad64x32_avg_neon void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3107,7 +3167,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x64_avg aom_sad64x64_avg_neon void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3152,7 +3217,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x16_avg aom_sad8x16_avg_neon void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3189,7 +3259,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x4_avg aom_sad8x4_avg_neon void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3226,7 +3301,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x8_avg aom_sad8x8_avg_neon void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4225,7 +4305,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_neon uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -4235,7 +4323,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_neon uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -4245,7 +4341,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_neon uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -4255,7 +4359,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_neon uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -4265,7 +4377,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_neon uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -4275,7 +4395,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_neon uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -4285,7 +4413,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_neon uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -4295,7 +4431,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_neon uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -4305,7 +4449,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_neon uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -4315,7 +4467,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_neon uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -4325,7 +4485,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_neon uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -4335,7 +4503,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_neon uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -4345,7 +4521,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_neon uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -4355,7 +4539,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_neon uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -4365,7 +4557,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_neon uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -4375,7 +4575,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_neon uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride,
diff --git a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_dsp_rtcd.h index 69a96ca..4a0ae3d 100644 --- a/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/linux/arm-neon-cpu-detect/config/aom_dsp_rtcd.h
@@ -3009,7 +3009,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad128x128_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3053,7 +3062,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad128x64_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3105,7 +3123,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad16x16_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3149,7 +3176,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad16x32_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3193,7 +3229,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad16x8_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3245,7 +3290,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad32x16_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3289,7 +3343,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad32x32_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3333,7 +3396,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad32x64_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3385,7 +3457,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad4x4_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3429,7 +3510,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad4x8_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3481,7 +3571,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad64x128_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3525,7 +3624,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad64x32_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3569,7 +3677,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad64x64_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3621,7 +3738,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad8x16_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3665,7 +3791,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad8x4_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3709,7 +3844,16 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +RTCD_EXTERN unsigned int (*aom_sad8x8_avg)(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4996,7 +5140,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance128x128)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -5006,7 +5166,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance128x64)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -5016,7 +5192,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance16x16)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -5026,7 +5218,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance16x32)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -5036,7 +5244,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance16x8)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -5046,7 +5270,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance32x16)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -5056,7 +5296,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance32x32)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -5066,7 +5322,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance32x64)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -5076,7 +5348,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance4x4)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -5086,7 +5374,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance4x8)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -5096,7 +5400,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance64x128)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -5106,7 +5426,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance64x32)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -5116,7 +5452,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance64x64)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -5126,7 +5478,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance8x16)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -5136,7 +5504,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance8x4)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -5146,7 +5530,23 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +RTCD_EXTERN uint32_t (*aom_sub_pixel_avg_variance8x8)( + const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride, @@ -6278,96 +6678,144 @@ aom_sad128x128 = aom_sad128x128_c; if (flags & HAS_NEON) aom_sad128x128 = aom_sad128x128_neon; + aom_sad128x128_avg = aom_sad128x128_avg_c; + if (flags & HAS_NEON) + aom_sad128x128_avg = aom_sad128x128_avg_neon; aom_sad128x128x4d = aom_sad128x128x4d_c; if (flags & HAS_NEON) aom_sad128x128x4d = aom_sad128x128x4d_neon; aom_sad128x64 = aom_sad128x64_c; if (flags & HAS_NEON) aom_sad128x64 = aom_sad128x64_neon; + aom_sad128x64_avg = aom_sad128x64_avg_c; + if (flags & HAS_NEON) + aom_sad128x64_avg = aom_sad128x64_avg_neon; aom_sad128x64x4d = aom_sad128x64x4d_c; if (flags & HAS_NEON) aom_sad128x64x4d = aom_sad128x64x4d_neon; aom_sad16x16 = aom_sad16x16_c; if (flags & HAS_NEON) aom_sad16x16 = aom_sad16x16_neon; + aom_sad16x16_avg = aom_sad16x16_avg_c; + if (flags & HAS_NEON) + aom_sad16x16_avg = aom_sad16x16_avg_neon; aom_sad16x16x4d = aom_sad16x16x4d_c; if (flags & HAS_NEON) aom_sad16x16x4d = aom_sad16x16x4d_neon; aom_sad16x32 = aom_sad16x32_c; if (flags & HAS_NEON) aom_sad16x32 = aom_sad16x32_neon; + aom_sad16x32_avg = aom_sad16x32_avg_c; + if (flags & HAS_NEON) + aom_sad16x32_avg = aom_sad16x32_avg_neon; aom_sad16x32x4d = aom_sad16x32x4d_c; if (flags & HAS_NEON) aom_sad16x32x4d = aom_sad16x32x4d_neon; aom_sad16x8 = aom_sad16x8_c; if (flags & HAS_NEON) aom_sad16x8 = aom_sad16x8_neon; + aom_sad16x8_avg = aom_sad16x8_avg_c; + if (flags & HAS_NEON) + aom_sad16x8_avg = aom_sad16x8_avg_neon; aom_sad16x8x4d = aom_sad16x8x4d_c; if (flags & HAS_NEON) aom_sad16x8x4d = aom_sad16x8x4d_neon; aom_sad32x16 = aom_sad32x16_c; if (flags & HAS_NEON) aom_sad32x16 = aom_sad32x16_neon; + aom_sad32x16_avg = aom_sad32x16_avg_c; + if (flags & HAS_NEON) + aom_sad32x16_avg = aom_sad32x16_avg_neon; aom_sad32x16x4d = aom_sad32x16x4d_c; if (flags & HAS_NEON) aom_sad32x16x4d = aom_sad32x16x4d_neon; aom_sad32x32 = aom_sad32x32_c; if (flags & HAS_NEON) aom_sad32x32 = aom_sad32x32_neon; + aom_sad32x32_avg = aom_sad32x32_avg_c; + if (flags & HAS_NEON) + aom_sad32x32_avg = aom_sad32x32_avg_neon; aom_sad32x32x4d = aom_sad32x32x4d_c; if (flags & HAS_NEON) aom_sad32x32x4d = aom_sad32x32x4d_neon; aom_sad32x64 = aom_sad32x64_c; if (flags & HAS_NEON) aom_sad32x64 = aom_sad32x64_neon; + aom_sad32x64_avg = aom_sad32x64_avg_c; + if (flags & HAS_NEON) + aom_sad32x64_avg = aom_sad32x64_avg_neon; aom_sad32x64x4d = aom_sad32x64x4d_c; if (flags & HAS_NEON) aom_sad32x64x4d = aom_sad32x64x4d_neon; aom_sad4x4 = aom_sad4x4_c; if (flags & HAS_NEON) aom_sad4x4 = aom_sad4x4_neon; + aom_sad4x4_avg = aom_sad4x4_avg_c; + if (flags & HAS_NEON) + aom_sad4x4_avg = aom_sad4x4_avg_neon; aom_sad4x4x4d = aom_sad4x4x4d_c; if (flags & HAS_NEON) aom_sad4x4x4d = aom_sad4x4x4d_neon; aom_sad4x8 = aom_sad4x8_c; if (flags & HAS_NEON) aom_sad4x8 = aom_sad4x8_neon; + aom_sad4x8_avg = aom_sad4x8_avg_c; + if (flags & HAS_NEON) + aom_sad4x8_avg = aom_sad4x8_avg_neon; aom_sad4x8x4d = aom_sad4x8x4d_c; if (flags & HAS_NEON) aom_sad4x8x4d = aom_sad4x8x4d_neon; aom_sad64x128 = aom_sad64x128_c; if (flags & HAS_NEON) aom_sad64x128 = aom_sad64x128_neon; + aom_sad64x128_avg = aom_sad64x128_avg_c; + if (flags & HAS_NEON) + aom_sad64x128_avg = aom_sad64x128_avg_neon; aom_sad64x128x4d = aom_sad64x128x4d_c; if (flags & HAS_NEON) aom_sad64x128x4d = aom_sad64x128x4d_neon; aom_sad64x32 = aom_sad64x32_c; if (flags & HAS_NEON) aom_sad64x32 = aom_sad64x32_neon; + aom_sad64x32_avg = aom_sad64x32_avg_c; + if (flags & HAS_NEON) + aom_sad64x32_avg = aom_sad64x32_avg_neon; aom_sad64x32x4d = aom_sad64x32x4d_c; if (flags & HAS_NEON) aom_sad64x32x4d = aom_sad64x32x4d_neon; aom_sad64x64 = aom_sad64x64_c; if (flags & HAS_NEON) aom_sad64x64 = aom_sad64x64_neon; + aom_sad64x64_avg = aom_sad64x64_avg_c; + if (flags & HAS_NEON) + aom_sad64x64_avg = aom_sad64x64_avg_neon; aom_sad64x64x4d = aom_sad64x64x4d_c; if (flags & HAS_NEON) aom_sad64x64x4d = aom_sad64x64x4d_neon; aom_sad8x16 = aom_sad8x16_c; if (flags & HAS_NEON) aom_sad8x16 = aom_sad8x16_neon; + aom_sad8x16_avg = aom_sad8x16_avg_c; + if (flags & HAS_NEON) + aom_sad8x16_avg = aom_sad8x16_avg_neon; aom_sad8x16x4d = aom_sad8x16x4d_c; if (flags & HAS_NEON) aom_sad8x16x4d = aom_sad8x16x4d_neon; aom_sad8x4 = aom_sad8x4_c; if (flags & HAS_NEON) aom_sad8x4 = aom_sad8x4_neon; + aom_sad8x4_avg = aom_sad8x4_avg_c; + if (flags & HAS_NEON) + aom_sad8x4_avg = aom_sad8x4_avg_neon; aom_sad8x4x4d = aom_sad8x4x4d_c; if (flags & HAS_NEON) aom_sad8x4x4d = aom_sad8x4x4d_neon; aom_sad8x8 = aom_sad8x8_c; if (flags & HAS_NEON) aom_sad8x8 = aom_sad8x8_neon; + aom_sad8x8_avg = aom_sad8x8_avg_c; + if (flags & HAS_NEON) + aom_sad8x8_avg = aom_sad8x8_avg_neon; aom_sad8x8x4d = aom_sad8x8x4d_c; if (flags & HAS_NEON) aom_sad8x8x4d = aom_sad8x8x4d_neon; @@ -6638,6 +7086,54 @@ aom_sse = aom_sse_c; if (flags & HAS_NEON) aom_sse = aom_sse_neon; + aom_sub_pixel_avg_variance128x128 = aom_sub_pixel_avg_variance128x128_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance128x128 = aom_sub_pixel_avg_variance128x128_neon; + aom_sub_pixel_avg_variance128x64 = aom_sub_pixel_avg_variance128x64_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance128x64 = aom_sub_pixel_avg_variance128x64_neon; + aom_sub_pixel_avg_variance16x16 = aom_sub_pixel_avg_variance16x16_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance16x16 = aom_sub_pixel_avg_variance16x16_neon; + aom_sub_pixel_avg_variance16x32 = aom_sub_pixel_avg_variance16x32_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance16x32 = aom_sub_pixel_avg_variance16x32_neon; + aom_sub_pixel_avg_variance16x8 = aom_sub_pixel_avg_variance16x8_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance16x8 = aom_sub_pixel_avg_variance16x8_neon; + aom_sub_pixel_avg_variance32x16 = aom_sub_pixel_avg_variance32x16_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance32x16 = aom_sub_pixel_avg_variance32x16_neon; + aom_sub_pixel_avg_variance32x32 = aom_sub_pixel_avg_variance32x32_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance32x32 = aom_sub_pixel_avg_variance32x32_neon; + aom_sub_pixel_avg_variance32x64 = aom_sub_pixel_avg_variance32x64_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance32x64 = aom_sub_pixel_avg_variance32x64_neon; + aom_sub_pixel_avg_variance4x4 = aom_sub_pixel_avg_variance4x4_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance4x4 = aom_sub_pixel_avg_variance4x4_neon; + aom_sub_pixel_avg_variance4x8 = aom_sub_pixel_avg_variance4x8_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance4x8 = aom_sub_pixel_avg_variance4x8_neon; + aom_sub_pixel_avg_variance64x128 = aom_sub_pixel_avg_variance64x128_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance64x128 = aom_sub_pixel_avg_variance64x128_neon; + aom_sub_pixel_avg_variance64x32 = aom_sub_pixel_avg_variance64x32_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance64x32 = aom_sub_pixel_avg_variance64x32_neon; + aom_sub_pixel_avg_variance64x64 = aom_sub_pixel_avg_variance64x64_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance64x64 = aom_sub_pixel_avg_variance64x64_neon; + aom_sub_pixel_avg_variance8x16 = aom_sub_pixel_avg_variance8x16_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance8x16 = aom_sub_pixel_avg_variance8x16_neon; + aom_sub_pixel_avg_variance8x4 = aom_sub_pixel_avg_variance8x4_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance8x4 = aom_sub_pixel_avg_variance8x4_neon; + aom_sub_pixel_avg_variance8x8 = aom_sub_pixel_avg_variance8x8_c; + if (flags & HAS_NEON) + aom_sub_pixel_avg_variance8x8 = aom_sub_pixel_avg_variance8x8_neon; aom_sub_pixel_variance128x128 = aom_sub_pixel_variance128x128_c; if (flags & HAS_NEON) aom_sub_pixel_variance128x128 = aom_sub_pixel_variance128x128_neon;
diff --git a/third_party/libaom/source/config/linux/arm-neon/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/linux/arm-neon/config/aom_dsp_rtcd.h index 2bcce10..1122512 100644 --- a/third_party/libaom/source/config/linux/arm-neon/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/linux/arm-neon/config/aom_dsp_rtcd.h
@@ -2631,7 +2631,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x128_avg aom_sad128x128_avg_neon void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2668,7 +2673,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x64_avg aom_sad128x64_avg_neon void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2713,7 +2723,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x16_avg aom_sad16x16_avg_neon void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2750,7 +2765,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x32_avg aom_sad16x32_avg_neon void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2787,7 +2807,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x8_avg aom_sad16x8_avg_neon void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2832,7 +2857,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x16_avg aom_sad32x16_avg_neon void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2869,7 +2899,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x32_avg aom_sad32x32_avg_neon void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2906,7 +2941,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x64_avg aom_sad32x64_avg_neon void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2951,7 +2991,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x4_avg aom_sad4x4_avg_neon void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2988,7 +3033,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x8_avg aom_sad4x8_avg_neon void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3033,7 +3083,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x128_avg aom_sad64x128_avg_neon void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3070,7 +3125,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x32_avg aom_sad64x32_avg_neon void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3107,7 +3167,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x64_avg aom_sad64x64_avg_neon void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3152,7 +3217,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x16_avg aom_sad8x16_avg_neon void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3189,7 +3259,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x4_avg aom_sad8x4_avg_neon void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3226,7 +3301,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x8_avg aom_sad8x8_avg_neon void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4225,7 +4305,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_neon uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -4235,7 +4323,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_neon uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -4245,7 +4341,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_neon uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -4255,7 +4359,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_neon uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -4265,7 +4377,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_neon uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -4275,7 +4395,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_neon uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -4285,7 +4413,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_neon uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -4295,7 +4431,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_neon uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -4305,7 +4449,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_neon uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -4315,7 +4467,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_neon uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -4325,7 +4485,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_neon uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -4335,7 +4503,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_neon uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -4345,7 +4521,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_neon uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -4355,7 +4539,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_neon uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -4365,7 +4557,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_neon uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -4375,7 +4575,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_neon uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride,
diff --git a/third_party/libaom/source/config/linux/arm64/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/linux/arm64/config/aom_dsp_rtcd.h index 2bcce10..1122512 100644 --- a/third_party/libaom/source/config/linux/arm64/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/linux/arm64/config/aom_dsp_rtcd.h
@@ -2631,7 +2631,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x128_avg aom_sad128x128_avg_neon void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2668,7 +2673,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x64_avg aom_sad128x64_avg_neon void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2713,7 +2723,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x16_avg aom_sad16x16_avg_neon void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2750,7 +2765,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x32_avg aom_sad16x32_avg_neon void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2787,7 +2807,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x8_avg aom_sad16x8_avg_neon void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2832,7 +2857,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x16_avg aom_sad32x16_avg_neon void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2869,7 +2899,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x32_avg aom_sad32x32_avg_neon void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2906,7 +2941,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x64_avg aom_sad32x64_avg_neon void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2951,7 +2991,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x4_avg aom_sad4x4_avg_neon void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2988,7 +3033,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x8_avg aom_sad4x8_avg_neon void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3033,7 +3083,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x128_avg aom_sad64x128_avg_neon void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3070,7 +3125,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x32_avg aom_sad64x32_avg_neon void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3107,7 +3167,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x64_avg aom_sad64x64_avg_neon void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3152,7 +3217,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x16_avg aom_sad8x16_avg_neon void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3189,7 +3259,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x4_avg aom_sad8x4_avg_neon void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3226,7 +3301,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x8_avg aom_sad8x8_avg_neon void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4225,7 +4305,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_neon uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -4235,7 +4323,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_neon uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -4245,7 +4341,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_neon uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -4255,7 +4359,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_neon uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -4265,7 +4377,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_neon uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -4275,7 +4395,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_neon uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -4285,7 +4413,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_neon uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -4295,7 +4431,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_neon uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -4305,7 +4449,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_neon uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -4315,7 +4467,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_neon uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -4325,7 +4485,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_neon uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -4335,7 +4503,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_neon uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -4345,7 +4521,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_neon uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -4355,7 +4539,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_neon uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -4365,7 +4557,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_neon uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -4375,7 +4575,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_neon uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride,
diff --git a/third_party/libaom/source/config/win/arm64/config/aom_dsp_rtcd.h b/third_party/libaom/source/config/win/arm64/config/aom_dsp_rtcd.h index 2bcce10..1122512 100644 --- a/third_party/libaom/source/config/win/arm64/config/aom_dsp_rtcd.h +++ b/third_party/libaom/source/config/win/arm64/config/aom_dsp_rtcd.h
@@ -2631,7 +2631,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x128_avg aom_sad128x128_avg_c +unsigned int aom_sad128x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x128_avg aom_sad128x128_avg_neon void aom_sad128x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2668,7 +2673,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad128x64_avg aom_sad128x64_avg_c +unsigned int aom_sad128x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad128x64_avg aom_sad128x64_avg_neon void aom_sad128x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2713,7 +2723,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x16_avg aom_sad16x16_avg_c +unsigned int aom_sad16x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x16_avg aom_sad16x16_avg_neon void aom_sad16x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2750,7 +2765,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x32_avg aom_sad16x32_avg_c +unsigned int aom_sad16x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x32_avg aom_sad16x32_avg_neon void aom_sad16x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2787,7 +2807,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad16x8_avg aom_sad16x8_avg_c +unsigned int aom_sad16x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad16x8_avg aom_sad16x8_avg_neon void aom_sad16x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2832,7 +2857,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x16_avg aom_sad32x16_avg_c +unsigned int aom_sad32x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x16_avg aom_sad32x16_avg_neon void aom_sad32x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2869,7 +2899,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x32_avg aom_sad32x32_avg_c +unsigned int aom_sad32x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x32_avg aom_sad32x32_avg_neon void aom_sad32x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2906,7 +2941,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad32x64_avg aom_sad32x64_avg_c +unsigned int aom_sad32x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad32x64_avg aom_sad32x64_avg_neon void aom_sad32x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2951,7 +2991,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x4_avg aom_sad4x4_avg_c +unsigned int aom_sad4x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x4_avg aom_sad4x4_avg_neon void aom_sad4x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -2988,7 +3033,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad4x8_avg aom_sad4x8_avg_c +unsigned int aom_sad4x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad4x8_avg aom_sad4x8_avg_neon void aom_sad4x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3033,7 +3083,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x128_avg aom_sad64x128_avg_c +unsigned int aom_sad64x128_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x128_avg aom_sad64x128_avg_neon void aom_sad64x128x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3070,7 +3125,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x32_avg aom_sad64x32_avg_c +unsigned int aom_sad64x32_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x32_avg aom_sad64x32_avg_neon void aom_sad64x32x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3107,7 +3167,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad64x64_avg aom_sad64x64_avg_c +unsigned int aom_sad64x64_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad64x64_avg aom_sad64x64_avg_neon void aom_sad64x64x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3152,7 +3217,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x16_avg aom_sad8x16_avg_c +unsigned int aom_sad8x16_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x16_avg aom_sad8x16_avg_neon void aom_sad8x16x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3189,7 +3259,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x4_avg aom_sad8x4_avg_c +unsigned int aom_sad8x4_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x4_avg aom_sad8x4_avg_neon void aom_sad8x4x4d_c(const uint8_t* src_ptr, int src_stride, @@ -3226,7 +3301,12 @@ const uint8_t* ref_ptr, int ref_stride, const uint8_t* second_pred); -#define aom_sad8x8_avg aom_sad8x8_avg_c +unsigned int aom_sad8x8_avg_neon(const uint8_t* src_ptr, + int src_stride, + const uint8_t* ref_ptr, + int ref_stride, + const uint8_t* second_pred); +#define aom_sad8x8_avg aom_sad8x8_avg_neon void aom_sad8x8x4d_c(const uint8_t* src_ptr, int src_stride, @@ -4225,7 +4305,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_c +uint32_t aom_sub_pixel_avg_variance128x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x128 aom_sub_pixel_avg_variance128x128_neon uint32_t aom_sub_pixel_avg_variance128x64_c(const uint8_t* src_ptr, int source_stride, @@ -4235,7 +4323,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_c +uint32_t aom_sub_pixel_avg_variance128x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance128x64 aom_sub_pixel_avg_variance128x64_neon uint32_t aom_sub_pixel_avg_variance16x16_c(const uint8_t* src_ptr, int source_stride, @@ -4245,7 +4341,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_c +uint32_t aom_sub_pixel_avg_variance16x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x16 aom_sub_pixel_avg_variance16x16_neon uint32_t aom_sub_pixel_avg_variance16x32_c(const uint8_t* src_ptr, int source_stride, @@ -4255,7 +4359,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_c +uint32_t aom_sub_pixel_avg_variance16x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x32 aom_sub_pixel_avg_variance16x32_neon uint32_t aom_sub_pixel_avg_variance16x8_c(const uint8_t* src_ptr, int source_stride, @@ -4265,7 +4377,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_c +uint32_t aom_sub_pixel_avg_variance16x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance16x8 aom_sub_pixel_avg_variance16x8_neon uint32_t aom_sub_pixel_avg_variance32x16_c(const uint8_t* src_ptr, int source_stride, @@ -4275,7 +4395,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_c +uint32_t aom_sub_pixel_avg_variance32x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x16 aom_sub_pixel_avg_variance32x16_neon uint32_t aom_sub_pixel_avg_variance32x32_c(const uint8_t* src_ptr, int source_stride, @@ -4285,7 +4413,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_c +uint32_t aom_sub_pixel_avg_variance32x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x32 aom_sub_pixel_avg_variance32x32_neon uint32_t aom_sub_pixel_avg_variance32x64_c(const uint8_t* src_ptr, int source_stride, @@ -4295,7 +4431,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_c +uint32_t aom_sub_pixel_avg_variance32x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance32x64 aom_sub_pixel_avg_variance32x64_neon uint32_t aom_sub_pixel_avg_variance4x4_c(const uint8_t* src_ptr, int source_stride, @@ -4305,7 +4449,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_c +uint32_t aom_sub_pixel_avg_variance4x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x4 aom_sub_pixel_avg_variance4x4_neon uint32_t aom_sub_pixel_avg_variance4x8_c(const uint8_t* src_ptr, int source_stride, @@ -4315,7 +4467,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_c +uint32_t aom_sub_pixel_avg_variance4x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance4x8 aom_sub_pixel_avg_variance4x8_neon uint32_t aom_sub_pixel_avg_variance64x128_c(const uint8_t* src_ptr, int source_stride, @@ -4325,7 +4485,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_c +uint32_t aom_sub_pixel_avg_variance64x128_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x128 aom_sub_pixel_avg_variance64x128_neon uint32_t aom_sub_pixel_avg_variance64x32_c(const uint8_t* src_ptr, int source_stride, @@ -4335,7 +4503,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_c +uint32_t aom_sub_pixel_avg_variance64x32_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x32 aom_sub_pixel_avg_variance64x32_neon uint32_t aom_sub_pixel_avg_variance64x64_c(const uint8_t* src_ptr, int source_stride, @@ -4345,7 +4521,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_c +uint32_t aom_sub_pixel_avg_variance64x64_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance64x64 aom_sub_pixel_avg_variance64x64_neon uint32_t aom_sub_pixel_avg_variance8x16_c(const uint8_t* src_ptr, int source_stride, @@ -4355,7 +4539,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_c +uint32_t aom_sub_pixel_avg_variance8x16_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x16 aom_sub_pixel_avg_variance8x16_neon uint32_t aom_sub_pixel_avg_variance8x4_c(const uint8_t* src_ptr, int source_stride, @@ -4365,7 +4557,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_c +uint32_t aom_sub_pixel_avg_variance8x4_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x4 aom_sub_pixel_avg_variance8x4_neon uint32_t aom_sub_pixel_avg_variance8x8_c(const uint8_t* src_ptr, int source_stride, @@ -4375,7 +4575,15 @@ int ref_stride, uint32_t* sse, const uint8_t* second_pred); -#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_c +uint32_t aom_sub_pixel_avg_variance8x8_neon(const uint8_t* src_ptr, + int source_stride, + int xoffset, + int yoffset, + const uint8_t* ref_ptr, + int ref_stride, + uint32_t* sse, + const uint8_t* second_pred); +#define aom_sub_pixel_avg_variance8x8 aom_sub_pixel_avg_variance8x8_neon uint32_t aom_sub_pixel_variance128x128_c(const uint8_t* src_ptr, int source_stride,
diff --git a/tools/metrics/histograms/metadata/autofill/histograms.xml b/tools/metrics/histograms/metadata/autofill/histograms.xml index e8030e2..babf4b7 100644 --- a/tools/metrics/histograms/metadata/autofill/histograms.xml +++ b/tools/metrics/histograms/metadata/autofill/histograms.xml
@@ -2393,6 +2393,9 @@ <histogram name="Autofill.MigrateUserOptedInToWalletSync" enum="AutofillMigrateUserOptedInToWalletSync" expires_after="2020-11-30"> + <obsolete> + Deprecated in M109 as this migration never applied to ChromeOS ASH. + </obsolete> <owner>msarda@google.com</owner> <owner>payments-autofill-team@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/dev/histograms.xml b/tools/metrics/histograms/metadata/dev/histograms.xml index aa18a00c8..ad477fac 100644 --- a/tools/metrics/histograms/metadata/dev/histograms.xml +++ b/tools/metrics/histograms/metadata/dev/histograms.xml
@@ -299,6 +299,16 @@ </summary> </histogram> +<histogram name="DevTools.NetworkPanelResponsePreviewOpened" + enum="DevToolsMediaType" expires_after="2023-12-31"> + <owner>yangguo@chromium.org</owner> + <owner>bmeurer@chromium.org</owner> + <summary> + Records the media types of files opened in the DevTools Network panel + response preview. + </summary> +</histogram> + <histogram name="DevTools.OpenedByAction" enum="DevToolsOpenedByAction" expires_after="2022-12-01"> <owner>changhaohan@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/extensions/histograms.xml b/tools/metrics/histograms/metadata/extensions/histograms.xml index e2b8fd48..10184ef 100644 --- a/tools/metrics/histograms/metadata/extensions/histograms.xml +++ b/tools/metrics/histograms/metadata/extensions/histograms.xml
@@ -3325,64 +3325,6 @@ <summary>Uninstalls grouped by Extension::HistogramType.</summary> </histogram> -<histogram name="Extensions.UpdateCheckApp" units="units" - expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of legacy packaged apps and hosted apps that were checked during - an update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckExtension" units="units" - expires_after="M77"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of extensions that were checked during an update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckGoogleUrl" units="units" - expires_after="M77"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of crx's with a Google-hosted update URL that were checked during - an update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckNoUrl" units="units" expires_after="M77"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of crx's with no update URL checked during an update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckOtherUrl" units="units" - expires_after="M77"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of crx's with a non-Google update URL that were checked during an - update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckPackagedApp" units="units" - expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of packaged apps that were checked during an update check. - </summary> -</histogram> - -<histogram name="Extensions.UpdateCheckTheme" units="units" - expires_after="2018-08-30"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <summary> - The number of themes that were checked during an update check. - </summary> -</histogram> - <histogram name="Extensions.UpdateOnLoad" units="units" expires_after="M85"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/net/histograms.xml b/tools/metrics/histograms/metadata/net/histograms.xml index 68f6c315..78dfc3c 100644 --- a/tools/metrics/histograms/metadata/net/histograms.xml +++ b/tools/metrics/histograms/metadata/net/histograms.xml
@@ -100,6 +100,20 @@ </summary> </histogram> +<histogram name="HttpCache.IsNoStore{Type}" enum="Boolean" + expires_after="2023-04-28"> + <owner>bashi@chromium.org</owner> + <owner>blink-network-stack@google.com</owner> + <summary> + Whether or not a response has `Cache-Control: no-store`. Recorded when a + HTTP transaction is finished. This histogram is for {Type}. + </summary> + <token key="Type"> + <variant name="" summary="all request types"/> + <variant name=".MainFrameHTML" summary="main frame requests"/> + </token> +</histogram> + <histogram name="HttpCache.MaxFileSizeOnInit" units="KB" expires_after="2022-02-20"> <owner>shivanisha@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/sync/histograms.xml b/tools/metrics/histograms/metadata/sync/histograms.xml index 925fd391..b2af8bb6 100644 --- a/tools/metrics/histograms/metadata/sync/histograms.xml +++ b/tools/metrics/histograms/metadata/sync/histograms.xml
@@ -1086,7 +1086,7 @@ </histogram> <histogram name="Sync.ProblematicServerSideBookmarks" - enum="RemoteBookmarkUpdateError" expires_after="2022-12-25"> + enum="RemoteBookmarkUpdateError" expires_after="2023-11-25"> <owner>mastiz@chromium.org</owner> <owner>rushans@google.com</owner> <component>Services>Sync</component> @@ -1097,7 +1097,7 @@ </histogram> <histogram name="Sync.ProblematicServerSideBookmarksDuringMerge" - enum="RemoteBookmarkUpdateError" expires_after="2023-02-12"> + enum="RemoteBookmarkUpdateError" expires_after="2023-11-25"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> <component>Services>Sync</component>
diff --git a/tools/metrics/histograms/metadata/web_rtc/histograms.xml b/tools/metrics/histograms/metadata/web_rtc/histograms.xml index 559dd70..83931d0 100644 --- a/tools/metrics/histograms/metadata/web_rtc/histograms.xml +++ b/tools/metrics/histograms/metadata/web_rtc/histograms.xml
@@ -1152,15 +1152,6 @@ </summary> </histogram> -<histogram name="WebRTC.ICE.UdpSocketWriteErrorCode" enum="SocketErrorCode" - expires_after="M77"> - <owner>zhihuang@chromium.org</owner> - <summary> - Counters on different types of UDP socket error code. Collected when we hit - the error code when writing. - </summary> -</histogram> - <histogram name="WebRTC.MediaStreamDevices.HasPanTiltZoomCamera" enum="BooleanAvailable" expires_after="2022-04-24"> <obsolete> @@ -2069,23 +2060,6 @@ </token> </histogram> -<histogram name="WebRTC.SystemSendPacketDuration{IPProtocolType}" units="ms" - expires_after="M81"> - <owner>qingsi@google.com</owner> - <owner>jeroendb@google.com</owner> - <summary> - The duration that it takes to send out a packet in system layer. This - includes both the queuing time (under the condition when socket returns - EWOULDBLOCK from system) as well as the time system takes to finish the - asynchronous send. For UDP, it's the time from P2PSocketHostUdp::Send to - P2PSocketHostUdp::HandleSendResult. Tcp part is to be implemented. - {IPProtocolType} - </summary> - <token key="IPProtocolType" variants="IPProtocolType"> - <variant name=""/> - </token> -</histogram> - <histogram name="WebRTC.UnreliableDataChannelMessageSize" units="bytes" expires_after="2022-10-23"> <owner>perkj@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 4586dee..919e06e 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -22,7 +22,7 @@ }, "linux": { "hash": "71fe40653e3ef4a8a1f324ecb879615ff81fe391", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/32e057826cb604da7f51f9f774e569f2b4884aa8/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/5f99acc936816759400c8ce5e4ee1cee2fc0633e/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/style_variable_generator/PRESUBMIT.py b/tools/style_variable_generator/PRESUBMIT.py deleted file mode 100644 index 2bf6443..0000000 --- a/tools/style_variable_generator/PRESUBMIT.py +++ /dev/null
@@ -1,60 +0,0 @@ -# Copyright 2019 The Chromium Authors -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -"""Presubmit script for changes affecting tools/style_variable_generator/ - -See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts -for more details about the presubmit API built into depot_tools. -""" -import os - -USE_PYTHON3 = True - -TEST_PATTERNS = [r'.+_test.py$'] -STYLE_VAR_GEN_INPUTS = [ - r'^tools[\\\/]style_variable_generator[\\\/].+\.json5$' -] - -def _CommonChecks(input_api, output_api): - env = os.environ - pythonpath = [os.path.join(os.getcwd(), '..')] - if 'PYTHONPATH' in env: - pythonpath.append(env.get('PYTHONPATH')) - env['PYTHONPATH'] = input_api.os_path.pathsep.join((pythonpath)) - - results = input_api.canned_checks.RunUnitTestsInDirectory( - input_api, - output_api, - 'tests', - files_to_check=TEST_PATTERNS, - env=env, - run_on_python2=False, - skip_shebang_check=True) - try: - import sys - old_sys_path = sys.path[:] - sys.path += [ - input_api.os_path.join(input_api.change.RepositoryRoot(), 'tools') - ] - import style_variable_generator.presubmit_support - results += ( - style_variable_generator.presubmit_support.FindDeletedCSSVariables( - input_api, output_api, STYLE_VAR_GEN_INPUTS)) - sys.path += [ - input_api.os_path.join(input_api.change.RepositoryRoot(), 'ui', - 'chromeos') - ] - import styles.presubmit_support - results += styles.presubmit_support._CheckSemanticColors( - input_api, output_api) - finally: - sys.path = old_sys_path - return results - - -def CheckChangeOnUpload(input_api, output_api): - return _CommonChecks(input_api, output_api) - - -def CheckChangeOnCommit(input_api, output_api): - return _CommonChecks(input_api, output_api)
diff --git a/tools/style_variable_generator/presubmit_support.py b/tools/style_variable_generator/presubmit_support.py index 20d5dc6d..ed1b63a 100644 --- a/tools/style_variable_generator/presubmit_support.py +++ b/tools/style_variable_generator/presubmit_support.py
@@ -7,6 +7,7 @@ import subprocess import sys from style_variable_generator.css_generator import CSSStyleGenerator +import re def BuildGrepQuery(deleted_names): @@ -25,11 +26,16 @@ def FindDeletedCSSVariables(input_api, output_api, input_file_filter): - # TODO(1312192): reenable after fixing presubmit exceptions - return [] - files = input_api.AffectedFiles( - file_filter=lambda f: input_api.FilterSourceFile( - f, files_to_check=input_file_filter)) + def IsInputFile(file): + file_path = file.LocalPath() + # Normalise windows file paths to unix format. + file_path = "/".join(os.path.split(file_path)) + return any([ + re.search(pattern, file_path) != None + for pattern in input_file_filter + ]) + + files = input_api.AffectedFiles(file_filter=IsInputFile) def get_css_var_names_for_contents(contents_function): style_generator = CSSStyleGenerator()
diff --git a/ui/base/interaction/element_tracker.cc b/ui/base/interaction/element_tracker.cc index f24c6fb..3896b6c 100644 --- a/ui/base/interaction/element_tracker.cc +++ b/ui/base/interaction/element_tracker.cc
@@ -249,6 +249,19 @@ return it != element_data_.end() && it->second.num_elements() > 0; } +ElementTracker::Contexts ElementTracker::GetAllContextsForTesting() const { + Contexts result; + for (const auto& [key, data] : element_data_) { + result.insert(key.second); + } + return result; +} + +ElementTracker::Subscription +ElementTracker::AddAnyElementShownCallbackForTesting(Callback callback) { + return any_element_shown_callbacks_.Add(std::move(callback)); +} + ElementTracker::Subscription ElementTracker::AddElementShownCallback( ElementIdentifier id, ElementContext context, @@ -323,6 +336,10 @@ it->second.NotifyElementShown(safe_element); } + // Do the "all elements" notification: + if (safe_element) + any_element_shown_callbacks_.Notify(element); + notification_elements_.pop_back(); }
diff --git a/ui/base/interaction/element_tracker.h b/ui/base/interaction/element_tracker.h index 31408b3..db21974 100644 --- a/ui/base/interaction/element_tracker.h +++ b/ui/base/interaction/element_tracker.h
@@ -95,6 +95,7 @@ using Callback = base::RepeatingCallback<void(TrackedElement*)>; using Subscription = base::CallbackListSubscription; using ElementList = std::vector<TrackedElement*>; + using Contexts = std::set<ElementContext>; // Identifier that should be used by each framework to create a // TrackedElement from an element that does not alreayd have an identifier. @@ -178,6 +179,12 @@ ElementContext context, Callback callback); + // Returns all known contexts. + Contexts GetAllContextsForTesting() const; + + // Adds a callback when any element is shown. + Subscription AddAnyElementShownCallbackForTesting(Callback callback); + private: friend class base::NoDestructor<ElementTracker>; class ElementData; @@ -208,6 +215,8 @@ // to be memory-stable. std::list<TrackedElement*> notification_elements_; std::map<LookupKey, ElementData> element_data_; + base::RepeatingCallbackList<void(TrackedElement*)> + any_element_shown_callbacks_; std::unique_ptr<GarbageCollector> gc_; };
diff --git a/ui/base/interaction/interactive_test.cc b/ui/base/interaction/interactive_test.cc index d9a2f61..9a924bf 100644 --- a/ui/base/interaction/interactive_test.cc +++ b/ui/base/interaction/interactive_test.cc
@@ -230,20 +230,32 @@ return steps; } +// static +InteractiveTestApi::MultiStep InteractiveTestApi::InSameContext( + MultiStep steps) { + for (auto& step : steps) + step.SetContext(InteractionSequence::ContextMode::kFromPreviousStep); + return steps; +} + +// static +InteractiveTestApi::MultiStep InteractiveTestApi::InContext( + ElementContext context, + MultiStep steps) { + // This context may not yet exist, but we want the pivot element to exist. + private_test_impl_->MaybeAddPivotElement(context); + for (auto& step : steps) + step.SetContext(context); + return steps; +} + bool InteractiveTestApi::RunTestSequenceImpl( ElementContext context, InteractionSequence::Builder builder) { builder.SetContext(context); - // Pivot element also serves as a re-entrancy guard. - CHECK(!private_test_impl_->pivot_element_); - auto pivot_element = - std::make_unique<TestElement>(kInteractiveTestPivotElementId, context); - pivot_element->Show(); - base::AutoReset<std::unique_ptr<TrackedElement>> pivot_element_reset( - &private_test_impl_->pivot_element_, std::move(pivot_element)); + private_test_impl_->Init(context); - private_test_impl_->success_ = false; builder.SetCompletedCallback( base::BindOnce(&internal::InteractiveTestPrivate::OnSequenceComplete, base::Unretained(private_test_impl_.get()))); @@ -252,6 +264,9 @@ base::Unretained(private_test_impl_.get()))); auto sequence = builder.Build(); sequence->RunSynchronouslyForTesting(); + + private_test_impl_->Cleanup(); + return private_test_impl_->success_; }
diff --git a/ui/base/interaction/interactive_test.h b/ui/base/interaction/interactive_test.h index d2c40ea..e119526 100644 --- a/ui/base/interaction/interactive_test.h +++ b/ui/base/interaction/interactive_test.h
@@ -196,13 +196,30 @@ // InAnyContext(PressButton(kElementIdentifier)) // // Note: does not work with EnsureNotPresent; use the `in_any_context` - // parameter. + // parameter. Also does not work with all event types (yet). // // TODO(dfried): consider if we should have a version that takes variadic // arguments and applies "in any context" to all of them? [[nodiscard]] static MultiStep InAnyContext(MultiStep steps); template <typename T> - static StepBuilder InAnyContext(T&& step); + [[nodiscard]] static StepBuilder InAnyContext(T&& step); + + // Provides syntactic sugar so you can put "inherit context from previous + // step" around a step or steps to ensure a sequence executes in a specific + // context. For example: + // + // InAnyContext(WaitForShow(kMyElementInOtherContext)), + // InSameContext(Steps( + // PressButton(kMyElementInOtherContext), + // WaitForHide(kMyElementInOtherContext) + // )), + [[nodiscard]] static MultiStep InSameContext(MultiStep steps); + template <typename T> + [[nodiscard]] static StepBuilder InSameContext(T&& step); + + [[nodiscard]] MultiStep InContext(ElementContext context, MultiStep steps); + template <typename T> + [[nodiscard]] StepBuilder InContext(ElementContext context, T&& step); // Used internally by methods in this class; do not call. internal::InteractiveTestPrivate& private_test_impl() { @@ -346,6 +363,20 @@ } // static +template <typename T> +InteractionSequence::StepBuilder InteractiveTestApi::InSameContext(T&& step) { + return std::move( + step.SetContext(InteractionSequence::ContextMode::kFromPreviousStep)); +} + +template <typename T> +InteractionSequence::StepBuilder InteractiveTestApi::InContext( + ElementContext context, + T&& step) { + return InContext(Steps(std::forward(step))); +} + +// static template <template <typename...> typename C, typename T, typename U> InteractionSequence::StepBuilder InteractiveTestApi::CheckResult( C<T()> function,
diff --git a/ui/base/interaction/interactive_test_internal.cc b/ui/base/interaction/interactive_test_internal.cc index 5b300b47..651573c6 100644 --- a/ui/base/interaction/interactive_test_internal.cc +++ b/ui/base/interaction/interactive_test_internal.cc
@@ -4,11 +4,14 @@ #include "ui/base/interaction/interactive_test_internal.h" +#include "base/callback_list.h" #include "base/check.h" +#include "base/containers/contains.h" #include "base/strings/string_piece_forward.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/variant.h" #include "ui/base/interaction/element_identifier.h" +#include "ui/base/interaction/element_test_util.h" namespace ui::test::internal { @@ -20,6 +23,48 @@ : test_util_(std::move(test_util)) {} InteractiveTestPrivate::~InteractiveTestPrivate() = default; +void InteractiveTestPrivate::Init(ElementContext initial_context) { + success_ = false; + MaybeAddPivotElement(initial_context); + for (ElementContext context : + ElementTracker::GetElementTracker()->GetAllContextsForTesting()) { + MaybeAddPivotElement(context); + } + context_subscription_ = + ElementTracker::GetElementTracker()->AddAnyElementShownCallbackForTesting( + base::BindRepeating(&InteractiveTestPrivate::OnElementAdded, + base::Unretained(this))); +} + +void InteractiveTestPrivate::Cleanup() { + context_subscription_ = base::CallbackListSubscription(); + pivot_elements_.clear(); +} + +void InteractiveTestPrivate::OnElementAdded(TrackedElement* el) { + if (el->identifier() == kInteractiveTestPivotElementId) + return; + MaybeAddPivotElement(el->context()); +} + +void InteractiveTestPrivate::MaybeAddPivotElement(ElementContext context) { + if (!base::Contains(pivot_elements_, context)) { + auto pivot = + std::make_unique<TestElement>(kInteractiveTestPivotElementId, context); + auto* const el = pivot.get(); + pivot_elements_.emplace(context, std::move(pivot)); + el->Show(); + } +} + +TrackedElement* InteractiveTestPrivate::GetPivotElement( + ElementContext context) const { + const auto it = pivot_elements_.find(context); + CHECK(it != pivot_elements_.end()) + << "Tried to reference non-existent context."; + return it->second.get(); +} + void InteractiveTestPrivate::DoTestSetUp() {} void InteractiveTestPrivate::DoTestTearDown() {}
diff --git a/ui/base/interaction/interactive_test_internal.h b/ui/base/interaction/interactive_test_internal.h index fe7f3a43..d014c39 100644 --- a/ui/base/interaction/interactive_test_internal.h +++ b/ui/base/interaction/interactive_test_internal.h
@@ -7,6 +7,7 @@ #include <memory> +#include "base/callback_list.h" #include "base/logging.h" #include "base/strings/string_piece_forward.h" #include "base/task/single_thread_task_runner.h" @@ -43,7 +44,9 @@ void operator=(const InteractiveTestPrivate&) = delete; InteractionTestUtil& test_util() { return *test_util_; } - TrackedElement* pivot_element() { return pivot_element_.get(); } + + // Gets the pivot element for the specified context, which must exist. + TrackedElement* GetPivotElement(ElementContext context) const; // Call this method during test SetUp(), or SetUpOnMainThread() for browser // tests. @@ -79,15 +82,29 @@ private: friend class ui::test::InteractiveTestApi; + // Prepare for a sequence to start. + void Init(ElementContext initial_context); + + // Clean up after a sequence. + void Cleanup(); + + // Note when a new element appears; we may update the context list. + void OnElementAdded(TrackedElement* el); + + // Maybe adds a pivot element for the given context. + void MaybeAddPivotElement(ElementContext context); + // Tracks whether a sequence succeeded or failed. bool success_ = false; // Used to simulate input to UI elements. std::unique_ptr<InteractionTestUtil> test_util_; - // Always present during a test sequence; used to relay events to trigger - // follow-up steps. - std::unique_ptr<TrackedElement> pivot_element_; + // Used to keep track of valid contexts. + base::CallbackListSubscription context_subscription_; + + // Used to relay events to trigger follow-up steps. + std::map<ElementContext, std::unique_ptr<TrackedElement>> pivot_elements_; // Overrides the default test failure behavior to test the API itself. InteractionSequence::AbortedCallback aborted_callback_for_testing_; @@ -144,6 +161,7 @@ result.emplace_back(std::move( InteractionSequence::StepBuilder() .SetElementID(kInteractiveTestPivotElementId) + .SetContext(InteractionSequence::ContextMode::kFromPreviousStep) .SetType(InteractionSequence::StepType::kCustomEvent, kInteractiveTestPivotEventType) .SetStartCallback(
diff --git a/ui/base/interaction/interactive_test_unittest.cc b/ui/base/interaction/interactive_test_unittest.cc index eceed8e..1547c898 100644 --- a/ui/base/interaction/interactive_test_unittest.cc +++ b/ui/base/interaction/interactive_test_unittest.cc
@@ -192,10 +192,46 @@ kTestContext2, InAnyContext(PressButton(kTestId1, InputType::kDontCare)), InAnyContext(SelectMenuItem(kTestId2, InputType::kKeyboard)), InAnyContext(DoDefaultAction(kTestId3, InputType::kMouse)), - InAnyContext(SelectTab(kTestId4, 3U, InputType::kTouch)), - InAnyContext(SelectDropdownItem(kTestId1, 2U, InputType::kDontCare)), - InAnyContext(EnterText(kTestId2, u"The quick brown fox.")), - InAnyContext(Confirm(kTestId3))); + InAnyContext(Steps(SelectTab(kTestId4, 3U, InputType::kTouch), + SelectDropdownItem(kTestId1, 2U, InputType::kDontCare), + EnterText(kTestId2, u"The quick brown fox."), + Confirm(kTestId3)))); + + EXPECT_THAT(simulator()->records(), + testing::ElementsAre( + ActionRecord{ActionType::kPressButton, kTestId1, + kTestContext1, InputType::kDontCare}, + ActionRecord{ActionType::kSelectMenuItem, kTestId2, + kTestContext1, InputType::kKeyboard}, + ActionRecord{ActionType::kDoDefaultAction, kTestId3, + kTestContext1, InputType::kMouse}, + ActionRecord{ActionType::kSelectTab, kTestId4, kTestContext1, + InputType::kTouch}, + ActionRecord{ActionType::kSelectDropdownItem, kTestId1, + kTestContext1, InputType::kDontCare}, + ActionRecord{ActionType::kEnterText, kTestId2, kTestContext1, + InputType::kKeyboard}, + ActionRecord{ActionType::kConfirm, kTestId3, kTestContext1, + InputType::kDontCare})); +} + +TEST_F(InteractiveTestTest, InteractionVerbsInSameContext) { + TestElement e1(kTestId1, kTestContext1); + TestElement e2(kTestId2, kTestContext1); + TestElement e3(kTestId3, kTestContext1); + TestElement e4(kTestId4, kTestContext1); + e1.Show(); + e2.Show(); + e3.Show(); + e4.Show(); + RunTestSequenceInContext( + kTestContext2, InAnyContext(PressButton(kTestId1, InputType::kDontCare)), + InSameContext(SelectMenuItem(kTestId2, InputType::kKeyboard)), + InSameContext(DoDefaultAction(kTestId3, InputType::kMouse)), + InSameContext(Steps( + SelectTab(kTestId4, 3U, InputType::kTouch), + SelectDropdownItem(kTestId1, 2U, InputType::kDontCare), + EnterText(kTestId2, u"The quick brown fox."), Confirm(kTestId3)))); EXPECT_THAT(simulator()->records(), testing::ElementsAre(
diff --git a/ui/chromeos/styles/PRESUBMIT.py b/ui/chromeos/styles/PRESUBMIT.py index 58984f08..a109ed79 100644 --- a/ui/chromeos/styles/PRESUBMIT.py +++ b/ui/chromeos/styles/PRESUBMIT.py
@@ -2,13 +2,20 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +PRESUBMIT_VERSION = '2.0.0' USE_PYTHON3 = True TEST_PATTERNS = [r'.+_test.py$'] -STYLE_VAR_GEN_INPUTS = [r'^ui[\\/]chromeos[\\/]colors[\\/].+\.json5$'] +# Regex patterns which identify all source json5 files we currently use in +# production. Note these patterns can assume the file path is always in unix +# style i.e. a/b/c. +STYLE_VAR_GEN_INPUTS = [ + # Matches all json5 files which are in ui/chromeos/styles. + r'^ui\/chromeos\/styles\/.*\.json5$' +] -def _CommonChecks(input_api, output_api): +def CheckCrosColorCSS(input_api, output_api): results = [] try: import sys @@ -27,7 +34,7 @@ results += ( style_variable_generator.presubmit_support.FindDeletedCSSVariables( input_api, output_api, STYLE_VAR_GEN_INPUTS)) - results = input_api.canned_checks.RunUnitTestsInDirectory( + results += input_api.canned_checks.RunUnitTestsInDirectory( input_api, output_api, '.', @@ -37,11 +44,3 @@ finally: sys.path = old_sys_path return results - - -def CheckChangeOnUpload(input_api, output_api): - return _CommonChecks(input_api, output_api) - - -def CheckChangeOnCommit(input_api, output_api): - return _CommonChecks(input_api, output_api)
diff --git a/ui/file_manager/file_manager/background/js/crostini.js b/ui/file_manager/file_manager/background/js/crostini.js index 39b23ff6..86bcf21 100644 --- a/ui/file_manager/file_manager/background/js/crostini.js +++ b/ui/file_manager/file_manager/background/js/crostini.js
@@ -17,8 +17,9 @@ export class CrostiniImpl { constructor() { /** - * Map of VM name to if it's enabled. False or undefined means not enabled. - * @private {Object<boolean>} + * Map of VM name to container name to if it's enabled. False or undefined + * means not enabled. + * @private {!Object<!Object<boolean>>} */ this.enabled_ = {}; @@ -38,10 +39,10 @@ * Must be done after loadTimeData is available. */ initEnabled() { - const vms = /** @type {!Array<string>} */ ( + const guests = /** @type {!Array<!Object<string>>} */ ( loadTimeData.getValue('VMS_FOR_SHARING')); - for (const vm of vms) { - this.setEnabled(vm, true); + for (const guest of guests) { + this.setEnabled(guest.vmName, guest.containerName, true); } chrome.fileManagerPrivate.onCrostiniChanged.addListener( this.onCrostiniChanged_.bind(this)); @@ -56,12 +57,16 @@ } /** - * Set whether the specified VM is enabled. + * Set whether the specified Guest is enabled. * @param {string} vmName + * @param {string} containerName * @param {boolean} enabled */ - setEnabled(vmName, enabled) { - this.enabled_[vmName] = enabled; + setEnabled(vmName, containerName, enabled) { + if (!this.enabled_[vmName]) { + this.enabled_[vmName] = {}; + } + this.enabled_[vmName][containerName] = enabled; } /** @@ -70,7 +75,8 @@ * @return {boolean} */ isEnabled(vmName) { - return !!this.enabled_[vmName]; + return (!!this.enabled_[vmName]) && + Object.values(this.enabled_[vmName]).includes(true); } /** @@ -143,10 +149,10 @@ onCrostiniChanged_(event) { switch (event.eventType) { case chrome.fileManagerPrivate.CrostiniEventType.ENABLE: - this.setEnabled(event.vmName, true); + this.setEnabled(event.vmName, event.containerName, true); break; case chrome.fileManagerPrivate.CrostiniEventType.DISABLE: - this.setEnabled(event.vmName, false); + this.setEnabled(event.vmName, event.containerName, false); break; case chrome.fileManagerPrivate.CrostiniEventType.SHARE: for (const entry of event.entries) {
diff --git a/ui/file_manager/file_manager/background/js/crostini_unittest.js b/ui/file_manager/file_manager/background/js/crostini_unittest.js index 6aae62b..70844e9 100644 --- a/ui/file_manager/file_manager/background/js/crostini_unittest.js +++ b/ui/file_manager/file_manager/background/js/crostini_unittest.js
@@ -70,13 +70,38 @@ assertFalse(crostini.isEnabled('termina')); assertFalse(crostini.isEnabled('PvmDefault')); - loadTimeData.overrideValues({'VMS_FOR_SHARING': ['termina', 'PvmDefault']}); + loadTimeData.overrideValues({ + 'VMS_FOR_SHARING': [ + {'vmName': 'termina', 'containerName': 'penguin'}, + {'vmName': 'PvmDefault', 'containerName': ''}, + ], + }); crostini.initEnabled(); assertTrue(crostini.isEnabled('termina')); assertTrue(crostini.isEnabled('PvmDefault')); } /** + * Tests setEnabled tracks enabled/disabled correctly, in particular with + * multiple containers in a VM. + */ +export function testSetEnabled() { + assertFalse(crostini.isEnabled('termina')); + + crostini.setEnabled('termina', 'penguin', true); + assertTrue(crostini.isEnabled('termina')); + + crostini.setEnabled('termina', 'puffin', true); + assertTrue(crostini.isEnabled('termina')); + + crostini.setEnabled('termina', 'penguin', false); + assertTrue(crostini.isEnabled('termina')); + + crostini.setEnabled('termina', 'puffin', false); + assertFalse(crostini.isEnabled('termina')); +} + +/** * Tests path sharing. */ export function testIsPathShared() { @@ -153,7 +178,7 @@ * Tests disallowed and allowed shared paths. */ export function testCanSharePath() { - crostini.setEnabled('vm', true); + crostini.setEnabled('vm', '', true); const mockFileSystem = new MockFileSystem('test'); const root = MockDirectoryEntry.create(mockFileSystem, '/');
diff --git a/ui/file_manager/file_manager/background/js/drive_sync_handler.js b/ui/file_manager/file_manager/background/js/drive_sync_handler.js index 5b0ca36..3bd1323 100644 --- a/ui/file_manager/file_manager/background/js/drive_sync_handler.js +++ b/ui/file_manager/file_manager/background/js/drive_sync_handler.js
@@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {assert} from 'chrome://resources/js/assert.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.js'; -import {getParentEntry} from '../../common/js/api.js'; +import {getUniqueParents} from '../../common/js/api.js'; import {AsyncQueue, RateLimiter} from '../../common/js/async_util.js'; import {ProgressCenterItem, ProgressItemState, ProgressItemType} from '../../common/js/progress_center_common.js'; import {getFilesAppIconURL, toFilesAppURL} from '../../common/js/url_constants.js'; @@ -166,6 +165,10 @@ this.dialogs_ = new Map(); // Register events. + chrome.fileManagerPrivate.onIndividualFileTransfersUpdated.addListener( + this.updateSyncStatusMetadata_.bind(this)); + chrome.fileManagerPrivate.onIndividualPinTransfersUpdated.addListener( + this.updateSyncStatusMetadata_.bind(this)); chrome.fileManagerPrivate.onFileTransfersUpdated.addListener( this.onFileTransfersStatusReceived_.bind(this, this.syncItem_)); chrome.fileManagerPrivate.onPinTransfersUpdated.addListener( @@ -252,28 +255,11 @@ return; } - /** @type {?Entry} */ - let entry; - if (status.fileUrl) { - try { - entry = await util.urlToEntry(status.fileUrl); - } catch (error) { - console.warn('Resolving URL ' + status.fileUrl + ' failed: ', error); - } - } - - if (util.isInlineSyncStatusEnabled()) { - this.updateEntrySyncStatusMetadata_(entry, status.transferState); - - // If inline sync status is enabled, don't display visual signals for - // Drive syncing. - return; - } - switch (status.transferState) { case 'in_progress': - await this.updateItem_(item, status, entry); + await this.updateItem_(item, status); break; + case 'queued': case 'completed': case 'failed': if ((status.hideWhenZeroJobs && status.numTotalJobs === 0) || @@ -288,41 +274,34 @@ } /** - * Updates the sync status metadata of the given entry with the given - * transferState. - * @param {?Entry} entry Entry whose sync status metadata should be updated. - * @param {string} transferState The new sync status transferState. - * status. + * Handles file transfer status updates for individual files, updating their + * sync status metadata. + * @param {!Array<!chrome.fileManagerPrivate.IndividualFileTransferStatus>} + * statuses Updated file transfer statuses. * @private */ - async updateEntrySyncStatusMetadata_(entry, transferState) { - if (!this.metadataModel_ || !entry) { + async updateSyncStatusMetadata_(statuses) { + if (!this.metadataModel_) { + // Files app is still loading. This should have no user visible impact + // since sync status update events are constantly emitted. return; } - try { - const cachedSyncStatusMetadata = - await this.metadataModel_.getCache([entry], ['syncStatus']); - if (cachedSyncStatusMetadata[0].syncStatus === transferState) { - // The sync status didn't change; no need to invalidate the cache. - return; - } - } catch (e) { - console.warn('Failed to retrieve sync status metadata cache for entry'); - } + // Get the cached syncStatus metadata for received statuses. + const entries = statuses.map(({entry}) => entry); + const cached = this.metadataModel_.getCache(entries, ['syncStatus']); - this.metadataModel_.notifyEntriesChanged([entry]); - this.metadataModel_.get([entry], ['syncStatus']); - try { - let parent = entry; - while (parent.fullPath !== parent.filesystem.root.fullPath) { - parent = await getParentEntry(parent); - this.metadataModel_.notifyEntriesChanged([parent]); - this.metadataModel_.get([parent], ['syncStatus']); - } - } catch (e) { - console.warn('Failed to update parent syncing status:', e); - } + // Filter out statuses that match what we already have in the cache. + const entriesToInvalidate = entries.filter( + (_, i) => cached[i].syncStatus !== statuses[i].transferState); + + // Get unique parents of entries to be invalidated. + const directoriesToInvalidate = await getUniqueParents(entriesToInvalidate); + entriesToInvalidate.push(...directoriesToInvalidate); + + // Invalidate entries and their parent directories. + this.metadataModel_.notifyEntriesChanged(entriesToInvalidate); + this.metadataModel_.get(entriesToInvalidate, ['syncStatus']); } /** @@ -330,15 +309,9 @@ * @param {ProgressCenterItem} item Item to update. * @param {chrome.fileManagerPrivate.FileTransferStatus} status Transfer * status. - * @param {?Entry} entry Transfer status' corresponding entry. * @private */ - async updateItem_(item, status, entry) { - if (!entry) { - console.warn('No corresponding entry for progress update event.'); - return; - } - + async updateItem_(item, status) { const unlock = await this.queue_.lock(); try { item.state = ProgressItemState.PROGRESSING; @@ -349,7 +322,13 @@ item.message = strf(this.statusMessages_[item.id].plural, status.numTotalJobs); } else { - item.message = strf(this.statusMessages_[item.id].single, entry.name); + try { + const entry = await util.urlToEntry(status.fileUrl); + item.message = strf(this.statusMessages_[item.id].single, entry.name); + } catch (error) { + console.warn('Resolving URL ' + status.fileUrl + ' failed: ', error); + return; + } } item.progressValue = status.processed || 0; item.progressMax = status.total || 0; @@ -408,7 +387,7 @@ * error event. * @private */ - onDriveSyncError_(event) { + async onDriveSyncError_(event) { if (!this.isProcessableEvent(event)) { return; } @@ -460,14 +439,20 @@ this.progressCenter_.updateItem(item); }; - window.webkitResolveLocalFileSystemURL( - event.fileUrl, - entry => { - postError(entry.name); - }, - error => { - postError(''); - }); + if (!event.fileUrl) { + postError(''); + return; + } + + try { + const entry = await util.urlToEntry(event.fileUrl); + if (util.isInlineSyncStatusEnabled()) { + this.updateSyncStatusMetadata_([{entry, transferState: 'failed'}]); + } + postError(entry.name); + } catch (error) { + postError(''); + } } /**
diff --git a/ui/file_manager/file_manager/common/js/api.js b/ui/file_manager/file_manager/common/js/api.js index 50fc114..88433db 100644 --- a/ui/file_manager/file_manager/common/js/api.js +++ b/ui/file_manager/file_manager/common/js/api.js
@@ -296,3 +296,33 @@ return promisify( chrome.fileManagerPrivate.executeTask, taskDescriptor, entries); } + +/** + * Returns unique parent directories of provided entries. Note: this assumes + * all provided entries are from the same filesystem. + * @param {!Array<!Entry>} entries + * @return {!Promise<!Array<!DirectoryEntry>>} + */ +export async function getUniqueParents(entries) { + if (entries.length === 0) { + return []; + } + const root = entries[0].filesystem.root; + + const uniquePaths = entries.reduce((paths, entry) => { + const parts = entry.fullPath.split('/').slice(0, -1); + + while (parts.length > 1) { + const path = parts.join('/'); + if (paths.has(path)) { + return paths; + } + paths.add(path); + parts.pop(); + } + + return paths; + }, new Set()); + + return Promise.all([...uniquePaths].map(path => getDirectory(root, path))); +}
diff --git a/ui/file_manager/file_manager/containers/breadcrumb_container.ts b/ui/file_manager/file_manager/containers/breadcrumb_container.ts index 0a1384a4..22183f3 100644 --- a/ui/file_manager/file_manager/containers/breadcrumb_container.ts +++ b/ui/file_manager/file_manager/containers/breadcrumb_container.ts
@@ -7,7 +7,7 @@ import {metrics} from '../common/js/metrics.js'; import {VolumeManagerCommon} from '../common/js/volume_manager_types.js'; import {PathComponent, PropStatus, State} from '../externs/ts/state.js'; -import {changeDirectory} from '../state/actions.js'; +import {changeDirectory} from '../state/actions/current_directory.js'; import {FileKey} from '../state/file_key.js'; import {getStore, Store} from '../state/store.js'; import {BreadcrumbClickedEvent, XfBreadcrumb} from '../widgets/xf_breadcrumb.js';
diff --git a/ui/file_manager/file_manager/definitions/file_manager.d.ts b/ui/file_manager/file_manager/definitions/file_manager.d.ts index d9bf61c..4d845ee 100644 --- a/ui/file_manager/file_manager/definitions/file_manager.d.ts +++ b/ui/file_manager/file_manager/definitions/file_manager.d.ts
@@ -3,6 +3,7 @@ // found in the LICENSE file. import {VolumeManager} from '../externs/volume_manager.js'; +import {MetadataModel} from '../foreground/js/metadata/metadata_model.js'; /** * Type definition for foreground/js/file_manager.js:FileManager. @@ -11,6 +12,7 @@ */ interface FileManager { volumeManager: VolumeManager; + metadataModel: MetadataModel; } /**
diff --git a/ui/file_manager/file_manager/externs/background/crostini.js b/ui/file_manager/file_manager/externs/background/crostini.js index dba68508..28a83a8 100644 --- a/ui/file_manager/file_manager/externs/background/crostini.js +++ b/ui/file_manager/file_manager/externs/background/crostini.js
@@ -23,11 +23,12 @@ initVolumeManager(volumeManager) {} /** - * Set whether the specified VM is enabled. + * Set whether the specified Guest is enabled. * @param {string} vmName + * @param {string} containerName * @param {boolean} enabled */ - setEnabled(vmName, enabled) {} + setEnabled(vmName, containerName, enabled) {} /** * Returns true if the specified VM is enabled.
diff --git a/ui/file_manager/file_manager/externs/files_app_entry_interfaces.js b/ui/file_manager/file_manager/externs/files_app_entry_interfaces.js index b44ff18e..0848abcf 100644 --- a/ui/file_manager/file_manager/externs/files_app_entry_interfaces.js +++ b/ui/file_manager/file_manager/externs/files_app_entry_interfaces.js
@@ -99,7 +99,7 @@ * Returns a FileSystemEntry if this instance has one, returns null if it * doesn't have or the entry hasn't been resolved yet. It's used to unwrap a * FilesAppEntry to be able to send to FileSystem API or fileManagerPrivate. - * @return {Entry} + * @return {?Entry} */ getNativeEntry() {} }
diff --git a/ui/file_manager/file_manager/externs/ts/state.js b/ui/file_manager/file_manager/externs/ts/state.js index f548982..dfcc1c2 100644 --- a/ui/file_manager/file_manager/externs/ts/state.js +++ b/ui/file_manager/file_manager/externs/ts/state.js
@@ -37,6 +37,7 @@ * label: string, * volumeType: (VolumeManagerCommon.VolumeType|null), * metadata: !MetadataItem, + * isDirectory: boolean, * type: !EntryType, * }} */
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager.css b/ui/file_manager/file_manager/foreground/css/file_manager.css index 689df7f..b23a163c 100644 --- a/ui/file_manager/file_manager/foreground/css/file_manager.css +++ b/ui/file_manager/file_manager/foreground/css/file_manager.css
@@ -2248,12 +2248,12 @@ width: 32px; } -.detail-pinned { +.inline-status { display: none; } body.files-ng #list-container - li.pinned:not([renaming]):not(.dim-offline):not([data-sync-status]) .detail-pinned { + li.pinned:not([renaming]):not(.dim-offline):not([data-sync-status]) .inline-status { -webkit-mask-image: url(../images/files/ui/offline.svg); -webkit-mask-position: center; -webkit-mask-repeat: no-repeat; @@ -2263,7 +2263,7 @@ width: 40px; } -body.files-ng #list-container li[data-sync-status]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status]:not([renaming]):not(.dim-offline) .inline-status { -webkit-mask-image: none; background-color: unset; background-position: center; @@ -2274,11 +2274,11 @@ width: 32px; } -body.files-ng #list-container li[data-sync-status=in_progress]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status=in_progress]:not([renaming]):not(.dim-offline) .inline-status { background-image: url(../images/files/ui/in_progress_indicator.svg); } -body.files-ng #list-container li[data-sync-status=error]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status=error]:not([renaming]):not(.dim-offline) .inline-status { background-image: url(../images/files/ui/error.svg); }
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager_gm3.css b/ui/file_manager/file_manager/foreground/css/file_manager_gm3.css index 7e4a42f2..1ea0aab 100644 --- a/ui/file_manager/file_manager/foreground/css/file_manager_gm3.css +++ b/ui/file_manager/file_manager/foreground/css/file_manager_gm3.css
@@ -2223,12 +2223,12 @@ width: 32px; } -.detail-pinned { +.inline-status { display: none; } body.files-ng #list-container - li.pinned:not([renaming]):not(.dim-offline):not([data-sync-status]) .detail-pinned { + li.pinned:not([renaming]):not(.dim-offline):not([data-sync-status]) .inline-status { -webkit-mask-image: url(../images/files/ui/offline.svg); -webkit-mask-position: center; -webkit-mask-repeat: no-repeat; @@ -2238,7 +2238,7 @@ width: 40px; } -body.files-ng #list-container li[data-sync-status]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status]:not([renaming]):not(.dim-offline) .inline-status { -webkit-mask-image: none; background-color: unset; background-position: center; @@ -2249,11 +2249,11 @@ width: 32px; } -body.files-ng #list-container li[data-sync-status=in_progress]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status=in_progress]:not([renaming]):not(.dim-offline) .inline-status { background-image: url(../images/files/ui/in_progress_indicator.svg); } -body.files-ng #list-container li[data-sync-status=error]:not([renaming]):not(.dim-offline) .detail-pinned { +body.files-ng #list-container li[data-sync-status=error]:not([renaming]):not(.dim-offline) .inline-status { background-image: url(../images/files/ui/error.svg); }
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js index a056757..41ab9c5 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_model.js +++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {assert} from 'chrome://resources/js/assert.js'; import {dispatchSimpleEvent} from 'chrome://resources/ash/common/cr_deprecated.js'; +import {assert} from 'chrome://resources/js/assert.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.js'; import {Aggregator, AsyncQueue} from '../../common/js/async_util.js'; @@ -18,7 +18,8 @@ import {Store} from '../../externs/ts/store.js'; import {VolumeInfo} from '../../externs/volume_info.js'; import {VolumeManager} from '../../externs/volume_manager.js'; -import {changeDirectory, searchAction} from '../../state/actions.js'; +import {searchAction} from '../../state/actions.js'; +import {changeDirectory} from '../../state/actions/current_directory.js'; import {getStore} from '../../state/store.js'; import {constants} from './constants.js';
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index 0cc8679..bc53a40 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -1286,11 +1286,11 @@ // enabled status from it to determine whether 'Linux files' is shown. switch (event.eventType) { case chrome.fileManagerPrivate.CrostiniEventType.ENABLE: - this.crostini_.setEnabled(event.vmName, true); + this.crostini_.setEnabled(event.vmName, event.containerName, true); return this.crostiniController_.redraw(); case chrome.fileManagerPrivate.CrostiniEventType.DISABLE: - this.crostini_.setEnabled(event.vmName, false); + this.crostini_.setEnabled(event.vmName, event.containerName, false); return this.crostiniController_.redraw(); // Event is sent when a user drops an unshared file on Plugin VM.
diff --git a/ui/file_manager/file_manager/foreground/js/file_selection.js b/ui/file_manager/file_manager/foreground/js/file_selection.js index 8c09f30e..c8e79a0 100644 --- a/ui/file_manager/file_manager/foreground/js/file_selection.js +++ b/ui/file_manager/file_manager/foreground/js/file_selection.js
@@ -2,15 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {assert} from 'chrome://resources/js/assert.js'; import {dispatchSimpleEvent} from 'chrome://resources/ash/common/cr_deprecated.js'; +import {assert} from 'chrome://resources/js/assert.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.js'; import {FileType} from '../../common/js/file_type.js'; import {util} from '../../common/js/util.js'; import {AllowedPaths} from '../../common/js/volume_manager_types.js'; import {FileOperationManager} from '../../externs/background/file_operation_manager.js'; +import {Store} from '../../externs/ts/store.js'; import {VolumeManager} from '../../externs/volume_manager.js'; +import {updateSelection} from '../../state/actions/current_directory.js'; +import {getStore} from '../../state/store.js'; import {constants} from './constants.js'; import {DirectoryModel} from './directory_model.js'; @@ -181,6 +184,15 @@ this.selectionUpdateTimer_ = 0; /** + * requestAnimationFrame used to debounce the calls to update the Store. + * @private {?number} + */ + this.updateStoreRaf_ = null; + + /** @private {!Store} */ + this.store_ = getStore(); + + /** * The time, in ms since the epoch, when it is OK to post next throttled * selection event. Can be directly compared with Date.now(). * @private {number} @@ -233,6 +245,10 @@ updateDelay = 1; } + if (!this.updateStoreRaf_) { + this.updateStoreRaf_ = requestAnimationFrame(() => this.updateStore_()); + } + const selection = this.selection; this.selectionUpdateTimer_ = setTimeout(() => { this.selectionUpdateTimer_ = null; @@ -267,6 +283,19 @@ } /** + * Sends the current selection to the Store. + * @private + */ + updateStore_() { + this.updateStoreRaf_ = null; + const entries = this.selection.entries; + this.store_.dispatch(updateSelection({ + selectedKeys: entries.map(e => e.toURL()), + entries, + })); + } + + /** * Returns true if all files in the selection files are selectable. * @return {boolean} */
diff --git a/ui/file_manager/file_manager/foreground/js/main_window_component.js b/ui/file_manager/file_manager/foreground/js/main_window_component.js index 71ce435..9de0948 100644 --- a/ui/file_manager/file_manager/foreground/js/main_window_component.js +++ b/ui/file_manager/file_manager/foreground/js/main_window_component.js
@@ -12,7 +12,7 @@ import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; import {DirectoryChangeEvent} from '../../externs/directory_change_event.js'; import {VolumeManager} from '../../externs/volume_manager.js'; -import {changeDirectory} from '../../state/actions.js'; +import {changeDirectory} from '../../state/actions/current_directory.js'; import {getStore} from '../../state/store.js'; import {AppStateController} from './app_state_controller.js';
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js index 7aa5c7ce..e6be367 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_table_list.js
@@ -462,7 +462,7 @@ */ filelist.renderPinned = (doc) => { const icon = /** @type {!HTMLDivElement} */ (doc.createElement('div')); - icon.className = 'detail-pinned'; + icon.className = 'inline-status'; icon.setAttribute('aria-label', str('OFFLINE_COLUMN_LABEL')); return icon; };
diff --git a/ui/file_manager/file_manager/state/actions.ts b/ui/file_manager/file_manager/state/actions.ts index 4005bde..8e5fef74 100644 --- a/ui/file_manager/file_manager/state/actions.ts +++ b/ui/file_manager/file_manager/state/actions.ts
@@ -5,7 +5,8 @@ import {PropStatus, SearchOptions} from '../externs/ts/state.js'; import {BaseAction} from '../lib/base_store.js'; -import {FileKey} from './file_key.js'; +import {ClearStaleCachedEntriesAction} from './actions/all_entries.js'; +import {ChangeDirectoryAction, ChangeSelectionAction} from './actions/current_directory.js'; /** * Union of all types of Actions in Files app. @@ -14,29 +15,18 @@ * A good explanation of this feature is here: * https://mariusschulz.com/blog/tagged-union-types-in-typescript */ -export type Action = - ChangeDirectoryAction|ClearStaleCachedEntriesAction|SearchAction; +export type Action = ChangeDirectoryAction|ChangeSelectionAction| + ClearStaleCachedEntriesAction|SearchAction; /** Enum to identify every Action in Files app. */ export const enum ActionType { CHANGE_DIRECTORY = 'change-directory', + CHANGE_SELECTION = 'change-selection', CLEAR_STALE_CACHED_ENTRIES = 'clear-stale-cached-entries', SEARCH = 'search', } -/** Action to request to change the Current Directory. */ -export interface ChangeDirectoryAction extends BaseAction { - type: ActionType.CHANGE_DIRECTORY; - payload: { - newDirectory?: Entry, key: FileKey, status: PropStatus, - }; -} - -export interface ClearStaleCachedEntriesAction extends BaseAction { - type: ActionType.CLEAR_STALE_CACHED_ENTRIES; - payload?: undefined; -} /** Action to update the search state. */ export interface SearchAction extends BaseAction { @@ -48,20 +38,6 @@ }; } -/** Factory for the ChangeDirectoryAction. */ -export function changeDirectory( - {to, toKey, status}: {to?: Entry, toKey: FileKey, status?: PropStatus}): - ChangeDirectoryAction { - return { - type: ActionType.CHANGE_DIRECTORY, - payload: { - newDirectory: to, - key: toKey ? toKey : to!.toURL(), - status: status ? status : PropStatus.STARTED, - }, - }; -} - export function searchAction( {query, status, options}: {query?: string, status?: PropStatus, options?: SearchOptions}):
diff --git a/ui/file_manager/file_manager/state/actions/all_entries.ts b/ui/file_manager/file_manager/state/actions/all_entries.ts new file mode 100644 index 0000000..9d9c3dd --- /dev/null +++ b/ui/file_manager/file_manager/state/actions/all_entries.ts
@@ -0,0 +1,14 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {BaseAction} from '../../lib/base_store.js'; +import {ActionType} from '../actions.js'; + +/** + * Processes the allEntries and removes any entry that isn't in use any more. + */ +export interface ClearStaleCachedEntriesAction extends BaseAction { + type: ActionType.CLEAR_STALE_CACHED_ENTRIES; + payload?: undefined; +}
diff --git a/ui/file_manager/file_manager/state/actions/current_directory.ts b/ui/file_manager/file_manager/state/actions/current_directory.ts new file mode 100644 index 0000000..f626853 --- /dev/null +++ b/ui/file_manager/file_manager/state/actions/current_directory.ts
@@ -0,0 +1,52 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {FilesAppDirEntry, FilesAppEntry} from '../../externs/files_app_entry_interfaces.js'; +import {PropStatus} from '../../externs/ts/state.js'; +import {BaseAction} from '../../lib/base_store.js'; +import {ActionType} from '../actions.js'; +import {FileKey} from '../file_key.js'; + +/** Action to request to change the Current Directory. */ +export interface ChangeDirectoryAction extends BaseAction { + type: ActionType.CHANGE_DIRECTORY; + payload: { + newDirectory?: DirectoryEntry|FilesAppDirEntry, + key: FileKey, + status: PropStatus, + }; +} + +/** Action to update the currently selected files/folders. */ +export interface ChangeSelectionAction extends BaseAction { + type: ActionType.CHANGE_SELECTION; + payload: { + selectedKeys: FileKey[], + entries: Array<Entry|FilesAppEntry>, + }; +} + +/** Factory for the ChangeDirectoryAction. */ +export function changeDirectory({to, toKey, status}: { + to?: DirectoryEntry|FilesAppDirEntry, toKey: FileKey, + status?: PropStatus, +}): ChangeDirectoryAction { + return { + type: ActionType.CHANGE_DIRECTORY, + payload: { + newDirectory: to, + key: toKey ? toKey : to!.toURL(), + status: status ? status : PropStatus.STARTED, + }, + }; +} + +/** Factory for the ChangeSelectionAction. */ +export function updateSelection(payload: ChangeSelectionAction['payload']): + ChangeSelectionAction { + return { + type: ActionType.CHANGE_SELECTION, + payload, + }; +}
diff --git a/ui/file_manager/file_manager/state/for_tests.ts b/ui/file_manager/file_manager/state/for_tests.ts new file mode 100644 index 0000000..516e4a00 --- /dev/null +++ b/ui/file_manager/file_manager/state/for_tests.ts
@@ -0,0 +1,36 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {assertDeepEquals} from 'chrome://webui-test/chromeos/chai_assert.js'; + +import {FilesAppDirEntry} from '../externs/files_app_entry_interfaces.js'; +import {PropStatus} from '../externs/ts/state.js'; + +import {changeDirectory, updateSelection} from './actions/current_directory.js'; +import {Store} from './store.js'; + +/** + * Compares 2 State objects and fails with nicely formatted message when it + * fails. + */ +export function assertStateEquals(want: any, got: any) { + assertDeepEquals( + want, got, + `\nWANT:\n${JSON.stringify(want, null, 2)}\nGOT:\n${ + JSON.stringify(got, null, 2)}\n\n`); +} + +/** Change the directory in the store. */ +export function cd(store: Store, directory: DirectoryEntry|FilesAppDirEntry) { + store.dispatch(changeDirectory( + {to: directory, toKey: directory.toURL(), status: PropStatus.SUCCESS})); +} + +/** Updates the selection in the store. */ +export function changeSelection(store: Store, entries: Entry[]) { + store.dispatch(updateSelection({ + selectedKeys: entries.map(e => e.toURL()), + entries, + })); +}
diff --git a/ui/file_manager/file_manager/state/reducers/all_entries.ts b/ui/file_manager/file_manager/state/reducers/all_entries.ts index 742685b..19b4d034 100644 --- a/ui/file_manager/file_manager/state/reducers/all_entries.ts +++ b/ui/file_manager/file_manager/state/reducers/all_entries.ts
@@ -3,9 +3,11 @@ // found in the LICENSE file. import {util} from '../../common/js/util.js'; +import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; import {FilesAppEntry} from '../../externs/files_app_entry_interfaces.js'; -import {State} from '../../externs/ts/state.js'; -import {Action, ActionType, ChangeDirectoryAction, ClearStaleCachedEntriesAction} from '../actions.js'; +import {EntryType, State} from '../../externs/ts/state.js'; +import {Action, ActionType} from '../actions.js'; +import {ClearStaleCachedEntriesAction} from '../actions/all_entries.js'; import {getStore} from '../store.js'; /** @@ -44,6 +46,12 @@ entriesToKeep.add(component.key); } } + const selectionKeys = state.currentDirectory?.selection.keys ?? []; + if (selectionKeys) { + for (const key of selectionKeys) { + entriesToKeep.add(key); + } + } for (const key of Object.keys(entries)) { if (entriesToKeep.has(key)) { @@ -57,21 +65,36 @@ } /** - * @param action Action being currently processed. - * @returns The entry instance from the allEntries, if it exists in the cache. + * Converts the entry to the Store representation of an Entry and appends the + * entry to the Store. */ -function getEntry(state: State, action: ChangeDirectoryAction): Entry| - FilesAppEntry|null { - const {newDirectory, key} = action.payload; - if (newDirectory) { - return newDirectory; - } +function appendEntry(state: State, entry: Entry|FilesAppEntry) { + const allEntries = state.allEntries || {}; + const key = entry.toURL(); + const volumeManager = window.fileManager?.volumeManager; + const metadataModel = window.fileManager?.metadataModel; + const volumeInfo = volumeManager?.getVolumeInfo(entry); + const locationInfo = volumeManager?.getLocationInfo(entry); + const label = locationInfo ? util.getEntryLabel(locationInfo, entry) : ''; - const entry = state.allEntries[key!] ? state.allEntries[key!]!.entry : null; - if (!entry) { - return null; - } - return entry; + const volumeType = volumeInfo?.volumeType || null; + + const entryData = allEntries[key] || {}; + const metadata = metadataModel ? + metadataModel.getCache([entry as FileEntry], [])[0] : + undefined; + + allEntries[key] = { + ...entryData, + entry, + type: getEntryType(entry), + isDirectory: entry.isDirectory, + label, + volumeType, + metadata, + }; + + state.allEntries = allEntries; } /** Caches the Action's entry in the `allEntries` attribute. */ @@ -79,32 +102,56 @@ // Schedule to clear the cached entries from the state. scheduleClearCachedEntries(); + if (action.type === ActionType.CHANGE_SELECTION) { + for (const entry of action.payload.entries) { + appendEntry(currentState, entry); + } + } if (action.type === ActionType.CHANGE_DIRECTORY) { - const {key} = action.payload; - const allEntries = currentState.allEntries || {}; - - const entry = getEntry(currentState, (action as ChangeDirectoryAction)); + const entry = action.payload.newDirectory; if (!entry) { // Nothing to cache, just continue. return currentState; } - const volumeManager = window.fileManager?.volumeManager; - const volumeInfo = volumeManager?.getVolumeInfo(entry); - const locationInfo = volumeManager?.getLocationInfo(entry); - const label = locationInfo ? util.getEntryLabel(locationInfo, entry) : ''; - - const volumeType = volumeInfo?.volumeType || null; - - const entryData = allEntries[key] || {}; - allEntries[key] = Object.assign(entryData, { - entry, - label, - volumeType, - }); - - currentState.allEntries = allEntries; + appendEntry(currentState, entry); } return currentState; } + +function getEntryType(entry: Entry|FilesAppEntry): EntryType { + // Entries from FilesAppEntry have the `type_name` property. + if (!('type_name' in entry)) { + return EntryType.FS_API; + } + + switch (entry.type_name) { + case 'EntryList': + return EntryType.ENTRY_LIST; + case 'VolumeEntry': + return EntryType.VOLUME_ROOT; + case 'FakeEntry': + switch (entry.rootType) { + case VolumeManagerCommon.RootType.RECENT: + return EntryType.RECENT; + case VolumeManagerCommon.RootType.TRASH: + return EntryType.TRASH; + case VolumeManagerCommon.RootType.DRIVE_FAKE_ROOT: + return EntryType.ENTRY_LIST; + case VolumeManagerCommon.RootType.CROSTINI: + return EntryType.PLACEHOLDER; + case VolumeManagerCommon.RootType.DRIVE_OFFLINE: + case VolumeManagerCommon.RootType.DRIVE_SHARED_WITH_ME: + // TODO(lucmult): This isn't really Recent but it's the closest. + return EntryType.RECENT; + } + console.warn(`Invalid fakeEntry.rootType='${entry.rootType} rootType`); + return EntryType.PLACEHOLDER; + case 'GuestOsPlaceholder': + return EntryType.PLACEHOLDER; + default: + console.warn(`Invalid entry.type_name='${entry.type_name}`); + return EntryType.FS_API; + } +}
diff --git a/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts b/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts index 1935b9d..917a54d 100644 --- a/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts +++ b/ui/file_manager/file_manager/state/reducers/all_entries_unittest.ts
@@ -2,12 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {assertDeepEquals, assertEquals} from 'chrome://webui-test/chromeos/chai_assert.js'; +import {assertDeepEquals, assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chromeos/chai_assert.js'; import {MockVolumeManager} from '../../background/js/mock_volume_manager.js'; +import {FakeEntryImpl, VolumeEntry} from '../../common/js/files_app_entry_types.js'; import {MockFileSystem} from '../../common/js/mock_entry.js'; import {waitUntil} from '../../common/js/test_error_reporting.js'; -import {ActionType, changeDirectory, ClearStaleCachedEntriesAction} from '../actions.js'; +import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; +import {EntryType, FileData} from '../../externs/ts/state.js'; +import {MetadataModel} from '../../foreground/js/metadata/metadata_model.js'; +import {MockMetadataModel} from '../../foreground/js/metadata/mock_metadata.js'; +import {ActionType} from '../actions.js'; +import {ClearStaleCachedEntriesAction} from '../actions/all_entries.js'; +import {cd, changeSelection} from '../for_tests.js'; import {getEmptyState, getStore, Store} from '../store.js'; import {clearCachedEntries} from './all_entries.js'; @@ -22,15 +29,19 @@ const volumeManager = new MockVolumeManager(); window.fileManager = { volumeManager: volumeManager, + metadataModel: new MockMetadataModel({}) as unknown as MetadataModel, }; store.init(getEmptyState()); - fileSystem = volumeManager.getCurrentProfileVolumeInfo( - 'downloads')!.fileSystem as MockFileSystem; + fileSystem = volumeManager + .getCurrentProfileVolumeInfo( + VolumeManagerCommon.VolumeType.DOWNLOADS)!.fileSystem as + MockFileSystem; fileSystem.populate([ '/dir-1/', '/dir-2/sub-dir/', + '/dir-2/file.txt', '/dir-3/', ]); } @@ -39,10 +50,6 @@ return Object.keys(store.getState().allEntries).length; } -function cd(directory: DirectoryEntry) { - store.dispatch(changeDirectory({to: directory, toKey: directory.toURL()})); -} - /** Tests that entries get cached in the allEntries. */ export function testAllEntries() { assertEquals(0, allEntriesSize(), 'allEntries should start empty'); @@ -50,13 +57,13 @@ const dir1 = fileSystem.entries['/dir-1']; const dir2 = fileSystem.entries['/dir-2']; const dir2SubDir = fileSystem.entries['/dir-2/sub-dir']; - cd(dir1); + cd(store, dir1); assertEquals(1, allEntriesSize(), 'dir-1 should be cached'); - cd(dir2); + cd(store, dir2); assertEquals(2, allEntriesSize(), 'dir-2 should be cached'); - cd(dir2SubDir); + cd(store, dir2SubDir); assertEquals(3, allEntriesSize(), 'dir-2/sub-dir/ should be cached'); } @@ -66,10 +73,10 @@ const dir3 = fileSystem.entries['/dir-3']; const dir2SubDir = fileSystem.entries['/dir-2/sub-dir']; - cd(dir1); - cd(dir2); - cd(dir3); - cd(dir2SubDir); + cd(store, dir1); + cd(store, dir2); + cd(store, dir3); + cd(store, dir2SubDir); assertEquals(4, allEntriesSize(), 'all entries should be cached'); @@ -96,3 +103,55 @@ done(); } + +export function testCacheEntries() { + const dir1 = fileSystem.entries['/dir-1']; + const file = fileSystem.entries['/dir-2/file.txt']; + + // Cache a directory via changeDirectory. + cd(store, dir1); + let resultEntry: FileData = store.getState().allEntries[dir1.toURL()]; + assertTrue(!!resultEntry); + assertEquals(resultEntry.entry, dir1); + assertTrue(resultEntry.isDirectory); + assertEquals(resultEntry.label, dir1.name); + assertEquals( + resultEntry.volumeType, VolumeManagerCommon.VolumeType.DOWNLOADS); + assertEquals(resultEntry.type, EntryType.FS_API); + + // Cache a file via changeSelection. + changeSelection(store, [file]); + resultEntry = store.getState().allEntries[file.toURL()]; + assertTrue(!!resultEntry); + assertEquals(resultEntry.entry, file); + assertFalse(resultEntry.isDirectory); + assertEquals(resultEntry.label, file.name); + assertEquals( + resultEntry.volumeType, VolumeManagerCommon.VolumeType.DOWNLOADS); + assertEquals(resultEntry.type, EntryType.FS_API); + + const recentRoot = + new FakeEntryImpl('Recent', VolumeManagerCommon.RootType.RECENT); + cd(store, recentRoot); + resultEntry = store.getState().allEntries[recentRoot.toURL()]; + assertTrue(!!resultEntry); + assertEquals(resultEntry.entry, recentRoot); + assertTrue(resultEntry.isDirectory); + assertEquals(resultEntry.label, recentRoot.name); + assertEquals(resultEntry.volumeType, null); + assertEquals(resultEntry.type, EntryType.RECENT); + + const volumeInfo = + window.fileManager.volumeManager.getCurrentProfileVolumeInfo( + VolumeManagerCommon.VolumeType.DOWNLOADS)!; + const volumeEntry = new VolumeEntry(volumeInfo); + cd(store, volumeEntry); + resultEntry = store.getState().allEntries[volumeEntry.toURL()]; + assertTrue(!!resultEntry); + assertEquals(resultEntry.entry, volumeEntry); + assertTrue(resultEntry.isDirectory); + assertEquals(resultEntry.label, volumeEntry.name); + assertEquals( + resultEntry.volumeType, VolumeManagerCommon.VolumeType.DOWNLOADS); + assertEquals(resultEntry.type, EntryType.VOLUME_ROOT); +}
diff --git a/ui/file_manager/file_manager/state/reducers/current_directory.ts b/ui/file_manager/file_manager/state/reducers/current_directory.ts index b31a311..b748417 100644 --- a/ui/file_manager/file_manager/state/reducers/current_directory.ts +++ b/ui/file_manager/file_manager/state/reducers/current_directory.ts
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {CurrentDirectory, PropStatus, State} from '../../externs/ts/state.js'; +import {CurrentDirectory, PropStatus, Selection, State} from '../../externs/ts/state.js'; import {PathComponent} from '../../foreground/js/path_component.js'; -import {ChangeDirectoryAction} from '../actions.js'; +import {ChangeDirectoryAction, ChangeSelectionAction} from '../actions/current_directory.js'; /** * @fileoverview @@ -65,6 +65,9 @@ key: c.url_, }; }); + + const locationInfo = volumeManager.getLocationInfo(fileData.entry!); + currentDirectory.rootType = locationInfo?.rootType; } } @@ -73,3 +76,72 @@ currentDirectory, }; } + +/** + * Updates the `currentDirectory.selection` state. + */ +export function updateSelection( + currentState: State, action: ChangeSelectionAction): State { + // TODO: When we have all the keys from current directory, we should validate + // that selectedKeys belongs to current directory. + const selection: Selection = { + keys: action.payload.selectedKeys, + dirCount: 0, + fileCount: 0, + // hostedCount might be updated to undefined in the for loop below. + hostedCount: 0, + // offlineCachedCount might be updated to undefined in the for loop below. + offlineCachedCount: 0, + fileTasks: { + tasks: [], + defaultHandlerPolicy: undefined, + status: PropStatus.STARTED, + keys: action.payload.selectedKeys, + }, + }; + + for (const key of action.payload.selectedKeys) { + const fileData = currentState.allEntries[key]; + if (!fileData) { + console.warn(`Missing entry: ${key}`); + continue; + } + if (fileData.isDirectory) { + selection.dirCount++; + } else { + selection.fileCount++; + } + + // Update hostedCount to undefined if any entry doesn't have the metadata + // yet. + const isHosted = fileData.metadata?.hosted; + if (isHosted === undefined) { + selection.hostedCount = undefined; + } else { + if (selection.hostedCount !== undefined && isHosted) { + selection.hostedCount++; + } + } + + // Update offlineCachedCount to undefined if any entry doesn't have the + // metadata yet. + const isOfflineCached = fileData.metadata?.offlineCached; + if (isOfflineCached === undefined) { + selection.offlineCachedCount = undefined; + } else { + if (selection.offlineCachedCount !== undefined && isOfflineCached) { + selection.offlineCachedCount++; + } + } + } + + const currentDirectory: CurrentDirectory = { + ...currentState.currentDirectory, + selection, + } as CurrentDirectory; + + return { + ...currentState, + currentDirectory, + }; +}
diff --git a/ui/file_manager/file_manager/state/reducers/current_directory_unittest.ts b/ui/file_manager/file_manager/state/reducers/current_directory_unittest.ts new file mode 100644 index 0000000..8a0790a --- /dev/null +++ b/ui/file_manager/file_manager/state/reducers/current_directory_unittest.ts
@@ -0,0 +1,180 @@ +// Copyright 2022 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {assertTrue} from 'chrome://webui-test/chai_assert.js'; + +import {MockVolumeManager} from '../../background/js/mock_volume_manager.js'; +import {MockFileSystem} from '../../common/js/mock_entry.js'; +import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; +import {CurrentDirectory, PropStatus} from '../../externs/ts/state.js'; +import {MetadataModel} from '../../foreground/js/metadata/metadata_model.js'; +import {MockMetadataModel} from '../../foreground/js/metadata/mock_metadata.js'; +import {changeDirectory, updateSelection} from '../actions/current_directory.js'; +import {assertStateEquals} from '../for_tests.js'; +import {getEmptyState, getStore, Store} from '../store.js'; + +let fileSystem: MockFileSystem; + +export function setUp() { + // changeDirectory() reducer uses the VolumeManager. + const volumeManager = new MockVolumeManager(); + window.fileManager = { + volumeManager: volumeManager, + metadataModel: new MockMetadataModel({}) as unknown as MetadataModel, + }; + + fileSystem = volumeManager.getCurrentProfileVolumeInfo( + 'downloads')!.fileSystem as MockFileSystem; + fileSystem.populate([ + '/dir-1/', + '/dir-2/sub-dir/', + '/dir-2/file.txt', + '/dir-3/', + ]); +} + +function setupStore(): Store { + const store = getStore(); + store.init(getEmptyState()); + return store; +} + +function cd(store: Store, directory: DirectoryEntry) { + store.dispatch(changeDirectory( + {to: directory, toKey: directory.toURL(), status: PropStatus.SUCCESS})); +} +function changeSelection(store: Store, entries: Entry[]) { + store.dispatch(updateSelection({ + selectedKeys: entries.map(e => e.toURL()), + entries, + })); +} + +export function testChangeDirectoryFromEmpty() { + const store = setupStore(); + const dir1 = fileSystem.entries['/dir-1']; + // The current directory starts empty. + assertTrue(store.getState().currentDirectory?.key === undefined); + + // Change Directory happens in 2 steps. + // First step, start the directory change. + store.dispatch(changeDirectory({toKey: dir1.toURL()})); + const want: CurrentDirectory = { + key: dir1.toURL(), + status: PropStatus.STARTED, + rootType: undefined, + pathComponents: [], + selection: { + keys: [], + dirCount: 0, + fileCount: 0, + hostedCount: undefined, + offlineCachedCount: undefined, + fileTasks: { + defaultHandlerPolicy: undefined, + tasks: [], + status: PropStatus.SUCCESS, + keys: [], + }, + }, + }; + assertStateEquals(want, store.getState().currentDirectory); + + // Finish the directory change. + store.dispatch(changeDirectory( + {toKey: dir1.toURL(), to: dir1, status: PropStatus.SUCCESS})); + + want.status = PropStatus.SUCCESS; + want.key = dir1.toURL(); + want.rootType = VolumeManagerCommon.RootType.DOWNLOADS; + want.pathComponents = [ + {name: 'Downloads', label: 'Downloads', key: fileSystem.root.toURL()}, + {name: dir1.name, label: dir1.name, key: dir1.toURL()}, + ]; + assertStateEquals(want, store.getState().currentDirectory); +} + +export function testChangeDirectoryTwice() { + const store = setupStore(); + const dir2 = fileSystem.entries['/dir-2']; + const subDir = fileSystem.entries['/dir-2/sub-dir']; + const dir1 = fileSystem.entries['/dir-1']; + cd(store, dir2); + changeSelection(store, [subDir]); + cd(store, dir1); + const want: CurrentDirectory = { + key: dir1.toURL(), + status: PropStatus.SUCCESS, + rootType: VolumeManagerCommon.RootType.DOWNLOADS, + pathComponents: [ + {name: 'Downloads', label: 'Downloads', key: fileSystem.root.toURL()}, + {name: dir1.name, label: dir1.name, key: dir1.toURL()}, + ], + selection: { + keys: [], + dirCount: 0, + fileCount: 0, + hostedCount: undefined, + offlineCachedCount: undefined, + fileTasks: { + defaultHandlerPolicy: undefined, + tasks: [], + status: PropStatus.SUCCESS, + keys: [], + }, + }, + }; + + assertStateEquals(want, store.getState().currentDirectory); +} + + +export function testChangeSelection() { + const store = setupStore(); + const dir2 = fileSystem.entries['/dir-2']; + const subDir = fileSystem.entries['/dir-2/sub-dir']; + const file = fileSystem.entries['/dir-2/file.txt']; + cd(store, dir2); + changeSelection(store, [subDir]); + + const want: CurrentDirectory = { + key: dir2.toURL(), + status: PropStatus.SUCCESS, + rootType: VolumeManagerCommon.RootType.DOWNLOADS, + pathComponents: [ + {name: 'Downloads', label: 'Downloads', key: fileSystem.root.toURL()}, + {name: dir2.name, label: dir2.name, key: dir2.toURL()}, + ], + selection: { + keys: [subDir.toURL()], + dirCount: 1, + fileCount: 0, + hostedCount: undefined, + offlineCachedCount: undefined, + fileTasks: { + defaultHandlerPolicy: undefined, + tasks: [], + status: PropStatus.STARTED, + keys: [subDir.toURL()], + }, + }, + }; + assertStateEquals(want, store.getState().currentDirectory); + + // Change the selection for a completely different one: + changeSelection(store, [file]); + want.selection.keys = [file.toURL()]; + want.selection.dirCount = 0; + want.selection.fileCount = 1; + want.selection.fileTasks.keys = [file.toURL()]; + assertStateEquals(want, store.getState().currentDirectory); + + // Append to the selection. + changeSelection(store, [file, subDir]); + want.selection.keys = [file.toURL(), subDir.toURL()]; + want.selection.dirCount = 1; + want.selection.fileCount = 1; + want.selection.fileTasks.keys = [file.toURL(), subDir.toURL()]; + assertStateEquals(want, store.getState().currentDirectory); +}
diff --git a/ui/file_manager/file_manager/state/reducers/root.ts b/ui/file_manager/file_manager/state/reducers/root.ts index 37092da..b61ec27 100644 --- a/ui/file_manager/file_manager/state/reducers/root.ts +++ b/ui/file_manager/file_manager/state/reducers/root.ts
@@ -6,7 +6,7 @@ import {Action, ActionType} from '../actions.js'; import {cacheEntries, clearCachedEntries} from './all_entries.js'; -import {changeDirectory} from './current_directory.js'; +import {changeDirectory, updateSelection} from './current_directory.js'; import {search} from './search.js'; /** @@ -25,13 +25,12 @@ switch (action.type) { case ActionType.CHANGE_DIRECTORY: return changeDirectory(state, action); - + case ActionType.CHANGE_SELECTION: + return updateSelection(state, action); case ActionType.CLEAR_STALE_CACHED_ENTRIES: return clearCachedEntries(state, action); - case ActionType.SEARCH: return search(state, action); - default: console.error(`invalid action: ${action}`); return state;
diff --git a/ui/file_manager/file_names.gni b/ui/file_manager/file_names.gni index 3aaabbe..96cd0c8 100644 --- a/ui/file_manager/file_names.gni +++ b/ui/file_manager/file_names.gni
@@ -250,13 +250,19 @@ "file_manager/lib/concurrency_models.ts", # State. + "file_manager/state/file_key.ts", "file_manager/state/store.ts", + + # Actions. + "file_manager/state/actions.ts", + "file_manager/state/actions/all_entries.ts", + "file_manager/state/actions/current_directory.ts", + + # Reducers. "file_manager/state/reducers/root.ts", "file_manager/state/reducers/all_entries.ts", "file_manager/state/reducers/current_directory.ts", "file_manager/state/reducers/search.ts", - "file_manager/state/actions.ts", - "file_manager/state/file_key.ts", # Containers. "file_manager/containers/breadcrumb_container.ts", @@ -302,7 +308,9 @@ "file_manager/lib/for_tests.ts", # Reducers: + "file_manager/state/for_tests.ts", "file_manager/state/reducers/all_entries_unittest.ts", + "file_manager/state/reducers/current_directory_unittest.ts", # Widgets: "file_manager/widgets/xf_breadcrumb_unittest.ts",
diff --git a/ui/file_manager/integration_tests/file_manager/drive_specific.js b/ui/file_manager/integration_tests/file_manager/drive_specific.js index f75a83c8..dd8809ab 100644 --- a/ui/file_manager/integration_tests/file_manager/drive_specific.js +++ b/ui/file_manager/integration_tests/file_manager/drive_specific.js
@@ -343,7 +343,7 @@ await remoteCall.waitForElementLost( appId, '#file-list .dim-offline[file-name="world.ogv"]'); await remoteCall.waitForElement( - appId, '#file-list .pinned[file-name="world.ogv"] .detail-pinned'); + appId, '#file-list .pinned[file-name="world.ogv"] .inline-status'); // Select world.ogv by itself. await remoteCall.waitAndClickElement( @@ -411,7 +411,7 @@ await remoteCall.waitForElementLost( appId, '#file-list .dim-offline[file-name="hello.txt"]'); await remoteCall.waitForElement( - appId, '#file-list .pinned[file-name="hello.txt"] .detail-pinned'); + appId, '#file-list .pinned[file-name="hello.txt"] .inline-status'); // Test Document.gdoc should not be pinned however. await remoteCall.waitForElement( @@ -468,7 +468,7 @@ // Check: File is pinned. await remoteCall.waitForElement(appId, '[command="#toggle-pinned"][checked]'); await remoteCall.waitForElement( - appId, '#file-list .pinned[file-name="hello.txt"] .detail-pinned'); + appId, '#file-list .pinned[file-name="hello.txt"] .inline-status'); await waitForNotification('disabled-mobile-sync'); await sendTestMessage({ name: 'clickNotificationButton',
diff --git a/ui/views/interaction/interactive_views_test.cc b/ui/views/interaction/interactive_views_test.cc index d3987f9a..bdb0a9db 100644 --- a/ui/views/interaction/interactive_views_test.cc +++ b/ui/views/interaction/interactive_views_test.cc
@@ -93,15 +93,16 @@ test->test_impl().mouse_error_message_.clear(); test->mouse_util().PerformGestures( base::BindOnce( - [](InteractiveViewsTestApi* test, bool success) { + [](InteractiveViewsTestApi* test, ui::ElementContext context, + bool success) { if (!success) test->test_impl().mouse_error_message_ = - "MoreMouseTo() failed."; + "MoveMouseTo() failed."; ui::ElementTracker::GetFrameworkDelegate()->NotifyCustomEvent( - test->test_impl().pivot_element(), + test->test_impl().GetPivotElement(context), kMouseGestureCompleteEvent); }, - base::Unretained(test)), + base::Unretained(test), el->context()), InteractionTestUtilMouse::MoveTo(std::move(pos_callback).Run(el))); }, base::Unretained(this), GetPositionCallback(std::move(position)))); @@ -125,19 +126,20 @@ step.SetElementID(kInteractiveTestPivotElementId); step.SetStartCallback(base::BindOnce( [](InteractiveViewsTestApi* test, ui_controls::MouseButton button, - bool release) { + bool release, ui::TrackedElement* el) { test->test_impl().mouse_error_message_.clear(); test->mouse_util().PerformGestures( base::BindOnce( - [](InteractiveViewsTestApi* test, bool success) { + [](InteractiveViewsTestApi* test, ui::ElementContext context, + bool success) { if (!success) test->test_impl().mouse_error_message_ = "ClickMouse() failed."; ui::ElementTracker::GetFrameworkDelegate()->NotifyCustomEvent( - test->test_impl().pivot_element(), + test->test_impl().GetPivotElement(context), kMouseGestureCompleteEvent); }, - base::Unretained(test)), + base::Unretained(test), el->context()), release ? InteractionTestUtilMouse::Click(button) : InteractionTestUtilMouse::MouseGestures{ InteractionTestUtilMouse::MouseDown(button)}); @@ -163,15 +165,16 @@ const gfx::Point target = std::move(pos_callback).Run(el); test->mouse_util().PerformGestures( base::BindOnce( - [](InteractiveViewsTestApi* test, bool success) { + [](InteractiveViewsTestApi* test, ui::ElementContext context, + bool success) { if (!success) test->test_impl().mouse_error_message_ = "DragMouseTo() failed."; ui::ElementTracker::GetFrameworkDelegate()->NotifyCustomEvent( - test->test_impl().pivot_element(), + test->test_impl().GetPivotElement(context), kMouseGestureCompleteEvent); }, - base::Unretained(test)), + base::Unretained(test), el->context()), release ? InteractionTestUtilMouse::DragAndRelease(target) : InteractionTestUtilMouse::DragAndHold(target)); }, @@ -196,19 +199,21 @@ StepBuilder step; step.SetElementID(kInteractiveTestPivotElementId); step.SetStartCallback(base::BindOnce( - [](InteractiveViewsTestApi* test, ui_controls::MouseButton button) { + [](InteractiveViewsTestApi* test, ui_controls::MouseButton button, + ui::TrackedElement* el) { test->test_impl().mouse_error_message_.clear(); test->mouse_util().PerformGestures( base::BindOnce( - [](InteractiveViewsTestApi* test, bool success) { + [](InteractiveViewsTestApi* test, ui::ElementContext context, + bool success) { if (!success) test->test_impl().mouse_error_message_ = "ReleaseMouse() failed."; ui::ElementTracker::GetFrameworkDelegate()->NotifyCustomEvent( - test->test_impl().pivot_element(), + test->test_impl().GetPivotElement(context), kMouseGestureCompleteEvent); }, - base::Unretained(test)), + base::Unretained(test), el->context()), InteractionTestUtilMouse::MouseUp(button)); }, base::Unretained(this), button)); @@ -343,9 +348,11 @@ .SetElementID(kInteractiveTestPivotElementId) .SetType(ui::InteractionSequence::StepType::kCustomEvent, kMouseGestureCompleteEvent) + .SetContext(ui::InteractionSequence::ContextMode::kFromPreviousStep) + .SetMustBeVisibleAtStart(false) .SetStartCallback(base::BindOnce( [](InteractiveViewsTestApi* test, ui::InteractionSequence* seq, - ui::TrackedElement*) { + ui::TrackedElement* el) { if (!test->test_impl().mouse_error_message_.empty()) { LOG(ERROR) << test->test_impl().mouse_error_message_; seq->FailForTesting();