diff --git a/DEPS b/DEPS index 08b64b4..2b736a3 100644 --- a/DEPS +++ b/DEPS
@@ -269,7 +269,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '18c861675e291f03d2cf2c2640e488ab30175ee8', + 'skia_revision': '8d3d0bcd4b2c469d8f5272d42916d8a0554950a3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -277,7 +277,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '6ddbfa397c9b16b47e8f190249f52d4faf17645e', + 'angle_revision': '486ae89e43a391ee2648826f34f41c26a9b8b570', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -285,7 +285,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': '02cb5702ac115d9eabff4a25bc875879fa09490f', + 'pdfium_revision': '0bd11f78b69d990331d7f4dad37d6fa34b08c3f9', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -296,7 +296,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:8.20220510.2.1', + 'fuchsia_version': 'version:8.20220511.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. @@ -384,7 +384,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. - 'dawn_revision': '63cea3f8c03a748c261b1f8e371735994c2e2552', + 'dawn_revision': 'b2004907a3543edf4c670449718cd6f547974383', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -451,7 +451,7 @@ 'libcxx_revision': '79a2e924d96e2fc1e4b937c42efd08898fa472d7', # GN CIPD package version. - 'gn_version': 'git_revision:bf4e17dc67b2a2007475415e3f9e1d1cf32f6e35', + 'gn_version': 'git_revision:578a7fe4c3c6b0bc2ae1fd2e37f14857d09895bf', } # Only these hosts are allowed for dependencies in this DEPS file. @@ -765,7 +765,7 @@ }, 'src/ios/third_party/material_components_ios/src': { - 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '0b44a810e77e18dcdb40d961e705fe44c7ab27fc', + 'url': Var('chromium_git') + '/external/github.com/material-components/material-components-ios.git' + '@' + '505c27cd9f6b33acbe54b5c40f291866e53a47f1', 'condition': 'checkout_ios', }, @@ -914,7 +914,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'vZNvIbZD3QeeHd82_9LRcLzoETy5YzBKbA7bV5MXBBAC', + 'version': 'N11h90BOkwT_ErtH-6ZmLb5ptpWC7xllgXt3TDEphj0C', }, ], 'condition': 'checkout_android', @@ -1527,7 +1527,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'a942004e951f2d6ccd726fc6ee4e62e5f08c2e62', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'fbdedcfb33db2b18f8679550a31e2a062f466dab', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1645,7 +1645,7 @@ Var('chromium_git') + '/external/github.com/GoogleChromeLabs/text-fragments-polyfill.git' + '@' + 'c036420683f672d685e27415de0a5f5e85bdc23f', 'src/third_party/tflite/src': - Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '08fef6195f0de0742953553fad4443b9d88a4764', + Var('chromium_git') + '/external/github.com/tensorflow/tensorflow.git' + '@' + '783ece207fa191df18e305c796aeb29c3057dc7b', 'src/third_party/turbine': { 'packages': [ @@ -1663,7 +1663,7 @@ 'condition': 'checkout_android', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@ef2b69a8c03b115ddf5abd144ccf6981e2cb7c59', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@3e76ffe3d4b39f7ec38581712dbde5c2e63ef0fb', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1702,7 +1702,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '0a1288f5e8262e900169795d742082bbc9d6ee22', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '8d1e4fbdce2e872c911baa4de1da8bdd941aff7d', + Var('webrtc_git') + '/src.git' + '@' + 'f783b938fa1cf9daafb9641652f677a33c506b2d', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1775,7 +1775,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@c0d0460839e9a2b01cb9bb98c6cd705bc353c9ed', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@a1d13526ebd16a86b129f5c2f2cb67e5d001340d', 'condition': 'checkout_src_internal', }, @@ -1827,7 +1827,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'uQylD8Z_Ho19HLXtlhIY4em419H4Nz9viFUdpLnckJkC', + 'version': 'Ouuh_QVH5Vhs25lO6hUI1P7F9kceKy2xDp23WlML33cC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -3593,6 +3593,7 @@ # explicitly here. '-absl', '-third_party/abseil-cpp', + '+third_party/abseil-cpp/absl/base/attributes.h', "+third_party/abseil-cpp/absl/numeric/int128.h", '+third_party/abseil-cpp/absl/types/optional.h', '+third_party/abseil-cpp/absl/types/variant.h',
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index d6260311e..727e955 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -838,7 +838,7 @@ // Controls whether the snooping protection prototype is enabled. const base::Feature kSnoopingProtection{"SnoopingProtection", - base::FEATURE_ENABLED_BY_DEFAULT}; + base::FEATURE_DISABLED_BY_DEFAULT}; // Enable or disable a new header bar for the ChromeOS virtual keyboard. const base::Feature kVirtualKeyboardNewHeader{
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index 877c418..45f3ff3b 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -628,11 +628,6 @@ // directory. For now, only one extension can be specified. const char kInstallSystemExtension[] = "install-system-extension"; -// If set, the Chrome settings will not expose the option to enable crostini -// unless the enable-experimental-kernel-vm-support flag is set in -// chrome://flags -const char kKernelnextRestrictVMs[] = "kernelnext-restrict-vms"; - // When this flag is set, the lacros-availability policy is ignored. const char kLacrosAvailabilityIgnore[] = "lacros-availability-ignore";
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 6ec54ba..b6c4037 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -207,7 +207,6 @@ extern const char kInstallLogFastUploadForTests[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kInstallSystemExtension[]; -COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kKernelnextRestrictVMs[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kLacrosAvailabilityIgnore[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kLacrosChromeAdditionalArgs[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kLacrosChromeAdditionalEnv[];
diff --git a/ash/system/eche/eche_tray.cc b/ash/system/eche/eche_tray.cc index 02f5688b..68b85ec 100644 --- a/ash/system/eche/eche_tray.cc +++ b/ash/system/eche/eche_tray.cc
@@ -33,6 +33,8 @@ #include "base/bind.h" #include "base/callback_forward.h" #include "base/metrics/histogram_functions.h" +#include "base/time/default_tick_clock.h" +#include "base/time/time.h" #include "components/account_id/account_id.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/l10n/l10n_util.h" @@ -225,6 +227,8 @@ void EcheTray::OnStreamStatusChanged(eche_app::mojom::StreamStatus status) { switch (status) { case eche_app::mojom::StreamStatus::kStreamStatusStarted: + // Reset the timestamp when the streaming is started. + init_stream_timestamp_.reset(); ShowBubble(); break; case eche_app::mojom::StreamStatus::kStreamStatusStopped: @@ -314,8 +318,10 @@ web_view_ = nullptr; close_button_ = nullptr; minimize_button_ = nullptr; + arrow_back_button_ = nullptr; unload_timer_.reset(); bubble_.reset(); + init_stream_timestamp_.reset(); } void EcheTray::SetGracefulCloseCallback( @@ -333,6 +339,13 @@ } void EcheTray::StartGracefulClose() { + if (init_stream_timestamp_.has_value()) { + base::UmaHistogramLongTimes100( + "Eche.StreamEvent.Duration.FromInitializeToClose", + base::TimeTicks::Now() - *init_stream_timestamp_); + init_stream_timestamp_.reset(); + } + if (!graceful_close_callback_) { PurgeAndClose(); return; @@ -361,6 +374,7 @@ base::UmaHistogramEnumeration( "Eche.StreamEvent", eche_app::mojom::StreamStatus::kStreamStatusInitializing); + init_stream_timestamp_ = base::TimeTicks::Now(); TrayBubbleView::InitParams init_params; init_params.delegate = this; // Note: The container id must be smaller than `kShellWindowId_ShelfContainer`
diff --git a/ash/system/eche/eche_tray.h b/ash/system/eche/eche_tray.h index d2149980..7b86c586 100644 --- a/ash/system/eche/eche_tray.h +++ b/ash/system/eche/eche_tray.h
@@ -239,6 +239,10 @@ views::Button* minimize_button_ = nullptr; views::Button* arrow_back_button_ = nullptr; + // The time a stream is initializing. Used to record the elapsed time from + // when the stream is initializing to when the stream is closed by user. + absl::optional<base::TimeTicks> init_stream_timestamp_; + // Observers base::ScopedObservation<SessionControllerImpl, SessionObserver> observed_session_{this};
diff --git a/ash/system/geolocation/geolocation_controller.cc b/ash/system/geolocation/geolocation_controller.cc index 21d0c58..5ecad42 100644 --- a/ash/system/geolocation/geolocation_controller.cc +++ b/ash/system/geolocation/geolocation_controller.cc
@@ -46,10 +46,12 @@ auto* timezone_settings = chromeos::system::TimezoneSettings::GetInstance(); current_timezone_id_ = timezone_settings->GetCurrentTimezoneID(); timezone_settings->AddObserver(this); + chromeos::PowerManagerClient::Get()->AddObserver(this); } GeolocationController::~GeolocationController() { chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); + chromeos::PowerManagerClient::Get()->RemoveObserver(this); } // static @@ -85,6 +87,11 @@ ScheduleNextRequest(base::Seconds(0)); } +void GeolocationController::SuspendDone(base::TimeDelta sleep_duration) { + if (sleep_duration >= kNextRequestDelayAfterSuccess) + ScheduleNextRequest(base::Seconds(0)); +} + // static base::TimeDelta GeolocationController::GetNextRequestDelayAfterSuccessForTesting() {
diff --git a/ash/system/geolocation/geolocation_controller.h b/ash/system/geolocation/geolocation_controller.h index 43178ce7..c105aa66 100644 --- a/ash/system/geolocation/geolocation_controller.h +++ b/ash/system/geolocation/geolocation_controller.h
@@ -15,6 +15,7 @@ #include "base/observer_list_types.h" #include "base/time/time.h" #include "base/timer/timer.h" +#include "chromeos/dbus/power/power_manager_client.h" #include "services/network/public/cpp/shared_url_loader_factory.h" namespace base { @@ -45,7 +46,8 @@ // TODO(crbug.com/1272178): `GeolocationController` should observe the sleep // and update next request time. class ASH_EXPORT GeolocationController - : public chromeos::system::TimezoneSettings::Observer { + : public chromeos::system::TimezoneSettings::Observer, + public chromeos::PowerManagerClient::Observer { public: class Observer : public base::CheckedObserver { public: @@ -82,6 +84,9 @@ // chromeos::system::TimezoneSettings::Observer: void TimezoneChanged(const icu::TimeZone& timezone) override; + // chromeos::PowerManagerClient::Observer: + void SuspendDone(base::TimeDelta sleep_duration) override; + // Returns sunset and sunrise time calculated from `geoposition_`. If the // position is not set, returns the default sunset 6 PM and sunrise 6 AM. base::Time GetSunsetTime() const { return GetSunRiseSet(/*sunrise=*/false); }
diff --git a/ash/system/geolocation/geolocation_controller_unittest.cc b/ash/system/geolocation/geolocation_controller_unittest.cc index 9b09483..956bd4d 100644 --- a/ash/system/geolocation/geolocation_controller_unittest.cc +++ b/ash/system/geolocation/geolocation_controller_unittest.cc
@@ -15,6 +15,7 @@ #include "base/time/clock.h" #include "base/time/time.h" #include "base/timer/mock_timer.h" +#include "chromeos/dbus/power/fake_power_manager_client.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/icu/source/i18n/unicode/timezone.h" @@ -35,7 +36,8 @@ // Base test fixture. class GeolocationControllerTest : public AshTestBase { public: - GeolocationControllerTest() = default; + GeolocationControllerTest() + : AshTestBase(base::test::TaskEnvironment::TimeSource::MOCK_TIME) {} GeolocationControllerTest(const GeolocationControllerTest&) = delete; GeolocationControllerTest& operator=(const GeolocationControllerTest&) = delete; @@ -66,6 +68,12 @@ SetServerPosition(position); } + // AshTestBase: + void TearDown() override { + controller_.reset(); + AshTestBase::TearDown(); + } + GeolocationController* controller() const { return controller_.get(); } base::SimpleTestClock* test_clock() { return &test_clock_; } base::OneShotTimer* timer_ptr() const { return timer_ptr_; } @@ -266,6 +274,45 @@ EXPECT_TRUE(timer_ptr()->IsRunning()); } +// Tests that if device sleeps more than a day, the geoposition is fetched +// instantly. +TEST_F(GeolocationControllerTest, RequestGeopositionAfterSuspend) { + const base::TimeDelta zero_duration = base::Seconds(0); + auto* power_manager_client = chromeos::FakePowerManagerClient::Get(); + const base::TimeDelta next_request_delay_after_success = base::Days(1); + // Add an observer. Adding the first observer automatically requests a + // geoposition instantly. + GeolocationControllerObserver observer; + controller()->AddObserver(&observer); + EXPECT_EQ(0, observer.position_received_num()); + EXPECT_EQ(zero_duration, timer_ptr()->GetCurrentDelay()); + + // Fetch that instant request to make the next request has a delay becomes + // `kNextRequestDelayAfterSuccess`, i.e. `next_request_delay_after_success`, + FireTimerToFetchGeoposition(); + EXPECT_EQ(next_request_delay_after_success, timer_ptr()->GetCurrentDelay()); + EXPECT_EQ(1, observer.position_received_num()); + + // Suspend the device for a day and wake the device. + power_manager_client->SendSuspendImminent( + power_manager::SuspendImminent::Reason::SuspendImminent_Reason_IDLE); + power_manager_client->SendSuspendDone(base::Days(1)); + // Test that after waking up from 1-day suspension, the controller request a + // new geoposition instantly. + EXPECT_EQ(zero_duration, timer_ptr()->GetCurrentDelay()); + FireTimerToFetchGeoposition(); + EXPECT_EQ(2, observer.position_received_num()); + EXPECT_EQ(next_request_delay_after_success, timer_ptr()->GetCurrentDelay()); + + // Suspend the device for less than a day. + power_manager_client->SendSuspendImminent( + power_manager::SuspendImminent::Reason::SuspendImminent_Reason_IDLE); + // Test that after waking up from 2-hr suspension, the controller continues + // the old geoposition request with the same delay. + power_manager_client->SendSuspendDone(base::Hours(2)); + EXPECT_EQ(next_request_delay_after_success, timer_ptr()->GetCurrentDelay()); +} + } // namespace } // namespace ash
diff --git a/ash/system/human_presence/snooping_protection_notification_blocker.cc b/ash/system/human_presence/snooping_protection_notification_blocker.cc index 8749954..3252ca7f 100644 --- a/ash/system/human_presence/snooping_protection_notification_blocker.cc +++ b/ash/system/human_presence/snooping_protection_notification_blocker.cc
@@ -24,6 +24,7 @@ #include "base/bind.h" #include "base/check_op.h" #include "base/memory/weak_ptr.h" +#include "base/metrics/histogram_functions.h" #include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_util.h" @@ -122,7 +123,7 @@ pref_change_registrar_->Add( prefs::kSnoopingProtectionNotificationSuppressionEnabled, base::BindRepeating( - &SnoopingProtectionNotificationBlocker::OnBlockingActiveChanged, + &SnoopingProtectionNotificationBlocker::OnBlockingPrefChanged, weak_ptr_factory_.GetWeakPtr())); } @@ -131,6 +132,18 @@ UpdateInfoNotificationIfNecessary(); } +void SnoopingProtectionNotificationBlocker::OnBlockingPrefChanged() { + DCHECK(pref_change_registrar_); + DCHECK(pref_change_registrar_->prefs()); + const bool pref_enabled = pref_change_registrar_->prefs()->GetBoolean( + prefs::kSnoopingProtectionNotificationSuppressionEnabled); + base::UmaHistogramBoolean( + "ChromeOS.HPS.SnoopingProtectionNotificationSuppression.Enabled", + pref_enabled); + + OnBlockingActiveChanged(); +} + bool SnoopingProtectionNotificationBlocker::ShouldShowNotificationAsPopup( const message_center::Notification& notification) const { // If we've populated our info popup, we're definitely hiding some other
diff --git a/ash/system/human_presence/snooping_protection_notification_blocker.h b/ash/system/human_presence/snooping_protection_notification_blocker.h index 29f1060..5fbcea7a 100644 --- a/ash/system/human_presence/snooping_protection_notification_blocker.h +++ b/ash/system/human_presence/snooping_protection_notification_blocker.h
@@ -84,6 +84,10 @@ // the snooping state and the user's preferences. void OnBlockingActiveChanged(); + // Called when prefs::kSnoopingProtectionNotificationSuppressionEnabled + // changes its value. + void OnBlockingPrefChanged(); + // Returns true if we are currently blocking notifications that aren't // explicit exceptions. bool BlockingActive() const;
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc index 04d9070..b45dee86 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc_unittest.cc
@@ -8,6 +8,7 @@ #include <cstring> #include "base/allocator/buildflags.h" +#include "base/allocator/partition_allocator/partition_alloc_constants.h" #include "base/compiler_specific.h" #include "base/memory/page_size.h" #include "build/build_config.h" @@ -128,7 +129,8 @@ TEST(PartitionAllocAsMalloc, AlignedAlloc) { for (size_t alloc_size : {100, 100000, 10000000}) { - for (size_t alignment = 1; alignment <= kMaxSupportedAlignment; + for (size_t alignment = 1; + alignment <= partition_alloc::kMaxSupportedAlignment; alignment <<= 1) { void* data = PartitionAlignedAlloc(nullptr, alloc_size, alignment, nullptr); @@ -141,7 +143,8 @@ TEST(PartitionAllocAsMalloc, AlignedRealloc) { for (size_t alloc_size : {100, 100000, 10000000}) { - for (size_t alignment = 1; alignment <= kMaxSupportedAlignment; + for (size_t alignment = 1; + alignment <= partition_alloc::kMaxSupportedAlignment; alignment <<= 1) { void* data = PartitionAlignedAlloc(nullptr, alloc_size, alignment, nullptr);
diff --git a/base/allocator/partition_allocator/partition_alloc_constants.h b/base/allocator/partition_allocator/partition_alloc_constants.h index 5f374c42..65bf99e 100644 --- a/base/allocator/partition_allocator/partition_alloc_constants.h +++ b/base/allocator/partition_allocator/partition_alloc_constants.h
@@ -429,68 +429,16 @@ } // namespace internal -// This function is used often enough to be worth publicizing outside the -// `internal` namespace. +// These constants are used outside PartitionAlloc itself, so we provide +// non-internal aliases here. +using ::partition_alloc::internal::kInvalidBucketSize; +using ::partition_alloc::internal::kMaxSuperPagesInPool; +using ::partition_alloc::internal::kMaxSupportedAlignment; +using ::partition_alloc::internal::kNumBuckets; +using ::partition_alloc::internal::kSuperPageSize; +using ::partition_alloc::internal::MaxDirectMapped; using ::partition_alloc::internal::PartitionPageSize; } // namespace partition_alloc -namespace base { - -// TODO(https://crbug.com/1288247): Remove these 'using' declarations once -// the migration to the new namespaces gets done. -using ::partition_alloc::AllocFlags; -using ::partition_alloc::internal::DirectMapAllocationGranularity; -using ::partition_alloc::internal::DirectMapAllocationGranularityOffsetMask; -using ::partition_alloc::internal::DirectMapAllocationGranularityShift; -#if defined(PA_HAS_MEMORY_TAGGING) -using ::partition_alloc::internal::HasOverflowTag; -#endif // defined(PA_HAS_MEMORY_TAGGING) -using ::partition_alloc::internal::kBitsPerSizeT; -using ::partition_alloc::internal::kBRPPoolHandle; -using ::partition_alloc::internal::kConfigurablePoolHandle; -using ::partition_alloc::internal::kDefaultEmptySlotSpanRingSize; -using ::partition_alloc::internal::kEmptyCacheIndexBits; -using ::partition_alloc::internal::kFreedByte; -using ::partition_alloc::internal::kGiB; -using ::partition_alloc::internal::kInvalidBucketSize; -using ::partition_alloc::internal::kMaxBucketed; -using ::partition_alloc::internal::kMaxBucketedOrder; -using ::partition_alloc::internal::kMaxBucketSpacing; -using ::partition_alloc::internal::kMaxFreeableSpans; -using ::partition_alloc::internal::kMaxMemoryTaggingSize; -using ::partition_alloc::internal::kMaxPartitionPagesPerRegularSlotSpan; -using ::partition_alloc::internal::kMaxSuperPagesInPool; -using ::partition_alloc::internal::kMaxSupportedAlignment; -using ::partition_alloc::internal::kMinBucketedOrder; -using ::partition_alloc::internal::kMinDirectMappedDownsize; -using ::partition_alloc::internal::kNumBucketedOrders; -using ::partition_alloc::internal::kNumBuckets; -using ::partition_alloc::internal::kNumBucketsPerOrder; -using ::partition_alloc::internal::kNumBucketsPerOrderBits; -using ::partition_alloc::internal::kNumPools; -using ::partition_alloc::internal::kPartitionCachelineSize; -using ::partition_alloc::internal::kPoolMaxSize; -using ::partition_alloc::internal::kQuarantinedByte; -using ::partition_alloc::internal::kReasonableSizeOfUnusedPages; -using ::partition_alloc::internal::kRegularPoolHandle; -using ::partition_alloc::internal::kSmallestBucket; -using ::partition_alloc::internal::kSuperPageAlignment; -using ::partition_alloc::internal::kSuperPageBaseMask; -using ::partition_alloc::internal::kSuperPageOffsetMask; -using ::partition_alloc::internal::kSuperPageShift; -using ::partition_alloc::internal::kSuperPageSize; -using ::partition_alloc::internal::kUninitializedByte; -using ::partition_alloc::internal::MaxDirectMapped; -using ::partition_alloc::internal::MaxRegularSlotSpanSize; -using ::partition_alloc::internal::MaxSuperPagesInPool; -using ::partition_alloc::internal::MaxSystemPagesPerRegularSlotSpan; -using ::partition_alloc::internal::NumPartitionPagesPerSuperPage; -using ::partition_alloc::internal::NumSystemPagesPerPartitionPage; -using ::partition_alloc::internal::PartitionPageBaseMask; -using ::partition_alloc::internal::PartitionPageOffsetMask; -using ::partition_alloc::internal::PartitionPageShift; - -} // namespace base - #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_ALLOC_CONSTANTS_H_
diff --git a/base/logging.cc b/base/logging.cc index 26f8e04..40b4bdaa 100644 --- a/base/logging.cc +++ b/base/logging.cc
@@ -501,12 +501,16 @@ bool ShouldLogToStderr(int severity) { if (g_logging_destination & LOG_TO_STDERR) return true; -#if !BUILDFLAG(IS_FUCHSIA) - // High-severity logs go to stderr by default, except on Fuchsia. + +#if BUILDFLAG(IS_FUCHSIA) + // Fuchsia will persist data logged to stdio by a component, so do not emit + // logs to stderr unless explicitly configured to do so. + return false; +#else if (severity >= kAlwaysPrintErrorLevel) return (g_logging_destination & ~LOG_TO_FILE) == LOG_NONE; -#endif return false; +#endif } int GetVlogVerbosity() {
diff --git a/base/memory/raw_ptr.cc b/base/memory/raw_ptr.cc index bc81fdb..b26a96c1 100644 --- a/base/memory/raw_ptr.cc +++ b/base/memory/raw_ptr.cc
@@ -74,7 +74,8 @@ CHECK(address - reservation_start >= partition_alloc::PartitionPageSize()); } else { CHECK(IsManagedByNormalBuckets(address)); - CHECK(address % kSuperPageSize >= partition_alloc::PartitionPageSize()); + CHECK(address % partition_alloc::kSuperPageSize >= + partition_alloc::PartitionPageSize()); } } #endif // DCHECK_IS_ON() || BUILDFLAG(ENABLE_BACKUP_REF_PTR_SLOW_CHECKS)
diff --git a/base/profiler/stack_copier_suspend_unittest.cc b/base/profiler/stack_copier_suspend_unittest.cc index ee4697d..9142049 100644 --- a/base/profiler/stack_copier_suspend_unittest.cc +++ b/base/profiler/stack_copier_suspend_unittest.cc
@@ -135,8 +135,9 @@ uintptr_t* stack_copy_bottom = reinterpret_cast<uintptr_t*>(stack_buffer.get()->buffer()); - std::vector<uintptr_t> stack_copy(stack_copy_bottom, - stack_copy_bottom + stack.size()); + std::vector<uintptr_t> stack_copy( + stack_copy_bottom, + stack_copy_bottom + (stack_buffer->size() / sizeof(*stack_copy_bottom))); // Use the buffer not being overwritten as a proxy for the unwind being // aborted. EXPECT_NE(stack, stack_copy);
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index 30c2043..fe40c571 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc
@@ -259,9 +259,9 @@ if (detailed) { base::internal::BucketIndexLookup lookup{}; std::string name = dump->absolute_name(); - for (size_t i = 0; i < kNumBuckets; i++) { + for (size_t i = 0; i < partition_alloc::kNumBuckets; i++) { size_t bucket_size = lookup.bucket_sizes()[i]; - if (bucket_size == kInvalidBucketSize) + if (bucket_size == partition_alloc::kInvalidBucketSize) continue; // Covers all normal buckets, that is up to ~1MiB, so 7 digits. std::string dump_name =
diff --git a/base/win/nt_status.h b/base/win/nt_status.h index 7b9f6f1..367b41f 100644 --- a/base/win/nt_status.h +++ b/base/win/nt_status.h
@@ -5,10 +5,8 @@ #ifndef BASE_WIN_NT_STATUS_H_ #define BASE_WIN_NT_STATUS_H_ -#include <windows.h> -#include <winternl.h> - #include "base/base_export.h" +#include "base/win/windows_types.h" namespace base { namespace win {
diff --git a/chrome/VERSION b/chrome/VERSION index 395bf7ff..314f166 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=103 MINOR=0 -BUILD=5056 +BUILD=5057 PATCH=0
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/omnibox/OmniboxPedalDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/omnibox/OmniboxPedalDelegateImpl.java index 42b632b..61a3d94 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/omnibox/OmniboxPedalDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/omnibox/OmniboxPedalDelegateImpl.java
@@ -146,7 +146,7 @@ assert omniboxPedal instanceof HistoryClustersAction; String query = ((HistoryClustersAction) omniboxPedal).getQuery(); assert !TextUtils.isEmpty(query); - mHistoryClustersCoordinator.showBottomSheet(query); + mHistoryClustersCoordinator.openHistoryClustersUi(query); } break; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java index dd5b6113..9b0c88d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
@@ -112,7 +112,7 @@ ChromeFeatureList.isEnabled(ChromeFeatureList.HISTORY_JOURNEYS); if (historyClustersEnabled) { mHistoryClustersCoordinator = new HistoryClustersCoordinator( - Profile.getLastUsedRegularProfile(), activity, null, null, tabSupplier); + Profile.getLastUsedRegularProfile(), activity, null, tabSupplier); if (!TextUtils.isEmpty(historyClustersQuery)) { mHistoryClustersCoordinator.setQuery(historyClustersQuery); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java index 495683f..7c118ea 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java
@@ -717,11 +717,10 @@ private void initHistoryClustersCoordinator(Profile profile) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.HISTORY_JOURNEYS)) { - mHistoryClustersCoordinator = - new HistoryClustersCoordinator(profile, mActivity, mBottomSheetController, - () - -> new Intent().setClass(mActivity, HistoryActivity.class), - mActivityTabProvider); + mHistoryClustersCoordinator = new HistoryClustersCoordinator(profile, mActivity, + () + -> new Intent().setClass(mActivity, HistoryActivity.class), + mActivityTabProvider); mHistoryClustersCoordinatorSupplier.set(mHistoryClustersCoordinator); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/OmniboxPedalsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/OmniboxPedalsTest.java index 480fda1..9737f23 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/OmniboxPedalsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/OmniboxPedalsTest.java
@@ -39,7 +39,6 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.history.HistoryActivity; -import org.chromium.chrome.browser.history_clusters.HistoryClustersBottomSheetContent; import org.chromium.chrome.browser.omnibox.LocationBarLayout; import org.chromium.chrome.browser.omnibox.OmniboxSuggestionType; import org.chromium.chrome.browser.omnibox.action.OmniboxActionType; @@ -56,8 +55,8 @@ import org.chromium.chrome.test.util.ActivityTestUtils; import org.chromium.chrome.test.util.OmniboxTestUtils; import org.chromium.chrome.test.util.OmniboxTestUtils.SuggestionInfo; +import org.chromium.chrome.test.util.browser.Features.EnableFeatures; import org.chromium.components.browser_ui.accessibility.AccessibilitySettings; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.site_settings.SiteSettings; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.omnibox.AutocompleteMatch; @@ -556,6 +555,7 @@ @Test @MediumTest + @EnableFeatures({ChromeFeatureList.HISTORY_JOURNEYS}) public void testHistoryClustersAction() { mOmniboxUtils.requestFocus(); List<AutocompleteMatch> suggestionsList = buildDummySuggestionsList(2, "Suggestion"); @@ -571,12 +571,16 @@ clickOnPedal(); - CriteriaHelper.pollUiThread(() -> { - BottomSheetController bottomSheetController = sActivityTestRule.getActivity() - .getRootUiCoordinatorForTesting() - .getBottomSheetController(); - Criteria.checkThat(bottomSheetController.getCurrentSheetContent(), - Matchers.instanceOf(HistoryClustersBottomSheetContent.class)); - }); + if (DeviceFormFactor.isNonMultiDisplayContextOnTablet(sActivityTestRule.getActivity())) { + CriteriaHelper.pollUiThread(() -> { + Tab tab = sActivityTestRule.getActivity().getActivityTab(); + Criteria.checkThat(tab, Matchers.notNullValue()); + Criteria.checkThat( + tab.getUrl().getSpec(), Matchers.startsWith("chrome://history/journeys")); + }); + } else { + ActivityTestUtils.waitForActivity( + InstrumentationRegistry.getInstrumentation(), HistoryActivity.class); + } } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinatorTest.java index 65f3c9f..c5e8eb9 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinatorTest.java
@@ -83,9 +83,8 @@ mActivityScenario = ActivityScenario.launch(ChromeTabbedActivity.class); mActivityScenario.onActivity(activity -> { - mHistoryClustersCoordinator = new HistoryClustersCoordinator(mProfile, activity, - activity.getRootUiCoordinatorForTesting().getBottomSheetController(), - () -> mIntent, () -> mTab); + mHistoryClustersCoordinator = + new HistoryClustersCoordinator(mProfile, activity, () -> mIntent, () -> mTab); }); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java index 34bf143..8d0957a 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediatorTest.java
@@ -31,7 +31,6 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.chrome.browser.history_clusters.HistoryClustersItemProperties.ItemType; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.favicon.LargeIconBridge; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.ui.modelutil.MVCListAdapter.ListItem; @@ -64,8 +63,6 @@ @Mock private GURL mGurl3; @Mock - private BottomSheetController mBottomSheetController; - @Mock private Tab mTab; private ClusterVisit mVisit1; @@ -76,8 +73,6 @@ private HistoryClustersResult mHistoryClustersResult; private ModelList mModelList; private PropertyModel mToolbarModel; - private HistoryClustersBottomSheetContent mBottomSheetContent = - new HistoryClustersBottomSheetContent(); private Intent mIntent = new Intent(); private Supplier<Intent> mHistoryActivityIntentFactory = () -> mIntent; private Supplier<Tab> mTabSupplier = () -> mTab; @@ -88,11 +83,8 @@ doReturn(mResources).when(mContext).getResources(); mModelList = new ModelList(); mToolbarModel = new PropertyModel(HistoryClustersToolbarProperties.ALL_KEYS); - mBottomSheetContent = new HistoryClustersBottomSheetContent(); mMediator = new HistoryClustersMediator(mBridge, mLargeIconBridge, mContext, mResources, - mModelList, new PropertyModel(HistoryClustersBottomSheetToolbarProperties.ALL_KEYS), - mToolbarModel, mBottomSheetController, mBottomSheetContent, - mHistoryActivityIntentFactory, mTabSupplier); + mModelList, mToolbarModel, mHistoryActivityIntentFactory, mTabSupplier); mVisit1 = new ClusterVisit(1.0F, mGurl1, "Title 1"); mVisit2 = new ClusterVisit(1.0F, mGurl2, "Title 1"); mVisit3 = new ClusterVisit(1.0F, mGurl3, "Title 1"); @@ -128,40 +120,16 @@ } @Test - public void testShowBottomSheet() { - Promise<HistoryClustersResult> promise = new Promise<>(); - doReturn(promise).when(mBridge).queryClusters("foo"); - - mMediator.showBottomSheet("foo"); - fulfillPromise(promise, mHistoryClustersResult); - verify(mBottomSheetController).requestShowContent(mBottomSheetContent, true); - - assertEquals(mModelList.size(), 3); - } - - @Test - public void testShowBottomSheet_emptyQuery() { - Promise<HistoryClustersResult> promise = new Promise<>(); - doReturn(promise).when(mBridge).queryClusters(""); - - mMediator.showBottomSheet(""); - fulfillPromise(promise, mHistoryClustersResult); - - verify(mBottomSheetController).requestShowContent(mBottomSheetContent, true); - assertEquals(mModelList.size(), 3); - } - - @Test public void testOpenInFullPageTablet() { doReturn(2).when(mResources).getInteger(R.integer.min_screen_width_bucket); - mMediator.openHistoryClustersInFullPage("pandas"); + mMediator.openHistoryClustersUi("pandas"); verify(mTab).loadUrl(argThat(hasSameUrl("chrome://history/journeys?q=pandas"))); } @Test public void testOpenInFullPagePhone() { doReturn(1).when(mResources).getInteger(R.integer.min_screen_width_bucket); - mMediator.openHistoryClustersInFullPage("pandas"); + mMediator.openHistoryClustersUi("pandas"); verify(mContext).startActivity(mIntent); assertTrue(IntentUtils.safeGetBooleanExtra(
diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc index 2a66a3aa..7c079a48 100644 --- a/chrome/app/chrome_crash_reporter_client_win.cc +++ b/chrome/app/chrome_crash_reporter_client_win.cc
@@ -55,9 +55,11 @@ if (process_type.empty()) install_static::GetUserDataDirectory(&user_data_dir, nullptr); - crash_reporter::InitializeCrashpadWithEmbeddedHandler( - process_type.empty(), install_static::WideToUTF8(process_type), + bool success = crash_reporter::InitializeCrashpadWithEmbeddedHandler( + /*initial_client=*/process_type.empty(), + install_static::WideToUTF8(process_type), install_static::WideToUTF8(user_data_dir), base::FilePath()); + DCHECK(success); } } #endif // !defined(NACL_WIN64)
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc index f240557..51d73c9 100644 --- a/chrome/app/chrome_main_delegate.cc +++ b/chrome/app/chrome_main_delegate.cc
@@ -1041,8 +1041,8 @@ InitializeUserDataDir(base::CommandLine::ForCurrentProcess()); #if BUILDFLAG(IS_CHROMEOS_LACROS) - // Initialize BrowserInitParams only for browser process and zygote process. - if (process_type.empty() || process_type == switches::kZygoteProcess) { + if (process_type.empty() || process_type == switches::kZygoteProcess || + process_type == switches::kUtilityProcess) { // TODO(elkurin): Add comments here when resource loading using ash // resources is implemented. const crosapi::mojom::BrowserInitParams* init_params =
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 31b619ae..f6bc98c 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -631,6 +631,10 @@ </if> <!-- Download Bubble Items --> + <message name="IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE" + desc="Message shown to the user to validate the download of a dangerous file."> + Chromium blocked this file because this type of file is dangerous + </message> <message name="IDS_DOWNLOAD_BUBBLE_MALICIOUS_URL_BLOCKED" desc="Message shown to the user to validate the download when the download url is classified to lead to malware by the safebrowsing database."> Chromium blocked this file because it is dangerous
diff --git a/chrome/app/chromium_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1 b/chrome/app/chromium_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1 new file mode 100644 index 0000000..e89dd6a1 --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1
@@ -0,0 +1 @@ +895f105e27e573832565d535497c83b184ebe76b \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 7039794..ba7a319 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7163,12 +7163,6 @@ <message name="IDS_CHROME_TIP" desc="Accessible name used by a screen reader for the in-product-help or tutorial bubble icon." is_accessibility_with_no_ui="true"> Chrome tip </message> - <message name="IDS_CLOSE_TUTORIAL" desc="Accessible name used by a screen reader for the tutorial bubble close button." is_accessibility_with_no_ui="true"> - Close tutorial - </message> - <message name="IDS_CLOSE_PROMO" desc="Accessible name used by a screen reader for the in-product-help bubble close button." is_accessibility_with_no_ui="true"> - Close help bubble - </message> <message name="IDS_GLOBAL_MEDIA_CONTROLS_PROMO" desc="Text shown on promotional UI appearing next to the global media controls toolbar button."> New! Control your music, videos, and more. </message> @@ -7226,39 +7220,11 @@ <message name="IDS_TAB_AUDIO_MUTING_PROMO" desc="Text shown on the promotional UI appearing next to the tab alert indicator."> Click the speaker icon to mute this tab </message> - <if expr="use_titlecase"> - <message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message"> - Got It - </message> - <message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time"> - Remind Me Later - </message> - <message name="IDS_PROMO_SHOW_TUTORIAL_BUTTON" desc="Text shown on a promo bubble button for the user to initiate a tutorial after being asked if they want to learn more."> - Show Me How - </message> - </if> - <if expr="not use_titlecase"> - <message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message"> - Got it - </message> - <message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time"> - Remind me later - </message> - <message name="IDS_PROMO_SHOW_TUTORIAL_BUTTON" desc="Text shown on a promo bubble button for the user to initiate a tutorial after being asked if they want to learn more."> - Show me how - </message> - </if> <message name="IDS_SHARED_HIGHLIGHTING_PROMO" desc="The title of in-product-help message encouraging users to interact with the highlight"> To create a highlight like this one, select any text and right-click. </message> <!-- User Education Tutorial Strings --> - <message name="IDS_TUTORIAL_RESTART_TUTORIAL" desc="The text shown on the button for restarting a tutorial"> - Restart tutorial - </message> - <message name="IDS_TUTORIAL_CLOSE_TUTORIAL" desc="The text shown on the button for closing a tutorial"> - Close - </message> <if expr="use_titlecase"> <message name="IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP" desc="The description of the add tab step in the tab group tutorial"> Right-click on a tab and select "Add Tab To New Group"
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index f4b4a6e..dee4f9c 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -666,6 +666,10 @@ </if> <!-- Download Bubble Items --> + <message name="IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE" + desc="Message shown to the user to validate the download of a dangerous file."> + Chrome blocked this file because this type of file is dangerous + </message> <message name="IDS_DOWNLOAD_BUBBLE_MALICIOUS_URL_BLOCKED" desc="Message shown to the user to validate the download when the download url is classified to lead to malware by the safebrowsing database."> Chrome blocked this file because it is dangerous
diff --git a/chrome/app/google_chrome_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1 new file mode 100644 index 0000000..e89dd6a1 --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE.png.sha1
@@ -0,0 +1 @@ +895f105e27e573832565d535497c83b184ebe76b \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 0258e030..90a90cb8 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -3668,6 +3668,9 @@ "autofill_assistant/password_change/apc_client.h", "autofill_assistant/password_change/apc_client_impl.cc", "autofill_assistant/password_change/apc_client_impl.h", + "autofill_assistant/password_change/apc_onboarding_coordinator.h", + "autofill_assistant/password_change/apc_onboarding_coordinator_impl.cc", + "autofill_assistant/password_change/apc_onboarding_coordinator_impl.h", "background/background_contents.cc", "background/background_contents.h", "background/background_contents_service_observer.h", @@ -4729,6 +4732,8 @@ "google/google_brand_code_map_chromeos.cc", "google/google_brand_code_map_chromeos.h", "icon_loader_chromeos.cc", + "lifetime/application_lifetime_chromeos.cc", + "lifetime/application_lifetime_chromeos.h", "media/chromeos_login_media_access_handler.cc", "media/chromeos_login_media_access_handler.h", "media/public_session_media_access_handler.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 9dd85b0..61764afd 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4670,10 +4670,6 @@ kOsCrOS, SINGLE_VALUE_TYPE( ::switches::kEnableExperimentalAccessibilitySwitchAccessText)}, - {"enable-experimental-kernel-vm-support", - flag_descriptions::kKernelnextVMsName, - flag_descriptions::kKernelnextVMsDescription, kOsCrOS, - FEATURE_VALUE_TYPE(features::kKernelnextVMs)}, {"enable-magnifier-continuous-mouse-following-mode-setting", flag_descriptions::kMagnifierContinuousMouseFollowingModeSettingName, flag_descriptions::
diff --git a/chrome/browser/apps/app_discovery_service/game_extras.cc b/chrome/browser/apps/app_discovery_service/game_extras.cc index 6a8825d..cda665d 100644 --- a/chrome/browser/apps/app_discovery_service/game_extras.cc +++ b/chrome/browser/apps/app_discovery_service/game_extras.cc
@@ -15,11 +15,13 @@ const std::u16string& source, const std::u16string& publisher, const base::FilePath& relative_icon_path, + const bool is_icon_masking_allowed, const GURL& deeplink_url) : platforms_(platforms), source_(source), publisher_(publisher), relative_icon_path_(relative_icon_path), + is_icon_masking_allowed_(is_icon_masking_allowed), deeplink_url_(deeplink_url) {} GameExtras::GameExtras(const GameExtras&) = default; @@ -51,6 +53,10 @@ return relative_icon_path_; } +bool GameExtras::GetIsIconMaskingAllowed() const { + return is_icon_masking_allowed_; +} + const GURL& GameExtras::GetDeeplinkUrl() const { return deeplink_url_; }
diff --git a/chrome/browser/apps/app_discovery_service/game_extras.h b/chrome/browser/apps/app_discovery_service/game_extras.h index 5d83e86..747148a 100644 --- a/chrome/browser/apps/app_discovery_service/game_extras.h +++ b/chrome/browser/apps/app_discovery_service/game_extras.h
@@ -21,6 +21,7 @@ const std::u16string& source, const std::u16string& publisher, const base::FilePath& relative_icon_path, + const bool is_icon_masking_allowed, const GURL& deeplink_url); GameExtras(const GameExtras&); GameExtras& operator=(const GameExtras&) = delete; @@ -37,6 +38,7 @@ // The company that published the game. const std::u16string& GetPublisher() const; const base::FilePath& GetRelativeIconPath() const; + bool GetIsIconMaskingAllowed() const; const GURL& GetDeeplinkUrl() const; private: @@ -44,6 +46,7 @@ std::u16string source_; std::u16string publisher_; base::FilePath relative_icon_path_; + bool is_icon_masking_allowed_; GURL deeplink_url_; };
diff --git a/chrome/browser/apps/app_discovery_service/game_fetcher.cc b/chrome/browser/apps/app_discovery_service/game_fetcher.cc index 5762f78..0882d9cc5 100644 --- a/chrome/browser/apps/app_discovery_service/game_fetcher.cc +++ b/chrome/browser/apps/app_discovery_service/game_fetcher.cc
@@ -219,6 +219,7 @@ base::UTF8ToUTF16(app_with_locale.app().source_name()), base::UTF8ToUTF16(app_with_locale.app().publisher_name()), base::FilePath(app_with_locale.app().icon_info().icon_path()), + app_with_locale.app().icon_info().is_masking_allowed(), GURL(app_with_locale.app().deeplink())); results.push_back(Result( AppSource::kGames, app_with_locale.app().app_id_for_platform(),
diff --git a/chrome/browser/apps/app_provisioning_service/proto/app_data.proto b/chrome/browser/apps/app_provisioning_service/proto/app_data.proto index f01bff54..2232b0b 100644 --- a/chrome/browser/apps/app_provisioning_service/proto/app_data.proto +++ b/chrome/browser/apps/app_provisioning_service/proto/app_data.proto
@@ -49,4 +49,5 @@ message IconInfo { optional string icon_path = 1; + optional bool is_masking_allowed = 2; }
diff --git a/chrome/browser/apps/platform_apps/app_browsertest.cc b/chrome/browser/apps/platform_apps/app_browsertest.cc index c1426bf6e..c496e41 100644 --- a/chrome/browser/apps/platform_apps/app_browsertest.cc +++ b/chrome/browser/apps/platform_apps/app_browsertest.cc
@@ -9,6 +9,7 @@ #include "apps/launcher.h" #include "base/auto_reset.h" #include "base/bind.h" +#include "base/callback_helpers.h" #include "base/command_line.h" #include "base/containers/contains.h" #include "base/files/file_util.h" @@ -72,6 +73,7 @@ #include "url/gurl.h" #if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h" #include "chrome/browser/ash/login/users/mock_user_manager.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "components/user_manager/scoped_user_manager.h" @@ -1339,53 +1341,48 @@ class RestartDeviceTest : public PlatformAppBrowserTest { public: - RestartDeviceTest() = default; - RestartDeviceTest(const RestartDeviceTest&) = delete; - RestartDeviceTest& operator=(const RestartDeviceTest&) = delete; - ~RestartDeviceTest() override = default; - - // PlatformAppBrowserTest overrides - void SetUpInProcessBrowserTestFixture() override { - PlatformAppBrowserTest::SetUpInProcessBrowserTestFixture(); - } - void SetUpOnMainThread() override { PlatformAppBrowserTest::SetUpOnMainThread(); - mock_user_manager_ = new ash::MockUserManager; - user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>( - base::WrapUnique(mock_user_manager_)); - - EXPECT_CALL(*mock_user_manager_, IsUserLoggedIn()) - .WillRepeatedly(testing::Return(true)); - EXPECT_CALL(*mock_user_manager_, IsLoggedInAsKioskApp()) - .WillRepeatedly(testing::Return(true)); - EXPECT_CALL(*mock_user_manager_, GetLoggedInUsers()) - .WillRepeatedly(testing::Invoke(mock_user_manager_, - &ash::MockUserManager::GetUsers)); + // Disable "faked" shutdown of Chrome if the OS was supposed to restart. + // The fakes this test injects would cause it to crash. + chromeos::FakePowerManagerClient* fake_power_manager_client = + chromeos::FakePowerManagerClient::Get(); + ASSERT_NE(nullptr, fake_power_manager_client); + fake_power_manager_client->set_restart_callback(base::DoNothing()); } void TearDownOnMainThread() override { - user_manager_enabler_.reset(); PlatformAppBrowserTest::TearDownOnMainThread(); + user_manager_enabler_.reset(); + fake_user_manager_ = nullptr; } - void TearDownInProcessBrowserTestFixture() override { - PlatformAppBrowserTest::TearDownInProcessBrowserTestFixture(); - } - - int num_request_restart_calls() const { + protected: + static int num_request_restart_calls() { return chromeos::FakePowerManagerClient::Get()->num_request_restart_calls(); } + void EnterKioskSession() { + fake_user_manager_ = new ash::FakeChromeUserManager(); + user_manager_enabler_ = std::make_unique<user_manager::ScopedUserManager>( + base::WrapUnique(fake_user_manager_)); + + const AccountId kiosk_account_id( + AccountId::FromUserEmail("kiosk@foobar.com")); + fake_user_manager_->AddKioskAppUser(kiosk_account_id); + fake_user_manager_->LoginUser(kiosk_account_id); + } + private: - ash::MockUserManager* mock_user_manager_ = nullptr; + ash::FakeChromeUserManager* fake_user_manager_ = nullptr; std::unique_ptr<user_manager::ScopedUserManager> user_manager_enabler_; }; // Tests that chrome.runtime.restart would request device restart in // ChromeOS kiosk mode. IN_PROC_BROWSER_TEST_F(RestartDeviceTest, Restart) { + EnterKioskSession(); ASSERT_EQ(0, num_request_restart_calls()); ExtensionTestMessageListener launched_listener("Launched", true);
diff --git a/chrome/browser/ash/apps/apk_web_app_installer.cc b/chrome/browser/ash/apps/apk_web_app_installer.cc index 62a0ab6..4364fb02 100644 --- a/chrome/browser/ash/apps/apk_web_app_installer.cc +++ b/chrome/browser/ash/apps/apk_web_app_installer.cc
@@ -13,9 +13,10 @@ #include "chrome/browser/ash/crosapi/crosapi_manager.h" #include "chrome/browser/ash/crosapi/web_app_service_ash.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/user_display_mode.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_utils.h" @@ -212,12 +213,13 @@ // Doesn't overwrite already existing web app with manifest fields from the // apk. GURL start_url = web_app_install_info_->start_url; - provider->install_manager().InstallWebAppFromInfo( - std::move(web_app_install_info_), - /*overwrite_existing_manifest_fields=*/false, - web_app::ForInstallableSite::kYes, webapps::WebappInstallSource::ARC, - base::BindOnce(&ApkWebAppInstaller::OnWebAppCreated, - base::Unretained(this), std::move(start_url))); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(web_app_install_info_), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::ARC, + base::BindOnce(&ApkWebAppInstaller::OnWebAppCreated, + base::Unretained(this), std::move(start_url)))); } }
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index 28f32650..5126a37 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc
@@ -200,6 +200,7 @@ #include "chromeos/components/sensors/ash/sensor_hal_dispatcher.h" #include "chromeos/dbus/constants/cryptohome_key_delegate_constants.h" #include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/power/power_policy_controller.h" #include "chromeos/dbus/session_manager/fake_session_manager_client.h" @@ -212,6 +213,7 @@ #include "chromeos/network/network_handler.h" #include "chromeos/network/portal_detector/network_portal_detector_stub.h" #include "chromeos/network/system_token_cert_db_storage.h" +#include "chromeos/services/cros_healthd/private/cpp/data_collector.h" #include "chromeos/services/cros_healthd/public/cpp/service_connection.h" #include "chromeos/services/machine_learning/public/cpp/service_connection.h" #include "chromeos/system/statistics_provider.h" @@ -292,12 +294,35 @@ prefs->SetBoolean(::prefs::kSafeBrowsingEnabled, false); } -void FakeSessionStopped() { - // Session manager would ask Chrome to exit. Fake this behavior. +#if !defined(USE_REAL_DBUS_CLIENTS) +chromeos::FakeSessionManagerClient* FakeSessionManagerClient() { + chromeos::FakeSessionManagerClient* fake_session_manager_client = + chromeos::FakeSessionManagerClient::Get(); + DCHECK(fake_session_manager_client); + return fake_session_manager_client; +} + +chromeos::FakePowerManagerClient* FakePowerManagerClient() { + chromeos::FakePowerManagerClient* fake_power_manager_client = + chromeos::FakePowerManagerClient::Get(); + DCHECK(fake_power_manager_client); + return fake_power_manager_client; +} + +void FakeShutdownSignal() { + // Receiving SIGTERM would result in `ExitIgnoreUnloadHandlers`. base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&chrome::ExitIgnoreUnloadHandlers)); } +void InstallFakeShutdownCalls() { + FakeSessionManagerClient()->set_stop_session_callback( + base::BindOnce(&FakeShutdownSignal)); + FakePowerManagerClient()->set_restart_callback( + base::BindOnce(&FakeShutdownSignal)); +} +#endif // !defined(USE_REAL_DBUS_CLIENTS) + } // namespace namespace internal { @@ -617,7 +642,7 @@ CHECK(DBusThreadManager::IsInitialized()); #if !defined(USE_REAL_DBUS_CLIENTS) - // USE_REAL_DBUS clients may be undefined even if the device is using reals + // USE_REAL_DBUS clients may be undefined even if the device is using real // dbus clients. if (!base::SysInfo::IsRunningOnChromeOS()) { if (command_line->HasSwitch(switches::kFakeDriveFsLauncherChrootPath) && @@ -633,11 +658,10 @@ base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); FakeUserDataAuthClient::Get()->set_user_data_dir(user_data_dir); - chromeos::FakeSessionManagerClient* fake_session_manager_client = - chromeos::FakeSessionManagerClient::Get(); - DCHECK(fake_session_manager_client); - fake_session_manager_client->set_stop_session_callback( - base::BindOnce(&FakeSessionStopped)); + // If we're not running on a device, i.e. either in a test or in ash Chrome + // on linux, fake dbus calls that would result in a shutdown of Chrome by + // the system. + InstallFakeShutdownCalls(); } #endif // !defined(USE_REAL_DBUS_CLIENTS) @@ -1112,6 +1136,9 @@ // Initialize the NetworkHealth aggregator. network_health::NetworkHealthService::GetInstance(); + // Create cros_healthd data collector. + cros_healthd::internal::DataCollector::Initialize(); + // Create the service connection to CrosHealthd platform service instance. auto* cros_healthd = cros_healthd::ServiceConnection::GetInstance();
diff --git a/chrome/browser/ash/crosapi/BUILD.gn b/chrome/browser/ash/crosapi/BUILD.gn index 1b20fd6..151585fd 100644 --- a/chrome/browser/ash/crosapi/BUILD.gn +++ b/chrome/browser/ash/crosapi/BUILD.gn
@@ -261,6 +261,7 @@ "//services/device/wake_lock/power_save_blocker", "//services/video_capture/public/cpp:cpp", "//services/video_capture/public/mojom", + "//ui/base", "//ui/message_center", "//ui/message_center/public/cpp", "//ui/shell_dialogs",
diff --git a/chrome/browser/ash/crosapi/browser_manager.cc b/chrome/browser/ash/crosapi/browser_manager.cc index 6c466ae..cf7fc5e 100644 --- a/chrome/browser/ash/crosapi/browser_manager.cc +++ b/chrome/browser/ash/crosapi/browser_manager.cc
@@ -31,6 +31,7 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "base/path_service.h" #include "base/posix/eintr_wrapper.h" #include "base/process/launch.h" #include "base/process/process_handle.h" @@ -66,6 +67,7 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/shelf/chrome_shelf_controller.h" #include "chrome/common/channel_info.h" +#include "chrome/common/chrome_paths.h" #include "chromeos/crosapi/cpp/crosapi_constants.h" #include "chromeos/crosapi/cpp/lacros_startup_state.h" #include "chromeos/startup/startup_switches.h" @@ -84,6 +86,7 @@ #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/platform/platform_channel.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/base/resource/temporary_shared_resource_path_chromeos.h" #include "ui/base/ui_base_features.h" #include "ui/base/ui_base_switches.h" #include "ui/message_center/public/cpp/notification_delegate.h" @@ -192,11 +195,44 @@ return false; } +// Return false when there is a failure that might break resource file sharing +// feature. +bool ClearOrMoveSharedResourceFile(bool clear_shared_resource_file) { + base::FilePath shared_resource_path; + // If shared resource pak doesn't exit, do nothing. + if (!base::PathService::Get(chrome::FILE_RESOURCES_FOR_SHARING_PACK, + &shared_resource_path) || + !base::PathExists(shared_resource_path)) { + return true; + } + + // Clear shared resource file cache if `clear_shared_resource_file` is true. + if (clear_shared_resource_file) { + if (!base::DeleteFile(shared_resource_path)) { + LOG(ERROR) << "Failed to delete cached shared resource file."; + return false; + } + return true; + } + + base::FilePath renamed_shared_resource_path = + ui::GetPathForTemporarySharedResourceFile(shared_resource_path); + + // Move shared resource pak to `renamed_shared_resource_path`. + if (!base::Move(shared_resource_path, renamed_shared_resource_path)) { + LOG(ERROR) << "Failed to move cached shared resource file to temporary " + << "location."; + return false; + } + return true; +} + // This method runs some work on a background thread prior to launching lacros. // The returns struct is used by the main thread as parameters to launch Lacros. LaunchParamsFromBackground DoLacrosBackgroundWorkPreLaunch( base::FilePath lacros_dir, - bool cleared_user_data_dir) { + bool cleared_user_data_dir, + bool clear_shared_resource_file) { LaunchParamsFromBackground params; if (!RotateLacrosLogs()) { @@ -221,6 +257,20 @@ } params.logfd = base::ScopedFD(fd); + + params.enable_resource_file_sharing = + base::FeatureList::IsEnabled(features::kLacrosResourcesFileSharing); + // If resource file sharing feature is disabled, clear the cached shared + // resource file anyway. + if (!params.enable_resource_file_sharing) + clear_shared_resource_file = true; + + // Clear shared resource file cache if it's initial lacros launch after ash + // reboot. If not, rename shared resource file cache to temporal name on + // Lacros launch. + if (!ClearOrMoveSharedResourceFile(clear_shared_resource_file)) + params.enable_resource_file_sharing = false; + return params; } @@ -881,10 +931,14 @@ base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&DoLacrosBackgroundWorkPreLaunch, lacros_path_, - cleared_user_data_dir), + cleared_user_data_dir, + is_initial_lacros_launch_after_reboot_), base::BindOnce(&BrowserManager::StartWithLogFile, weak_factory_.GetWeakPtr(), std::move(initial_browser_action))); + + // Set false to prepare for the next Lacros launch. + is_initial_lacros_launch_after_reboot_ = false; } void BrowserManager::StartWithLogFile( @@ -1049,7 +1103,7 @@ command_line.AppendSwitch(switches::kEnableCrashpad); } - if (base::FeatureList::IsEnabled(features::kLacrosResourcesFileSharing)) { + if (params.enable_resource_file_sharing) { // Pass a flag to enable resources file sharing to Lacros. // To use resources file sharing feature on Lacros, it's required for ash to // run with enabling the feature as well since the feature is based on some
diff --git a/chrome/browser/ash/crosapi/browser_manager.h b/chrome/browser/ash/crosapi/browser_manager.h index 1a56a47..baed518 100644 --- a/chrome/browser/ash/crosapi/browser_manager.h +++ b/chrome/browser/ash/crosapi/browser_manager.h
@@ -280,6 +280,9 @@ // An fd for a log file. base::ScopedFD logfd; + + // Set true if Lacros uses resource file sharing. + bool enable_resource_file_sharing = false; }; protected: @@ -573,6 +576,11 @@ // Tracks whether lacros-chrome is terminated. bool is_terminated_ = false; + // True if Lacros has not yet launched after the latest ash reboot. + // This value is used for resource sharing feature where ash deletes cached + // shared resource file after ash is rebooted. + bool is_initial_lacros_launch_after_reboot_ = true; + // Helps set up and manage the mojo connections between lacros-chrome and // ash-chrome in testing environment. Only applicable when // '--lacros-mojo-socket-for-testing' is present in the command line.
diff --git a/chrome/browser/ash/crostini/crostini_features.cc b/chrome/browser/ash/crostini/crostini_features.cc index 5740de3..2ca99ab 100644 --- a/chrome/browser/ash/crostini/crostini_features.cc +++ b/chrome/browser/ash/crostini/crostini_features.cc
@@ -5,8 +5,6 @@ #include "chrome/browser/ash/crostini/crostini_features.h" #include "ash/constants/ash_features.h" -#include "ash/constants/ash_switches.h" -#include "base/command_line.h" #include "base/feature_list.h" #include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" @@ -207,20 +205,6 @@ return false; } - bool kernelnext = base::CommandLine::ForCurrentProcess()->HasSwitch( - ash::switches::kKernelnextRestrictVMs); - bool kernelnext_override = - base::FeatureList::IsEnabled(features::kKernelnextVMs); - if (kernelnext && !kernelnext_override) { - // The host kernel is on an experimental version. In future updates this - // device may not have VM support, so we allow enabling VMs, but guard them - // on a chrome://flags switch (enable-experimental-kernel-vm-support). - VLOG(1) << "Cannot run crostini on experimental kernel without " - << "--enable-experimental-kernel-vm-support."; - *reason = "Crostini can not run on experimental kernel by default"; - return false; - } - return true; }
diff --git a/chrome/browser/ash/drive/drivefs_test_support.cc b/chrome/browser/ash/drive/drivefs_test_support.cc index 5796bfe..27be1520 100644 --- a/chrome/browser/ash/drive/drivefs_test_support.cc +++ b/chrome/browser/ash/drive/drivefs_test_support.cc
@@ -49,15 +49,15 @@ } bool SetUpUserDataDirectoryForDriveFsTest() { - auto known_users_list = std::make_unique<base::ListValue>(); - auto user_dict = std::make_unique<base::DictionaryValue>(); - user_dict->SetStringKey("account_type", "google"); - user_dict->SetStringKey("email", "testuser@gmail.com"); - user_dict->SetStringKey("gaia_id", "123456"); - known_users_list->Append(std::move(user_dict)); + base::Value::List known_users_list; + base::Value::Dict user_dict; + user_dict.Set("account_type", "google"); + user_dict.Set("email", "testuser@gmail.com"); + user_dict.Set("gaia_id", "123456"); + known_users_list.Append(std::move(user_dict)); - base::DictionaryValue local_state; - local_state.SetList("KnownUsers", std::move(known_users_list)); + base::Value::Dict local_state; + local_state.Set("KnownUsers", std::move(known_users_list)); std::string local_state_json; if (!base::JSONWriter::Write(local_state, &local_state_json)) @@ -67,8 +67,7 @@ if (!base::PathService::Get(chrome::DIR_USER_DATA, &local_state_file)) return false; local_state_file = local_state_file.Append(chrome::kLocalStateFilename); - return base::WriteFile(local_state_file, local_state_json.data(), - local_state_json.size()) != -1; + return base::WriteFile(local_state_file, local_state_json); } } // namespace drive
diff --git a/chrome/browser/ash/input_method/emoji_suggester.cc b/chrome/browser/ash/input_method/emoji_suggester.cc index 35bf3c8..c74a87c 100644 --- a/chrome/browser/ash/input_method/emoji_suggester.cc +++ b/chrome/browser/ash/input_method/emoji_suggester.cc
@@ -25,6 +25,7 @@ #include "chrome/grit/generated_resources.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/strings/grit/components_strings.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/l10n/l10n_util.h" #include "ui/events/keycodes/dom/dom_code.h" @@ -151,11 +152,15 @@ } void EmojiSuggester::OnFocus(int context_id) { - context_id_ = context_id; + // Some parts of the code reserve negative/zero context_id for unfocused + // context. As a result we should make sure it is not being erroneously set to + // a negative number, and cause unexpected behaviour. + DCHECK(context_id > 0); + focused_context_id_ = context_id; } void EmojiSuggester::OnBlur() { - context_id_ = -1; + focused_context_id_ = absl::nullopt; } void EmojiSuggester::OnExternalSuggestionsUpdated( @@ -224,7 +229,7 @@ bool EmojiSuggester::TrySuggestWithSurroundingText(const std::u16string& text, int cursor_pos, int anchor_pos) { - if (emoji_map_.empty()) + if (emoji_map_.empty() || !focused_context_id_.has_value()) return false; // All these below conditions are required for a emoji suggestion to be @@ -284,20 +289,29 @@ } void EmojiSuggester::ShowSuggestionWindow() { + if (!focused_context_id_.has_value()) { + LOG(ERROR) << "suggest: Failed to show suggestion. No context id."; + } + std::string error; - suggestion_handler_->SetAssistiveWindowProperties(context_id_, properties_, - &error); + suggestion_handler_->SetAssistiveWindowProperties(*focused_context_id_, + properties_, &error); if (!error.empty()) { LOG(ERROR) << "Fail to show suggestion. " << error; } } bool EmojiSuggester::AcceptSuggestion(size_t index) { + if (!focused_context_id_.has_value()) { + LOG(ERROR) << "suggest: Failed to accept suggestion. No context id."; + return false; + } + if (index < 0 || index >= candidates_.size()) return false; std::string error; - suggestion_handler_->AcceptSuggestionCandidate(context_id_, + suggestion_handler_->AcceptSuggestionCandidate(*focused_context_id_, candidates_[index], &error); if (!error.empty()) { @@ -311,12 +325,17 @@ } void EmojiSuggester::DismissSuggestion() { + if (!focused_context_id_.has_value()) { + LOG(ERROR) << "suggest: Failed to dismiss suggestion. No context id."; + return; + } + std::string error; properties_.visible = false; properties_.announce_string = l10n_util::GetStringUTF16(IDS_SUGGESTION_DISMISSED); - suggestion_handler_->SetAssistiveWindowProperties(context_id_, properties_, - &error); + suggestion_handler_->SetAssistiveWindowProperties(*focused_context_id_, + properties_, &error); if (!error.empty()) { LOG(ERROR) << "Failed to dismiss suggestion. " << error; return; @@ -327,9 +346,13 @@ void EmojiSuggester::SetButtonHighlighted( const ui::ime::AssistiveWindowButton& button, bool highlighted) { + if (!focused_context_id_.has_value()) { + LOG(ERROR) << "suggest: Failed to set button highlighted. No context id."; + return; + } std::string error; - suggestion_handler_->SetButtonHighlighted(context_id_, button, highlighted, - &error); + suggestion_handler_->SetButtonHighlighted(*focused_context_id_, button, + highlighted, &error); if (!error.empty()) { LOG(ERROR) << "Failed to set button highlighted. " << error; }
diff --git a/chrome/browser/ash/input_method/emoji_suggester.h b/chrome/browser/ash/input_method/emoji_suggester.h index 17a9dc6..17c8f19c 100644 --- a/chrome/browser/ash/input_method/emoji_suggester.h +++ b/chrome/browser/ash/input_method/emoji_suggester.h
@@ -14,6 +14,7 @@ #include "chrome/browser/ash/input_method/suggestion_enums.h" #include "chrome/browser/ash/input_method/suggestion_handler_interface.h" #include "chrome/browser/ash/input_method/ui/assistive_delegate.h" +#include "third_party/abseil-cpp/absl/types/optional.h" class Profile; @@ -71,8 +72,8 @@ SuggestionHandlerInterface* const suggestion_handler_; Profile* profile_; - // ID of the focused text field, 0 if none is focused. - int context_id_ = -1; + // ID of the focused text field, nullopt if none is focused. + absl::optional<int> focused_context_id_; // If we are showing a suggestion right now. bool suggestion_shown_ = false;
diff --git a/chrome/browser/ash/input_method/emoji_suggester_unittest.cc b/chrome/browser/ash/input_method/emoji_suggester_unittest.cc index 656067b..e3d7fc5 100644 --- a/chrome/browser/ash/input_method/emoji_suggester_unittest.cc +++ b/chrome/browser/ash/input_method/emoji_suggester_unittest.cc
@@ -30,6 +30,7 @@ } const char kEmojiData[] = "happy,😀;😃;😄"; +const int kContextId = 24601; class TestSuggestionHandler : public SuggestionHandlerInterface { public: @@ -58,6 +59,7 @@ int context_id, const AssistiveWindowProperties& assistive_window, std::string* error) override { + context_id_ = context_id; candidate_highlighted_.clear(); for (size_t i = 0; i < assistive_window.candidates.size(); i++) { candidate_highlighted_.push_back(0); @@ -84,6 +86,10 @@ EXPECT_EQ(show_setting_link_, show_setting_link); } + void VerifyContextId(const int context_id) { + EXPECT_EQ(context_id_, context_id); + } + bool DismissSuggestion(int context_id, std::string* error) override { return false; } @@ -117,6 +123,7 @@ bool learn_more_button_highlighted_ = false; std::vector<int> candidate_highlighted_; size_t currently_highlighted_index_ = INT_MAX; + int context_id_ = -1; }; class EmojiSuggesterTest : public testing::Test { @@ -130,6 +137,7 @@ chrome_keyboard_controller_client_ = ChromeKeyboardControllerClient::CreateForTest(); chrome_keyboard_controller_client_->set_keyboard_visible_for_test(false); + emoji_suggester_->OnFocus(kContextId); } SuggestionStatus Press(ui::DomCode code) { @@ -148,6 +156,11 @@ EXPECT_TRUE(emoji_suggester_->TrySuggestWithSurroundingText(u"happy ", 6, 6)); } +TEST_F(EmojiSuggesterTest, PassesContextIdToHandlerOnSuggestion) { + emoji_suggester_->TrySuggestWithSurroundingText(u"happy ", 6, 6); + engine_->VerifyContextId(kContextId); +} + TEST_F(EmojiSuggesterTest, SuggestWhenStringStartsWithOpenBracket) { EXPECT_TRUE( emoji_suggester_->TrySuggestWithSurroundingText(u"(happy ", 7, 7)); @@ -180,6 +193,12 @@ EXPECT_FALSE(emoji_suggester_->TrySuggestWithSurroundingText(u"hapy ", 5, 5)); } +TEST_F(EmojiSuggesterTest, DoNotSuggestAfterBlur) { + emoji_suggester_->OnBlur(); + EXPECT_FALSE( + emoji_suggester_->TrySuggestWithSurroundingText(u"happy ", 6, 6)); +} + TEST_F(EmojiSuggesterTest, DoNotShowSuggestionWhenVirtualKeyboardEnabled) { chrome_keyboard_controller_client_->set_keyboard_visible_for_test(true); EXPECT_TRUE(emoji_suggester_->TrySuggestWithSurroundingText(u"happy ", 6, 6));
diff --git a/chrome/browser/ash/input_method/multi_word_suggester.cc b/chrome/browser/ash/input_method/multi_word_suggester.cc index 0d8ae42..7ae21f3 100644 --- a/chrome/browser/ash/input_method/multi_word_suggester.cc +++ b/chrome/browser/ash/input_method/multi_word_suggester.cc
@@ -130,7 +130,7 @@ // Some parts of the code reserve negative/zero context_id for unfocused // context. As a result we should make sure it is not being erroneously set to // a negative number, and cause unexpected behaviour. - DCHECK(context_id); + DCHECK(context_id > 0); focused_context_id_ = context_id; state_.ResetSuggestion(); }
diff --git a/chrome/browser/ash/input_method/native_input_method_engine.cc b/chrome/browser/ash/input_method/native_input_method_engine.cc index d883a2a..7d21f5f 100644 --- a/chrome/browser/ash/input_method/native_input_method_engine.cc +++ b/chrome/browser/ash/input_method/native_input_method_engine.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ash/input_method/grammar_service_client.h" #include "chrome/browser/ash/input_method/input_method_quick_settings_helpers.h" #include "chrome/browser/ash/input_method/input_method_settings.h" +#include "chrome/browser/ash/input_method/native_input_method_engine_observer.h" #include "chrome/browser/ash/input_method/suggestions_service_client.h" #include "chrome/browser/ash/input_method/ui/input_method_menu_manager.h" #include "chrome/browser/profiles/profile_manager.h" @@ -44,496 +45,9 @@ #include "ui/events/keycodes/dom/keycode_converter.h" namespace ash { + namespace input_method { -namespace { - -namespace mojom = ::ash::ime::mojom; - -// These are persisted to logs. Entries should not be renumbered. Numeric values -// should not be reused. Must stay in sync with IMENonAutocorrectDiacriticStatus -// enum in: tools/metrics/histograms/enums.xml -enum class NonAutocorrectDiacriticStatus { - kWithoutDiacritics = 0, - kWithDiacritics = 1, - kMaxValue = kWithDiacritics, -}; - -bool IsRuleBasedEngine(const std::string& engine_id) { - return base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE); -} - -bool IsFstEngine(const std::string& engine_id) { - return base::StartsWith(engine_id, "xkb:", base::CompareCase::SENSITIVE) || - base::StartsWith(engine_id, "experimental_", - base::CompareCase::SENSITIVE); -} - -bool IsKoreanEngine(const std::string& engine_id) { - return base::StartsWith(engine_id, "ko-", base::CompareCase::SENSITIVE); -} - -bool IsChineseEngine(const std::string& engine_id) { - return engine_id == "zh-t-i0-pinyin" || engine_id == "zh-hant-t-i0-pinyin" || - engine_id == "zh-hant-t-i0-cangjie-1987" || - engine_id == "zh-hant-t-i0-cangjie-1987-x-m0-simplified" || - engine_id == "yue-hant-t-i0-und" || engine_id == "zh-t-i0-wubi-1986" || - engine_id == "zh-hant-t-i0-array-1992" || - engine_id == "zh-hant-t-i0-dayi-1988" || - engine_id == "zh-hant-t-i0-und"; -} - -bool IsJapaneseEngine(const std::string& engine_id) { - return engine_id == "nacl_mozc_jp" || engine_id == "nacl_mozc_us"; -} - -bool IsUsEnglishEngine(const std::string& engine_id) { - return engine_id == "xkb:us::eng"; -} - -bool IsTransliterationEngine(const std::string& engine_id) { - return engine_id == "ar-t-i0-und" || engine_id == "el-t-i0-und" || - engine_id == "gu-t-i0-und" || engine_id == "he-t-i0-und" || - engine_id == "hi-t-i0-und" || engine_id == "kn-t-i0-und" || - engine_id == "ml-t-i0-und" || engine_id == "mr-t-i0-und" || - engine_id == "ne-t-i0-und" || engine_id == "or-t-i0-und" || - engine_id == "fa-t-i0-und" || engine_id == "pa-t-i0-und" || - engine_id == "sa-t-i0-und" || engine_id == "ta-t-i0-und" || - engine_id == "te-t-i0-und" || engine_id == "ur-t-i0-und"; -} - -bool CanRouteToNativeMojoEngine(const std::string& engine_id) { - // To avoid handling tricky cases where the user types with both the virtual - // and the physical keyboard, only run the native code path if the virtual - // keyboard is disabled. Otherwise, just let the extension handle any physical - // key events. - if (ChromeKeyboardControllerClient::Get()->GetKeyboardEnabled()) { - return false; - } - - return (base::FeatureList::IsEnabled( - features::kSystemChinesePhysicalTyping) && - IsChineseEngine(engine_id)) || - (base::FeatureList::IsEnabled( - features::kSystemJapanesePhysicalTyping) && - IsJapaneseEngine(engine_id)) || - (base::FeatureList::IsEnabled( - features::kSystemTransliterationPhysicalTyping) && - IsTransliterationEngine(engine_id)) || - IsKoreanEngine(engine_id) || IsFstEngine(engine_id); -} - -bool IsPhysicalKeyboardAutocorrectEnabled(PrefService* prefs, - const std::string& engine_id) { - if (base::StartsWith(engine_id, "experimental_", - base::CompareCase::SENSITIVE) || - base::FeatureList::IsEnabled(features::kAutocorrectParamsTuning)) { - return true; - } - - const base::Value* input_method_settings = - prefs->GetDictionary(::prefs::kLanguageInputMethodSpecificSettings); - const base::Value* autocorrect_setting = input_method_settings->FindPath( - engine_id + ".physicalKeyboardAutoCorrectionLevel"); - return autocorrect_setting && autocorrect_setting->GetIfInt().value_or(0) > 0; -} - -bool IsLacrosEnabled() { - return base::FeatureList::IsEnabled(chromeos::features::kLacrosSupport); -} - -bool IsPredictiveWritingEnabled(PrefService* pref_service, - const std::string& engine_id) { - return (!IsLacrosEnabled() && features::IsAssistiveMultiWordEnabled() && - IsPredictiveWritingPrefEnabled(pref_service, engine_id) && - IsUsEnglishEngine(engine_id)); -} - -std::string NormalizeRuleBasedEngineId(const std::string engine_id) { - // For legacy reasons, |engine_id| starts with "vkd_" in the input method - // manifest, but the InputEngineManager expects the prefix "m17n:". - // TODO(https://crbug.com/1012490): Migrate to m17n prefix and remove this. - if (base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE)) { - return "m17n:" + engine_id.substr(4); - } - return engine_id; -} - -mojom::ModifierStatePtr ModifierStateFromEvent(const ui::KeyEvent& event) { - auto modifier_state = mojom::ModifierState::New(); - modifier_state->alt = event.flags() & ui::EF_ALT_DOWN; - modifier_state->alt_graph = event.flags() & ui::EF_ALTGR_DOWN; - modifier_state->caps_lock = event.flags() & ui::EF_CAPS_LOCK_ON; - modifier_state->control = event.flags() & ui::EF_CONTROL_DOWN; - modifier_state->shift = event.flags() & ui::EF_SHIFT_DOWN; - return modifier_state; -} - -mojom::InputFieldType TextInputTypeToMojoType(ui::TextInputType type) { - using mojom::InputFieldType; - switch (type) { - case ui::TEXT_INPUT_TYPE_PASSWORD: - return InputFieldType::kPassword; - case ui::TEXT_INPUT_TYPE_SEARCH: - return InputFieldType::kSearch; - case ui::TEXT_INPUT_TYPE_EMAIL: - return InputFieldType::kEmail; - case ui::TEXT_INPUT_TYPE_TELEPHONE: - return InputFieldType::kTelephone; - case ui::TEXT_INPUT_TYPE_URL: - return InputFieldType::kURL; - case ui::TEXT_INPUT_TYPE_NUMBER: - return InputFieldType::kNumber; - case ui::TEXT_INPUT_TYPE_NULL: - return InputFieldType::kNoIME; - case ui::TEXT_INPUT_TYPE_TEXT: - return InputFieldType::kText; - default: - return InputFieldType::kText; - } -} - -mojom::AutocorrectMode AutocorrectFlagsToMojoType(int flags) { - if (((flags & ui::TEXT_INPUT_FLAG_AUTOCORRECT_OFF) || - (flags & ui::TEXT_INPUT_FLAG_SPELLCHECK_OFF))) { - return mojom::AutocorrectMode::kDisabled; - } - return mojom::AutocorrectMode::kEnabled; -} - -enum class ImeServiceEvent { - kUnknown = 0, - kInitSuccess = 1, - kInitFailed = 2, - kActivateImeSuccess = 3, - kActivateImeFailed = 4, - kServiceDisconnected = 5, - kMaxValue = kServiceDisconnected -}; - -void LogEvent(ImeServiceEvent event) { - UMA_HISTOGRAM_ENUMERATION("InputMethod.Mojo.Extension.Event", event); -} - -// Not using a EnumTraits here because the mapping is not 1:1. -mojom::DomCode DomCodeToMojom(const ui::DomCode code) { - switch (code) { - case ui::DomCode::BACKQUOTE: - return mojom::DomCode::kBackquote; - case ui::DomCode::BACKSLASH: - return mojom::DomCode::kBackslash; - case ui::DomCode::BRACKET_LEFT: - return mojom::DomCode::kBracketLeft; - case ui::DomCode::BRACKET_RIGHT: - return mojom::DomCode::kBracketRight; - case ui::DomCode::COMMA: - return mojom::DomCode::kComma; - case ui::DomCode::DIGIT0: - return mojom::DomCode::kDigit0; - case ui::DomCode::DIGIT1: - return mojom::DomCode::kDigit1; - case ui::DomCode::DIGIT2: - return mojom::DomCode::kDigit2; - case ui::DomCode::DIGIT3: - return mojom::DomCode::kDigit3; - case ui::DomCode::DIGIT4: - return mojom::DomCode::kDigit4; - case ui::DomCode::DIGIT5: - return mojom::DomCode::kDigit5; - case ui::DomCode::DIGIT6: - return mojom::DomCode::kDigit6; - case ui::DomCode::DIGIT7: - return mojom::DomCode::kDigit7; - case ui::DomCode::DIGIT8: - return mojom::DomCode::kDigit8; - case ui::DomCode::DIGIT9: - return mojom::DomCode::kDigit9; - case ui::DomCode::EQUAL: - return mojom::DomCode::kEqual; - case ui::DomCode::INTL_BACKSLASH: - return mojom::DomCode::kIntlBackslash; - case ui::DomCode::INTL_RO: - return mojom::DomCode::kIntlRo; - case ui::DomCode::INTL_YEN: - return mojom::DomCode::kIntlYen; - case ui::DomCode::US_A: - return mojom::DomCode::kKeyA; - case ui::DomCode::US_B: - return mojom::DomCode::kKeyB; - case ui::DomCode::US_C: - return mojom::DomCode::kKeyC; - case ui::DomCode::US_D: - return mojom::DomCode::kKeyD; - case ui::DomCode::US_E: - return mojom::DomCode::kKeyE; - case ui::DomCode::US_F: - return mojom::DomCode::kKeyF; - case ui::DomCode::US_G: - return mojom::DomCode::kKeyG; - case ui::DomCode::US_H: - return mojom::DomCode::kKeyH; - case ui::DomCode::US_I: - return mojom::DomCode::kKeyI; - case ui::DomCode::US_J: - return mojom::DomCode::kKeyJ; - case ui::DomCode::US_K: - return mojom::DomCode::kKeyK; - case ui::DomCode::US_L: - return mojom::DomCode::kKeyL; - case ui::DomCode::US_M: - return mojom::DomCode::kKeyM; - case ui::DomCode::US_N: - return mojom::DomCode::kKeyN; - case ui::DomCode::US_O: - return mojom::DomCode::kKeyO; - case ui::DomCode::US_P: - return mojom::DomCode::kKeyP; - case ui::DomCode::US_Q: - return mojom::DomCode::kKeyQ; - case ui::DomCode::US_R: - return mojom::DomCode::kKeyR; - case ui::DomCode::US_S: - return mojom::DomCode::kKeyS; - case ui::DomCode::US_T: - return mojom::DomCode::kKeyT; - case ui::DomCode::US_U: - return mojom::DomCode::kKeyU; - case ui::DomCode::US_V: - return mojom::DomCode::kKeyV; - case ui::DomCode::US_W: - return mojom::DomCode::kKeyW; - case ui::DomCode::US_X: - return mojom::DomCode::kKeyX; - case ui::DomCode::US_Y: - return mojom::DomCode::kKeyY; - case ui::DomCode::US_Z: - return mojom::DomCode::kKeyZ; - case ui::DomCode::MINUS: - return mojom::DomCode::kMinus; - case ui::DomCode::PERIOD: - return mojom::DomCode::kPeriod; - case ui::DomCode::QUOTE: - return mojom::DomCode::kQuote; - case ui::DomCode::SEMICOLON: - return mojom::DomCode::kSemicolon; - case ui::DomCode::SLASH: - return mojom::DomCode::kSlash; - case ui::DomCode::BACKSPACE: - return mojom::DomCode::kBackspace; - case ui::DomCode::ENTER: - return mojom::DomCode::kEnter; - case ui::DomCode::SPACE: - return mojom::DomCode::kSpace; - case ui::DomCode::ALT_LEFT: - return mojom::DomCode::kAltLeft; - case ui::DomCode::ALT_RIGHT: - return mojom::DomCode::kAltRight; - case ui::DomCode::SHIFT_LEFT: - return mojom::DomCode::kShiftLeft; - case ui::DomCode::SHIFT_RIGHT: - return mojom::DomCode::kShiftRight; - case ui::DomCode::CONTROL_LEFT: - return mojom::DomCode::kControlLeft; - case ui::DomCode::CONTROL_RIGHT: - return mojom::DomCode::kControlRight; - case ui::DomCode::CAPS_LOCK: - return mojom::DomCode::kCapsLock; - default: - return mojom::DomCode::kOther; - } -} - -// Not using an EnumTraits here because the mapping is not 1:1. -absl::optional<mojom::NamedDomKey> NamedDomKeyToMojom( - const ui::DomKey::Base& key) { - switch (key) { - case ui::DomKey::ALT: - return mojom::NamedDomKey::kAlt; - case ui::DomKey::ALT_GRAPH: - return mojom::NamedDomKey::kAltGraph; - case ui::DomKey::CAPS_LOCK: - return mojom::NamedDomKey::kCapsLock; - case ui::DomKey::CONTROL: - return mojom::NamedDomKey::kControl; - case ui::DomKey::SHIFT: - return mojom::NamedDomKey::kShift; - case ui::DomKey::ENTER: - return mojom::NamedDomKey::kEnter; - case ui::DomKey::BACKSPACE: - return mojom::NamedDomKey::kBackspace; - case ui::DomKey::ESCAPE: - return mojom::NamedDomKey::kEscape; - case ui::DomKey::HANGUL_MODE: - return mojom::NamedDomKey::kHangeulMode; - case ui::DomKey::HANJA_MODE: - return mojom::NamedDomKey::kHanjaMode; - case ui::DomKey::ARROW_DOWN: - return mojom::NamedDomKey::kArrowDown; - case ui::DomKey::ARROW_LEFT: - return mojom::NamedDomKey::kArrowLeft; - case ui::DomKey::ARROW_RIGHT: - return mojom::NamedDomKey::kArrowRight; - case ui::DomKey::ARROW_UP: - return mojom::NamedDomKey::kArrowUp; - case ui::DomKey::PAGE_DOWN: - return mojom::NamedDomKey::kPageDown; - case ui::DomKey::PAGE_UP: - return mojom::NamedDomKey::kPageUp; - case ui::DomKey::TAB: - return mojom::NamedDomKey::kTab; - default: - return absl::nullopt; - } -} - -// Returns nullptr if it's not convertible. -// Not using a UnionTraits here because the mapping is not 1:1. -mojom::DomKeyPtr DomKeyToMojom(const ui::DomKey& key) { - // `IsCharacter` may return true for named keys like Enter because they have a - // Unicode representation. Hence, try to convert the key into a named key - // first before trying to convert it to a character key. - if (ui::KeycodeConverter::IsDomKeyNamed(key)) { - absl::optional<mojom::NamedDomKey> named_key = NamedDomKeyToMojom(key); - return named_key ? mojom::DomKey::NewNamedKey(*named_key) : nullptr; - } - if (key.IsCharacter()) { - return mojom::DomKey::NewCodepoint(key.ToCharacter()); - } - return nullptr; -} - -// Returns nullptr if it's not convertible. -// Not using a StructTraits here because the mapping is not 1:1. -mojom::PhysicalKeyEventPtr CreatePhysicalKeyEventFromKeyEvent( - const ui::KeyEvent& event) { - mojom::DomKeyPtr key = DomKeyToMojom(event.GetDomKey()); - if (!key) { - return nullptr; - } - - return mojom::PhysicalKeyEvent::New( - event.type() == ui::ET_KEY_PRESSED ? mojom::KeyEventType::kKeyDown - : mojom::KeyEventType::kKeyUp, - std::move(key), DomCodeToMojom(event.code()), - ModifierStateFromEvent(event)); -} - -uint32_t Utf16ToCodepoint(const std::u16string& str) { - int32_t index = 0; - uint32_t codepoint = 0; - base::ReadUnicodeCharacter(str.data(), str.length(), &index, &codepoint); - - // Should only contain a single codepoint. - DCHECK_GE(index, 0); - DCHECK_EQ(static_cast<size_t>(index), str.length() - 1); - return codepoint; -} - -ui::ImeTextSpan::Thickness GetCompositionSpanThickness( - const mojom::CompositionSpanStyle& style) { - switch (style) { - case mojom::CompositionSpanStyle::kNone: - return ui::ImeTextSpan::Thickness::kNone; - case mojom::CompositionSpanStyle::kDefault: - return ui::ImeTextSpan::Thickness::kThin; - } -} - -// Not using a StructTraits here because the mapping is not 1:1. -ui::ImeTextSpan CompositionSpanToImeTextSpan( - const mojom::CompositionSpan& span) { - return ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, span.start, - span.end, GetCompositionSpanThickness(span.style), - span.style == mojom::CompositionSpanStyle::kNone - ? ui::ImeTextSpan::UnderlineStyle::kNone - : ui::ImeTextSpan::UnderlineStyle::kSolid); -} - -void OnConnected(bool bound) { - LogEvent(bound ? ImeServiceEvent::kActivateImeSuccess - : ImeServiceEvent::kActivateImeFailed); -} - -void OnError(base::Time start) { - LOG(ERROR) << "IME Service connection error"; - - // If the Mojo pipe disconnection happens in 1000 ms after the service - // is initialized, we consider it as a failure. Normally it's caused - // by the Mojo service itself or misconfigured on Chrome OS. - if (base::Time::Now() - start < base::Milliseconds(1000)) { - LogEvent(ImeServiceEvent::kInitFailed); - } else { - LogEvent(ImeServiceEvent::kServiceDisconnected); - } -} - -InputFieldContext CreateInputFieldContext( - const AssistiveSuggesterSwitch::EnabledSuggestions& enabled_suggestions) { - return InputFieldContext{ - .lacros_enabled = IsLacrosEnabled(), - .multiword_enabled = features::IsAssistiveMultiWordEnabled(), - .multiword_allowed = enabled_suggestions.multi_word_suggestions}; -} - -mojom::TextPredictionMode GetTextPredictionMode( - const std::string& engine_id, - const InputFieldContext& context, - const PrefService& prefs) { - // TODO(crbug.com/1263335): Enable text prediction for Lacros. - return context.multiword_enabled && context.multiword_allowed && - !context.lacros_enabled && - prefs.GetBoolean(prefs::kAssistPredictiveWritingEnabled) && - IsUsEnglishEngine(engine_id) - ? mojom::TextPredictionMode::kEnabled - : mojom::TextPredictionMode::kDisabled; -} - -std::string MojomLayoutToXkbLayout(mojom::PinyinLayout layout) { - switch (layout) { - case mojom::PinyinLayout::kUsQwerty: - return "us"; - case mojom::PinyinLayout::kDvorak: - return "us(dvorak)"; - case mojom::PinyinLayout::kColemak: - return "us(colemak)"; - } -} - -mojom::InputFieldInfoPtr CreateInputFieldInfo( - const std::string& engine_id, - const ui::IMEEngineHandlerInterface::InputContext& context, - const InputFieldContext& input_field_context, - const PrefService& prefs, - bool is_normal_screen) { - // Disable most features on the login screen. - if (!is_normal_screen) { - return mojom::InputFieldInfo::New( - context.type == ui::TEXT_INPUT_TYPE_PASSWORD - ? mojom::InputFieldType::kPassword - : mojom::InputFieldType::kNoIME, - mojom::AutocorrectMode::kDisabled, - mojom::PersonalizationMode::kDisabled, - mojom::TextPredictionMode::kDisabled); - } - - return mojom::InputFieldInfo::New( - TextInputTypeToMojoType(context.type), - AutocorrectFlagsToMojoType(context.flags), - context.should_do_learning ? mojom::PersonalizationMode::kEnabled - : mojom::PersonalizationMode::kDisabled, - GetTextPredictionMode(engine_id, input_field_context, prefs)); -} - -void OverrideXkbLayoutIfNeeded(ImeKeyboard* keyboard, - const mojom::InputMethodSettingsPtr& settings) { - if (settings && settings->is_pinyin_settings()) { - keyboard->SetCurrentKeyboardLayoutByName( - MojomLayoutToXkbLayout(settings->get_pinyin_settings()->layout)); - } -} - -} // namespace - NativeInputMethodEngine::NativeInputMethodEngine() : NativeInputMethodEngine(/*use_ime_service=*/true) {} @@ -586,7 +100,7 @@ // Wrap the given observer in our observer that will decide whether to call // Mojo directly or forward to the extension. - auto native_observer = std::make_unique<NativeInputMethodEngine::ImeObserver>( + auto native_observer = std::make_unique<NativeInputMethodEngineObserver>( profile->GetPrefs(), std::move(observer), std::move(assistive_suggester), std::move(autocorrect_manager), std::move(suggestions_collector), std::make_unique<GrammarManager>( @@ -641,702 +155,9 @@ typed_word, corrected_word); } -NativeInputMethodEngine::ImeObserver* -NativeInputMethodEngine::GetNativeObserver() const { - return static_cast<ImeObserver*>(observer_.get()); -} - -NativeInputMethodEngine::ImeObserver::ImeObserver( - PrefService* prefs, - std::unique_ptr<InputMethodEngineObserver> ime_base_observer, - std::unique_ptr<AssistiveSuggester> assistive_suggester, - std::unique_ptr<AutocorrectManager> autocorrect_manager, - std::unique_ptr<SuggestionsCollector> suggestions_collector, - std::unique_ptr<GrammarManager> grammar_manager, - bool use_ime_service) - : prefs_(prefs), - ime_base_observer_(std::move(ime_base_observer)), - assistive_suggester_(std::move(assistive_suggester)), - autocorrect_manager_(std::move(autocorrect_manager)), - suggestions_collector_(std::move(suggestions_collector)), - grammar_manager_(std::move(grammar_manager)), - use_ime_service_(use_ime_service) {} - -NativeInputMethodEngine::ImeObserver::~ImeObserver() = default; - -bool NativeInputMethodEngine::ImeObserver::ShouldRouteToRuleBasedEngine( - const std::string& engine_id) const { - return use_ime_service_ && IsRuleBasedEngine(engine_id); -} - -bool NativeInputMethodEngine::ImeObserver::ShouldRouteToNativeMojoEngine( - const std::string& engine_id) const { - return use_ime_service_ && CanRouteToNativeMojoEngine(engine_id); -} - -void NativeInputMethodEngine::ImeObserver::OnConnectionFactoryBound( - bool bound) { - if (bound) - return; - - LOG(ERROR) << "ConnectionFactory failed to bind, abort."; - connection_factory_.reset(); -} - -void NativeInputMethodEngine::ImeObserver::ConnectToImeService( - mojom::ConnectionTarget connection_target, - const std::string& engine_id) { - if (!remote_manager_.is_bound()) { - auto* ime_manager = InputMethodManager::Get(); - ime_manager->ConnectInputEngineManager( - remote_manager_.BindNewPipeAndPassReceiver()); - remote_manager_.set_disconnect_handler( - base::BindOnce(&OnError, base::Time::Now())); - LogEvent(ImeServiceEvent::kInitSuccess); - } - - // Deactivate any existing engine. - connection_factory_.reset(); - input_method_.reset(); - host_receiver_.reset(); - - remote_manager_->InitializeConnectionFactory( - connection_factory_.BindNewPipeAndPassReceiver(), connection_target, - base::BindOnce( - &NativeInputMethodEngine::ImeObserver::OnConnectionFactoryBound, - weak_ptr_factory_.GetWeakPtr())); - - mojo::PendingAssociatedRemote<ime::mojom::InputMethodHost> input_method_host; - host_receiver_.Bind(input_method_host.InitWithNewEndpointAndPassReceiver()); - - ime::mojom::InputMethodSettingsPtr settings = - CreateSettingsFromPrefs(*prefs_, engine_id, InputFieldContext{}); - connection_factory_->ConnectToInputMethod( - engine_id, input_method_.BindNewEndpointAndPassReceiver(), - std::move(input_method_host), std::move(settings), - base::BindOnce(&OnConnected)); -} - -void NativeInputMethodEngine::ImeObserver::ActivateTextClient( - int context_id, - bool on_focus_success) { - if (text_client_ && text_client_->context_id == context_id) - text_client_->state = TextClientState::kActive; -} - -void NativeInputMethodEngine::ImeObserver::OnActivate( - const std::string& engine_id) { - // Always hide the candidates window and clear the quick settings menu when - // switching input methods. - UpdateCandidatesWindow(nullptr); - ui::ime::InputMethodMenuManager::GetInstance() - ->SetCurrentInputMethodMenuItemList({}); - - // TODO(b/181077907): Always launch the IME service and let IME service decide - // whether it should shutdown or not. - if (IsFstEngine(engine_id) && ShouldRouteToNativeMojoEngine(engine_id) && - // The FST Mojo engine is only needed if autocorrect is enabled. - !IsPhysicalKeyboardAutocorrectEnabled(prefs_, engine_id) && - !IsPredictiveWritingEnabled(prefs_, engine_id)) { - connection_factory_.reset(); - remote_manager_.reset(); - input_method_.reset(); - host_receiver_.reset(); - return; - } - - if (ShouldRouteToRuleBasedEngine(engine_id)) { - const auto new_engine_id = NormalizeRuleBasedEngineId(engine_id); - ConnectToImeService(mojom::ConnectionTarget::kImeService, new_engine_id); - // Notify the virtual keyboard extension that the IME has changed. - ime_base_observer_->OnActivate(engine_id); - } else if (ShouldRouteToNativeMojoEngine(engine_id)) { - ConnectToImeService(mojom::ConnectionTarget::kDecoder, engine_id); - // Inform the assistive suggester of the new engine activation. - assistive_suggester_->OnActivate(engine_id); - } else { - // Release the IME service. - // TODO(b/147709499): A better way to cleanup all. - connection_factory_.reset(); - remote_manager_.reset(); - input_method_.reset(); - host_receiver_.reset(); - - // It is possible that the extension has missed changes to the input method - // options because the options were changed while it was sleeping. - // Trigger an input method option changed event to ensure the extension has - // the latest options. - ime_base_observer_->OnInputMethodOptionsChanged(engine_id); - ime_base_observer_->OnActivate(engine_id); - } -} - -void NativeInputMethodEngine::ImeObserver::OnFocus( - const std::string& engine_id, - int context_id, - const IMEEngineHandlerInterface::InputContext& context) { - text_client_ = - TextClient{.context_id = context_id, .state = TextClientState::kPending}; - - if (assistive_suggester_->IsAssistiveFeatureEnabled()) { - assistive_suggester_->OnFocus(context_id); - } - autocorrect_manager_->OnFocus(context_id); - if (grammar_manager_->IsOnDeviceGrammarEnabled()) { - grammar_manager_->OnFocus(context_id, context.flags); - } - if (ShouldRouteToNativeMojoEngine(engine_id)) { - if (IsInputMethodBound()) { - if (assistive_suggester_.get()) { - assistive_suggester_->FetchEnabledSuggestionsFromBrowserContextThen( - base::BindOnce(&NativeInputMethodEngine::ImeObserver:: - HandleOnFocusAsyncForNativeMojoEngine, - weak_ptr_factory_.GetWeakPtr(), engine_id, - context_id, context)); - } else { - // Because assistive_suggester is not available, we can assume that - // there are no enabled suggestions. Hence we just run this function - // synchronously with no enabled suggestions. - HandleOnFocusAsyncForNativeMojoEngine( - engine_id, context_id, context, - AssistiveSuggesterSwitch::EnabledSuggestions{}); - } - } - } else { - // TODO(b/218608883): Support OnFocusCallback through extension based PK. - ime_base_observer_->OnFocus(engine_id, context_id, context); - ActivateTextClient(context_id, true); - } -} - -void NativeInputMethodEngine::ImeObserver:: - HandleOnFocusAsyncForNativeMojoEngine( - const std::string& engine_id, - int context_id, - const IMEEngineHandlerInterface::InputContext& context, - const AssistiveSuggesterSwitch::EnabledSuggestions& - enabled_suggestions) { - // It is possible the text client got unfocused/or changed before this async - // function is run, if the new focus/blur event occurred fast enough. In that - // case, this async OnFocus call is obsolete, and should be skipped. - if (!text_client_.has_value() || text_client_->context_id != context_id || - text_client_->state != TextClientState::kPending) { - return; - } - - InputFieldContext input_field_context = - features::IsAssistiveMultiWordEnabled() - ? CreateInputFieldContext(enabled_suggestions) - : InputFieldContext{}; - // TODO(b/200611333): Make input_method_->OnFocus return the overriding - // XKB layout instead of having the logic here in Chromium. - ime::mojom::InputMethodSettingsPtr settings = - CreateSettingsFromPrefs(*prefs_, engine_id, input_field_context); - OverrideXkbLayoutIfNeeded(InputMethodManager::Get()->GetImeKeyboard(), - settings); - - const bool is_normal_screen = - InputMethodManager::Get()->GetActiveIMEState()->GetUIStyle() == - InputMethodManager::UIStyle::kNormal; - mojom::InputFieldInfoPtr input_field_info = CreateInputFieldInfo( - engine_id, context, input_field_context, *prefs_, is_normal_screen); - - base::OnceCallback<void(bool)> on_focus_callback = - base::BindOnce(&NativeInputMethodEngine::ImeObserver::ActivateTextClient, - weak_ptr_factory_.GetWeakPtr(), text_client_->context_id); - - input_method_->OnFocus(std::move(input_field_info), - prefs_ ? std::move(settings) : nullptr, - std::move(on_focus_callback)); - - // TODO(b/202224495): Send the surrounding text as part of InputFieldInfo. - SendSurroundingTextToNativeMojoEngine(last_surrounding_text_); -} - -void NativeInputMethodEngine::ImeObserver::OnTouch( - ui::EventPointerType pointerType) { - ime_base_observer_->OnTouch(pointerType); -} - -void NativeInputMethodEngine::ImeObserver::OnBlur(const std::string& engine_id, - int context_id) { - // Always hide the candidates window when there's no focus. - UpdateCandidatesWindow(nullptr); - - text_client_ = absl::nullopt; - - if (assistive_suggester_->IsAssistiveFeatureEnabled()) - assistive_suggester_->OnBlur(); - - if (ShouldRouteToNativeMojoEngine(engine_id)) { - if (IsInputMethodBound()) { - input_method_->OnBlur(); - } - } else { - ime_base_observer_->OnBlur(engine_id, context_id); - } -} - -void NativeInputMethodEngine::ImeObserver::OnKeyEvent( - const std::string& engine_id, - const ui::KeyEvent& event, - ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) { - if (assistive_suggester_->IsAssistiveFeatureEnabled()) { - if (assistive_suggester_->OnKeyEvent(event)) { - std::move(callback).Run(true); - return; - } - } - if (autocorrect_manager_->OnKeyEvent(event)) { - std::move(callback).Run(true); - return; - } - if (grammar_manager_->IsOnDeviceGrammarEnabled() && - grammar_manager_->OnKeyEvent(event)) { - std::move(callback).Run(true); - return; - } - - if (ShouldRouteToRuleBasedEngine(engine_id) || - ShouldRouteToNativeMojoEngine(engine_id)) { - if (IsInputMethodBound() && IsInputMethodConnected()) { - // CharacterComposer only takes KEY_PRESSED events. - const bool filtered = event.type() == ui::ET_KEY_PRESSED && - character_composer_.FilterKeyPress(event); - - // Don't send dead keys to the system IME. Dead keys should be handled at - // the OS level and not exposed to IMEs. - if (event.GetDomKey().IsDeadKey()) { - std::move(callback).Run(true); - return; - } - - mojom::PhysicalKeyEventPtr key_event = - CreatePhysicalKeyEventFromKeyEvent(event); - if (!key_event) { - std::move(callback).Run(false); - return; - } - - // Hot switches to turn on/off certain IME features. - if (IsFstEngine(engine_id) && autocorrect_manager_->DisabledByRule()) { - std::move(callback).Run(false); - return; - } - - if (filtered) { - // TODO(b/174612548): Transform the corresponding KEY_RELEASED event to - // use the composed character as well. - key_event->key = mojom::DomKey::NewCodepoint( - Utf16ToCodepoint(character_composer_.composed_character())); - } - - auto process_key_event_callback = base::BindOnce( - [](ui::IMEEngineHandlerInterface::KeyEventDoneCallback - original_callback, - mojom::KeyEventResult result) { - std::move(original_callback) - .Run(result == mojom::KeyEventResult::kConsumedByIme); - }, - std::move(callback)); - - input_method_->ProcessKeyEvent(std::move(key_event), - std::move(process_key_event_callback)); - } else { - std::move(callback).Run(false); - } - } else { - ime_base_observer_->OnKeyEvent(engine_id, event, std::move(callback)); - } -} - -void NativeInputMethodEngine::ImeObserver::OnReset( - const std::string& engine_id) { - if (ShouldRouteToNativeMojoEngine(engine_id) || - ShouldRouteToRuleBasedEngine(engine_id)) { - if (IsInputMethodBound()) { - input_method_->OnCompositionCanceledBySystem(); - } - } else { - ime_base_observer_->OnReset(engine_id); - } -} - -void NativeInputMethodEngine::ImeObserver::OnDeactivated( - const std::string& engine_id) { - if (ShouldRouteToRuleBasedEngine(engine_id)) - input_method_.reset(); - ime_base_observer_->OnDeactivated(engine_id); -} - -void NativeInputMethodEngine::ImeObserver::OnCompositionBoundsChanged( - const std::vector<gfx::Rect>& bounds) { - ime_base_observer_->OnCompositionBoundsChanged(bounds); -} - -void NativeInputMethodEngine::ImeObserver::OnSurroundingTextChanged( - const std::string& engine_id, - const std::u16string& text, - int cursor_pos, - int anchor_pos, - int offset_pos) { - DCHECK_GE(cursor_pos, 0); - DCHECK_GE(anchor_pos, 0); - - last_surrounding_text_ = SurroundingText{.text = text, - .cursor_pos = cursor_pos, - .anchor_pos = anchor_pos, - .offset_pos = offset_pos}; - - assistive_suggester_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); - autocorrect_manager_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); - if (grammar_manager_->IsOnDeviceGrammarEnabled()) { - grammar_manager_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); - } - if (ShouldRouteToNativeMojoEngine(engine_id)) { - if (IsInputMethodBound()) { - SendSurroundingTextToNativeMojoEngine(last_surrounding_text_); - } - } else { - ime_base_observer_->OnSurroundingTextChanged(engine_id, text, cursor_pos, - anchor_pos, offset_pos); - } -} - -void NativeInputMethodEngine::ImeObserver::OnCandidateClicked( - const std::string& component_id, - int candidate_id, - MouseButtonEvent button) { - if (ShouldRouteToNativeMojoEngine(component_id)) { - if (IsInputMethodBound()) - input_method_->OnCandidateSelected(candidate_id); - } else { - ime_base_observer_->OnCandidateClicked(component_id, candidate_id, button); - } -} - -void NativeInputMethodEngine::ImeObserver::OnAssistiveWindowButtonClicked( - const ui::ime::AssistiveWindowButton& button) { - switch (button.id) { - case ui::ime::ButtonId::kSmartInputsSettingLink: - base::RecordAction(base::UserMetricsAction( - "ChromeOS.Settings.SmartInputs.PersonalInfoSuggestions.Open")); - // TODO(crbug/1101689): Add subpath for personal info suggestions - // settings. - chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( - ProfileManager::GetActiveUserProfile(), - chromeos::settings::mojom::kSmartInputsSubpagePath); - break; - case ui::ime::ButtonId::kLearnMore: - if (button.window_type == - ui::ime::AssistiveWindowType::kEmojiSuggestion) { - base::RecordAction(base::UserMetricsAction( - "ChromeOS.Settings.SmartInputs.EmojiSuggestions.Open")); - // TODO(crbug/1101689): Add subpath for emoji suggestions settings. - chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( - ProfileManager::GetActiveUserProfile(), - chromeos::settings::mojom::kSmartInputsSubpagePath); - } - break; - case ui::ime::ButtonId::kSuggestion: - if (assistive_suggester_->IsAssistiveFeatureEnabled()) { - assistive_suggester_->AcceptSuggestion(button.index); - } - if (grammar_manager_->IsOnDeviceGrammarEnabled()) { - grammar_manager_->AcceptSuggestion(); - } - break; - case ui::ime::ButtonId::kUndo: - autocorrect_manager_->UndoAutocorrect(); - break; - case ui::ime::ButtonId::kIgnoreSuggestion: - if (grammar_manager_->IsOnDeviceGrammarEnabled()) { - grammar_manager_->IgnoreSuggestion(); - } - break; - case ui::ime::ButtonId::kAddToDictionary: - case ui::ime::ButtonId::kNone: - ime_base_observer_->OnAssistiveWindowButtonClicked(button); - break; - } -} - -void NativeInputMethodEngine::ImeObserver::OnMenuItemActivated( - const std::string& component_id, - const std::string& menu_id) { - if (ShouldRouteToNativeMojoEngine(component_id)) { - if (input_method_.is_bound()) { - mojom::InputMethodQuickSettingsPtr settings = GetQuickSettingsAfterToggle( - ui::ime::InputMethodMenuManager::GetInstance() - ->GetCurrentInputMethodMenuItemList(), - menu_id); - // Notify the IME of the change and then update the menu. - input_method_->OnQuickSettingsUpdated(settings.Clone()); - UpdateQuickSettings(std::move(settings)); - } - } else { - ime_base_observer_->OnMenuItemActivated(component_id, menu_id); - } -} - -void NativeInputMethodEngine::ImeObserver::OnScreenProjectionChanged( - bool is_projected) { - ime_base_observer_->OnScreenProjectionChanged(is_projected); -} - -void NativeInputMethodEngine::ImeObserver::OnSuggestionsGathered( - RequestSuggestionsCallback callback, - mojom::SuggestionsResponsePtr response) { - std::move(callback).Run(std::move(response)); -} - -void NativeInputMethodEngine::ImeObserver::OnSuggestionsChanged( - const std::vector<std::string>& suggestions) { - ime_base_observer_->OnSuggestionsChanged(suggestions); -} - -void NativeInputMethodEngine::ImeObserver::OnInputMethodOptionsChanged( - const std::string& engine_id) { - ime_base_observer_->OnInputMethodOptionsChanged(engine_id); -} - -void NativeInputMethodEngine::ImeObserver::CommitText( - const std::u16string& text, - mojom::CommitTextCursorBehavior cursor_behavior) { - if (!IsTextClientActive()) - return; - ui::IMEBridge::Get()->GetInputContextHandler()->CommitText( - text, - cursor_behavior == mojom::CommitTextCursorBehavior::kMoveCursorBeforeText - ? ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorBeforeText - : ui::TextInputClient::InsertTextCursorBehavior:: - kMoveCursorAfterText); -} - -void NativeInputMethodEngine::ImeObserver::DEPRECATED_SetComposition( - const std::u16string& text, - std::vector<mojom::CompositionSpanPtr> spans) { - if (!IsTextClientActive()) - return; - SetComposition(text, std::move(spans), text.length()); -} - -void NativeInputMethodEngine::ImeObserver::SetComposition( - const std::u16string& text, - std::vector<mojom::CompositionSpanPtr> spans, - uint32_t new_cursor_position) { - if (!IsTextClientActive() || new_cursor_position > text.length()) { - return; - } - - ui::CompositionText composition; - composition.text = text; - - composition.ime_text_spans.reserve(spans.size()); - for (const auto& span : spans) { - composition.ime_text_spans.push_back(CompositionSpanToImeTextSpan(*span)); - } - - ui::IMEBridge::Get()->GetInputContextHandler()->UpdateCompositionText( - std::move(composition), - /*cursor_pos=*/new_cursor_position, - /*visible=*/true); -} - -void NativeInputMethodEngine::ImeObserver::SetCompositionRange( - uint32_t start_index, - uint32_t end_index) { - if (!IsTextClientActive()) - return; - - const auto ordered_range = std::minmax(start_index, end_index); - // TODO(b/151884011): Turn on underlining for composition-based languages. - ui::IMEBridge::Get()->GetInputContextHandler()->SetComposingRange( - ordered_range.first, ordered_range.second, - {ui::ImeTextSpan( - ui::ImeTextSpan::Type::kComposition, /*start_offset=*/0, - /*end_offset=*/ordered_range.second - ordered_range.first, - ui::ImeTextSpan::Thickness::kNone, - ui::ImeTextSpan::UnderlineStyle::kNone)}); -} - -void NativeInputMethodEngine::ImeObserver::FinishComposition() { - if (!IsTextClientActive()) - return; - - ui::IMEInputContextHandlerInterface* input_context = - ui::IMEBridge::Get()->GetInputContextHandler(); - - input_context->ConfirmCompositionText(/*reset_engine=*/false, - /*keep_selection=*/true); - - auto* manager = InputMethodManager::Get(); - if (!manager || - !extension_ime_util::IsExperimentalMultilingual( - manager->GetActiveIMEState()->GetCurrentInputMethod().id())) { - return; - } - - std::u16string composition_text = input_context->GetCompositionText(); - base::TrimWhitespace(composition_text, base::TRIM_ALL, &composition_text); - bool has_diacritics = HasDiacritics(composition_text); - - base::UmaHistogramEnumeration( - "InputMethod.MultilingualExperiment.NonAutocorrect", - has_diacritics ? NonAutocorrectDiacriticStatus::kWithDiacritics - : NonAutocorrectDiacriticStatus::kWithoutDiacritics); -} - -void NativeInputMethodEngine::ImeObserver::DeleteSurroundingText( - uint32_t num_before_cursor, - uint32_t num_after_cursor) { - if (!IsTextClientActive()) - return; - ui::IMEBridge::Get()->GetInputContextHandler()->DeleteSurroundingText( - /*offset=*/-static_cast<int>(num_before_cursor), - /*length=*/num_before_cursor + num_after_cursor); -} - -void NativeInputMethodEngine::ImeObserver::HandleAutocorrect( - mojom::AutocorrectSpanPtr autocorrect_span) { - if (!IsTextClientActive()) - return; - autocorrect_manager_->HandleAutocorrect(autocorrect_span->autocorrect_range, - autocorrect_span->original_text, - autocorrect_span->current_text); -} - -void NativeInputMethodEngine::ImeObserver::RequestSuggestions( - mojom::SuggestionsRequestPtr request, - RequestSuggestionsCallback callback) { - suggestions_collector_->GatherSuggestions( - std::move(request), - base::BindOnce( - &NativeInputMethodEngine::ImeObserver::OnSuggestionsGathered, - base::Unretained(this), std::move(callback))); -} - -void NativeInputMethodEngine::ImeObserver::DisplaySuggestions( - const std::vector<ime::TextSuggestion>& suggestions) { - if (!IsTextClientActive()) - return; - assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); -} - -void NativeInputMethodEngine::ImeObserver::UpdateCandidatesWindow( - mojom::CandidatesWindowPtr window) { - if (!IsTextClientActive()) - return; - - IMECandidateWindowHandlerInterface* candidate_window_handler = - ui::IMEBridge::Get()->GetCandidateWindowHandler(); - if (!candidate_window_handler) { - return; - } - - if (!window) { - candidate_window_handler->HideLookupTable(); - return; - } - - ui::CandidateWindow candidate_window; - for (const auto& candidate : window->candidates) { - ui::CandidateWindow::Entry entry; - entry.value = base::UTF8ToUTF16(candidate->text); - entry.label = base::UTF8ToUTF16(candidate->label.value_or("")); - entry.annotation = base::UTF8ToUTF16(candidate->annotation.value_or("")); - candidate_window.mutable_candidates()->push_back(entry); - } - - ui::CandidateWindow::CandidateWindowProperty property; - property.is_cursor_visible = !window->highlighted_candidate.is_null(); - property.cursor_position = - window->highlighted_candidate ? window->highlighted_candidate->index : 0; - property.page_size = window->candidates.size(); - property.is_vertical = true; - property.is_auxiliary_text_visible = - window->auxiliary_text.value_or("") != ""; - property.auxiliary_text = window->auxiliary_text.value_or(""); - candidate_window.SetProperty(property); - - candidate_window_handler->UpdateLookupTable(candidate_window); -} - -void NativeInputMethodEngine::ImeObserver::RecordUkm(mojom::UkmEntryPtr entry) { - if (entry->is_non_compliant_api()) { - ui::RecordUkmNonCompliantApi( - ui::IMEBridge::Get() - ->GetInputContextHandler() - ->GetClientSourceForMetrics(), - entry->get_non_compliant_api()->non_compliant_operation); - } -} - -void NativeInputMethodEngine::ImeObserver::ReportKoreanAction( - mojom::KoreanAction action) { - UMA_HISTOGRAM_ENUMERATION("InputMethod.PhysicalKeyboard.Korean.Action", - action); -} - -void NativeInputMethodEngine::ImeObserver::ReportKoreanSettings( - mojom::KoreanSettingsPtr settings) { - UMA_HISTOGRAM_BOOLEAN("InputMethod.PhysicalKeyboard.Korean.MultipleSyllables", - settings->input_multiple_syllables); - UMA_HISTOGRAM_ENUMERATION("InputMethod.PhysicalKeyboard.Korean.Layout", - settings->layout); -} - -void NativeInputMethodEngine::ImeObserver::UpdateQuickSettings( - mojom::InputMethodQuickSettingsPtr quick_settings) { - ui::ime::InputMethodMenuManager::GetInstance() - ->SetCurrentInputMethodMenuItemList( - CreateMenuItemsFromQuickSettings(*quick_settings)); -} - -void NativeInputMethodEngine::ImeObserver::FlushForTesting() { - if (remote_manager_.is_bound()) - remote_manager_.FlushForTesting(); // IN-TEST - if (connection_factory_.is_bound()) - connection_factory_.FlushForTesting(); // IN-TEST - if (host_receiver_.is_bound()) - host_receiver_.FlushForTesting(); // IN-TEST - if (input_method_.is_bound()) - input_method_.FlushForTesting(); // IN-TEST -} - -void NativeInputMethodEngine::ImeObserver::OnProfileWillBeDestroyed() { - prefs_ = nullptr; -} - -bool NativeInputMethodEngine::ImeObserver::IsInputMethodBound() { - return connection_factory_.is_bound() && input_method_.is_bound(); -} - -bool NativeInputMethodEngine::ImeObserver::IsInputMethodConnected() { - return (connection_factory_.is_bound() && - connection_factory_.is_connected() && input_method_.is_bound() && - input_method_.is_connected()); -} - -bool NativeInputMethodEngine::ImeObserver::IsTextClientActive() { - return text_client_ && text_client_->state == TextClientState::kActive; -} - -void NativeInputMethodEngine::ImeObserver:: - SendSurroundingTextToNativeMojoEngine( - const SurroundingText& surrounding_text) { - std::vector<size_t> selection_indices = { - static_cast<size_t>(surrounding_text.anchor_pos), - static_cast<size_t>(surrounding_text.cursor_pos)}; - std::string utf8_text = base::UTF16ToUTF8AndAdjustOffsets( - surrounding_text.text, &selection_indices); - - auto selection = mojom::SelectionRange::New(); - selection->anchor = selection_indices[0]; - selection->focus = selection_indices[1]; - - input_method_->OnSurroundingTextChanged( - std::move(utf8_text), surrounding_text.offset_pos, std::move(selection)); +NativeInputMethodEngineObserver* NativeInputMethodEngine::GetNativeObserver() + const { + return static_cast<NativeInputMethodEngineObserver*>(observer_.get()); } bool NativeInputMethodEngine::UpdateMenuItems(
diff --git a/chrome/browser/ash/input_method/native_input_method_engine.h b/chrome/browser/ash/input_method/native_input_method_engine.h index 51c693c1..48e40cc 100644 --- a/chrome/browser/ash/input_method/native_input_method_engine.h +++ b/chrome/browser/ash/input_method/native_input_method_engine.h
@@ -17,6 +17,7 @@ #include "chrome/browser/ash/input_method/autocorrect_manager.h" #include "chrome/browser/ash/input_method/grammar_manager.h" #include "chrome/browser/ash/input_method/input_method_engine.h" +#include "chrome/browser/ash/input_method/native_input_method_engine_observer.h" #include "chrome/browser/ash/input_method/suggestions_collector.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "components/prefs/pref_change_registrar.h" @@ -41,9 +42,9 @@ // NativeInputMethodEngine and "ExtensionInputMethodEngine" (which is // InputMethodEngine in the current design). All extensions-related logic // will reside in the ExtensionInputMethodEngine inheritance tree. There will -// be no "ImeObserver" for the native engine either, as it is only used as -// a way for ExtensionInputMethodEngine to delegate to the extensions code, -// which is not required for the native engine. +// be no "NativeInputMethodEngineObserver" for the native engine either, as it +// is only used as a way for ExtensionInputMethodEngine to delegate to the +// extensions code, which is not required for the native engine. class NativeInputMethodEngine : public InputMethodEngine, public ChromeKeyboardControllerClient::Observer { @@ -100,169 +101,6 @@ int start_index); private: - class ImeObserver : public InputMethodEngineObserver, - public ime::mojom::InputMethodHost { - public: - // |ime_base_observer| is to forward events to extension during this - // migration. It will be removed when the official extension is completely - // migrated. - // |use_ime_service| should always be |true| in prod code, and may only be - // |false| in browser tests that need to avoid connecting to the Mojo IME - // service which can involve loading libimedecoder.so unsupported in tests. - // TODO(crbug/1197005): Migrate native_input_method_engine_browsertest suite - // to e2e Tast tests and unit tests, then dismantle this for-test-only flag. - ImeObserver(PrefService* prefs, - std::unique_ptr<InputMethodEngineObserver> ime_base_observer, - std::unique_ptr<AssistiveSuggester> assistive_suggester, - std::unique_ptr<AutocorrectManager> autocorrect_manager, - std::unique_ptr<SuggestionsCollector> suggestions_collector, - std::unique_ptr<GrammarManager> grammar_manager, - bool use_ime_service); - ~ImeObserver() override; - - // InputMethodEngineObserver: - void OnActivate(const std::string& engine_id) override; - void OnFocus( - const std::string& engine_id, - int context_id, - const IMEEngineHandlerInterface::InputContext& context) override; - void OnTouch(ui::EventPointerType pointerType) override; - void OnBlur(const std::string& engine_id, int context_id) override; - void OnKeyEvent( - const std::string& engine_id, - const ui::KeyEvent& event, - ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) override; - void OnReset(const std::string& engine_id) override; - void OnDeactivated(const std::string& engine_id) override; - void OnCompositionBoundsChanged( - const std::vector<gfx::Rect>& bounds) override; - void OnSurroundingTextChanged(const std::string& engine_id, - const std::u16string& text, - int cursor_pos, - int anchor_pos, - int offset_pos) override; - void OnCandidateClicked(const std::string& component_id, - int candidate_id, - MouseButtonEvent button) override; - void OnAssistiveWindowButtonClicked( - const ui::ime::AssistiveWindowButton& button) override; - void OnMenuItemActivated(const std::string& component_id, - const std::string& menu_id) override; - void OnScreenProjectionChanged(bool is_projected) override; - void OnSuggestionsChanged( - const std::vector<std::string>& suggestions) override; - void OnInputMethodOptionsChanged(const std::string& engine_id) override; - - // ime::mojom::InputMethodHost: - void CommitText( - const std::u16string& text, - ime::mojom::CommitTextCursorBehavior cursor_behavior) override; - void DEPRECATED_SetComposition( - const std::u16string& text, - std::vector<ime::mojom::CompositionSpanPtr> spans) override; - void SetComposition(const std::u16string& text, - std::vector<ime::mojom::CompositionSpanPtr> spans, - uint32_t new_cursor_position) override; - void SetCompositionRange(uint32_t start_index, uint32_t end_index) override; - void FinishComposition() override; - void DeleteSurroundingText(uint32_t num_before_cursor, - uint32_t num_after_cursor) override; - void HandleAutocorrect( - ime::mojom::AutocorrectSpanPtr autocorrect_span) override; - void RequestSuggestions(ime::mojom::SuggestionsRequestPtr request, - RequestSuggestionsCallback callback) override; - void DisplaySuggestions( - const std::vector<ime::TextSuggestion>& suggestions) override; - void UpdateCandidatesWindow( - ime::mojom::CandidatesWindowPtr window) override; - void RecordUkm(ime::mojom::UkmEntryPtr entry) override; - void ReportKoreanAction(ime::mojom::KoreanAction action) override; - void ReportKoreanSettings(ime::mojom::KoreanSettingsPtr settings) override; - void UpdateQuickSettings( - ime::mojom::InputMethodQuickSettingsPtr quick_settings) override; - - // Called when suggestions are collected from the system via - // suggestions_collector_. - void OnSuggestionsGathered(RequestSuggestionsCallback request_callback, - ime::mojom::SuggestionsResponsePtr response); - - // Flush all relevant Mojo pipes. - void FlushForTesting(); - - // Returns whether this is connected to the input engine. - bool IsConnectedForTesting() { return IsInputMethodBound(); } - - void OnProfileWillBeDestroyed(); - - private: - struct SurroundingText { - std::u16string text; - int cursor_pos = 0; - int anchor_pos = 0; - int offset_pos = 0; - }; - - enum TextClientState { - kPending = 0, - kActive = 1, - }; - - struct TextClient { - int context_id; - TextClientState state; - }; - - void SendSurroundingTextToNativeMojoEngine( - const SurroundingText& surrounding_text); - - bool ShouldRouteToRuleBasedEngine(const std::string& engine_id) const; - bool ShouldRouteToNativeMojoEngine(const std::string& engine_id) const; - - void OnConnectionFactoryBound(bool bound); - void ConnectToImeService(ime::mojom::ConnectionTarget connection_target, - const std::string& engine_id); - - void HandleOnFocusAsyncForNativeMojoEngine( - const std::string& engine_id, - int context_id, - const IMEEngineHandlerInterface::InputContext& context, - const AssistiveSuggesterSwitch::EnabledSuggestions& - enabled_suggestions); - - bool IsInputMethodBound(); - bool IsInputMethodConnected(); - bool IsTextClientActive(); - void ActivateTextClient(int context_id, bool on_focus_success); - - PrefService* prefs_ = nullptr; - - std::unique_ptr<InputMethodEngineObserver> ime_base_observer_; - mojo::Remote<ime::mojom::InputEngineManager> remote_manager_; - mojo::Remote<ime::mojom::ConnectionFactory> connection_factory_; - mojo::AssociatedRemote<ime::mojom::InputMethod> input_method_; - mojo::AssociatedReceiver<ime::mojom::InputMethodHost> host_receiver_{this}; - - std::unique_ptr<AssistiveSuggester> assistive_suggester_; - std::unique_ptr<AutocorrectManager> autocorrect_manager_; - std::unique_ptr<SuggestionsCollector> suggestions_collector_; - std::unique_ptr<GrammarManager> grammar_manager_; - - ui::CharacterComposer character_composer_; - - SurroundingText last_surrounding_text_; - - absl::optional<TextClient> text_client_; - - // |use_ime_service| should always be |true| in prod code, and may only be - // |false| in browser tests that need to avoid connecting to the Mojo IME - // service which can involve loading libimedecoder.so unsupported in tests. - // TODO(crbug/1197005): Migrate native_input_method_engine_browsertest suite - // to e2e Tast tests and unit tests, then dismantle this for-test-only flag. - bool use_ime_service_ = true; - - base::WeakPtrFactory<ImeObserver> weak_ptr_factory_{this}; - }; - // |use_ime_service| should always be |true| in prod code, and may only be // |false| in browser tests that need to avoid connecting to the Mojo IME // service which can involve loading libimedecoder.so unsupported in tests. @@ -270,7 +108,7 @@ // to e2e Tast tests and unit tests, then dismantle this for-test-only flag. explicit NativeInputMethodEngine(bool use_ime_service); - ImeObserver* GetNativeObserver() const; + NativeInputMethodEngineObserver* GetNativeObserver() const; bool UpdateMenuItems(const std::vector<InputMethodManager::MenuItem>& items, std::string* error) override;
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 new file mode 100644 index 0000000..b16b0d3a --- /dev/null +++ b/chrome/browser/ash/input_method/native_input_method_engine_observer.cc
@@ -0,0 +1,1222 @@ +// 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. + +#include "chrome/browser/ash/input_method/native_input_method_engine_observer.h" + +#include <utility> + +#include "ash/constants/ash_features.h" +#include "ash/constants/ash_pref_names.h" +#include "ash/services/ime/public/mojom/input_method.mojom.h" +#include "base/feature_list.h" +#include "base/i18n/i18n_constants.h" +#include "base/i18n/icu_string_conversions.h" +#include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/strings/strcat.h" +#include "base/strings/string_util.h" +#include "base/strings/utf_offset_string_conversions.h" +#include "base/strings/utf_string_conversion_utils.h" +#include "base/strings/utf_string_conversions.h" +#include "chrome/browser/ash/input_method/assistive_suggester_client_filter.h" +#include "chrome/browser/ash/input_method/assistive_suggester_prefs.h" +#include "chrome/browser/ash/input_method/assistive_suggester_switch.h" +#include "chrome/browser/ash/input_method/autocorrect_manager.h" +#include "chrome/browser/ash/input_method/diacritics_checker.h" +#include "chrome/browser/ash/input_method/get_browser_url.h" +#include "chrome/browser/ash/input_method/grammar_service_client.h" +#include "chrome/browser/ash/input_method/input_method_quick_settings_helpers.h" +#include "chrome/browser/ash/input_method/input_method_settings.h" +#include "chrome/browser/ash/input_method/suggestions_service_client.h" +#include "chrome/browser/ash/input_method/ui/input_method_menu_manager.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/settings_window_manager_chromeos.h" +#include "chrome/browser/ui/webui/settings/chromeos/constants/routes.mojom.h" +#include "chrome/common/pref_names.h" +#include "components/prefs/pref_service.h" +#include "ui/base/ime/ash/extension_ime_util.h" +#include "ui/base/ime/ash/ime_bridge.h" +#include "ui/base/ime/ash/ime_keyboard.h" +#include "ui/base/ime/ash/input_method_manager.h" +#include "ui/base/ime/ash/input_method_ukm.h" +#include "ui/events/keycodes/dom/keycode_converter.h" + +namespace ash { +namespace input_method { + +namespace { + +namespace mojom = ::ash::ime::mojom; + +// These are persisted to logs. Entries should not be renumbered. Numeric values +// should not be reused. Must stay in sync with IMENonAutocorrectDiacriticStatus +// enum in: tools/metrics/histograms/enums.xml +enum class NonAutocorrectDiacriticStatus { + kWithoutDiacritics = 0, + kWithDiacritics = 1, + kMaxValue = kWithDiacritics, +}; + +bool IsRuleBasedEngine(const std::string& engine_id) { + return base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE); +} + +bool IsFstEngine(const std::string& engine_id) { + return base::StartsWith(engine_id, "xkb:", base::CompareCase::SENSITIVE) || + base::StartsWith(engine_id, "experimental_", + base::CompareCase::SENSITIVE); +} + +bool IsKoreanEngine(const std::string& engine_id) { + return base::StartsWith(engine_id, "ko-", base::CompareCase::SENSITIVE); +} + +bool IsChineseEngine(const std::string& engine_id) { + return engine_id == "zh-t-i0-pinyin" || engine_id == "zh-hant-t-i0-pinyin" || + engine_id == "zh-hant-t-i0-cangjie-1987" || + engine_id == "zh-hant-t-i0-cangjie-1987-x-m0-simplified" || + engine_id == "yue-hant-t-i0-und" || engine_id == "zh-t-i0-wubi-1986" || + engine_id == "zh-hant-t-i0-array-1992" || + engine_id == "zh-hant-t-i0-dayi-1988" || + engine_id == "zh-hant-t-i0-und"; +} + +bool IsJapaneseEngine(const std::string& engine_id) { + return engine_id == "nacl_mozc_jp" || engine_id == "nacl_mozc_us"; +} + +bool IsUsEnglishEngine(const std::string& engine_id) { + return engine_id == "xkb:us::eng"; +} + +bool IsTransliterationEngine(const std::string& engine_id) { + return engine_id == "ar-t-i0-und" || engine_id == "el-t-i0-und" || + engine_id == "gu-t-i0-und" || engine_id == "he-t-i0-und" || + engine_id == "hi-t-i0-und" || engine_id == "kn-t-i0-und" || + engine_id == "ml-t-i0-und" || engine_id == "mr-t-i0-und" || + engine_id == "ne-t-i0-und" || engine_id == "or-t-i0-und" || + engine_id == "fa-t-i0-und" || engine_id == "pa-t-i0-und" || + engine_id == "sa-t-i0-und" || engine_id == "ta-t-i0-und" || + engine_id == "te-t-i0-und" || engine_id == "ur-t-i0-und"; +} + +bool IsPhysicalKeyboardAutocorrectEnabled(PrefService* prefs, + const std::string& engine_id) { + if (base::StartsWith(engine_id, "experimental_", + base::CompareCase::SENSITIVE) || + base::FeatureList::IsEnabled(features::kAutocorrectParamsTuning)) { + return true; + } + + const base::Value* input_method_settings = + prefs->GetDictionary(::prefs::kLanguageInputMethodSpecificSettings); + const base::Value* autocorrect_setting = input_method_settings->FindPath( + engine_id + ".physicalKeyboardAutoCorrectionLevel"); + return autocorrect_setting && autocorrect_setting->GetIfInt().value_or(0) > 0; +} + +bool IsLacrosEnabled() { + return base::FeatureList::IsEnabled(chromeos::features::kLacrosSupport); +} + +bool IsPredictiveWritingEnabled(PrefService* pref_service, + const std::string& engine_id) { + return (!IsLacrosEnabled() && features::IsAssistiveMultiWordEnabled() && + IsPredictiveWritingPrefEnabled(pref_service, engine_id) && + IsUsEnglishEngine(engine_id)); +} + +std::string NormalizeRuleBasedEngineId(const std::string engine_id) { + // For legacy reasons, |engine_id| starts with "vkd_" in the input method + // manifest, but the InputEngineManager expects the prefix "m17n:". + // TODO(https://crbug.com/1012490): Migrate to m17n prefix and remove this. + if (base::StartsWith(engine_id, "vkd_", base::CompareCase::SENSITIVE)) { + return "m17n:" + engine_id.substr(4); + } + return engine_id; +} + +mojom::ModifierStatePtr ModifierStateFromEvent(const ui::KeyEvent& event) { + auto modifier_state = mojom::ModifierState::New(); + modifier_state->alt = event.flags() & ui::EF_ALT_DOWN; + modifier_state->alt_graph = event.flags() & ui::EF_ALTGR_DOWN; + modifier_state->caps_lock = event.flags() & ui::EF_CAPS_LOCK_ON; + modifier_state->control = event.flags() & ui::EF_CONTROL_DOWN; + modifier_state->shift = event.flags() & ui::EF_SHIFT_DOWN; + return modifier_state; +} + +mojom::InputFieldType TextInputTypeToMojoType(ui::TextInputType type) { + using mojom::InputFieldType; + switch (type) { + case ui::TEXT_INPUT_TYPE_PASSWORD: + return InputFieldType::kPassword; + case ui::TEXT_INPUT_TYPE_SEARCH: + return InputFieldType::kSearch; + case ui::TEXT_INPUT_TYPE_EMAIL: + return InputFieldType::kEmail; + case ui::TEXT_INPUT_TYPE_TELEPHONE: + return InputFieldType::kTelephone; + case ui::TEXT_INPUT_TYPE_URL: + return InputFieldType::kURL; + case ui::TEXT_INPUT_TYPE_NUMBER: + return InputFieldType::kNumber; + case ui::TEXT_INPUT_TYPE_NULL: + return InputFieldType::kNoIME; + case ui::TEXT_INPUT_TYPE_TEXT: + return InputFieldType::kText; + default: + return InputFieldType::kText; + } +} + +mojom::AutocorrectMode AutocorrectFlagsToMojoType(int flags) { + if (((flags & ui::TEXT_INPUT_FLAG_AUTOCORRECT_OFF) || + (flags & ui::TEXT_INPUT_FLAG_SPELLCHECK_OFF))) { + return mojom::AutocorrectMode::kDisabled; + } + return mojom::AutocorrectMode::kEnabled; +} + +enum class ImeServiceEvent { + kUnknown = 0, + kInitSuccess = 1, + kInitFailed = 2, + kActivateImeSuccess = 3, + kActivateImeFailed = 4, + kServiceDisconnected = 5, + kMaxValue = kServiceDisconnected +}; + +void LogEvent(ImeServiceEvent event) { + UMA_HISTOGRAM_ENUMERATION("InputMethod.Mojo.Extension.Event", event); +} + +// Not using a EnumTraits here because the mapping is not 1:1. +mojom::DomCode DomCodeToMojom(const ui::DomCode code) { + switch (code) { + case ui::DomCode::BACKQUOTE: + return mojom::DomCode::kBackquote; + case ui::DomCode::BACKSLASH: + return mojom::DomCode::kBackslash; + case ui::DomCode::BRACKET_LEFT: + return mojom::DomCode::kBracketLeft; + case ui::DomCode::BRACKET_RIGHT: + return mojom::DomCode::kBracketRight; + case ui::DomCode::COMMA: + return mojom::DomCode::kComma; + case ui::DomCode::DIGIT0: + return mojom::DomCode::kDigit0; + case ui::DomCode::DIGIT1: + return mojom::DomCode::kDigit1; + case ui::DomCode::DIGIT2: + return mojom::DomCode::kDigit2; + case ui::DomCode::DIGIT3: + return mojom::DomCode::kDigit3; + case ui::DomCode::DIGIT4: + return mojom::DomCode::kDigit4; + case ui::DomCode::DIGIT5: + return mojom::DomCode::kDigit5; + case ui::DomCode::DIGIT6: + return mojom::DomCode::kDigit6; + case ui::DomCode::DIGIT7: + return mojom::DomCode::kDigit7; + case ui::DomCode::DIGIT8: + return mojom::DomCode::kDigit8; + case ui::DomCode::DIGIT9: + return mojom::DomCode::kDigit9; + case ui::DomCode::EQUAL: + return mojom::DomCode::kEqual; + case ui::DomCode::INTL_BACKSLASH: + return mojom::DomCode::kIntlBackslash; + case ui::DomCode::INTL_RO: + return mojom::DomCode::kIntlRo; + case ui::DomCode::INTL_YEN: + return mojom::DomCode::kIntlYen; + case ui::DomCode::US_A: + return mojom::DomCode::kKeyA; + case ui::DomCode::US_B: + return mojom::DomCode::kKeyB; + case ui::DomCode::US_C: + return mojom::DomCode::kKeyC; + case ui::DomCode::US_D: + return mojom::DomCode::kKeyD; + case ui::DomCode::US_E: + return mojom::DomCode::kKeyE; + case ui::DomCode::US_F: + return mojom::DomCode::kKeyF; + case ui::DomCode::US_G: + return mojom::DomCode::kKeyG; + case ui::DomCode::US_H: + return mojom::DomCode::kKeyH; + case ui::DomCode::US_I: + return mojom::DomCode::kKeyI; + case ui::DomCode::US_J: + return mojom::DomCode::kKeyJ; + case ui::DomCode::US_K: + return mojom::DomCode::kKeyK; + case ui::DomCode::US_L: + return mojom::DomCode::kKeyL; + case ui::DomCode::US_M: + return mojom::DomCode::kKeyM; + case ui::DomCode::US_N: + return mojom::DomCode::kKeyN; + case ui::DomCode::US_O: + return mojom::DomCode::kKeyO; + case ui::DomCode::US_P: + return mojom::DomCode::kKeyP; + case ui::DomCode::US_Q: + return mojom::DomCode::kKeyQ; + case ui::DomCode::US_R: + return mojom::DomCode::kKeyR; + case ui::DomCode::US_S: + return mojom::DomCode::kKeyS; + case ui::DomCode::US_T: + return mojom::DomCode::kKeyT; + case ui::DomCode::US_U: + return mojom::DomCode::kKeyU; + case ui::DomCode::US_V: + return mojom::DomCode::kKeyV; + case ui::DomCode::US_W: + return mojom::DomCode::kKeyW; + case ui::DomCode::US_X: + return mojom::DomCode::kKeyX; + case ui::DomCode::US_Y: + return mojom::DomCode::kKeyY; + case ui::DomCode::US_Z: + return mojom::DomCode::kKeyZ; + case ui::DomCode::MINUS: + return mojom::DomCode::kMinus; + case ui::DomCode::PERIOD: + return mojom::DomCode::kPeriod; + case ui::DomCode::QUOTE: + return mojom::DomCode::kQuote; + case ui::DomCode::SEMICOLON: + return mojom::DomCode::kSemicolon; + case ui::DomCode::SLASH: + return mojom::DomCode::kSlash; + case ui::DomCode::BACKSPACE: + return mojom::DomCode::kBackspace; + case ui::DomCode::ENTER: + return mojom::DomCode::kEnter; + case ui::DomCode::SPACE: + return mojom::DomCode::kSpace; + case ui::DomCode::ALT_LEFT: + return mojom::DomCode::kAltLeft; + case ui::DomCode::ALT_RIGHT: + return mojom::DomCode::kAltRight; + case ui::DomCode::SHIFT_LEFT: + return mojom::DomCode::kShiftLeft; + case ui::DomCode::SHIFT_RIGHT: + return mojom::DomCode::kShiftRight; + case ui::DomCode::CONTROL_LEFT: + return mojom::DomCode::kControlLeft; + case ui::DomCode::CONTROL_RIGHT: + return mojom::DomCode::kControlRight; + case ui::DomCode::CAPS_LOCK: + return mojom::DomCode::kCapsLock; + default: + return mojom::DomCode::kOther; + } +} + +// Not using an EnumTraits here because the mapping is not 1:1. +absl::optional<mojom::NamedDomKey> NamedDomKeyToMojom( + const ui::DomKey::Base& key) { + switch (key) { + case ui::DomKey::ALT: + return mojom::NamedDomKey::kAlt; + case ui::DomKey::ALT_GRAPH: + return mojom::NamedDomKey::kAltGraph; + case ui::DomKey::CAPS_LOCK: + return mojom::NamedDomKey::kCapsLock; + case ui::DomKey::CONTROL: + return mojom::NamedDomKey::kControl; + case ui::DomKey::SHIFT: + return mojom::NamedDomKey::kShift; + case ui::DomKey::ENTER: + return mojom::NamedDomKey::kEnter; + case ui::DomKey::BACKSPACE: + return mojom::NamedDomKey::kBackspace; + case ui::DomKey::ESCAPE: + return mojom::NamedDomKey::kEscape; + case ui::DomKey::HANGUL_MODE: + return mojom::NamedDomKey::kHangeulMode; + case ui::DomKey::HANJA_MODE: + return mojom::NamedDomKey::kHanjaMode; + case ui::DomKey::ARROW_DOWN: + return mojom::NamedDomKey::kArrowDown; + case ui::DomKey::ARROW_LEFT: + return mojom::NamedDomKey::kArrowLeft; + case ui::DomKey::ARROW_RIGHT: + return mojom::NamedDomKey::kArrowRight; + case ui::DomKey::ARROW_UP: + return mojom::NamedDomKey::kArrowUp; + case ui::DomKey::PAGE_DOWN: + return mojom::NamedDomKey::kPageDown; + case ui::DomKey::PAGE_UP: + return mojom::NamedDomKey::kPageUp; + case ui::DomKey::TAB: + return mojom::NamedDomKey::kTab; + default: + return absl::nullopt; + } +} + +// Returns nullptr if it's not convertible. +// Not using a UnionTraits here because the mapping is not 1:1. +mojom::DomKeyPtr DomKeyToMojom(const ui::DomKey& key) { + // `IsCharacter` may return true for named keys like Enter because they have a + // Unicode representation. Hence, try to convert the key into a named key + // first before trying to convert it to a character key. + if (ui::KeycodeConverter::IsDomKeyNamed(key)) { + absl::optional<mojom::NamedDomKey> named_key = NamedDomKeyToMojom(key); + return named_key ? mojom::DomKey::NewNamedKey(*named_key) : nullptr; + } + if (key.IsCharacter()) { + return mojom::DomKey::NewCodepoint(key.ToCharacter()); + } + return nullptr; +} + +// Returns nullptr if it's not convertible. +// Not using a StructTraits here because the mapping is not 1:1. +mojom::PhysicalKeyEventPtr CreatePhysicalKeyEventFromKeyEvent( + const ui::KeyEvent& event) { + mojom::DomKeyPtr key = DomKeyToMojom(event.GetDomKey()); + if (!key) { + return nullptr; + } + + return mojom::PhysicalKeyEvent::New( + event.type() == ui::ET_KEY_PRESSED ? mojom::KeyEventType::kKeyDown + : mojom::KeyEventType::kKeyUp, + std::move(key), DomCodeToMojom(event.code()), + ModifierStateFromEvent(event)); +} + +uint32_t Utf16ToCodepoint(const std::u16string& str) { + int32_t index = 0; + uint32_t codepoint = 0; + base::ReadUnicodeCharacter(str.data(), str.length(), &index, &codepoint); + + // Should only contain a single codepoint. + DCHECK_GE(index, 0); + DCHECK_EQ(static_cast<size_t>(index), str.length() - 1); + return codepoint; +} + +ui::ImeTextSpan::Thickness GetCompositionSpanThickness( + const mojom::CompositionSpanStyle& style) { + switch (style) { + case mojom::CompositionSpanStyle::kNone: + return ui::ImeTextSpan::Thickness::kNone; + case mojom::CompositionSpanStyle::kDefault: + return ui::ImeTextSpan::Thickness::kThin; + } +} + +// Not using a StructTraits here because the mapping is not 1:1. +ui::ImeTextSpan CompositionSpanToImeTextSpan( + const mojom::CompositionSpan& span) { + return ui::ImeTextSpan(ui::ImeTextSpan::Type::kComposition, span.start, + span.end, GetCompositionSpanThickness(span.style), + span.style == mojom::CompositionSpanStyle::kNone + ? ui::ImeTextSpan::UnderlineStyle::kNone + : ui::ImeTextSpan::UnderlineStyle::kSolid); +} + +void OnConnected(bool bound) { + LogEvent(bound ? ImeServiceEvent::kActivateImeSuccess + : ImeServiceEvent::kActivateImeFailed); +} + +void OnError(base::Time start) { + LOG(ERROR) << "IME Service connection error"; + + // If the Mojo pipe disconnection happens in 1000 ms after the service + // is initialized, we consider it as a failure. Normally it's caused + // by the Mojo service itself or misconfigured on Chrome OS. + if (base::Time::Now() - start < base::Milliseconds(1000)) { + LogEvent(ImeServiceEvent::kInitFailed); + } else { + LogEvent(ImeServiceEvent::kServiceDisconnected); + } +} + +InputFieldContext CreateInputFieldContext( + const AssistiveSuggesterSwitch::EnabledSuggestions& enabled_suggestions) { + return InputFieldContext{ + .lacros_enabled = IsLacrosEnabled(), + .multiword_enabled = features::IsAssistiveMultiWordEnabled(), + .multiword_allowed = enabled_suggestions.multi_word_suggestions}; +} + +mojom::TextPredictionMode GetTextPredictionMode( + const std::string& engine_id, + const InputFieldContext& context, + const PrefService& prefs) { + // TODO(crbug.com/1263335): Enable text prediction for Lacros. + return context.multiword_enabled && context.multiword_allowed && + !context.lacros_enabled && + prefs.GetBoolean(prefs::kAssistPredictiveWritingEnabled) && + IsUsEnglishEngine(engine_id) + ? mojom::TextPredictionMode::kEnabled + : mojom::TextPredictionMode::kDisabled; +} + +std::string MojomLayoutToXkbLayout(mojom::PinyinLayout layout) { + switch (layout) { + case mojom::PinyinLayout::kUsQwerty: + return "us"; + case mojom::PinyinLayout::kDvorak: + return "us(dvorak)"; + case mojom::PinyinLayout::kColemak: + return "us(colemak)"; + } +} + +mojom::InputFieldInfoPtr CreateInputFieldInfo( + const std::string& engine_id, + const ui::IMEEngineHandlerInterface::InputContext& context, + const InputFieldContext& input_field_context, + const PrefService& prefs, + bool is_normal_screen) { + // Disable most features on the login screen. + if (!is_normal_screen) { + return mojom::InputFieldInfo::New( + context.type == ui::TEXT_INPUT_TYPE_PASSWORD + ? mojom::InputFieldType::kPassword + : mojom::InputFieldType::kNoIME, + mojom::AutocorrectMode::kDisabled, + mojom::PersonalizationMode::kDisabled, + mojom::TextPredictionMode::kDisabled); + } + + return mojom::InputFieldInfo::New( + TextInputTypeToMojoType(context.type), + AutocorrectFlagsToMojoType(context.flags), + context.should_do_learning ? mojom::PersonalizationMode::kEnabled + : mojom::PersonalizationMode::kDisabled, + GetTextPredictionMode(engine_id, input_field_context, prefs)); +} + +void OverrideXkbLayoutIfNeeded(ImeKeyboard* keyboard, + const mojom::InputMethodSettingsPtr& settings) { + if (settings && settings->is_pinyin_settings()) { + keyboard->SetCurrentKeyboardLayoutByName( + MojomLayoutToXkbLayout(settings->get_pinyin_settings()->layout)); + } +} + +} // namespace + +bool CanRouteToNativeMojoEngine(const std::string& engine_id) { + // To avoid handling tricky cases where the user types with both the virtual + // and the physical keyboard, only run the native code path if the virtual + // keyboard is disabled. Otherwise, just let the extension handle any physical + // key events. + if (ChromeKeyboardControllerClient::Get()->GetKeyboardEnabled()) { + return false; + } + + return (base::FeatureList::IsEnabled( + features::kSystemChinesePhysicalTyping) && + IsChineseEngine(engine_id)) || + (base::FeatureList::IsEnabled( + features::kSystemJapanesePhysicalTyping) && + IsJapaneseEngine(engine_id)) || + (base::FeatureList::IsEnabled( + features::kSystemTransliterationPhysicalTyping) && + IsTransliterationEngine(engine_id)) || + IsKoreanEngine(engine_id) || IsFstEngine(engine_id); +} + +NativeInputMethodEngineObserver::NativeInputMethodEngineObserver( + PrefService* prefs, + std::unique_ptr<InputMethodEngineObserver> ime_base_observer, + std::unique_ptr<AssistiveSuggester> assistive_suggester, + std::unique_ptr<AutocorrectManager> autocorrect_manager, + std::unique_ptr<SuggestionsCollector> suggestions_collector, + std::unique_ptr<GrammarManager> grammar_manager, + bool use_ime_service) + : prefs_(prefs), + ime_base_observer_(std::move(ime_base_observer)), + assistive_suggester_(std::move(assistive_suggester)), + autocorrect_manager_(std::move(autocorrect_manager)), + suggestions_collector_(std::move(suggestions_collector)), + grammar_manager_(std::move(grammar_manager)), + use_ime_service_(use_ime_service) {} + +NativeInputMethodEngineObserver::~NativeInputMethodEngineObserver() = default; + +bool NativeInputMethodEngineObserver::ShouldRouteToRuleBasedEngine( + const std::string& engine_id) const { + return use_ime_service_ && IsRuleBasedEngine(engine_id); +} + +bool NativeInputMethodEngineObserver::ShouldRouteToNativeMojoEngine( + const std::string& engine_id) const { + return use_ime_service_ && CanRouteToNativeMojoEngine(engine_id); +} + +void NativeInputMethodEngineObserver::OnConnectionFactoryBound(bool bound) { + if (bound) + return; + + LOG(ERROR) << "ConnectionFactory failed to bind, abort."; + connection_factory_.reset(); +} + +void NativeInputMethodEngineObserver::ConnectToImeService( + mojom::ConnectionTarget connection_target, + const std::string& engine_id) { + if (!remote_manager_.is_bound()) { + auto* ime_manager = InputMethodManager::Get(); + ime_manager->ConnectInputEngineManager( + remote_manager_.BindNewPipeAndPassReceiver()); + remote_manager_.set_disconnect_handler( + base::BindOnce(&OnError, base::Time::Now())); + LogEvent(ImeServiceEvent::kInitSuccess); + } + + // Deactivate any existing engine. + connection_factory_.reset(); + input_method_.reset(); + host_receiver_.reset(); + + remote_manager_->InitializeConnectionFactory( + connection_factory_.BindNewPipeAndPassReceiver(), connection_target, + base::BindOnce(&NativeInputMethodEngineObserver::OnConnectionFactoryBound, + weak_ptr_factory_.GetWeakPtr())); + + mojo::PendingAssociatedRemote<ime::mojom::InputMethodHost> input_method_host; + host_receiver_.Bind(input_method_host.InitWithNewEndpointAndPassReceiver()); + + ime::mojom::InputMethodSettingsPtr settings = + CreateSettingsFromPrefs(*prefs_, engine_id, InputFieldContext{}); + connection_factory_->ConnectToInputMethod( + engine_id, input_method_.BindNewEndpointAndPassReceiver(), + std::move(input_method_host), std::move(settings), + base::BindOnce(&OnConnected)); +} + +void NativeInputMethodEngineObserver::ActivateTextClient( + int context_id, + bool on_focus_success) { + if (text_client_ && text_client_->context_id == context_id) + text_client_->state = TextClientState::kActive; +} + +void NativeInputMethodEngineObserver::OnActivate(const std::string& engine_id) { + // Always hide the candidates window and clear the quick settings menu when + // switching input methods. + UpdateCandidatesWindow(nullptr); + ui::ime::InputMethodMenuManager::GetInstance() + ->SetCurrentInputMethodMenuItemList({}); + + // TODO(b/181077907): Always launch the IME service and let IME service decide + // whether it should shutdown or not. + if (IsFstEngine(engine_id) && ShouldRouteToNativeMojoEngine(engine_id) && + // The FST Mojo engine is only needed if autocorrect is enabled. + !IsPhysicalKeyboardAutocorrectEnabled(prefs_, engine_id) && + !IsPredictiveWritingEnabled(prefs_, engine_id)) { + connection_factory_.reset(); + remote_manager_.reset(); + input_method_.reset(); + host_receiver_.reset(); + return; + } + + if (ShouldRouteToRuleBasedEngine(engine_id)) { + const auto new_engine_id = NormalizeRuleBasedEngineId(engine_id); + ConnectToImeService(mojom::ConnectionTarget::kImeService, new_engine_id); + // Notify the virtual keyboard extension that the IME has changed. + ime_base_observer_->OnActivate(engine_id); + } else if (ShouldRouteToNativeMojoEngine(engine_id)) { + ConnectToImeService(mojom::ConnectionTarget::kDecoder, engine_id); + // Inform the assistive suggester of the new engine activation. + assistive_suggester_->OnActivate(engine_id); + } else { + // Release the IME service. + // TODO(b/147709499): A better way to cleanup all. + connection_factory_.reset(); + remote_manager_.reset(); + input_method_.reset(); + host_receiver_.reset(); + + // It is possible that the extension has missed changes to the input method + // options because the options were changed while it was sleeping. + // Trigger an input method option changed event to ensure the extension has + // the latest options. + ime_base_observer_->OnInputMethodOptionsChanged(engine_id); + ime_base_observer_->OnActivate(engine_id); + } +} + +void NativeInputMethodEngineObserver::OnFocus( + const std::string& engine_id, + int context_id, + const IMEEngineHandlerInterface::InputContext& context) { + text_client_ = + TextClient{.context_id = context_id, .state = TextClientState::kPending}; + + if (assistive_suggester_->IsAssistiveFeatureEnabled()) { + assistive_suggester_->OnFocus(context_id); + } + autocorrect_manager_->OnFocus(context_id); + if (grammar_manager_->IsOnDeviceGrammarEnabled()) { + grammar_manager_->OnFocus(context_id, context.flags); + } + if (ShouldRouteToNativeMojoEngine(engine_id)) { + if (IsInputMethodBound()) { + if (assistive_suggester_.get()) { + assistive_suggester_->FetchEnabledSuggestionsFromBrowserContextThen( + base::BindOnce(&NativeInputMethodEngineObserver:: + HandleOnFocusAsyncForNativeMojoEngine, + weak_ptr_factory_.GetWeakPtr(), engine_id, + context_id, context)); + } else { + // Because assistive_suggester is not available, we can assume that + // there are no enabled suggestions. Hence we just run this function + // synchronously with no enabled suggestions. + HandleOnFocusAsyncForNativeMojoEngine( + engine_id, context_id, context, + AssistiveSuggesterSwitch::EnabledSuggestions{}); + } + } + } else { + // TODO(b/218608883): Support OnFocusCallback through extension based PK. + ime_base_observer_->OnFocus(engine_id, context_id, context); + ActivateTextClient(context_id, true); + } +} + +void NativeInputMethodEngineObserver::HandleOnFocusAsyncForNativeMojoEngine( + const std::string& engine_id, + int context_id, + const IMEEngineHandlerInterface::InputContext& context, + const AssistiveSuggesterSwitch::EnabledSuggestions& enabled_suggestions) { + // It is possible the text client got unfocused/or changed before this async + // function is run, if the new focus/blur event occurred fast enough. In that + // case, this async OnFocus call is obsolete, and should be skipped. + if (!text_client_.has_value() || text_client_->context_id != context_id || + text_client_->state != TextClientState::kPending) { + return; + } + + InputFieldContext input_field_context = + features::IsAssistiveMultiWordEnabled() + ? CreateInputFieldContext(enabled_suggestions) + : InputFieldContext{}; + // TODO(b/200611333): Make input_method_->OnFocus return the overriding + // XKB layout instead of having the logic here in Chromium. + ime::mojom::InputMethodSettingsPtr settings = + CreateSettingsFromPrefs(*prefs_, engine_id, input_field_context); + OverrideXkbLayoutIfNeeded(InputMethodManager::Get()->GetImeKeyboard(), + settings); + + const bool is_normal_screen = + InputMethodManager::Get()->GetActiveIMEState()->GetUIStyle() == + InputMethodManager::UIStyle::kNormal; + mojom::InputFieldInfoPtr input_field_info = CreateInputFieldInfo( + engine_id, context, input_field_context, *prefs_, is_normal_screen); + + base::OnceCallback<void(bool)> on_focus_callback = + base::BindOnce(&NativeInputMethodEngineObserver::ActivateTextClient, + weak_ptr_factory_.GetWeakPtr(), text_client_->context_id); + + input_method_->OnFocus(std::move(input_field_info), + prefs_ ? std::move(settings) : nullptr, + std::move(on_focus_callback)); + + // TODO(b/202224495): Send the surrounding text as part of InputFieldInfo. + SendSurroundingTextToNativeMojoEngine(last_surrounding_text_); +} + +void NativeInputMethodEngineObserver::OnTouch( + ui::EventPointerType pointerType) { + ime_base_observer_->OnTouch(pointerType); +} + +void NativeInputMethodEngineObserver::OnBlur(const std::string& engine_id, + int context_id) { + // Always hide the candidates window when there's no focus. + UpdateCandidatesWindow(nullptr); + + text_client_ = absl::nullopt; + + if (assistive_suggester_->IsAssistiveFeatureEnabled()) + assistive_suggester_->OnBlur(); + + if (ShouldRouteToNativeMojoEngine(engine_id)) { + if (IsInputMethodBound()) { + input_method_->OnBlur(); + } + } else { + ime_base_observer_->OnBlur(engine_id, context_id); + } +} + +void NativeInputMethodEngineObserver::OnKeyEvent( + const std::string& engine_id, + const ui::KeyEvent& event, + ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) { + if (assistive_suggester_->IsAssistiveFeatureEnabled()) { + if (assistive_suggester_->OnKeyEvent(event)) { + std::move(callback).Run(true); + return; + } + } + if (autocorrect_manager_->OnKeyEvent(event)) { + std::move(callback).Run(true); + return; + } + if (grammar_manager_->IsOnDeviceGrammarEnabled() && + grammar_manager_->OnKeyEvent(event)) { + std::move(callback).Run(true); + return; + } + + if (ShouldRouteToRuleBasedEngine(engine_id) || + ShouldRouteToNativeMojoEngine(engine_id)) { + if (IsInputMethodBound() && IsInputMethodConnected()) { + // CharacterComposer only takes KEY_PRESSED events. + const bool filtered = event.type() == ui::ET_KEY_PRESSED && + character_composer_.FilterKeyPress(event); + + // Don't send dead keys to the system IME. Dead keys should be handled at + // the OS level and not exposed to IMEs. + if (event.GetDomKey().IsDeadKey()) { + std::move(callback).Run(true); + return; + } + + mojom::PhysicalKeyEventPtr key_event = + CreatePhysicalKeyEventFromKeyEvent(event); + if (!key_event) { + std::move(callback).Run(false); + return; + } + + // Hot switches to turn on/off certain IME features. + if (IsFstEngine(engine_id) && autocorrect_manager_->DisabledByRule()) { + std::move(callback).Run(false); + return; + } + + if (filtered) { + // TODO(b/174612548): Transform the corresponding KEY_RELEASED event to + // use the composed character as well. + key_event->key = mojom::DomKey::NewCodepoint( + Utf16ToCodepoint(character_composer_.composed_character())); + } + + auto process_key_event_callback = base::BindOnce( + [](ui::IMEEngineHandlerInterface::KeyEventDoneCallback + original_callback, + mojom::KeyEventResult result) { + std::move(original_callback) + .Run(result == mojom::KeyEventResult::kConsumedByIme); + }, + std::move(callback)); + + input_method_->ProcessKeyEvent(std::move(key_event), + std::move(process_key_event_callback)); + } else { + std::move(callback).Run(false); + } + } else { + ime_base_observer_->OnKeyEvent(engine_id, event, std::move(callback)); + } +} + +void NativeInputMethodEngineObserver::OnReset(const std::string& engine_id) { + if (ShouldRouteToNativeMojoEngine(engine_id) || + ShouldRouteToRuleBasedEngine(engine_id)) { + if (IsInputMethodBound()) { + input_method_->OnCompositionCanceledBySystem(); + } + } else { + ime_base_observer_->OnReset(engine_id); + } +} + +void NativeInputMethodEngineObserver::OnDeactivated( + const std::string& engine_id) { + if (ShouldRouteToRuleBasedEngine(engine_id)) + input_method_.reset(); + ime_base_observer_->OnDeactivated(engine_id); +} + +void NativeInputMethodEngineObserver::OnCompositionBoundsChanged( + const std::vector<gfx::Rect>& bounds) { + ime_base_observer_->OnCompositionBoundsChanged(bounds); +} + +void NativeInputMethodEngineObserver::OnSurroundingTextChanged( + const std::string& engine_id, + const std::u16string& text, + int cursor_pos, + int anchor_pos, + int offset_pos) { + DCHECK_GE(cursor_pos, 0); + DCHECK_GE(anchor_pos, 0); + + last_surrounding_text_ = SurroundingText{.text = text, + .cursor_pos = cursor_pos, + .anchor_pos = anchor_pos, + .offset_pos = offset_pos}; + + assistive_suggester_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); + autocorrect_manager_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); + if (grammar_manager_->IsOnDeviceGrammarEnabled()) { + grammar_manager_->OnSurroundingTextChanged(text, cursor_pos, anchor_pos); + } + if (ShouldRouteToNativeMojoEngine(engine_id)) { + if (IsInputMethodBound()) { + SendSurroundingTextToNativeMojoEngine(last_surrounding_text_); + } + } else { + ime_base_observer_->OnSurroundingTextChanged(engine_id, text, cursor_pos, + anchor_pos, offset_pos); + } +} + +void NativeInputMethodEngineObserver::OnCandidateClicked( + const std::string& component_id, + int candidate_id, + MouseButtonEvent button) { + if (ShouldRouteToNativeMojoEngine(component_id)) { + if (IsInputMethodBound()) + input_method_->OnCandidateSelected(candidate_id); + } else { + ime_base_observer_->OnCandidateClicked(component_id, candidate_id, button); + } +} + +void NativeInputMethodEngineObserver::OnAssistiveWindowButtonClicked( + const ui::ime::AssistiveWindowButton& button) { + switch (button.id) { + case ui::ime::ButtonId::kSmartInputsSettingLink: + base::RecordAction(base::UserMetricsAction( + "ChromeOS.Settings.SmartInputs.PersonalInfoSuggestions.Open")); + // TODO(crbug/1101689): Add subpath for personal info suggestions + // settings. + chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( + ProfileManager::GetActiveUserProfile(), + chromeos::settings::mojom::kSmartInputsSubpagePath); + break; + case ui::ime::ButtonId::kLearnMore: + if (button.window_type == + ui::ime::AssistiveWindowType::kEmojiSuggestion) { + base::RecordAction(base::UserMetricsAction( + "ChromeOS.Settings.SmartInputs.EmojiSuggestions.Open")); + // TODO(crbug/1101689): Add subpath for emoji suggestions settings. + chrome::SettingsWindowManager::GetInstance()->ShowOSSettings( + ProfileManager::GetActiveUserProfile(), + chromeos::settings::mojom::kSmartInputsSubpagePath); + } + break; + case ui::ime::ButtonId::kSuggestion: + if (assistive_suggester_->IsAssistiveFeatureEnabled()) { + assistive_suggester_->AcceptSuggestion(button.index); + } + if (grammar_manager_->IsOnDeviceGrammarEnabled()) { + grammar_manager_->AcceptSuggestion(); + } + break; + case ui::ime::ButtonId::kUndo: + autocorrect_manager_->UndoAutocorrect(); + break; + case ui::ime::ButtonId::kIgnoreSuggestion: + if (grammar_manager_->IsOnDeviceGrammarEnabled()) { + grammar_manager_->IgnoreSuggestion(); + } + break; + case ui::ime::ButtonId::kAddToDictionary: + case ui::ime::ButtonId::kNone: + ime_base_observer_->OnAssistiveWindowButtonClicked(button); + break; + } +} + +void NativeInputMethodEngineObserver::OnMenuItemActivated( + const std::string& component_id, + const std::string& menu_id) { + if (ShouldRouteToNativeMojoEngine(component_id)) { + if (input_method_.is_bound()) { + mojom::InputMethodQuickSettingsPtr settings = GetQuickSettingsAfterToggle( + ui::ime::InputMethodMenuManager::GetInstance() + ->GetCurrentInputMethodMenuItemList(), + menu_id); + // Notify the IME of the change and then update the menu. + input_method_->OnQuickSettingsUpdated(settings.Clone()); + UpdateQuickSettings(std::move(settings)); + } + } else { + ime_base_observer_->OnMenuItemActivated(component_id, menu_id); + } +} + +void NativeInputMethodEngineObserver::OnScreenProjectionChanged( + bool is_projected) { + ime_base_observer_->OnScreenProjectionChanged(is_projected); +} + +void NativeInputMethodEngineObserver::OnSuggestionsGathered( + RequestSuggestionsCallback callback, + mojom::SuggestionsResponsePtr response) { + std::move(callback).Run(std::move(response)); +} + +void NativeInputMethodEngineObserver::OnSuggestionsChanged( + const std::vector<std::string>& suggestions) { + ime_base_observer_->OnSuggestionsChanged(suggestions); +} + +void NativeInputMethodEngineObserver::OnInputMethodOptionsChanged( + const std::string& engine_id) { + ime_base_observer_->OnInputMethodOptionsChanged(engine_id); +} + +void NativeInputMethodEngineObserver::CommitText( + const std::u16string& text, + mojom::CommitTextCursorBehavior cursor_behavior) { + if (!IsTextClientActive()) + return; + ui::IMEBridge::Get()->GetInputContextHandler()->CommitText( + text, + cursor_behavior == mojom::CommitTextCursorBehavior::kMoveCursorBeforeText + ? ui::TextInputClient::InsertTextCursorBehavior::kMoveCursorBeforeText + : ui::TextInputClient::InsertTextCursorBehavior:: + kMoveCursorAfterText); +} + +void NativeInputMethodEngineObserver::DEPRECATED_SetComposition( + const std::u16string& text, + std::vector<mojom::CompositionSpanPtr> spans) { + if (!IsTextClientActive()) + return; + SetComposition(text, std::move(spans), text.length()); +} + +void NativeInputMethodEngineObserver::SetComposition( + const std::u16string& text, + std::vector<mojom::CompositionSpanPtr> spans, + uint32_t new_cursor_position) { + if (!IsTextClientActive() || new_cursor_position > text.length()) { + return; + } + + ui::CompositionText composition; + composition.text = text; + + composition.ime_text_spans.reserve(spans.size()); + for (const auto& span : spans) { + composition.ime_text_spans.push_back(CompositionSpanToImeTextSpan(*span)); + } + + ui::IMEBridge::Get()->GetInputContextHandler()->UpdateCompositionText( + std::move(composition), + /*cursor_pos=*/new_cursor_position, + /*visible=*/true); +} + +void NativeInputMethodEngineObserver::SetCompositionRange(uint32_t start_index, + uint32_t end_index) { + if (!IsTextClientActive()) + return; + + const auto ordered_range = std::minmax(start_index, end_index); + // TODO(b/151884011): Turn on underlining for composition-based languages. + ui::IMEBridge::Get()->GetInputContextHandler()->SetComposingRange( + ordered_range.first, ordered_range.second, + {ui::ImeTextSpan( + ui::ImeTextSpan::Type::kComposition, /*start_offset=*/0, + /*end_offset=*/ordered_range.second - ordered_range.first, + ui::ImeTextSpan::Thickness::kNone, + ui::ImeTextSpan::UnderlineStyle::kNone)}); +} + +void NativeInputMethodEngineObserver::FinishComposition() { + if (!IsTextClientActive()) + return; + + ui::IMEInputContextHandlerInterface* input_context = + ui::IMEBridge::Get()->GetInputContextHandler(); + + input_context->ConfirmCompositionText(/*reset_engine=*/false, + /*keep_selection=*/true); + + auto* manager = InputMethodManager::Get(); + if (!manager || + !extension_ime_util::IsExperimentalMultilingual( + manager->GetActiveIMEState()->GetCurrentInputMethod().id())) { + return; + } + + std::u16string composition_text = input_context->GetCompositionText(); + base::TrimWhitespace(composition_text, base::TRIM_ALL, &composition_text); + bool has_diacritics = HasDiacritics(composition_text); + + base::UmaHistogramEnumeration( + "InputMethod.MultilingualExperiment.NonAutocorrect", + has_diacritics ? NonAutocorrectDiacriticStatus::kWithDiacritics + : NonAutocorrectDiacriticStatus::kWithoutDiacritics); +} + +void NativeInputMethodEngineObserver::DeleteSurroundingText( + uint32_t num_before_cursor, + uint32_t num_after_cursor) { + if (!IsTextClientActive()) + return; + ui::IMEBridge::Get()->GetInputContextHandler()->DeleteSurroundingText( + /*offset=*/-static_cast<int>(num_before_cursor), + /*length=*/num_before_cursor + num_after_cursor); +} + +void NativeInputMethodEngineObserver::HandleAutocorrect( + mojom::AutocorrectSpanPtr autocorrect_span) { + if (!IsTextClientActive()) + return; + autocorrect_manager_->HandleAutocorrect(autocorrect_span->autocorrect_range, + autocorrect_span->original_text, + autocorrect_span->current_text); +} + +void NativeInputMethodEngineObserver::RequestSuggestions( + mojom::SuggestionsRequestPtr request, + RequestSuggestionsCallback callback) { + suggestions_collector_->GatherSuggestions( + std::move(request), + base::BindOnce(&NativeInputMethodEngineObserver::OnSuggestionsGathered, + base::Unretained(this), std::move(callback))); +} + +void NativeInputMethodEngineObserver::DisplaySuggestions( + const std::vector<ime::TextSuggestion>& suggestions) { + if (!IsTextClientActive()) + return; + assistive_suggester_->OnExternalSuggestionsUpdated(suggestions); +} + +void NativeInputMethodEngineObserver::UpdateCandidatesWindow( + mojom::CandidatesWindowPtr window) { + if (!IsTextClientActive()) + return; + + IMECandidateWindowHandlerInterface* candidate_window_handler = + ui::IMEBridge::Get()->GetCandidateWindowHandler(); + if (!candidate_window_handler) { + return; + } + + if (!window) { + candidate_window_handler->HideLookupTable(); + return; + } + + ui::CandidateWindow candidate_window; + for (const auto& candidate : window->candidates) { + ui::CandidateWindow::Entry entry; + entry.value = base::UTF8ToUTF16(candidate->text); + entry.label = base::UTF8ToUTF16(candidate->label.value_or("")); + entry.annotation = base::UTF8ToUTF16(candidate->annotation.value_or("")); + candidate_window.mutable_candidates()->push_back(entry); + } + + ui::CandidateWindow::CandidateWindowProperty property; + property.is_cursor_visible = !window->highlighted_candidate.is_null(); + property.cursor_position = + window->highlighted_candidate ? window->highlighted_candidate->index : 0; + property.page_size = window->candidates.size(); + property.is_vertical = true; + property.is_auxiliary_text_visible = + window->auxiliary_text.value_or("") != ""; + property.auxiliary_text = window->auxiliary_text.value_or(""); + candidate_window.SetProperty(property); + + candidate_window_handler->UpdateLookupTable(candidate_window); +} + +void NativeInputMethodEngineObserver::RecordUkm(mojom::UkmEntryPtr entry) { + if (entry->is_non_compliant_api()) { + ui::RecordUkmNonCompliantApi( + ui::IMEBridge::Get() + ->GetInputContextHandler() + ->GetClientSourceForMetrics(), + entry->get_non_compliant_api()->non_compliant_operation); + } +} + +void NativeInputMethodEngineObserver::ReportKoreanAction( + mojom::KoreanAction action) { + UMA_HISTOGRAM_ENUMERATION("InputMethod.PhysicalKeyboard.Korean.Action", + action); +} + +void NativeInputMethodEngineObserver::ReportKoreanSettings( + mojom::KoreanSettingsPtr settings) { + UMA_HISTOGRAM_BOOLEAN("InputMethod.PhysicalKeyboard.Korean.MultipleSyllables", + settings->input_multiple_syllables); + UMA_HISTOGRAM_ENUMERATION("InputMethod.PhysicalKeyboard.Korean.Layout", + settings->layout); +} + +void NativeInputMethodEngineObserver::UpdateQuickSettings( + mojom::InputMethodQuickSettingsPtr quick_settings) { + ui::ime::InputMethodMenuManager::GetInstance() + ->SetCurrentInputMethodMenuItemList( + CreateMenuItemsFromQuickSettings(*quick_settings)); +} + +void NativeInputMethodEngineObserver::FlushForTesting() { + if (remote_manager_.is_bound()) + remote_manager_.FlushForTesting(); // IN-TEST + if (connection_factory_.is_bound()) + connection_factory_.FlushForTesting(); // IN-TEST + if (host_receiver_.is_bound()) + host_receiver_.FlushForTesting(); // IN-TEST + if (input_method_.is_bound()) + input_method_.FlushForTesting(); // IN-TEST +} + +void NativeInputMethodEngineObserver::OnProfileWillBeDestroyed() { + prefs_ = nullptr; +} + +bool NativeInputMethodEngineObserver::IsInputMethodBound() { + return connection_factory_.is_bound() && input_method_.is_bound(); +} + +bool NativeInputMethodEngineObserver::IsInputMethodConnected() { + return (connection_factory_.is_bound() && + connection_factory_.is_connected() && input_method_.is_bound() && + input_method_.is_connected()); +} + +bool NativeInputMethodEngineObserver::IsTextClientActive() { + return text_client_ && text_client_->state == TextClientState::kActive; +} + +void NativeInputMethodEngineObserver::SendSurroundingTextToNativeMojoEngine( + const SurroundingText& surrounding_text) { + std::vector<size_t> selection_indices = { + static_cast<size_t>(surrounding_text.anchor_pos), + static_cast<size_t>(surrounding_text.cursor_pos)}; + std::string utf8_text = base::UTF16ToUTF8AndAdjustOffsets( + surrounding_text.text, &selection_indices); + + auto selection = mojom::SelectionRange::New(); + selection->anchor = selection_indices[0]; + selection->focus = selection_indices[1]; + + input_method_->OnSurroundingTextChanged( + std::move(utf8_text), surrounding_text.offset_pos, std::move(selection)); +} + +} // namespace input_method +} // namespace ash
diff --git a/chrome/browser/ash/input_method/native_input_method_engine_observer.h b/chrome/browser/ash/input_method/native_input_method_engine_observer.h new file mode 100644 index 0000000..a040352 --- /dev/null +++ b/chrome/browser/ash/input_method/native_input_method_engine_observer.h
@@ -0,0 +1,201 @@ +// 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. +#ifndef CHROME_BROWSER_ASH_INPUT_METHOD_NATIVE_INPUT_METHOD_ENGINE_OBSERVER_H_ +#define CHROME_BROWSER_ASH_INPUT_METHOD_NATIVE_INPUT_METHOD_ENGINE_OBSERVER_H_ + +#include "ash/services/ime/public/cpp/suggestions.h" +#include "ash/services/ime/public/mojom/connection_factory.mojom.h" +#include "ash/services/ime/public/mojom/input_engine.mojom.h" +#include "ash/services/ime/public/mojom/input_method.mojom.h" +#include "ash/services/ime/public/mojom/input_method_host.mojom.h" +#include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" +#include "chrome/browser/ash/input_method/assistive_suggester.h" +#include "chrome/browser/ash/input_method/assistive_suggester_switch.h" +#include "chrome/browser/ash/input_method/autocorrect_manager.h" +#include "chrome/browser/ash/input_method/grammar_manager.h" +#include "chrome/browser/ash/input_method/input_method_engine.h" +#include "chrome/browser/ash/input_method/suggestions_collector.h" +#include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" +#include "components/prefs/pref_change_registrar.h" +#include "components/prefs/pref_service.h" +#include "mojo/public/cpp/bindings/associated_receiver.h" +#include "mojo/public/cpp/bindings/associated_remote.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "ui/base/ime/ash/ime_engine_handler_interface.h" +#include "ui/base/ime/character_composer.h" + +namespace ash { +namespace input_method { + +using ui::IMEEngineHandlerInterface; + +bool CanRouteToNativeMojoEngine(const std::string& engine_id); + +class NativeInputMethodEngineObserver : public InputMethodEngineObserver, + public ime::mojom::InputMethodHost { + public: + // |ime_base_observer| is to forward events to extension during this + // migration. It will be removed when the official extension is completely + // migrated. + // |use_ime_service| should always be |true| in prod code, and may only be + // |false| in browser tests that need to avoid connecting to the Mojo IME + // service which can involve loading libimedecoder.so unsupported in tests. + // TODO(crbug/1197005): Migrate native_input_method_engine_browsertest suite + // to e2e Tast tests and unit tests, then dismantle this for-test-only flag. + NativeInputMethodEngineObserver( + PrefService* prefs, + std::unique_ptr<InputMethodEngineObserver> ime_base_observer, + std::unique_ptr<AssistiveSuggester> assistive_suggester, + std::unique_ptr<AutocorrectManager> autocorrect_manager, + std::unique_ptr<SuggestionsCollector> suggestions_collector, + std::unique_ptr<GrammarManager> grammar_manager, + bool use_ime_service); + ~NativeInputMethodEngineObserver() override; + + // InputMethodEngineObserver: + void OnActivate(const std::string& engine_id) override; + void OnFocus(const std::string& engine_id, + int context_id, + const IMEEngineHandlerInterface::InputContext& context) override; + void OnTouch(ui::EventPointerType pointerType) override; + void OnBlur(const std::string& engine_id, int context_id) override; + void OnKeyEvent( + const std::string& engine_id, + const ui::KeyEvent& event, + ui::IMEEngineHandlerInterface::KeyEventDoneCallback callback) override; + void OnReset(const std::string& engine_id) override; + void OnDeactivated(const std::string& engine_id) override; + void OnCompositionBoundsChanged( + const std::vector<gfx::Rect>& bounds) override; + void OnSurroundingTextChanged(const std::string& engine_id, + const std::u16string& text, + int cursor_pos, + int anchor_pos, + int offset_pos) override; + void OnCandidateClicked(const std::string& component_id, + int candidate_id, + MouseButtonEvent button) override; + void OnAssistiveWindowButtonClicked( + const ui::ime::AssistiveWindowButton& button) override; + void OnMenuItemActivated(const std::string& component_id, + const std::string& menu_id) override; + void OnScreenProjectionChanged(bool is_projected) override; + void OnSuggestionsChanged( + const std::vector<std::string>& suggestions) override; + void OnInputMethodOptionsChanged(const std::string& engine_id) override; + + // ime::mojom::InputMethodHost: + void CommitText( + const std::u16string& text, + ime::mojom::CommitTextCursorBehavior cursor_behavior) override; + void DEPRECATED_SetComposition( + const std::u16string& text, + std::vector<ime::mojom::CompositionSpanPtr> spans) override; + void SetComposition(const std::u16string& text, + std::vector<ime::mojom::CompositionSpanPtr> spans, + uint32_t new_cursor_position) override; + void SetCompositionRange(uint32_t start_index, uint32_t end_index) override; + void FinishComposition() override; + void DeleteSurroundingText(uint32_t num_before_cursor, + uint32_t num_after_cursor) override; + void HandleAutocorrect( + ime::mojom::AutocorrectSpanPtr autocorrect_span) override; + void RequestSuggestions(ime::mojom::SuggestionsRequestPtr request, + RequestSuggestionsCallback callback) override; + void DisplaySuggestions( + const std::vector<ime::TextSuggestion>& suggestions) override; + void UpdateCandidatesWindow(ime::mojom::CandidatesWindowPtr window) override; + void RecordUkm(ime::mojom::UkmEntryPtr entry) override; + void ReportKoreanAction(ime::mojom::KoreanAction action) override; + void ReportKoreanSettings(ime::mojom::KoreanSettingsPtr settings) override; + void UpdateQuickSettings( + ime::mojom::InputMethodQuickSettingsPtr quick_settings) override; + + // Called when suggestions are collected from the system via + // suggestions_collector_. + void OnSuggestionsGathered(RequestSuggestionsCallback request_callback, + ime::mojom::SuggestionsResponsePtr response); + + // Flush all relevant Mojo pipes. + void FlushForTesting(); + + // Returns whether this is connected to the input engine. + bool IsConnectedForTesting() { return IsInputMethodBound(); } + + void OnProfileWillBeDestroyed(); + + private: + struct SurroundingText { + std::u16string text; + int cursor_pos = 0; + int anchor_pos = 0; + int offset_pos = 0; + }; + + enum TextClientState { + kPending = 0, + kActive = 1, + }; + + struct TextClient { + int context_id; + TextClientState state; + }; + + void SendSurroundingTextToNativeMojoEngine( + const SurroundingText& surrounding_text); + + bool ShouldRouteToRuleBasedEngine(const std::string& engine_id) const; + bool ShouldRouteToNativeMojoEngine(const std::string& engine_id) const; + + void OnConnectionFactoryBound(bool bound); + void ConnectToImeService(ime::mojom::ConnectionTarget connection_target, + const std::string& engine_id); + + void HandleOnFocusAsyncForNativeMojoEngine( + const std::string& engine_id, + int context_id, + const IMEEngineHandlerInterface::InputContext& context, + const AssistiveSuggesterSwitch::EnabledSuggestions& enabled_suggestions); + + bool IsInputMethodBound(); + bool IsInputMethodConnected(); + bool IsTextClientActive(); + void ActivateTextClient(int context_id, bool on_focus_success); + + PrefService* prefs_ = nullptr; + + std::unique_ptr<InputMethodEngineObserver> ime_base_observer_; + mojo::Remote<ime::mojom::InputEngineManager> remote_manager_; + mojo::Remote<ime::mojom::ConnectionFactory> connection_factory_; + mojo::AssociatedRemote<ime::mojom::InputMethod> input_method_; + mojo::AssociatedReceiver<ime::mojom::InputMethodHost> host_receiver_{this}; + + std::unique_ptr<AssistiveSuggester> assistive_suggester_; + std::unique_ptr<AutocorrectManager> autocorrect_manager_; + std::unique_ptr<SuggestionsCollector> suggestions_collector_; + std::unique_ptr<GrammarManager> grammar_manager_; + + ui::CharacterComposer character_composer_; + + SurroundingText last_surrounding_text_; + + absl::optional<TextClient> text_client_; + + // |use_ime_service| should always be |true| in prod code, and may only be + // |false| in browser tests that need to avoid connecting to the Mojo IME + // service which can involve loading libimedecoder.so unsupported in tests. + // TODO(crbug/1197005): Migrate native_input_method_engine_browsertest suite + // to e2e Tast tests and unit tests, then dismantle this for-test-only flag. + bool use_ime_service_ = true; + + base::WeakPtrFactory<NativeInputMethodEngineObserver> weak_ptr_factory_{this}; +}; + +} // namespace input_method +} // namespace ash + +#endif // CHROME_BROWSER_ASH_INPUT_METHOD_NATIVE_INPUT_METHOD_ENGINE_OBSERVER_H_
diff --git a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc index 086ef823..9ec9fae 100644 --- a/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc +++ b/chrome/browser/ash/login/demo_mode/demo_setup_browsertest.cc
@@ -624,8 +624,9 @@ EXPECT_FALSE(StartupUtils::IsDeviceRegistered()); } -// TODO(crbug.com/1150349): Flaky on ChromeOS ASAN. -#if defined(ADDRESS_SANITIZER) +// TODO(crbug.com/1150349, crbug.com/1324447): Flaky on ChromeOS ASAN and on +// builder "linux-chromeos-dbg". +#if defined(ADDRESS_SANITIZER) || !defined(NDEBUG) #define MAYBE_OnlineSetupFlowCrosComponentFailure \ DISABLED_OnlineSetupFlowCrosComponentFailure #else
diff --git a/chrome/browser/ash/login/enable_debugging_browsertest.cc b/chrome/browser/ash/login/enable_debugging_browsertest.cc index 25b5b31..f2af2d4 100644 --- a/chrome/browser/ash/login/enable_debugging_browsertest.cc +++ b/chrome/browser/ash/login/enable_debugging_browsertest.cc
@@ -263,6 +263,13 @@ // Show remove protection, click on [Remove protection] button and wait for // reboot. IN_PROC_BROWSER_TEST_F(EnableDebuggingDevTest, ShowAndRemoveProtection) { + // Disarm faked reboot, otherwise Chrome just stops and there's nothing to + // verify. + chromeos::FakePowerManagerClient* fake_power_manager_client = + chromeos::FakePowerManagerClient::Get(); + ASSERT_NE(fake_power_manager_client, nullptr); + fake_power_manager_client->set_restart_callback(base::DoNothing()); + ShowRemoveProtectionScreen(); debug_daemon_client_->ResetWait(); test::OobeJS().TapOnPath(kRemoveProtectionButton); @@ -273,7 +280,7 @@ base::RunLoop().RunUntilIdle(); EXPECT_EQ(debug_daemon_client_->num_remove_protection(), 1); EXPECT_EQ(debug_daemon_client_->num_enable_debugging_features(), 0); - EXPECT_EQ(FakePowerManagerClient::Get()->num_request_restart_calls(), 1); + EXPECT_EQ(fake_power_manager_client->num_request_restart_calls(), 1); } // Show setup screen. Click on [Enable] button. Wait until done screen is shown.
diff --git a/chrome/browser/ash/system_extensions/api/window_management/cros_window_browsertest.cc b/chrome/browser/ash/system_extensions/api/window_management/cros_window_browsertest.cc index 8f266ef..9c299a6 100644 --- a/chrome/browser/ash/system_extensions/api/window_management/cros_window_browsertest.cc +++ b/chrome/browser/ash/system_extensions/api/window_management/cros_window_browsertest.cc
@@ -515,3 +515,22 @@ RunTest(test_code); } + +// Tests that the CrosWindowManagement object is an EventTarget. +IN_PROC_BROWSER_TEST_F(CrosWindowBrowserTest, CrosWindowManagementEventTarget) { + const char test_code[] = R"( +async function cros_test() { + assert_true(chromeos.windowManagement instanceof EventTarget); + + return new Promise(resolve => { + chromeos.windowManagement.addEventListener('testevent', e => { + assert_equals(e.target, chromeos.windowManagement); + resolve(); + }); + chromeos.windowManagement.dispatchEvent(new Event('testevent')); + }); +} + )"; + + RunTest(test_code); +}
diff --git a/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc b/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc index 462c9b62..950f3acbe 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc +++ b/chrome/browser/autofill_assistant/password_change/apc_client_impl.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/memory/raw_ptr.h" +#include "chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h" #include "content/public/browser/web_contents.h" #include "url/gurl.h"
diff --git a/chrome/browser/autofill_assistant/password_change/apc_client_impl.h b/chrome/browser/autofill_assistant/password_change/apc_client_impl.h index 7c5b1c4c..3e6716f2 100644 --- a/chrome/browser/autofill_assistant/password_change/apc_client_impl.h +++ b/chrome/browser/autofill_assistant/password_change/apc_client_impl.h
@@ -11,6 +11,7 @@ #include <string> #include "base/memory/raw_ptr.h" +#include "chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_user_data.h" #include "url/gurl.h" @@ -50,6 +51,10 @@ // another is already ongoing in the tab. bool is_running_ = false; + // Orchestrates prompting the user for consent if it has not been given + // previously. + std::unique_ptr<ApcOnboardingCoordinator> onboarding_coordinator_; + WEB_CONTENTS_USER_DATA_KEY_DECL(); };
diff --git a/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator.h b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator.h new file mode 100644 index 0000000..8a03aa0 --- /dev/null +++ b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator.h
@@ -0,0 +1,26 @@ +// 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. + +#ifndef CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_H_ +#define CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_H_ + +#include "base/callback.h" + +// Abstract interface for an onboarding coordinator. +class ApcOnboardingCoordinator { + public: + // A callback with a success parameter indicating whether consent has been + // given. + using Callback = base::OnceCallback<void(bool)>; + + ApcOnboardingCoordinator() = default; + virtual ~ApcOnboardingCoordinator() = default; + + // Starts the onboarding process. This may include several steps, such as + // checking preferences whether consent has been given previously, prompting + // the user to give consent now, etc. + virtual void PerformOnboarding(Callback callback) = 0; +}; + +#endif // CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_H_
diff --git a/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.cc b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.cc new file mode 100644 index 0000000..4ac565d8 --- /dev/null +++ b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.cc
@@ -0,0 +1,59 @@ +// 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. + +#include "chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h" + +#include <memory> + +#include "base/bind.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" + +ApcOnboardingCoordinatorImpl::ApcOnboardingCoordinatorImpl( + AssistantDisplayDelegate* display_delegate) + : display_delegate_(display_delegate) {} + +ApcOnboardingCoordinatorImpl::~ApcOnboardingCoordinatorImpl() = default; + +void ApcOnboardingCoordinatorImpl::PerformOnboarding(Callback callback) { + callback_ = std::move(callback); + // Check preferences and see whether they are already set. + if (IsOnboardingAlreadyAccepted()) { + std::move(callback_).Run(true); + return; + } + + // If not, construct controller and view and wait for signal. + // TODO(crbug.com/1322387): User proper consent texts. + AssistantOnboardingInformation info; + info.consent_caption = u"Do you give consent to use Autofill Assistant?"; + info.consent_text = u"This is what you agree to."; + + dialog_controller_ = CreateOnboardingController(info); + dialog_controller_->Show( + CreateOnboardingPrompt(dialog_controller_.get(), display_delegate_), + base::BindOnce( + &ApcOnboardingCoordinatorImpl::OnControllerResponseReceived, + base::Unretained(this))); +} + +std::unique_ptr<AssistantOnboardingController> CreateOnboardingController( + const AssistantOnboardingInformation& onboarding_information) { + return AssistantOnboardingController::Create(onboarding_information); +} + +AssistantOnboardingPrompt* ApcOnboardingCoordinatorImpl::CreateOnboardingPrompt( + AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate) { + return AssistantOnboardingPrompt::Create(controller, display_delegate); +} + +bool ApcOnboardingCoordinatorImpl::IsOnboardingAlreadyAccepted() { + // TODO(crbug.com/1322387): Check preference key. + return false; +} + +void ApcOnboardingCoordinatorImpl::OnControllerResponseReceived(bool success) { + std::move(callback_).Run(success); +}
diff --git a/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h new file mode 100644 index 0000000..59cd87c --- /dev/null +++ b/chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator_impl.h
@@ -0,0 +1,57 @@ +// 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. + +#ifndef CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_IMPL_H_ +#define CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_IMPL_H_ + +#include "chrome/browser/autofill_assistant/password_change/apc_onboarding_coordinator.h" + +#include <memory> +#include <string> + +#include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" + +// Implementation of the |ApcOnboardingCoordinator| interface that takes care +// of onboarding/consent for automated password change. +class ApcOnboardingCoordinatorImpl : public ApcOnboardingCoordinator { + public: + explicit ApcOnboardingCoordinatorImpl( + AssistantDisplayDelegate* display_delegate); + ~ApcOnboardingCoordinatorImpl() override; + + // ApcOnboardingCoordinator: + void PerformOnboarding(Callback callback) override; + + protected: + // These methods pass through their arguments to the respective factory + // functions. Encapsulating them allows injecting mock controllers and + // mock prompts during unit tests. + std::unique_ptr<AssistantOnboardingController> CreateOnboardingController( + const AssistantOnboardingInformation& onboarding_information); + AssistantOnboardingPrompt* CreateOnboardingPrompt( + AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate); + + private: + // Returns whether the user has previously accepted onboarding by checking + // the respective pref key. + bool IsOnboardingAlreadyAccepted(); + + // Handles the response from the UI controller prompting the user for consent. + void OnControllerResponseReceived(bool success); + + // Provides the ability to (un-)register the onboarding view. + raw_ptr<AssistantDisplayDelegate> display_delegate_; + + // Informs the caller about the success of the onboarding process. + Callback callback_; + + // Controller for the dialog. + std::unique_ptr<AssistantOnboardingController> dialog_controller_; +}; + +#endif // CHROME_BROWSER_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_APC_ONBOARDING_COORDINATOR_IMPL_H_
diff --git a/chrome/browser/chrome_back_forward_cache_browsertest.cc b/chrome/browser/chrome_back_forward_cache_browsertest.cc index 2fabe8e1..780f8c3 100644 --- a/chrome/browser/chrome_back_forward_cache_browsertest.cc +++ b/chrome/browser/chrome_back_forward_cache_browsertest.cc
@@ -231,8 +231,9 @@ content::RenderFrameHost::LifecycleState::kInBackForwardCache); } +// TODO(crbug.com/1324437): Disabled for being flaky. IN_PROC_BROWSER_TEST_F(ChromeBackForwardCacheBrowserTest, - PermissionContextBase) { + DISABLED_PermissionContextBase) { // HTTPS needed for GEOLOCATION permission net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); https_server.AddDefaultHandlers(GetChromeTestDataDir());
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 9fa45c17..33b6a05 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -344,6 +344,7 @@ "//chromeos/services/assistant:lib", "//chromeos/services/assistant/public/cpp", "//chromeos/services/bluetooth_config:in_process_bluetooth_config", + "//chromeos/services/cros_healthd/private/cpp", "//chromeos/services/cros_healthd/public/cpp", "//chromeos/services/cros_healthd/public/mojom", "//chromeos/services/machine_learning/public/cpp", @@ -1730,6 +1731,8 @@ "../ash/input_method/multi_word_suggester.h", "../ash/input_method/native_input_method_engine.cc", "../ash/input_method/native_input_method_engine.h", + "../ash/input_method/native_input_method_engine_observer.cc", + "../ash/input_method/native_input_method_engine_observer.h", "../ash/input_method/personal_info_suggester.cc", "../ash/input_method/personal_info_suggester.h", "../ash/input_method/suggester.h",
diff --git a/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc b/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc index 343859f..6fc46af5 100644 --- a/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc +++ b/chrome/browser/chromeos/arc/arc_external_protocol_dialog.cc
@@ -604,6 +604,7 @@ std::vector<ArcIntentHelperMojoDelegate::IntentHandlerInfo> handlers, std::unique_ptr<ArcIntentHelperMojoDelegate> mojo_delegate, base::OnceCallback<void(bool)> handled_cb, + bool show_stay_in_chrome, std::unique_ptr<ArcIconCacheDelegate::ActivityToIconsMap> icons) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -628,10 +629,9 @@ if (!browser) return std::move(handled_cb).Run(false); - const bool stay_in_chrome = IsChromeAnAppCandidate(handlers); bool handled = MaybeAddDevicesAndShowPicker( url, initiating_origin, web_contents.get(), std::move(app_info), - stay_in_chrome, + show_stay_in_chrome, /*show_remember_selection=*/true, base::BindOnce(OnIntentPickerClosed, web_contents, url, safe_to_bypass_ui, std::move(handlers), std::move(mojo_delegate))); @@ -702,16 +702,26 @@ // Otherwise, retrieve icons of the activities. Since this function is for // handling external protocols, Chrome is rarely in the list, but if the |url| - // is intent: with fallback or geo:, for example, it may be. + // is intent: with fallback or geo:, for example, it may be. In this case, we + // remove it from the handler list and show the "Stay in Chrome" button + // instead. + bool show_stay_in_chrome = false; std::vector<ArcIntentHelperMojoDelegate::ActivityName> activities; - for (const auto& handler : handlers) { - activities.emplace_back(handler.package_name, handler.activity_name); + auto it = handlers.begin(); + while (it != handlers.end()) { + if (it->package_name == kArcIntentHelperPackageName) { + it = handlers.erase(it); + show_stay_in_chrome = true; + } else { + activities.emplace_back(it->package_name, it->activity_name); + ++it; + } } ArcIconCacheDelegate::GetInstance()->GetActivityIcons( - activities, - base::BindOnce(OnAppIconsReceived, web_contents, url, initiating_origin, - safe_to_bypass_ui, std::move(handlers), - std::move(mojo_delegate), std::move(handled_cb))); + activities, base::BindOnce(OnAppIconsReceived, web_contents, url, + initiating_origin, safe_to_bypass_ui, + std::move(handlers), std::move(mojo_delegate), + std::move(handled_cb), show_stay_in_chrome)); } } // namespace
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc index d00b2ce..462bf08 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_mount.cc
@@ -55,12 +55,12 @@ if (logger) { logger->Log(logging::LOG_INFO, "%s[%d] called. (source: '%s')", name(), request_id(), - params->source.empty() ? "(none)" : params->source.c_str()); + params->file_url.empty() ? "(none)" : params->file_url.c_str()); } set_log_on_completion(true); path_ = file_manager::util::GetLocalPathFromURL(render_frame_host(), profile, - GURL(params->source)); + GURL(params->file_url)); if (path_.empty()) return RespondNow(Error("Invalid path")); @@ -73,7 +73,7 @@ std::vector<storage::FileSystemURL> urls; const storage::FileSystemURL url = - file_system_context->CrackURLInFirstPartyContext(GURL(params->source)); + file_system_context->CrackURLInFirstPartyContext(GURL(params->file_url)); urls.push_back(url); notifier->NotifyFileTasks(urls); @@ -142,17 +142,17 @@ if (logger) { logger->Log(logging::LOG_INFO, "%s[%d] called. (source: '%s')", name(), request_id(), - params->source.empty() ? "(none)" : params->source.c_str()); + params->file_url.empty() ? "(none)" : params->file_url.c_str()); } set_log_on_completion(true); - if (params->source.empty()) + if (params->file_url.empty()) return RespondNow(Error("Invalid path")); DCHECK_CURRENTLY_ON(BrowserThread::UI); base::FilePath path = file_manager::util::GetLocalPathFromURL( - render_frame_host(), profile, GURL(params->source)); + render_frame_host(), profile, GURL(params->file_url)); DiskMountManager* const disk_mount_manager = DiskMountManager::GetInstance(); DCHECK(disk_mount_manager);
diff --git a/chrome/browser/download/bubble/download_display_controller.cc b/chrome/browser/download/bubble/download_display_controller.cc index 9abadc4a..c9aa134 100644 --- a/chrome/browser/download/bubble/download_display_controller.cc +++ b/chrome/browser/download/bubble/download_display_controller.cc
@@ -26,6 +26,22 @@ // The amount of time for the toolbar icon to stay active after a download is // completed. constexpr base::TimeDelta kToolbarIconActiveTimeInterval = base::Minutes(1); + +// From the button UI's perspective, whether the download is considered in +// progress. +bool IsModelInProgress(const DownloadUIModelPtr& model) { + // Consider dangerous downloads as completed, because we don't want to + // encourage users to interact with them. However, consider downloads pending + // scanning as in progress, because we do want users to scan potential + // dangerous downloads. + if (model->IsDangerous() && + model->GetDangerType() != + download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING) { + return false; + } + return model->GetState() == download::DownloadItem::IN_PROGRESS; +} + } // namespace DownloadDisplayController::DownloadDisplayController( @@ -106,7 +122,7 @@ model->GetState() != download::DownloadItem::CANCELLED) { has_deep_scanning_download = true; } - if (model->GetState() == download::DownloadItem::IN_PROGRESS) { + if (IsModelInProgress(model)) { in_progress_count++; } } @@ -210,7 +226,7 @@ std::vector<DownloadUIModelPtr> all_models = bubble_controller_->GetAllItemsToDisplay(); for (const auto& model : all_models) { - if (model->GetState() == download::DownloadItem::IN_PROGRESS) { + if (IsModelInProgress(model)) { ++progress_info.download_count; if (model->GetTotalBytes() <= 0) { // There may or may not be more data coming down this pipe.
diff --git a/chrome/browser/download/bubble/download_display_controller_unittest.cc b/chrome/browser/download/bubble/download_display_controller_unittest.cc index 9a38fb5..37834b6 100644 --- a/chrome/browser/download/bubble/download_display_controller_unittest.cc +++ b/chrome/browser/download/bubble/download_display_controller_unittest.cc
@@ -176,6 +176,7 @@ .WillRepeatedly(Return(base::Time::Now())); EXPECT_CALL(item(index), GetDangerType()) .WillRepeatedly(Return(download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS)); + EXPECT_CALL(item(index), IsDangerous()).WillRepeatedly(Return(false)); int received_bytes = state == download::DownloadItem::IN_PROGRESS ? 50 : 100; EXPECT_CALL(item(index), GetReceivedBytes()) @@ -504,6 +505,35 @@ /*is_active=*/true)); } +TEST_F(DownloadDisplayControllerTest, + UpdateToolbarButtonState_DangerousDownload) { + EXPECT_TRUE(VerifyDisplayState(/*shown=*/false, /*detail_shown=*/false, + /*icon_state=*/DownloadIconState::kComplete, + /*is_active=*/false)); + + InitDownloadItem(FILE_PATH_LITERAL("/foo/bar.pdf"), + download::DownloadItem::IN_PROGRESS); + EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/true, + /*icon_state=*/DownloadIconState::kProgress, + /*is_active=*/true)); + + EXPECT_CALL(item(0), IsDangerous()).WillRepeatedly(Return(true)); + UpdateDownloadItem(/*item_index=*/0, DownloadState::IN_PROGRESS, + download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST, + /*show_details_if_done=*/true); + EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/true, + /*icon_state=*/DownloadIconState::kComplete, + /*is_active=*/false)); + + // Downloads prompted for deep scanning should be considered in progress. + UpdateDownloadItem(/*item_index=*/0, DownloadState::IN_PROGRESS, + download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING, + /*show_details_if_done=*/true); + EXPECT_TRUE(VerifyDisplayState(/*shown=*/true, /*detail_shown=*/true, + /*icon_state=*/DownloadIconState::kProgress, + /*is_active=*/true)); +} + TEST_F(DownloadDisplayControllerTest, InitialState_OldLastDownload) { base::Time current_time = base::Time::Now(); // Set the last complete time to more than 1 day ago.
diff --git a/chrome/browser/download/download_ui_model.cc b/chrome/browser/download/download_ui_model.cc index b1dc790..c150073 100644 --- a/chrome/browser/download/download_ui_model.cc +++ b/chrome/browser/download/download_ui_model.cc
@@ -837,10 +837,9 @@ DownloadCommands::Command::DISCARD, /*is_prominent=*/true); } else { - // TODO(crbug.com/1320025): Update the strings to match the UX mock. return DownloadUIModel::BubbleUIInfo( l10n_util::GetStringUTF16( - IDS_DOWNLOAD_BUBBLE_MALICIOUS_URL_BLOCKED)) + IDS_DOWNLOAD_BUBBLE_DANGEROUS_FILE)) .AddIconAndColor(views::kInfoIcon, ui::kColorSecondaryForeground) .AddPrimaryButton(DownloadCommands::Command::KEEP) .AddSubpageButton(
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn index 2b1fbb0..a2c9b2c 100644 --- a/chrome/browser/extensions/BUILD.gn +++ b/chrome/browser/extensions/BUILD.gn
@@ -1002,6 +1002,7 @@ "//chromeos/components/quick_answers/public/cpp:prefs", "//chromeos/crosapi/cpp", "//chromeos/crosapi/mojom", + "//chromeos/dbus/missive:missive", "//remoting/host/it2me:chrome_os_host", ] } else {
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc index 3e8d165..05e58db 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
@@ -16,7 +16,20 @@ #include "chrome/browser/enterprise/connectors/connectors_service.h" #include "chrome/browser/enterprise/signals/device_info_fetcher.h" #include "chrome/browser/enterprise/signals/signals_common.h" +#include "chrome/browser/enterprise/util/affiliation.h" #include "chrome/browser/enterprise/util/managed_browser_utils.h" +#include "chrome/browser/profiles/profile.h" + +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/policy/dm_token_utils.h" +#include "chromeos/dbus/missive/missive_client.h" +#include "components/policy/core/common/cloud/dm_token.h" +#include "components/reporting/client/report_queue_configuration.h" +#include "components/reporting/proto/synced/record.pb.h" +#include "components/reporting/proto/synced/record_constants.pb.h" +#include "components/reporting/util/statusor.h" +#endif + #include "components/content_settings/core/common/pref_names.h" #include "components/enterprise/browser/controller/browser_dm_token_storage.h" #include "net/cert/x509_util.h" @@ -471,4 +484,123 @@ Respond(OneArgument(base::Value::FromUniquePtrValue(ret.ToValue()))); } +#if BUILDFLAG(IS_CHROMEOS) + +// enqueueRecord + +EnterpriseReportingPrivateEnqueueRecordFunction:: + EnterpriseReportingPrivateEnqueueRecordFunction() = default; + +EnterpriseReportingPrivateEnqueueRecordFunction:: + ~EnterpriseReportingPrivateEnqueueRecordFunction() = default; + +ExtensionFunction::ResponseAction +EnterpriseReportingPrivateEnqueueRecordFunction::Run() { + auto* profile = Profile::FromBrowserContext(browser_context()); + DCHECK(profile); + + if (!IsProfileAffiliated(profile)) { + return RespondNow(Error(kErrorProfileNotAffiliated)); + } + + std::unique_ptr<api::enterprise_reporting_private::EnqueueRecord::Params> + params(api::enterprise_reporting_private::EnqueueRecord::Params::Create( + args())); + EXTENSION_FUNCTION_VALIDATE(params.get()); + + // Parse params + const auto event_type = params->request.event_type; + ::reporting::Record record; + ::reporting::Priority priority; + if (!TryParseParams(std::move(params), record, priority)) { + return RespondNow(Error(kErrorInvalidEnqueueRecordRequest)); + } + + // Attach appropriate DM token to record + if (!TryAttachDMTokenToRecord(record, event_type)) { + return RespondNow(Error(kErrorCannotAssociateRecordWithUser)); + } + + // Initiate enqueue and subsequent upload + auto enqueue_completion_cb = base::BindOnce( + &EnterpriseReportingPrivateEnqueueRecordFunction::OnRecordEnqueued, this); + auto* reporting_client = ::chromeos::MissiveClient::Get(); + DCHECK(reporting_client); + reporting_client->EnqueueRecord(priority, record, + std::move(enqueue_completion_cb)); + return RespondLater(); +} + +bool EnterpriseReportingPrivateEnqueueRecordFunction::TryParseParams( + std::unique_ptr<api::enterprise_reporting_private::EnqueueRecord::Params> + params, + ::reporting::Record& record, + ::reporting::Priority& priority) { + if (params->request.record_data.empty()) { + return false; + } + + const auto* record_data = + reinterpret_cast<const char*>(params->request.record_data.data()); + if (!record.ParseFromArray(record_data, params->request.record_data.size())) { + // Invalid record payload + return false; + } + + if (!::reporting::Priority_IsValid(params->request.priority) || + !::reporting::Priority_Parse( + ::reporting::Priority_Name(params->request.priority), &priority)) { + // Invalid priority + return false; + } + + // Valid + return true; +} + +bool EnterpriseReportingPrivateEnqueueRecordFunction::TryAttachDMTokenToRecord( + ::reporting::Record& record, + api::enterprise_reporting_private::EventType event_type) { + if (event_type == + api::enterprise_reporting_private::EventType::EVENT_TYPE_DEVICE) { + // Device DM tokens are automatically appended during uploads, so we need + // not specify them with the record. + return true; + } + + auto* profile = Profile::FromBrowserContext(browser_context()); + + const policy::DMToken& dm_token = policy::GetDMToken(profile); + if (!dm_token.is_valid()) { + return false; + } + + record.set_dm_token(dm_token.value()); + return true; +} + +void EnterpriseReportingPrivateEnqueueRecordFunction::OnRecordEnqueued( + ::reporting::Status result) { + if (!result.ok()) { + Respond(Error(kUnexpectedErrorEnqueueRecordRequest)); + return; + } + + Respond(NoArguments()); +} + +bool EnterpriseReportingPrivateEnqueueRecordFunction::IsProfileAffiliated( + Profile* profile) { + if (profile_is_affiliated_for_testing_) { + return true; + } + return chrome::enterprise_util::IsProfileAffiliated(profile); +} + +void EnterpriseReportingPrivateEnqueueRecordFunction:: + SetProfileIsAffiliatedForTesting(bool is_affiliated) { + profile_is_affiliated_for_testing_ = is_affiliated; +} +#endif + } // namespace extensions
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h index babf279..afcbfc6 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h
@@ -14,6 +14,13 @@ #include "chrome/browser/enterprise/signals/device_info_fetcher.h" #include "chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.h" #include "chrome/common/extensions/api/enterprise_reporting_private.h" + +#if BUILDFLAG(IS_CHROMEOS) +#include "components/reporting/proto/synced/record.pb.h" +#include "components/reporting/proto/synced/record_constants.pb.h" +#include "components/reporting/util/statusor.h" +#endif + #include "extensions/browser/extension_function.h" namespace extensions { @@ -204,6 +211,57 @@ client_cert_fetcher_; }; +#if BUILDFLAG(IS_CHROMEOS) + +class EnterpriseReportingPrivateEnqueueRecordFunction + : public ExtensionFunction { + public: + inline static constexpr char kErrorInvalidEnqueueRecordRequest[] = + "Invalid request"; + inline static constexpr char kUnexpectedErrorEnqueueRecordRequest[] = + "Encountered unexpected error while enqueuing record"; + inline static constexpr char kErrorProfileNotAffiliated[] = + "Profile is not affiliated"; + inline static constexpr char kErrorCannotAssociateRecordWithUser[] = + "Cannot associate record with user"; + + DECLARE_EXTENSION_FUNCTION("enterprise.reportingPrivate.enqueueRecord", + ENTERPRISEREPORTINGPRIVATE_ENQUEUERECORD) + + EnterpriseReportingPrivateEnqueueRecordFunction(); + EnterpriseReportingPrivateEnqueueRecordFunction( + const EnterpriseReportingPrivateEnqueueRecordFunction&) = delete; + EnterpriseReportingPrivateEnqueueRecordFunction& operator=( + const EnterpriseReportingPrivateEnqueueRecordFunction&) = delete; + + void SetProfileIsAffiliatedForTesting(bool is_affiliated); + + private: + ~EnterpriseReportingPrivateEnqueueRecordFunction() override; + + // ExtensionFunction: + ExtensionFunction::ResponseAction Run() override; + + bool TryParseParams( + std::unique_ptr<api::enterprise_reporting_private::EnqueueRecord::Params> + params, + ::reporting::Record& record, + ::reporting::Priority& priority); + + bool TryAttachDMTokenToRecord( + ::reporting::Record& record, + api::enterprise_reporting_private::EventType event_type); + + // Callback invoked after the record was successfully enqueued + void OnRecordEnqueued(::reporting::Status result); + + bool IsProfileAffiliated(Profile* profile); + + bool profile_is_affiliated_for_testing_ = false; +}; + +#endif + } // namespace extensions #endif // CHROME_BROWSER_EXTENSIONS_API_ENTERPRISE_REPORTING_PRIVATE_ENTERPRISE_REPORTING_PRIVATE_API_H_
diff --git a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_unittest.cc b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_unittest.cc index 2344a7e..2020979 100644 --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_unittest.cc +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_unittest.cc
@@ -17,17 +17,28 @@ #include "chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.h" #include "chrome/browser/extensions/extension_api_unittest.h" #include "chrome/browser/extensions/extension_function_test_utils.h" +#include "chrome/browser/extensions/test_extension_system.h" #include "chrome/browser/net/stub_resolver_config_reader.h" #include "chrome/browser/policy/dm_token_utils.h" +#include "chrome/browser/prefs/browser_prefs.h" +#include "chrome/common/extensions/api/enterprise_reporting_private.h" #include "chrome/common/pref_names.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile.h" +#include "chrome/test/base/testing_profile_manager.h" #include "components/component_updater/pref_names.h" #include "components/enterprise/browser/controller/fake_browser_dm_token_storage.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/core/common/policy_types.h" +#include "components/reporting/proto/synced/record.pb.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/version_info/version_info.h" #include "testing/gtest/include/gtest/gtest.h" +#if BUILDFLAG(IS_CHROMEOS) +#include "chromeos/dbus/missive/missive_client.h" +#endif + #if BUILDFLAG(IS_WIN) #include <netfw.h> #include <windows.h> @@ -1013,4 +1024,156 @@ ExpectDefaultThirdPartyBlockingEnabled(info); } +#if BUILDFLAG(IS_CHROMEOS) +// Test for API enterprise.reportingPrivate.enqueueRecord +class EnterpriseReportingPrivateEnqueueRecordFunctionTest + : public ExtensionApiUnittest { + public: + EnterpriseReportingPrivateEnqueueRecordFunctionTest() = default; + + EnterpriseReportingPrivateEnqueueRecordFunctionTest( + const EnterpriseReportingPrivateEnqueueRecordFunctionTest&) = delete; + EnterpriseReportingPrivateEnqueueRecordFunctionTest& operator=( + const EnterpriseReportingPrivateEnqueueRecordFunctionTest&) = delete; + + static constexpr char kNoError[] = ""; + static constexpr char kTestDMTokenValue[] = "test_dm_token_value"; + + void SetUp() override { + ExtensionApiUnittest::SetUp(); + ::chromeos::MissiveClient::InitializeFake(); + function_ = + base::MakeRefCounted<EnterpriseReportingPrivateEnqueueRecordFunction>(); + // Set up a Record to attach to an EnqueueRecordRequest + base::Value data{base::Value::Type::DICTIONARY}; + data.SetKey("TEST_KEY", base::Value("TEST_VALUE")); + std::string serialized_data; + ASSERT_TRUE(base::JSONWriter::Write(data, &serialized_data)); + reporting::Record record; + record.set_data(serialized_data); + record.set_destination(reporting::Destination::TELEMETRY_METRIC); + serialized_record_data_.resize(record.SerializeAsString().size()); + ASSERT_TRUE(record.SerializeToArray(serialized_record_data_.data(), + serialized_record_data_.size())); + } + + void TearDown() override { + function_.reset(); + ::chromeos::MissiveClient::Shutdown(); + ExtensionApiUnittest::TearDown(); + } + + protected: + std::vector<uint8_t> serialized_record_data_; + scoped_refptr<extensions::EnterpriseReportingPrivateEnqueueRecordFunction> + function_; +}; + +TEST_F(EnterpriseReportingPrivateEnqueueRecordFunctionTest, + ValidRecordSuccessfullyEnqueued) { + function_->SetProfileIsAffiliatedForTesting(/*is_affiliated=*/true); + + api::enterprise_reporting_private::EnqueueRecordRequest + enqueue_record_request; + enqueue_record_request.record_data = serialized_record_data_; + enqueue_record_request.priority = reporting::Priority::BACKGROUND_BATCH; + enqueue_record_request.event_type = + api::enterprise_reporting_private::EventType::EVENT_TYPE_USER; + + std::unique_ptr<base::ListValue> params = std::make_unique<base::ListValue>(); + params->Append(enqueue_record_request.ToValue()); + + // Set up DM token + policy::SetDMTokenForTesting( + policy::DMToken::CreateValidTokenForTesting(kTestDMTokenValue)); + + extension_function_test_utils::RunFunction(function_.get(), std::move(params), + browser(), + extensions::api_test_utils::NONE); + EXPECT_EQ(function_->GetError(), kNoError); +} + +TEST_F(EnterpriseReportingPrivateEnqueueRecordFunctionTest, + InvalidPriorityReturnsError) { + function_->SetProfileIsAffiliatedForTesting(true); + + api::enterprise_reporting_private::EnqueueRecordRequest + enqueue_record_request; + enqueue_record_request.record_data = serialized_record_data_; + + // Set priority to invalid enum value + enqueue_record_request.priority = -1; + + enqueue_record_request.event_type = + api::enterprise_reporting_private::EventType::EVENT_TYPE_USER; + + std::unique_ptr<base::ListValue> params = std::make_unique<base::ListValue>(); + params->Append(enqueue_record_request.ToValue()); + + policy::SetDMTokenForTesting( + policy::DMToken::CreateValidTokenForTesting(kTestDMTokenValue)); + + extension_function_test_utils::RunFunction(function_.get(), std::move(params), + browser(), + extensions::api_test_utils::NONE); + + EXPECT_EQ(function_->GetError(), + EnterpriseReportingPrivateEnqueueRecordFunction:: + kErrorInvalidEnqueueRecordRequest); +} + +TEST_F(EnterpriseReportingPrivateEnqueueRecordFunctionTest, + NonAffiliatedUserReturnsError) { + function_->SetProfileIsAffiliatedForTesting(false); + + api::enterprise_reporting_private::EnqueueRecordRequest + enqueue_record_request; + enqueue_record_request.record_data = serialized_record_data_; + + enqueue_record_request.priority = reporting::Priority::BACKGROUND_BATCH; + + enqueue_record_request.event_type = + api::enterprise_reporting_private::EventType::EVENT_TYPE_USER; + + std::unique_ptr<base::ListValue> params = std::make_unique<base::ListValue>(); + params->Append(enqueue_record_request.ToValue()); + + policy::SetDMTokenForTesting( + policy::DMToken::CreateValidTokenForTesting(kTestDMTokenValue)); + + extension_function_test_utils::RunFunction(function_.get(), std::move(params), + browser(), + extensions::api_test_utils::NONE); + + EXPECT_EQ(function_->GetError(), + EnterpriseReportingPrivateEnqueueRecordFunction:: + kErrorProfileNotAffiliated); +} + +TEST_F(EnterpriseReportingPrivateEnqueueRecordFunctionTest, + InvalidDMTokenReturnsError) { + function_->SetProfileIsAffiliatedForTesting(true); + api::enterprise_reporting_private::EnqueueRecordRequest + enqueue_record_request; + enqueue_record_request.record_data = serialized_record_data_; + enqueue_record_request.priority = reporting::Priority::BACKGROUND_BATCH; + enqueue_record_request.event_type = + api::enterprise_reporting_private::EventType::EVENT_TYPE_USER; + + std::unique_ptr<base::ListValue> params = std::make_unique<base::ListValue>(); + params->Append(enqueue_record_request.ToValue()); + + // Set up invalid DM token + policy::SetDMTokenForTesting(policy::DMToken::CreateInvalidTokenForTesting()); + + extension_function_test_utils::RunFunction(function_.get(), std::move(params), + browser(), + extensions::api_test_utils::NONE); + + EXPECT_EQ(function_->GetError(), + EnterpriseReportingPrivateEnqueueRecordFunction:: + kErrorCannotAssociateRecordWithUser); +} +#endif // BUILDFLAG(IS_CHROMEOS) + } // namespace extensions
diff --git a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc index 20e5551..238ec36 100644 --- a/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc +++ b/chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
@@ -32,7 +32,9 @@ #include "chrome/browser/ui/tab_helpers.h" #include "chrome/browser/ui/web_applications/web_app_dialog_utils.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/user_display_mode.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_install_manager.h" @@ -276,12 +278,13 @@ auto* provider = web_app::WebAppProvider::GetForWebApps( Profile::FromBrowserContext(context)); - provider->install_manager().InstallWebAppFromInfo( - std::move(web_app_info), /*overwrite_existing_manifest_fields=*/false, - web_app::ForInstallableSite::kNo, - webapps::WebappInstallSource::MANAGEMENT_API, - base::BindOnce(OnGenerateAppForLinkCompleted, - base::RetainedRef(function))); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(web_app_info), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::MANAGEMENT_API, + base::BindOnce(OnGenerateAppForLinkCompleted, + base::RetainedRef(function)))); } extensions::api::management::ExtensionInfo CreateExtensionInfoFromWebApp(
diff --git a/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc b/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc index df238dd2..03f3ca9a 100644 --- a/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc +++ b/chrome/browser/extensions/corb_and_cors_extension_browsertest.cc
@@ -413,7 +413,7 @@ std::string FetchViaContentScript(const GURL& url, content::WebContents* web_contents) { return FetchHelper( - url, + url, web_contents, base::BindOnce(&CorbAndCorsExtensionBrowserTest::ExecuteContentScript, base::Unretained(this), base::Unretained(web_contents))); } @@ -439,9 +439,12 @@ const GURL& url, const content::ToRenderFrameHost& execution_target) { return FetchHelper( - url, base::BindOnce( - &CorbAndCorsExtensionBrowserTest::ExecuteRegularScript, - base::Unretained(this), execution_target.render_frame_host())); + url, + content::WebContents::FromRenderFrameHost( + execution_target.render_frame_host()), + base::BindOnce(&CorbAndCorsExtensionBrowserTest::ExecuteRegularScript, + base::Unretained(this), + execution_target.render_frame_host())); } // Performs a fetch of |url| from a srcdoc subframe added to |parent_frame| @@ -449,7 +452,7 @@ std::string FetchViaSrcDocFrame(GURL url, content::RenderFrameHost* parent_frame) { return FetchHelper( - url, + url, content::WebContents::FromRenderFrameHost(parent_frame), base::BindOnce(&CorbAndCorsExtensionBrowserTest::ExecuteInSrcDocFrame, base::Unretained(this), base::Unretained(parent_frame))); } @@ -548,8 +551,10 @@ base::OnceCallback<bool(const std::string& fetch_script)>; // Returns response body of a fetch of |url| initiated via |fetch_callback|. - std::string FetchHelper(const GURL& url, FetchCallback fetch_callback) { - content::DOMMessageQueue message_queue; + std::string FetchHelper(const GURL& url, + content::WebContents* web_contents, + FetchCallback fetch_callback) { + content::DOMMessageQueue message_queue(web_contents); // Inject a content script that performs a cross-origin fetch to // cross-site.com. @@ -576,7 +581,7 @@ // Monitor CORB behavior + result of the fetch. base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); // Navigate to a fetch-initiator.com page - this should trigger execution of // the |content_script| declared in the extension manifest. @@ -603,7 +608,7 @@ // Monitor CORB behavior + result of the fetch. base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); // Inject an about:blank subframe - this should trigger execution of the // |content_script| declared in the extension manifest. @@ -694,7 +699,7 @@ document.body.appendChild(link); domAutomationController.send('READY'); )"; - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); ASSERT_TRUE(ExecuteContentScript( active_web_contents(), base::StringPrintf(kNewButtonScriptTemplate, @@ -717,7 +722,7 @@ base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); content::ExecuteScriptAsync(active_web_contents(), kFetchInitiatingScript); std::string fetch_result = PopString(&queue); @@ -737,7 +742,7 @@ base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); content::ExecuteScriptAsync(active_web_contents(), kFetchInitiatingScript); std::string fetch_result = PopString(&queue); @@ -934,7 +939,7 @@ { base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); ExecuteScriptAsync(active_web_contents(), script); std::string xhr_result = PopString(&queue); @@ -964,7 +969,7 @@ { base::HistogramTester histograms; content::WebContentsConsoleObserver console_observer(active_web_contents()); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); ExecuteContentScript(active_web_contents(), script); std::string xhr_result = PopString(&queue); @@ -1225,7 +1230,7 @@ GURL resource("/fake-trust-token-page"); { - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); base::Value request_init(base::Value::Type::DICTIONARY); request_init.SetStringPath("trustToken.type", "token-redemption"); @@ -1248,7 +1253,7 @@ ->GetMainFrame() ->FlushNetworkAndNavigationInterfacesForTesting(); { - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); base::Value request_init(base::Value::Type::DICTIONARY); request_init.SetStringPath("trustToken.type", "token-redemption"); @@ -1438,7 +1443,7 @@ ProcessManager::Get(browser()->profile()) ->GetBackgroundHostForExtension(extension()->id()) ->host_contents(); - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(background_web_contents); content::ExecuteScriptAsync(background_web_contents, script); std::string fetch_result = PopString(&message_queue); @@ -1569,7 +1574,7 @@ ->host_contents(); base::HistogramTester histograms; - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(background_web_contents); content::ExecuteScriptAsync( background_web_contents, CreateFetchScript(cross_site_resource2, std::move(request_init))); @@ -1963,7 +1968,7 @@ { GURL nosniff_xml_with_permission( embedded_test_server()->GetURL("cross-site.com", "/nosniff.xml")); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); base::HistogramTester histograms; content::ExecuteScriptAsync( active_web_contents(), @@ -1981,7 +1986,7 @@ { GURL nosniff_xml_with_permission(embedded_test_server()->GetURL( "other-without-permission.com", "/nosniff.xml")); - content::DOMMessageQueue queue; + content::DOMMessageQueue queue(active_web_contents()); base::HistogramTester histograms; ServiceWorkerConsoleObserver console_observer( active_web_contents()->GetBrowserContext()); @@ -2196,8 +2201,17 @@ std::string web_view_navigation_script = content::JsReplace(kWebViewNavigationScriptTemplate, guest_url); { - content::DOMMessageQueue queue; - content::ExecuteScriptAsync(app_contents, web_view_navigation_script); + // NOTE: The Dom message will be emitted in a new WebContents instance that + // is created when setting webview.src. Hence, we need to listen for the + // message in that instance. + content::WebContents* webview_contents = nullptr; + { + content::WebContentsAddedObserver webview_contents_added_observer; + content::ExecuteScriptAsync(app_contents, web_view_navigation_script); + webview_contents = webview_contents_added_observer.GetWebContents(); + } + content::DOMMessageQueue queue(webview_contents); + std::string fetch_result = PopString(&queue); // Verify that no CORB or CORS blocking occurred. @@ -2324,7 +2338,7 @@ .then(text => domAutomationController.send(text)) .catch(err => domAutomationController.send('ERROR: ' + err)); )"; - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); ExecuteContentScript( active_web_contents(), content::JsReplace(kScriptTemplate, same_origin_resource)); @@ -2444,7 +2458,7 @@ active_web_contents()->GetMainFrame()->GetLastCommittedOrigin()); // Inject a content script that performs a cross-origin GET fetch. - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(active_web_contents()); GURL cors_resource_url( embedded_test_server()->GetURL("cross-site.com", cors_resource_path)); EXPECT_TRUE(ExecuteContentScript(active_web_contents(),
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index f659578..ccb2ffb 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2030,11 +2030,6 @@ "expiry_milestone": 110 }, { - "name": "enable-experimental-kernel-vm-support", - "owners": [ "davidmunro@google.com", "zwisler", "clumptini@google.com" ], - "expiry_milestone": 110 - }, - { "name": "enable-experimental-rgb-keyboard-patterns", "owners": [ "jimmyxgong", "zentaro", "michaelcheco", "cros-peripherals@google.com"], "expiry_milestone": 112 @@ -5212,8 +5207,8 @@ }, { "name": "run-video-capture-service-in-browser", - "owners": [ "agpalak", "guidou" ], - "expiry_milestone": 99 + "owners": [ "agpalak", "herre" ], + "expiry_milestone": 110 }, { "name": "sameparty-cookies-considered-first-party",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 3fd49d2..754b54d 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -3838,10 +3838,6 @@ const char kHappinessTrackingSurveysForDesktopDemoDescription[] = "Enable showing Happiness Tracking Surveys Demo to users on Desktop"; -const char kKernelnextVMsName[] = "Enable VMs on experimental kernels."; -const char kKernelnextVMsDescription[] = - "Enables VM support on devices running experimental kernel versions."; - const char kOmniboxDriveSuggestionsName[] = "Omnibox Google Drive Document suggestions"; const char kOmniboxDriveSuggestionsDescriptions[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 5c61c92..fbe4e54 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2192,9 +2192,6 @@ extern const char kHappinessTrackingSurveysForDesktopDemoName[]; extern const char kHappinessTrackingSurveysForDesktopDemoDescription[]; -extern const char kKernelnextVMsName[]; -extern const char kKernelnextVMsDescription[]; - extern const char kOmniboxDriveSuggestionsName[]; extern const char kOmniboxDriveSuggestionsDescriptions[];
diff --git a/chrome/browser/headless/headless_mode_browsertest.cc b/chrome/browser/headless/headless_mode_browsertest.cc index 766e0db..f6eb9884 100644 --- a/chrome/browser/headless/headless_mode_browsertest.cc +++ b/chrome/browser/headless/headless_mode_browsertest.cc
@@ -39,6 +39,10 @@ #include "ui/ozone/public/ozone_platform.h" #endif // BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_WIN) +#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" +#endif // BUILDFLAG(IS_WIN) + namespace { const int kErrorResultCode = -1; } // namespace @@ -66,10 +70,21 @@ #endif // BUILDFLAG(IS_LINUX) #if BUILDFLAG(IS_WIN) +// A class to expose a protected method for testing purposes. +class DesktopWindowTreeHostWinWrapper : public views::DesktopWindowTreeHostWin { + public: + HWND GetHWND() const { return DesktopWindowTreeHostWin::GetHWND(); } +}; + IN_PROC_BROWSER_TEST_F(HeadlessModeBrowserTest, BrowserDesktopWindowHidden) { - // On Windows the Native Headless Chrome browser window exists but is - // hidden. - EXPECT_FALSE(browser()->window()->IsVisible()); + // On Windows, the Native Headless Chrome browser window exists and is + // visible, while the underlying platform window is hidden. + EXPECT_TRUE(browser()->window()->IsVisible()); + + DesktopWindowTreeHostWinWrapper* desktop_window_tree_host = + static_cast<DesktopWindowTreeHostWinWrapper*>( + browser()->window()->GetNativeWindow()->GetHost()); + EXPECT_FALSE(::IsWindowVisible(desktop_window_tree_host->GetHWND())); } #endif // BUILDFLAG(IS_WIN)
diff --git a/chrome/browser/history_clusters/BUILD.gn b/chrome/browser/history_clusters/BUILD.gn index d3ae18cd..ade260d7 100644 --- a/chrome/browser/history_clusters/BUILD.gn +++ b/chrome/browser/history_clusters/BUILD.gn
@@ -11,8 +11,6 @@ "java/res/drawable/ic_journeys.xml", "java/res/layout/history_cluster_visit.xml", "java/res/layout/history_clusters_activity_content.xml", - "java/res/layout/history_clusters_bottom_sheet_content.xml", - "java/res/layout/history_clusters_bottom_sheet_toolbar.xml", "java/res/layout/history_clusters_toolbar.xml", "java/res/menu/history_clusters_menu.xml", ] @@ -23,8 +21,6 @@ sources = [ "java/src/org/chromium/chrome/browser/history_clusters/ClusterVisit.java", "java/src/org/chromium/chrome/browser/history_clusters/HistoryCluster.java", - "java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetContent.java", - "java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetToolbarProperties.java", "java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBridge.java", "java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersConstants.java", "java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinator.java", @@ -47,7 +43,6 @@ "//chrome/browser/tab:java", "//chrome/browser/ui/android/favicon:java", "//chrome/browser/ui/android/strings:ui_strings_grd", - "//components/browser_ui/bottomsheet/android:java", "//components/browser_ui/widget/android:java", "//components/embedder_support/android:util_java", "//components/favicon/android:java",
diff --git a/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_content.xml b/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_content.xml deleted file mode 100644 index d006195..0000000 --- a/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_content.xml +++ /dev/null
@@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. --> -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> - <include layout="@layout/history_clusters_bottom_sheet_toolbar"/> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> -</LinearLayout> \ No newline at end of file
diff --git a/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_toolbar.xml b/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_toolbar.xml deleted file mode 100644 index c173522..0000000 --- a/chrome/browser/history_clusters/java/res/layout/history_clusters_bottom_sheet_toolbar.xml +++ /dev/null
@@ -1,76 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. --> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:id="@+id/bottom_sheet_toolbar" - android:layout_width="match_parent" - android:layout_height="70dp" - android:orientation="vertical" - android:layout_gravity="start|bottom"> - <ImageView - android:id="@+id/drag_handlebar" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal|top" - android:layout_marginTop="8dp" - android:importantForAccessibility="no" - android:src="@drawable/drag_handlebar" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="56dp" - android:layout_marginStart="8dp" - android:layout_marginEnd="8dp" - android:orientation="horizontal" - android:gravity="center" - android:layout_gravity="start|bottom"> - - <org.chromium.ui.widget.ChromeImageView - android:src="@drawable/ic_journeys" - android:id="@+id/journey_icon" - android:layout_height="40dp" - android:layout_width="40dp" - android:paddingHorizontal="8dp" - android:layout_marginEnd="8dp" - tools:ignore="ContentDescription" /> - - <TextView - android:id="@+id/query" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginEnd="16dp" - android:ellipsize="end" - android:singleLine="true" - android:textAppearance="@style/TextAppearance.TextLarge.Primary" - android:layout_weight="1"/> - - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/open_in_tab_group" - android:src="@drawable/ic_widgets" - android:layout_height="40dp" - android:layout_width="40dp" - android:paddingHorizontal="8dp" - android:layout_marginEnd="8dp" - app:tint="@color/default_icon_color_tint_list" - style="@style/ToolbarButton"/> - - <org.chromium.ui.widget.ChromeImageButton - android:id="@+id/open_history_activity" - android:src="@drawable/open_in_new_tab" - android:layout_height="40dp" - android:layout_width="40dp" - android:paddingHorizontal="8dp" - app:tint="@color/default_icon_color_tint_list" - style="@style/ToolbarButton"/> - </LinearLayout> - <View - android:id="@+id/sheet_divider" - android:background="@macro/divider_line_bg_color" - android:layout_height="1dp" - android:layout_width="match_parent"/> -</LinearLayout> \ No newline at end of file
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetContent.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetContent.java deleted file mode 100644 index c76a126..0000000 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetContent.java +++ /dev/null
@@ -1,89 +0,0 @@ -// 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. - -package org.chromium.chrome.browser.history_clusters; - -import android.view.View; - -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; - -import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent; - -/** - * Bottom sheet content implementation for the HistoryClusters UI. This enables the bottom sheet - * system to render our bottom sheet content and e.g. announce accessibility events correctly. - */ -@VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) -public class HistoryClustersBottomSheetContent implements BottomSheetContent { - private View mContentView; - private View mToolbarView; - - @Override - public View getContentView() { - return mContentView; - } - - @Nullable - @Override - public View getToolbarView() { - return null; - } - - @Override - public int getVerticalScrollOffset() { - if (mContentView == null) { - return 0; - } - - return mContentView.getScrollY(); - } - - @Override - public void destroy() {} - - @Override - public int getPriority() { - return BottomSheetContent.ContentPriority.HIGH; - } - - @Override - public int getPeekHeight() { - return BottomSheetContent.HeightMode.DISABLED; - } - - @Override - public float getFullHeightRatio() { - return BottomSheetContent.HeightMode.WRAP_CONTENT; - } - - @Override - public boolean swipeToDismissEnabled() { - return true; - } - - @Override - public int getSheetContentDescriptionStringId() { - return R.string.history_clusters_journeys_tab_label; - } - - @Override - public int getSheetHalfHeightAccessibilityStringId() { - return R.string.history_clusters_journeys_half_height; - } - - @Override - public int getSheetFullHeightAccessibilityStringId() { - return R.string.history_clusters_journeys_full_height; - } - - @Override - public int getSheetClosedAccessibilityStringId() { - return R.string.history_clusters_journeys_closed; - } - - void setContentView(View contentView) { - mContentView = contentView; - } -}
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetToolbarProperties.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetToolbarProperties.java deleted file mode 100644 index 7d6139c..0000000 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersBottomSheetToolbarProperties.java +++ /dev/null
@@ -1,19 +0,0 @@ -// 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. - -package org.chromium.chrome.browser.history_clusters; - -import android.view.View.OnClickListener; - -import org.chromium.ui.modelutil.PropertyKey; -import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey; - -class HistoryClustersBottomSheetToolbarProperties { - static final WritableObjectPropertyKey<OnClickListener> OPEN_ACTIVITY_BUTTON_CLICK_LISTENER = - new WritableObjectPropertyKey<>("open in new window click listener"); - static final WritableObjectPropertyKey<String> QUERY_TEXT = - new WritableObjectPropertyKey<>("query text"); - - static final PropertyKey[] ALL_KEYS = {OPEN_ACTIVITY_BUTTON_CLICK_LISTENER, QUERY_TEXT}; -}
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinator.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinator.java index b23b592..ca3e1ba 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinator.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersCoordinator.java
@@ -22,7 +22,6 @@ import org.chromium.chrome.browser.history_clusters.HistoryClustersToolbarProperties.QueryState; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.tab.Tab; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.widget.selectable_list.SelectableItemView; import org.chromium.components.browser_ui.widget.selectable_list.SelectableListLayout; import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelegate; @@ -39,12 +38,9 @@ public class HistoryClustersCoordinator implements OnMenuItemClickListener { private final HistoryClustersMediator mMediator; private final ModelList mModelList; - private final HistoryClustersBottomSheetContent mBottomSheetContent; private SimpleRecyclerViewAdapter mAdapter; private final Context mContext; - private boolean mBottomSheetInflated; private boolean mActivityViewInflated; - private final PropertyModel mBottomSheetToolbarModel; private final PropertyModel mToolbarModel; private ViewGroup mActivityContentView; private HistoryClustersToolbar mToolbar; @@ -56,29 +52,22 @@ * @param profile The profile from which the coordinator should access history data. * @param context Android context from which UI configuration (strings, colors etc.) should be * derived. - * @param bottomSheetController Controller for interacting with the bottom sheet system, e.g. to - * request to show our content. * @param historyActivityIntentFactory Supplier of an intent that targets the History activity. * We can't directly set the class ourselves without creating a circular dependency. * @param tabSupplier Supplier of the currently active tab. Null in cases where there isn't a * tab, e.g. when we're operating in a dedicated history activity. */ public HistoryClustersCoordinator(@NonNull Profile profile, @NonNull Context context, - BottomSheetController bottomSheetController, Supplier<Intent> historyActivityIntentFactory, @Nullable Supplier<Tab> tabSupplier) { mContext = context; mModelList = new ModelList(); - mBottomSheetContent = new HistoryClustersBottomSheetContent(); - mBottomSheetToolbarModel = - new PropertyModel(HistoryClustersBottomSheetToolbarProperties.ALL_KEYS); mToolbarModel = new PropertyModel.Builder(HistoryClustersToolbarProperties.ALL_KEYS) .with(HistoryClustersToolbarProperties.QUERY_STATE, QueryState.forQueryless()) .build(); mMediator = new HistoryClustersMediator(HistoryClustersBridge.getForProfile(profile), new LargeIconBridge(profile), context, context.getResources(), mModelList, - mBottomSheetToolbarModel, mToolbarModel, bottomSheetController, mBottomSheetContent, - historyActivityIntentFactory, tabSupplier); + mToolbarModel, historyActivityIntentFactory, tabSupplier); } public void destroy() { @@ -89,6 +78,15 @@ mMediator.startSearch(query); } + /** + * Opens the History Clusters UI. On phones this opens the History Activity; on tablets, it + * navigates to a NativePage in the active tab. + * @param query The preset query to populate when opening the UI. + */ + public void openHistoryClustersUi(String query) { + mMediator.openHistoryClustersUi(query); + } + /** Gets the root view for a "full activity" presentation of the user's history clusters. */ public ViewGroup getActivityContentView() { if (!mActivityViewInflated) { @@ -98,14 +96,6 @@ return mActivityContentView; } - /** Shows the bottom sheet, populating it with clusters matching the given query. */ - public void showBottomSheet(String query) { - if (!mBottomSheetInflated) { - inflateBottomSheet(); - } - mMediator.showBottomSheet(query); - } - void inflateActivityView() { mAdapter = new SimpleRecyclerViewAdapter(mModelList); mAdapter.registerType( @@ -141,31 +131,6 @@ mActivityViewInflated = true; } - void inflateBottomSheet() { - mAdapter = new SimpleRecyclerViewAdapter(mModelList); - mAdapter.registerType( - ItemType.VISIT, this::buildVisitView, HistoryClustersViewBinder::bindVisitView); - - LayoutInflater layoutInflater = LayoutInflater.from(mContext); - View contentView = - layoutInflater.inflate(R.layout.history_clusters_bottom_sheet_content, null); - RecyclerView recyclerView = contentView.findViewById(R.id.recycler_view); - recyclerView.setLayoutManager(new LinearLayoutManager( - recyclerView.getContext(), LinearLayoutManager.VERTICAL, false)); - recyclerView.setItemAnimator(null); - recyclerView.setAdapter(mAdapter); - contentView.setLayoutParams(new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); - - View bottomSheetToolbar = contentView.findViewById(R.id.bottom_sheet_toolbar); - - PropertyModelChangeProcessor.create(mBottomSheetToolbarModel, bottomSheetToolbar, - HistoryClustersViewBinder::bindBottomSheetToolbar); - - mBottomSheetContent.setContentView(contentView); - mBottomSheetInflated = true; - } - private View buildVisitView(ViewGroup parent) { SelectableItemView<ClusterVisit> itemView = (SelectableItemView<ClusterVisit>) LayoutInflater.from(parent.getContext())
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java index ac14eb8..8cd9645 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersMediator.java
@@ -13,19 +13,13 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; -import org.chromium.base.Callback; import org.chromium.base.Promise; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.browser.history_clusters.HistoryClustersItemProperties.ItemType; import org.chromium.chrome.browser.history_clusters.HistoryClustersToolbarProperties.QueryState; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.ui.favicon.FaviconUtils; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetContent; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; -import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.StateChangeReason; -import org.chromium.components.browser_ui.bottomsheet.EmptyBottomSheetObserver; import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.browser_ui.widget.selectable_list.SelectableListToolbar.SearchDelegate; import org.chromium.components.embedder_support.util.UrlConstants; @@ -36,18 +30,15 @@ import org.chromium.ui.modelutil.MVCListAdapter.ModelList; import org.chromium.ui.modelutil.PropertyModel; -class HistoryClustersMediator extends EmptyBottomSheetObserver implements SearchDelegate { +class HistoryClustersMediator implements SearchDelegate { private final HistoryClustersBridge mHistoryClustersBridge; private final Context mContext; private final Resources mResources; private final ModelList mModelList; - private final PropertyModel mBottomSheetToolbarModel; private final PropertyModel mToolbarModel; private final RoundedIconGenerator mIconGenerator; private final LargeIconBridge mLargeIconBridge; private final int mFaviconSize; - private final BottomSheetController mBottomSheetController; - private final BottomSheetContent mBottomSheetContent; private final Supplier<Tab> mTabSupplier; private Promise<HistoryClustersResult> mPromise; private Supplier<Intent> mHistoryActivityIntentFactory; @@ -59,45 +50,28 @@ * @param context Android context from which UI configuration should be derived. * @param resources Android resources object from which strings, colors etc. should be fetched. * @param modelList Model list to which fetched cluster data should be pushed to. - * @param bottomSheetToolbarModel Model for properties affecting the bottom sheet toolbar. * @param toolbarModel Model for properties affecting the "full page" toolbar shown in the * history activity. - * @param bottomSheetController Controller for interacting with the bottom sheet system, e.g. to - * request to show our content. - * @param bottomSheetContent {@link BottomSheetContent} instance that tells the BottomSheet * @param historyActivityIntentFactory Supplier of an intent that targets the History activity. * @param tabSupplier Supplier of the currently active tab. Null in cases where there isn't a * tab, e.g. when we're operating in a dedicated history activity. */ HistoryClustersMediator(@NonNull HistoryClustersBridge historyClustersBridge, LargeIconBridge largeIconBridge, @NonNull Context context, @NonNull Resources resources, - @NonNull ModelList modelList, @NonNull PropertyModel bottomSheetToolbarModel, - @NonNull PropertyModel toolbarModel, - @NonNull BottomSheetController bottomSheetController, - @NonNull BottomSheetContent bottomSheetContent, + @NonNull ModelList modelList, @NonNull PropertyModel toolbarModel, Supplier<Intent> historyActivityIntentFactory, @Nullable Supplier<Tab> tabSupplier) { mHistoryClustersBridge = historyClustersBridge; mLargeIconBridge = largeIconBridge; mModelList = modelList; mContext = context; mResources = resources; - mBottomSheetToolbarModel = bottomSheetToolbarModel; mToolbarModel = toolbarModel; - mBottomSheetController = bottomSheetController; - mBottomSheetContent = bottomSheetContent; mHistoryActivityIntentFactory = historyActivityIntentFactory; mTabSupplier = tabSupplier; mFaviconSize = mResources.getDimensionPixelSize(R.dimen.default_favicon_min_size); mIconGenerator = FaviconUtils.createCircularIconGenerator(mContext); } - // BottomSheetObserver - @Override - public void onSheetClosed(@StateChangeReason int reason) { - mModelList.clear(); - mBottomSheetController.removeObserver(this); - } - // SearchDelegate implementation. @Override public void onSearchTextChanged(String query) { @@ -124,24 +98,7 @@ mPromise.then(this::queryComplete); } - void showBottomSheet(String query) { - mBottomSheetToolbarModel.set(HistoryClustersBottomSheetToolbarProperties.QUERY_TEXT, - formatQueryForDisplay(query)); - query(query); - mPromise.then((Callback<HistoryClustersResult>) (unused) -> requestShowBottomSheet(query)); - } - - private void requestShowBottomSheet(String query) { - if (mBottomSheetController.requestShowContent(mBottomSheetContent, true)) { - mBottomSheetController.addObserver(this); - mBottomSheetToolbarModel.set( - HistoryClustersBottomSheetToolbarProperties.OPEN_ACTIVITY_BUTTON_CLICK_LISTENER, - (unused) -> openHistoryClustersInFullPage(query)); - } - } - - @VisibleForTesting - void openHistoryClustersInFullPage(String query) { + void openHistoryClustersUi(String query) { boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(mContext); if (isTablet) { Tab currentTab = mTabSupplier.get(); @@ -190,12 +147,4 @@ } } } - - private String formatQueryForDisplay(String query) { - return new StringBuilder() - .append(mResources.getString(R.string.quotation_mark_prefix)) - .append(query) - .append(mResources.getString(R.string.quotation_mark_suffix)) - .toString(); - } }
diff --git a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java index c5e4e933..f9b9eae 100644 --- a/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java +++ b/chrome/browser/history_clusters/java/src/org/chromium/chrome/browser/history_clusters/HistoryClustersViewBinder.java
@@ -5,13 +5,11 @@ package org.chromium.chrome.browser.history_clusters; import android.view.View; -import android.widget.TextView; import org.chromium.chrome.browser.history_clusters.HistoryClustersToolbarProperties.QueryState; import org.chromium.components.browser_ui.widget.selectable_list.SelectableListLayout; import org.chromium.ui.modelutil.PropertyKey; import org.chromium.ui.modelutil.PropertyModel; -import org.chromium.ui.widget.ChromeImageButton; class HistoryClustersViewBinder { public static void bindVisitView(PropertyModel model, View view, PropertyKey key) { @@ -25,19 +23,6 @@ } } - public static void bindBottomSheetToolbar(PropertyModel model, View view, PropertyKey key) { - if (key - == HistoryClustersBottomSheetToolbarProperties - .OPEN_ACTIVITY_BUTTON_CLICK_LISTENER) { - ChromeImageButton openButton = view.findViewById(R.id.open_history_activity); - openButton.setOnClickListener(model.get(HistoryClustersBottomSheetToolbarProperties - .OPEN_ACTIVITY_BUTTON_CLICK_LISTENER)); - } else if (key == HistoryClustersBottomSheetToolbarProperties.QUERY_TEXT) { - TextView textView = view.findViewById(R.id.query); - textView.setText(model.get(HistoryClustersBottomSheetToolbarProperties.QUERY_TEXT)); - } - } - public static void bindToolbar( PropertyModel model, HistoryClustersToolbar toolbar, PropertyKey key) { if (key == HistoryClustersToolbarProperties.QUERY_STATE) {
diff --git a/chrome/browser/lacros/standalone_browser_test_controller.cc b/chrome/browser/lacros/standalone_browser_test_controller.cc index 9aa0bc8..eca4eb2 100644 --- a/chrome/browser/lacros/standalone_browser_test_controller.cc +++ b/chrome/browser/lacros/standalone_browser_test_controller.cc
@@ -7,9 +7,10 @@ #include "chrome/browser/apps/app_service/app_service_proxy.h" #include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/user_display_mode.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chromeos/lacros/lacros_service.h" #include "components/webapps/browser/installable/installable_metrics.h" @@ -63,12 +64,14 @@ info->user_display_mode = WindowModeToUserDisplayMode(window_mode); Profile* profile = ProfileManager::GetPrimaryUserProfile(); auto* provider = web_app::WebAppProvider::GetForWebApps(profile); - provider->install_manager().InstallWebAppFromInfo( - std::move(info), /*overwrite_existing_manifest_fields=*/false, - web_app::ForInstallableSite::kYes, - /*install_source=*/webapps::WebappInstallSource::SYNC, - base::BindOnce(&StandaloneBrowserTestController::WebAppInstallationDone, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(info), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::SYNC, + base::BindOnce( + &StandaloneBrowserTestController::WebAppInstallationDone, + weak_ptr_factory_.GetWeakPtr(), std::move(callback)))); } void StandaloneBrowserTestController::WebAppInstallationDone(
diff --git a/chrome/browser/lacros/web_app_provider_bridge_lacros.cc b/chrome/browser/lacros/web_app_provider_bridge_lacros.cc index 120c0d2..948da7a7 100644 --- a/chrome/browser/lacros/web_app_provider_bridge_lacros.cc +++ b/chrome/browser/lacros/web_app_provider_bridge_lacros.cc
@@ -7,12 +7,13 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/user_display_mode.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chromeos/crosapi/mojom/web_app_service.mojom.h" #include "chromeos/crosapi/mojom/web_app_types.mojom.h" @@ -55,11 +56,11 @@ const SkBitmap& bitmap = *arc_install_info->icon.bitmap(); install_info->icon_bitmaps.any[bitmap.width()] = bitmap; - provider->install_manager().InstallWebAppFromInfo( - std::move(install_info), - /*overwrite_existing_manifest_fields=*/false, - web_app::ForInstallableSite::kYes, - webapps::WebappInstallSource::ARC, std::move(callback)); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(install_info), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::ARC, std::move(callback))); }, std::move(arc_install_info), std::move(callback))); }
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc index c65f234..56f30aa 100644 --- a/chrome/browser/lifetime/application_lifetime.cc +++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -54,6 +54,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/boot_times_recorder.h" #include "chrome/browser/ash/settings/cros_settings.h" +#include "chrome/browser/lifetime/application_lifetime_chromeos.h" #include "chromeos/dbus/power/power_policy_controller.h" #include "third_party/cros_system_api/dbus/service_constants.h" #include "ui/aura/env.h" @@ -177,7 +178,7 @@ // If an update is pending NotifyAndTerminate() will trigger a system reboot, // which in turn will send SIGTERM to Chrome, and that ends up processing // unload handlers. - if (browser_shutdown::UpdatePending()) { + if (UpdatePending()) { browser_shutdown::NotifyAndTerminate(true); return; } @@ -337,25 +338,18 @@ } #endif // !BUILDFLAG(IS_ANDROID) +// The ChromeOS implementation is in application_lifetime_chromeos.cc +#if !BUILDFLAG(IS_CHROMEOS_ASH) void AttemptRelaunch() { -#if BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::PowerManagerClient::Get()->RequestRestart( - power_manager::REQUEST_RESTART_OTHER, "Chrome relaunch"); - // If running the Chrome OS build, but we're not on the device, fall through. -#endif AttemptRestart(); } #if !BUILDFLAG(IS_ANDROID) void RelaunchIgnoreUnloadHandlers() { -#if BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::PowerManagerClient::Get()->RequestRestart( - power_manager::REQUEST_RESTART_OTHER, "Chrome relaunch"); - // If running the Chrome OS build, but we're not on the device, fall through. -#endif AttemptRestartInternal(IgnoreUnloadHandlers(true)); } -#endif +#endif // !BUILDFLAG(IS_ANDROID) +#endif // !BUILDFLAG(IS_CHROMEOS_ASH) void AttemptExit() { #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/lifetime/application_lifetime_chromeos.cc b/chrome/browser/lifetime/application_lifetime_chromeos.cc new file mode 100644 index 0000000..de43d8e --- /dev/null +++ b/chrome/browser/lifetime/application_lifetime_chromeos.cc
@@ -0,0 +1,54 @@ +// 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. + +#include "chrome/browser/lifetime/application_lifetime_chromeos.h" +#include "chrome/browser/lifetime/application_lifetime.h" + +#include "chromeos/dbus/dbus_thread_manager.h" +#include "chromeos/dbus/power/power_manager_client.h" +#include "chromeos/dbus/update_engine/update_engine_client.h" + +namespace chrome { +namespace { + +chromeos::UpdateEngineClient* GetUpdateEngineClient() { + DCHECK(ash::DBusThreadManager::IsInitialized()); + chromeos::UpdateEngineClient* update_engine_client = + chromeos::DBusThreadManager::Get()->GetUpdateEngineClient(); + DCHECK(update_engine_client); + return update_engine_client; +} + +ash::PowerManagerClient* GetPowerManagerClient() { + ash::PowerManagerClient* power_manager_client = + ash::PowerManagerClient::Get(); + DCHECK(power_manager_client); + return power_manager_client; +} + +} // namespace + +void AttemptRelaunch() { + GetPowerManagerClient()->RequestRestart(power_manager::REQUEST_RESTART_OTHER, + "Chrome relaunch"); +} + +void RelaunchIgnoreUnloadHandlers() { + AttemptRelaunch(); +} + +void RelaunchForUpdate() { + DCHECK(UpdatePending()); + GetUpdateEngineClient()->RebootAfterUpdate(); +} + +bool UpdatePending() { + if (!ash::DBusThreadManager::IsInitialized()) + return false; + + return GetUpdateEngineClient()->GetLastStatus().current_operation() == + update_engine::UPDATED_NEED_REBOOT; +} + +} // namespace chrome
diff --git a/chrome/browser/lifetime/application_lifetime_chromeos.h b/chrome/browser/lifetime/application_lifetime_chromeos.h new file mode 100644 index 0000000..9f8267d --- /dev/null +++ b/chrome/browser/lifetime/application_lifetime_chromeos.h
@@ -0,0 +1,19 @@ +// 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. + +#ifndef CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_CHROMEOS_H_ +#define CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_CHROMEOS_H_ + +namespace chrome { + +// Requests a relaunch from ChromeOS update engine. +// Only use this if there's an update pending. +void RelaunchForUpdate(); + +// True if there's a system update pending. +bool UpdatePending(); + +} // namespace chrome + +#endif // CHROME_BROWSER_LIFETIME_APPLICATION_LIFETIME_CHROMEOS_H_
diff --git a/chrome/browser/lifetime/application_lifetime_chromeos_browsertest.cc b/chrome/browser/lifetime/application_lifetime_chromeos_browsertest.cc index fc2d9967..f29dc7a 100644 --- a/chrome/browser/lifetime/application_lifetime_chromeos_browsertest.cc +++ b/chrome/browser/lifetime/application_lifetime_chromeos_browsertest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/lifetime/application_lifetime.h" +#include "chrome/browser/lifetime/application_lifetime_chromeos.h" #include "base/run_loop.h" #include "chrome/browser/browser_process.h" @@ -132,10 +133,10 @@ auto* fake_power_manager_client = chromeos::FakePowerManagerClient::Get(); EXPECT_GE(fake_power_manager_client->num_request_restart_calls(), 1); - // Restart flags are set. + // No restart flags set. PrefService* pref_service = g_browser_process->local_state(); - EXPECT_TRUE(pref_service->GetBoolean(prefs::kWasRestarted)); - EXPECT_TRUE(KeepAliveRegistry::GetInstance()->IsRestarting()); + EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted)); + EXPECT_FALSE(KeepAliveRegistry::GetInstance()->IsRestarting()); WaitForBrowserToClose(); } @@ -161,4 +162,14 @@ WaitForBrowserToClose(); } +IN_PROC_BROWSER_TEST_F(ApplicationLifetimeTest, RelaunchForUpdate) { + FakePendingUpdate(); + RelaunchForUpdate(); + + // Reboot requested via update engine client. + EXPECT_TRUE(RequestedRebootAfterUpdate()); + + WaitForBrowserToClose(); +} + } // namespace chrome
diff --git a/chrome/browser/lifetime/application_lifetime_chromeos_unittest.cc b/chrome/browser/lifetime/application_lifetime_chromeos_unittest.cc new file mode 100644 index 0000000..ec72b89 --- /dev/null +++ b/chrome/browser/lifetime/application_lifetime_chromeos_unittest.cc
@@ -0,0 +1,17 @@ +// 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. + +#include "chrome/browser/lifetime/application_lifetime_chromeos.h" + +#include "chromeos/dbus/dbus_thread_manager.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chrome { + +TEST(ApplicationLifetimeChromeosTest, NoUpdateIfDbusIsNotInitialized) { + ASSERT_FALSE(ash::DBusThreadManager::IsInitialized()); + EXPECT_FALSE(UpdatePending()); +} + +} // namespace chrome
diff --git a/chrome/browser/lifetime/termination_notification.cc b/chrome/browser/lifetime/termination_notification.cc index e4f6defa..da6d54c 100644 --- a/chrome/browser/lifetime/termination_notification.cc +++ b/chrome/browser/lifetime/termination_notification.cc
@@ -15,6 +15,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/components/login/session/session_termination_manager.h" +#include "chrome/browser/lifetime/application_lifetime_chromeos.h" #include "chromeos/dbus/dbus_thread_manager.h" // nogncheck #include "chromeos/dbus/power/power_policy_controller.h" #include "chromeos/dbus/session_manager/session_manager_client.h" @@ -24,16 +25,6 @@ namespace browser_shutdown { namespace { -#if BUILDFLAG(IS_CHROMEOS_ASH) -chromeos::UpdateEngineClient* GetUpdateEngineClient() { - DCHECK(chromeos::DBusThreadManager::IsInitialized()); - auto* update_engine_client = - chromeos::DBusThreadManager::Get()->GetUpdateEngineClient(); - DCHECK(update_engine_client); - return update_engine_client; -} -#endif - base::OnceClosureList& GetAppTerminatingCallbackList() { static base::NoDestructor<base::OnceClosureList> callback_list; return *callback_list; @@ -61,10 +52,6 @@ } void NotifyAndTerminate(bool fast_path) { - NotifyAndTerminate(fast_path, RebootPolicy::kOptionalReboot); -} - -void NotifyAndTerminate(bool fast_path, RebootPolicy reboot_policy) { #if BUILDFLAG(IS_CHROMEOS_ASH) static bool notified = false; // Return if a shutdown request has already been sent. @@ -80,9 +67,8 @@ if (chromeos::PowerPolicyController::IsInitialized()) chromeos::PowerPolicyController::Get()->NotifyChromeIsExiting(); - // Reboot if an update has been applied. - if (UpdatePending() || reboot_policy == RebootPolicy::kForceReboot) { - GetUpdateEngineClient()->RebootAfterUpdate(); + if (chrome::UpdatePending()) { + chrome::RelaunchForUpdate(); return; } @@ -95,14 +81,4 @@ #endif } -#if BUILDFLAG(IS_CHROMEOS_ASH) -bool UpdatePending() { - if (!chromeos::DBusThreadManager::IsInitialized()) - return false; - - return GetUpdateEngineClient()->GetLastStatus().current_operation() == - update_engine::Operation::UPDATED_NEED_REBOOT; -} -#endif - } // namespace browser_shutdown
diff --git a/chrome/browser/lifetime/termination_notification.h b/chrome/browser/lifetime/termination_notification.h index 1c7aee85..42b0c3b 100644 --- a/chrome/browser/lifetime/termination_notification.h +++ b/chrome/browser/lifetime/termination_notification.h
@@ -23,17 +23,8 @@ // Send out notifications. // For ChromeOS, also request session manager to end the session. -// |reboot_policy| is used to signal whether or not a reboot should be forced. -// By default, the functions only reboot the system if an update is available. -// When a component flash update is present, but not a system update, the -// kForceReboot flag is passed. -enum class RebootPolicy { kForceReboot, kOptionalReboot }; +// The function reboots the system if an update is available. void NotifyAndTerminate(bool fast_path); -void NotifyAndTerminate(bool fast_path, RebootPolicy reboot_policy); - -#if BUILDFLAG(IS_CHROMEOS_ASH) -bool UpdatePending(); -#endif } // namespace browser_shutdown
diff --git a/chrome/browser/metrics/perf/perf_events_collector.cc b/chrome/browser/metrics/perf/perf_events_collector.cc index e4aa2bb..0840c2e 100644 --- a/chrome/browser/metrics/perf/perf_events_collector.cc +++ b/chrome/browser/metrics/perf/perf_events_collector.cc
@@ -12,6 +12,7 @@ #include "base/files/file_util.h" #include "base/metrics/histogram_functions.h" #include "base/rand_util.h" +#include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/stringprintf.h" @@ -37,6 +38,9 @@ const base::Feature kCWPCollectionOnHostAndGuest{ "CWPCollectionOnHostAndGuest", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kCWPCollectsETM{"CWPCollectsETM", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Name the histogram that represents the success and various failure modes for // parsing CPU frequencies. const char kParseFrequenciesHistogramName[] = @@ -147,65 +151,68 @@ // Collect precise=3 (:ppp) cycle events on microarchitectures and kernels that // support it. -const char kPerfCyclesPPPCmd[] = "perf record -a -e cycles:ppp -c 1000003"; +const char kPerfCyclesPPPCmd[] = "-- record -a -e cycles:ppp -c 1000003"; const char kPerfFPCallgraphPPPCmd[] = - "perf record -a -e cycles:ppp -g -c 4000037"; + "-- record -a -e cycles:ppp -g -c 4000037"; const char kPerfLBRCallgraphPPPCmd[] = - "perf record -a -e cycles:ppp -c 4000037 --call-graph lbr"; + "-- record -a -e cycles:ppp -c 4000037 --call-graph lbr"; -const char kPerfCyclesPPPHGCmd[] = "perf record -a -e cycles:pppHG -c 1000003"; +const char kPerfCyclesPPPHGCmd[] = "-- record -a -e cycles:pppHG -c 1000003"; const char kPerfFPCallgraphPPPHGCmd[] = - "perf record -a -e cycles:pppHG -g -c 4000037"; + "-- record -a -e cycles:pppHG -g -c 4000037"; // Collect default (imprecise) cycle events everywhere else. -const char kPerfCyclesCmd[] = "perf record -a -e cycles -c 1000003"; +const char kPerfCyclesCmd[] = "-- record -a -e cycles -c 1000003"; -const char kPerfCyclesHGCmd[] = "perf record -a -e cycles:HG -c 1000003"; +const char kPerfCyclesHGCmd[] = "-- record -a -e cycles:HG -c 1000003"; -const char kPerfFPCallgraphCmd[] = "perf record -a -e cycles -g -c 4000037"; +const char kPerfFPCallgraphCmd[] = "-- record -a -e cycles -g -c 4000037"; -const char kPerfFPCallgraphHGCmd[] = - "perf record -a -e cycles:HG -g -c 4000037"; +const char kPerfFPCallgraphHGCmd[] = "-- record -a -e cycles:HG -g -c 4000037"; const char kPerfLBRCallgraphCmd[] = - "perf record -a -e cycles -c 6000011 --call-graph lbr"; + "-- record -a -e cycles -c 6000011 --call-graph lbr"; -const char kPerfLBRCmd[] = "perf record -a -e r20c4 -b -c 800011"; +const char kPerfLBRCmd[] = "-- record -a -e r20c4 -b -c 800011"; // Silvermont, Airmont, Goldmont don't have a branches taken event. Therefore, // we sample on the branches retired event. -const char kPerfLBRCmdAtom[] = "perf record -a -e rc4 -b -c 800011"; +const char kPerfLBRCmdAtom[] = "-- record -a -e rc4 -b -c 800011"; // The following events count misses in the last level caches and level 2 TLBs. // TLB miss cycles for IvyBridge, Haswell, Broadwell and SandyBridge. const char kPerfITLBMissCyclesCmdIvyBridge[] = - "perf record -a -e itlb_misses.walk_duration -c 30001"; + "-- record -a -e itlb_misses.walk_duration -c 30001"; const char kPerfDTLBMissCyclesCmdIvyBridge[] = - "perf record -a -e dtlb_load_misses.walk_duration -g -c 350003"; + "-- record -a -e dtlb_load_misses.walk_duration -g -c 350003"; // TLB miss cycles for Skylake, Kabylake, Tigerlake. const char kPerfITLBMissCyclesCmdSkylake[] = - "perf record -a -e itlb_misses.walk_pending -c 30001"; + "-- record -a -e itlb_misses.walk_pending -c 30001"; const char kPerfDTLBMissCyclesCmdSkylake[] = - "perf record -a -e dtlb_load_misses.walk_pending -g -c 350003"; + "-- record -a -e dtlb_load_misses.walk_pending -g -c 350003"; // TLB miss cycles for Atom, including Silvermont, Airmont and Goldmont. const char kPerfITLBMissCyclesCmdAtom[] = - "perf record -a -e page_walks.i_side_cycles -c 30001"; + "-- record -a -e page_walks.i_side_cycles -c 30001"; const char kPerfDTLBMissCyclesCmdAtom[] = - "perf record -a -e page_walks.d_side_cycles -g -c 350003"; + "-- record -a -e page_walks.d_side_cycles -g -c 350003"; -const char kPerfLLCMissesCmd[] = "perf record -a -e r412e -g -c 30007"; +const char kPerfLLCMissesCmd[] = "-- record -a -e r412e -g -c 30007"; // Precise events (request zero skid) for last level cache misses. -const char kPerfLLCMissesPreciseCmd[] = - "perf record -a -e r412e:pp -g -c 30007"; +const char kPerfLLCMissesPreciseCmd[] = "-- record -a -e r412e:pp -g -c 30007"; + +// ETM for ARM boards including trogdor and herobrine. +const char kPerfETMCmd[] = + "--run_inject --inject_args inject;--itrace=i512il;--strip -- record -a -e " + "cs_etm/autofdo/"; const std::vector<RandomSelector::WeightAndValue> GetDefaultCommands_x86_64( const CPUIdentity& cpuid) { @@ -304,21 +311,41 @@ return cmds; } +std::vector<RandomSelector::WeightAndValue> GetDefaultCommands_aarch64( + const std::string& model) { + using WeightAndValue = RandomSelector::WeightAndValue; + std::vector<WeightAndValue> cmds; + + if (base::FeatureList::IsEnabled(kCWPCollectsETM) && + (model == "TROGDOR" || model == "HEROBRINE")) { + cmds.emplace_back(WeightAndValue(50.0, kPerfCyclesHGCmd)); + cmds.emplace_back(WeightAndValue(20.0, kPerfFPCallgraphHGCmd)); + cmds.emplace_back(WeightAndValue(30.0, kPerfETMCmd)); + } else { + cmds.emplace_back(WeightAndValue(80.0, kPerfCyclesHGCmd)); + cmds.emplace_back(WeightAndValue(20.0, kPerfFPCallgraphHGCmd)); + } + return cmds; +} + } // namespace namespace internal { -std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu( - const CPUIdentity& cpuid) { +std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpuModel( + const CPUIdentity& cpuid, + const std::string& model) { using WeightAndValue = RandomSelector::WeightAndValue; if (cpuid.arch == "x86_64") // 64-bit x86 return GetDefaultCommands_x86_64(cpuid); + if (cpuid.arch == "aarch64") // ARM64 + return GetDefaultCommands_aarch64(model); + std::vector<WeightAndValue> cmds; - if (cpuid.arch == "x86" || // 32-bit x86, or... - cpuid.arch == "armv7l" || // ARM32 - cpuid.arch == "aarch64") { // ARM64 + if (cpuid.arch == "x86" || // 32-bit x86, or... + cpuid.arch == "armv7l") { // ARM32 if (base::FeatureList::IsEnabled(kCWPCollectionOnHostAndGuest)) { cmds.emplace_back(WeightAndValue(80.0, kPerfCyclesHGCmd)); cmds.emplace_back(WeightAndValue(20.0, kPerfFPCallgraphHGCmd)); @@ -361,8 +388,8 @@ base::BindOnce(&PerfCollector::ParseCPUFrequencies, task_runner, weak_factory_.GetWeakPtr())); - CHECK(command_selector_.SetOdds( - internal::GetDefaultCommandsForCpu(GetCPUIdentity()))); + CHECK(command_selector_.SetOdds(internal::GetDefaultCommandsForCpuModel( + GetCPUIdentity(), base::SysInfo::HardwareModelName()))); std::map<std::string, std::string> params; if (variations::GetVariationParams(kCWPFieldTrialName, ¶ms)) { SetCollectionParamsFromVariationParams(params); @@ -484,13 +511,13 @@ } std::unique_ptr<PerfOutputCall> PerfCollector::CreatePerfOutputCall( - base::TimeDelta duration, const std::vector<std::string>& perf_args, + bool disable_cpu_idle, PerfOutputCall::DoneCallback callback) { DCHECK(debugd_client_provider_.get()); return std::make_unique<PerfOutputCall>( - debugd_client_provider_->debug_daemon_client(), duration, perf_args, - std::move(callback)); + debugd_client_provider_->debug_daemon_client(), perf_args, + disable_cpu_idle, std::move(callback)); } void PerfCollector::OnPerfOutputComplete( @@ -637,24 +664,30 @@ return true; } -namespace internal { +// static +PerfCollector::EventType PerfCollector::CommandEventType( + const std::vector<std::string>& args) { + if (args.size() < 4) + return EventType::kOther; -bool CommandSamplesCPUCycles(const std::vector<std::string>& args) { - // Command must start with "perf record". - if (args.size() < 4 || args[0] != "perf" || args[1] != "record") - return false; - // Cycles event can be either the raw 'cycles' event, or the event name can be - // annotated with some qualifier suffix. Check for all cases. - for (size_t i = 2; i + 1 < args.size(); ++i) { - if (args[i] == "-e" && - (args[i + 1] == "cycles" || args[i + 1].rfind("cycles:", 0) == 0)) - return true; + bool isRecord = false; + for (size_t i = 0; i + 1 < args.size(); ++i) { + if (!isRecord && args[i] == "record") { + isRecord = true; + continue; + } + if (isRecord && args[i] == "-e") { + // Cycles event can be either the raw 'cycles' event, or the event name + // can be annotated with some qualifier suffix. Check for all cases. + if (args[i + 1] == "cycles" || args[i + 1].rfind("cycles:", 0) == 0) + return EventType::kCycles; + if (args[i + 1].rfind("cs_etm/autofdo", 0) == 0) + return EventType::kETM; + } } - return false; + return EventType::kOther; } -} // namespace internal - void PerfCollector::CollectProfile( std::unique_ptr<SampledProfile> sampled_profile) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -667,19 +700,24 @@ return; } - std::vector<std::string> command = - base::SplitString(command_selector_.Select(), kPerfCommandDelimiter, - base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - bool has_cycles = internal::CommandSamplesCPUCycles(command); + // Prepend the duration to the command before splitting. + std::vector<std::string> command = base::SplitString( + base::StrCat({"--duration ", + base::NumberToString( + collection_params().collection_duration.InSeconds()), + " ", command_selector_.Select()}), + kPerfCommandDelimiter, base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); + auto event_type = CommandEventType(command); DCHECK(sampled_profile->has_trigger_event()); current_trigger_ = sampled_profile->trigger_event(); perf_output_call_ = CreatePerfOutputCall( - collection_params().collection_duration, command, + command, event_type == EventType::kETM, base::BindOnce(&PerfCollector::OnPerfOutputComplete, weak_factory_.GetWeakPtr(), std::move(incognito_observer), - std::move(sampled_profile), has_cycles)); + std::move(sampled_profile), + event_type == EventType::kCycles)); } // static
diff --git a/chrome/browser/metrics/perf/perf_events_collector.h b/chrome/browser/metrics/perf/perf_events_collector.h index e215184..d5d7be4 100644 --- a/chrome/browser/metrics/perf/perf_events_collector.h +++ b/chrome/browser/metrics/perf/perf_events_collector.h
@@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "base/time/time.h" #include "chrome/browser/metrics/perf/metric_collector.h" #include "chrome/browser/metrics/perf/perf_output.h" #include "chrome/browser/metrics/perf/random_selector.h" @@ -47,8 +48,8 @@ protected: // For testing to mock PerfOutputCall. virtual std::unique_ptr<PerfOutputCall> CreatePerfOutputCall( - base::TimeDelta duration, - const std::vector<std::string>& perf_args, + const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, PerfOutputCall::DoneCallback callback); void OnPerfOutputComplete( @@ -144,6 +145,15 @@ SampledProfile::TriggerEvent current_trigger_ = SampledProfile::UNKNOWN_TRIGGER_EVENT; + // Enumeration representing event types that need additional treatment + // during or after the collection. + enum class EventType { + kOther, + kCycles, + kETM, + }; + static EventType CommandEventType(const std::vector<std::string>& args); + private: // Change the values in |collection_params_| and the commands in // |command_selector| for any keys that are present in |params|. @@ -171,8 +181,9 @@ // Return the default set of perf commands and their odds of selection given // the identity of the CPU in |cpuid|. -std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpu( - const CPUIdentity& cpuid); +std::vector<RandomSelector::WeightAndValue> GetDefaultCommandsForCpuModel( + const CPUIdentity& cpuid, + const std::string& model); // For the "PerfCommand::"-prefixed keys in |params|, return the cpu specifier // that is the narrowest match for the CPU identified by |cpuid|.
diff --git a/chrome/browser/metrics/perf/perf_events_collector_unittest.cc b/chrome/browser/metrics/perf/perf_events_collector_unittest.cc index 221b730..7d99f51 100644 --- a/chrome/browser/metrics/perf/perf_events_collector_unittest.cc +++ b/chrome/browser/metrics/perf/perf_events_collector_unittest.cc
@@ -14,11 +14,13 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ptr_util.h" -#include "base/metrics/field_trial.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "base/system/sys_info.h" #include "base/test/bind.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" +#include "base/time/time.h" #include "chrome/browser/metrics/perf/cpu_identity.h" #include "chrome/browser/metrics/perf/windowed_incognito_observer.h" #include "components/variations/variations_associated_data.h" @@ -33,32 +35,33 @@ const char kPerfCommandDelimiter[] = " "; -const char kPerfCyclesCmd[] = "perf record -a -e cycles -c 1000003"; -const char kPerfCyclesHGCmd[] = "perf record -a -e cycles:HG -c 1000003"; -const char kPerfFPCallgraphCmd[] = "perf record -a -e cycles -g -c 4000037"; -const char kPerfFPCallgraphHGCmd[] = - "perf record -a -e cycles:HG -g -c 4000037"; +const char kPerfCyclesCmd[] = "-- record -a -e cycles -c 1000003"; +const char kPerfCyclesHGCmd[] = "-- record -a -e cycles:HG -c 1000003"; +const char kPerfFPCallgraphCmd[] = "-- record -a -e cycles -g -c 4000037"; +const char kPerfFPCallgraphHGCmd[] = "-- record -a -e cycles:HG -g -c 4000037"; const char kPerfLBRCallgraphCmd[] = - "perf record -a -e cycles -c 6000011 --call-graph lbr"; -const char kPerfCyclesPPPCmd[] = "perf record -a -e cycles:ppp -c 1000003"; -const char kPerfCyclesPPPHGCmd[] = "perf record -a -e cycles:pppHG -c 1000003"; + "-- record -a -e cycles -c 6000011 --call-graph lbr"; +const char kPerfCyclesPPPCmd[] = "-- record -a -e cycles:ppp -c 1000003"; +const char kPerfCyclesPPPHGCmd[] = "-- record -a -e cycles:pppHG -c 1000003"; const char kPerfFPCallgraphPPPCmd[] = - "perf record -a -e cycles:ppp -g -c 4000037"; + "-- record -a -e cycles:ppp -g -c 4000037"; const char kPerfFPCallgraphPPPHGCmd[] = - "perf record -a -e cycles:pppHG -g -c 4000037"; + "-- record -a -e cycles:pppHG -g -c 4000037"; const char kPerfLBRCallgraphPPPCmd[] = - "perf record -a -e cycles:ppp -c 4000037 --call-graph lbr"; -const char kPerfLBRCmd[] = "perf record -a -e r20c4 -b -c 800011"; -const char kPerfLBRCmdAtom[] = "perf record -a -e rc4 -b -c 800011"; + "-- record -a -e cycles:ppp -c 4000037 --call-graph lbr"; +const char kPerfLBRCmd[] = "-- record -a -e r20c4 -b -c 800011"; +const char kPerfLBRCmdAtom[] = "-- record -a -e rc4 -b -c 800011"; const char kPerfITLBMissCyclesCmdIvyBridge[] = - "perf record -a -e itlb_misses.walk_duration -c 30001"; + "-- record -a -e itlb_misses.walk_duration -c 30001"; const char kPerfITLBMissCyclesCmdSkylake[] = - "perf record -a -e itlb_misses.walk_pending -c 30001"; + "-- record -a -e itlb_misses.walk_pending -c 30001"; const char kPerfITLBMissCyclesCmdAtom[] = - "perf record -a -e page_walks.i_side_cycles -c 30001"; -const char kPerfLLCMissesCmd[] = "perf record -a -e r412e -g -c 30007"; -const char kPerfLLCMissesPreciseCmd[] = - "perf record -a -e r412e:pp -g -c 30007"; + "-- record -a -e page_walks.i_side_cycles -c 30001"; +const char kPerfLLCMissesCmd[] = "-- record -a -e r412e -g -c 30007"; +const char kPerfLLCMissesPreciseCmd[] = "-- record -a -e r412e:pp -g -c 30007"; +const char kPerfETMCmd[] = + "--run_inject --inject_args inject;--itrace=i512il;--strip -- record -a -e " + "cs_etm/autofdo/"; // Converts a protobuf to serialized format as a byte vector. std::vector<uint8_t> SerializeMessageToVector( @@ -97,6 +100,17 @@ return proto; } +base::TimeDelta GetDuration(const std::vector<std::string>& quipper_args) { + for (auto it = quipper_args.begin(); it != quipper_args.end(); ++it) { + if (*it == "--duration" && it != quipper_args.end()) { + int dur; + if (base::StringToInt(*(it + 1), &dur)) + return base::Seconds(dur); + } + } + return base::Seconds(0); +} + // A mock PerfOutputCall class for testing, which outputs example perf data // after the profile duration elapses. class FakePerfOutputCall : public PerfOutputCall { @@ -182,6 +196,8 @@ using PerfCollector::collection_params; using PerfCollector::CollectPSICPU; using PerfCollector::command_selector; + using PerfCollector::CommandEventType; + using PerfCollector::EventType; using PerfCollector::Init; using PerfCollector::IsRunning; using PerfCollector::LacrosChannelAndVersion; @@ -195,15 +211,18 @@ bool collection_stopped() { return collection_stopped_; } bool collection_done() { return !real_callback_; } + base::TimeDelta elapsed_duration; + protected: std::unique_ptr<PerfOutputCall> CreatePerfOutputCall( - base::TimeDelta duration, - const std::vector<std::string>& perf_args, + const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, PerfOutputCall::DoneCallback callback) override { real_callback_ = std::move(callback); + elapsed_duration = GetDuration(quipper_args); return std::make_unique<FakePerfOutputCall>( - duration, + elapsed_duration, base::BindOnce(&TestPerfCollector::OnCollectionDone, base::Unretained(this)), base::BindOnce(&TestPerfCollector::OnCollectionStopped, @@ -223,14 +242,26 @@ const base::TimeDelta kPeriodicCollectionInterval = base::Hours(1); const base::TimeDelta kCollectionDuration = base::Seconds(2); -// A wrapper around internal::CommandSamplesCPUCycles, to test if a perf command -// samples the cycles event. The wrapper takes a command as a string, while the -// wrapped internal::CommandSamplesCPUCycles takes the command split into words. +// A wrapper around CommandEventType, to test if a perf command samples +// the cycles event. The wrapper takes a command as a string, while the +// wrapped CommandEventType takes the command split into words. bool DoesCommandSampleCycles(std::string command) { + using EventType = TestPerfCollector::EventType; std::vector<std::string> cmd_args = base::SplitString(command, kPerfCommandDelimiter, base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); - return internal::CommandSamplesCPUCycles(cmd_args); + return TestPerfCollector::CommandEventType(cmd_args) == EventType::kCycles; +} + +// A wrapper around CommandEventType, to test if a perf command samples +// the etm event. The wrapper takes a command as a string, while the +// wrapped CommandEventType takes the command split into words. +bool DoesCommandSampleETM(std::string command) { + using EventType = TestPerfCollector::EventType; + std::vector<std::string> cmd_args = + base::SplitString(command, kPerfCommandDelimiter, base::KEEP_WHITESPACE, + base::SPLIT_WANT_ALL); + return TestPerfCollector::CommandEventType(cmd_args) == EventType::kETM; } } // namespace @@ -264,6 +295,8 @@ perf_collector_->Init(); // PerfCollector requires the user to be logged in. perf_collector_->RecordUserLogin(base::TimeTicks::Now()); + + perf_collector_->elapsed_duration = base::Seconds(0); } void TearDown() override { @@ -296,6 +329,20 @@ EXPECT_GT(perf_collector_->max_frequencies_mhz().size(), 0u); } +TEST_F(PerfCollectorTest, PrependDuration) { + // Timer is active after login and a periodic collection is scheduled. + EXPECT_TRUE(perf_collector_->IsRunning()); + base::HistogramTester histogram_tester; + + // Advance the clock by a periodic collection interval to trigger + // a collection. + task_environment_.FastForwardBy(kPeriodicCollectionInterval); + EXPECT_EQ(perf_collector_->elapsed_duration, kCollectionDuration); + histogram_tester.ExpectUniqueSample( + "ChromeOS.CWP.CollectPerf", + TestPerfCollector::CollectionAttemptStatus::SUCCESS, 1); +} + TEST_F(PerfCollectorTest, NoCollectionWhenProfileCacheFull) { // Timer is active after login and a periodic collection is scheduled. EXPECT_TRUE(perf_collector_->IsRunning()); @@ -445,7 +492,7 @@ cpuid.model_name = ""; cpuid.release = "3.8.11"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -481,7 +528,7 @@ cpuid.model_name = ""; cpuid.release = "3.8.11"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesHGCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -498,7 +545,7 @@ cpuid.model_name = ""; cpuid.release = "3.8.11"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -531,7 +578,7 @@ cpuid.model_name = ""; cpuid.release = "3.8.11"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -570,7 +617,7 @@ cpuid.model_name = ""; cpuid.release = "3.18.0"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 3UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); // We have both FP and LBR based callstacks. @@ -605,7 +652,7 @@ cpuid.model_name = ""; cpuid.release = "5.4.64"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 3UL); EXPECT_EQ(cmds[0].value, kPerfCyclesPPPCmd); // We have both FP and LBR based callstacks. @@ -643,7 +690,7 @@ cpuid.model_name = ""; cpuid.release = "5.4.64"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 3UL); EXPECT_EQ(cmds[0].value, kPerfCyclesPPPHGCmd); // We have both FP and LBR based callstacks. @@ -662,7 +709,7 @@ cpuid.model_name = ""; cpuid.release = "4.4.196"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -701,7 +748,7 @@ cpuid.model_name = ""; cpuid.release = "4.14.214"; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesPPPCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -739,7 +786,7 @@ cpuid.model = 0x70; // Excavator cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -761,7 +808,7 @@ cpuid.model = 0; cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -788,11 +835,11 @@ cpuid.model = 0; cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); - EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); + EXPECT_EQ(cmds[0].value, kPerfCyclesHGCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); - EXPECT_EQ(cmds[1].value, kPerfFPCallgraphCmd); + EXPECT_EQ(cmds[1].value, kPerfFPCallgraphHGCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[1].value)); auto found = std::find_if(cmds.begin(), cmds.end(), @@ -818,7 +865,7 @@ cpuid.model = 0; cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesHGCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -826,6 +873,27 @@ EXPECT_TRUE(DoesCommandSampleCycles(cmds[1].value)); } +TEST_F(PerfCollectorTest, DefaultCommandsBasedOnArch_Arm64_ETM) { + const base::Feature kCWPCollectsETM{"CWPCollectsETM", + base::FEATURE_DISABLED_BY_DEFAULT}; + feature_list_.InitAndEnableFeature(kCWPCollectsETM); + CPUIdentity cpuid; + cpuid.arch = "aarch64"; + cpuid.vendor = ""; + cpuid.family = 0; + cpuid.model = 0; + cpuid.model_name = ""; + std::vector<RandomSelector::WeightAndValue> cmds = + internal::GetDefaultCommandsForCpuModel(cpuid, "TROGDOR"); + ASSERT_GE(cmds.size(), 3UL); + EXPECT_EQ(cmds[0].value, kPerfCyclesHGCmd); + EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); + EXPECT_EQ(cmds[1].value, kPerfFPCallgraphHGCmd); + EXPECT_TRUE(DoesCommandSampleCycles(cmds[1].value)); + EXPECT_EQ(cmds[2].value, kPerfETMCmd); + EXPECT_TRUE(DoesCommandSampleETM(cmds[2].value)); +} + TEST_F(PerfCollectorTest, DefaultCommandsBasedOnArch_x86_32) { CPUIdentity cpuid; cpuid.arch = "x86"; @@ -834,7 +902,7 @@ cpuid.model = 0x2f; // Westmere cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); ASSERT_GE(cmds.size(), 2UL); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -861,7 +929,7 @@ cpuid.model = 0; cpuid.model_name = ""; std::vector<RandomSelector::WeightAndValue> cmds = - internal::GetDefaultCommandsForCpu(cpuid); + internal::GetDefaultCommandsForCpuModel(cpuid, ""); EXPECT_EQ(1UL, cmds.size()); EXPECT_EQ(cmds[0].value, kPerfCyclesCmd); EXPECT_TRUE(DoesCommandSampleCycles(cmds[0].value)); @@ -1173,6 +1241,94 @@ TestPerfCollector::ParseLacrosPath::kUnrecognized, 1); } +TEST_F(PerfCollectorTest, CommandEventType) { + using EventType = TestPerfCollector::EventType; + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", "cycles", + "-c", "1000003"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", "cycles", + "-g", "-c", "4000037"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "cycles", "-c", + "4000037", "--call-graph", "lbr"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "cycles:ppp", + "-c", "1000003"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "cycles:ppp", + "-g", "-c", "4000037"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "cycles:ppp", + "-c", "4000037", "--call-graph", "lbr"}), + EventType::kCycles); + + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", "r20c4", + "-b", "-c", "200011"}), + EventType::kOther); + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", "rc4", + "-b", "-c", "300001"}), + EventType::kOther); + EXPECT_EQ( + TestPerfCollector::CommandEventType({"--duration", "0", "--", "record", + "-a", "-e", "r0481", "-c", "2003"}), + EventType::kOther); + EXPECT_EQ( + TestPerfCollector::CommandEventType({"--duration", "0", "--", "record", + "-a", "-e", "r13d0", "-c", "2003"}), + EventType::kOther); + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", + "iTLB-misses", "-c", "2003"}), + EventType::kOther); + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "record", "-a", "-e", + "dTLB-misses", "-c", "2003"}), + EventType::kOther); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "cache-misses", + "-c", "10007"}), + EventType::kOther); + + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "instructions", + "-e", "cycles", "-c", "1000003"}), + EventType::kCycles); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-a", "-e", "instructions", + "-e", "cycles:ppp", "-c", "1000003"}), + EventType::kCycles); + + EXPECT_EQ(TestPerfCollector::CommandEventType({"--duration", "0", "--", + "stat", "-a", "-e", "cycles", + "-e", "instructions"}), + EventType::kOther); + + EXPECT_EQ( + TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-e", "cs_etm/autofdo/", "-a"}), + EventType::kETM); + EXPECT_EQ( + TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-e", "cs_etm/autofdo/u", "-a"}), + EventType::kETM); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--", "record", "-e", + "cs_etm/autofdo,preset=1/", "-a"}), + EventType::kETM); + EXPECT_EQ(TestPerfCollector::CommandEventType( + {"--duration", "0", "--run_inject", "--inject_args", "-b", "--", + "record", "-e", "cs_etm/autofdo/", "-a"}), + EventType::kETM); +} + class PerfCollectorCollectionParamsTest : public testing::Test { public: PerfCollectorCollectionParamsTest() {} @@ -1200,7 +1356,8 @@ TEST_F(PerfCollectorCollectionParamsTest, Commands_EmptyExperiment) { std::vector<RandomSelector::WeightAndValue> default_cmds = - internal::GetDefaultCommandsForCpu(GetCPUIdentity()); + internal::GetDefaultCommandsForCpuModel( + GetCPUIdentity(), base::SysInfo::HardwareModelName()); std::map<std::string, std::string> params; ASSERT_TRUE(variations::AssociateVariationParams( "ChromeOSWideProfilingCollection", "group_name", params)); @@ -1215,7 +1372,8 @@ TEST_F(PerfCollectorCollectionParamsTest, Commands_InvalidValues) { std::vector<RandomSelector::WeightAndValue> default_cmds = - internal::GetDefaultCommandsForCpu(GetCPUIdentity()); + internal::GetDefaultCommandsForCpuModel( + GetCPUIdentity(), base::SysInfo::HardwareModelName()); std::map<std::string, std::string> params; // Use the "default" cpu specifier since we don't want to predict what CPU // this test is running on. (CPU detection is tested above.) @@ -1242,7 +1400,8 @@ TEST_F(PerfCollectorCollectionParamsTest, Commands_Override) { using WeightAndValue = RandomSelector::WeightAndValue; std::vector<RandomSelector::WeightAndValue> default_cmds = - internal::GetDefaultCommandsForCpu(GetCPUIdentity()); + internal::GetDefaultCommandsForCpuModel( + GetCPUIdentity(), base::SysInfo::HardwareModelName()); std::map<std::string, std::string> params; // Use the "default" cpu specifier since we don't want to predict what CPU // this test is running on. (CPU detection is tested above.) @@ -1309,46 +1468,4 @@ parsed_params.restore_session.max_collection_delay); } -TEST(PerfCollectorInternalTest, CommandSamplesCPUCycles) { - EXPECT_TRUE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "cycles", "-c", "1000003"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "cycles", "-g", "-c", "4000037"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles({"perf", "record", "-a", "-e", - "cycles", "-c", "4000037", - "--call-graph", "lbr"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "cycles:ppp", "-c", "1000003"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "cycles:ppp", "-g", "-c", "4000037"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles({"perf", "record", "-a", "-e", - "cycles:ppp", "-c", "4000037", - "--call-graph", "lbr"})); - - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "r20c4", "-b", "-c", "200011"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "rc4", "-b", "-c", "300001"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "r0481", "-c", "2003"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "r13d0", "-c", "2003"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "iTLB-misses", "-c", "2003"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "dTLB-misses", "-c", "2003"})); - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "cache-misses", "-c", "10007"})); - - EXPECT_TRUE(internal::CommandSamplesCPUCycles({"perf", "record", "-a", "-e", - "instructions", "-e", "cycles", - "-c", "1000003"})); - EXPECT_TRUE(internal::CommandSamplesCPUCycles( - {"perf", "record", "-a", "-e", "instructions", "-e", "cycles:ppp", "-c", - "1000003"})); - - EXPECT_FALSE(internal::CommandSamplesCPUCycles( - {"perf", "stat", "-a", "-e", "cycles", "-e", "instructions"})); -} - } // namespace metrics
diff --git a/chrome/browser/metrics/perf/perf_output.cc b/chrome/browser/metrics/perf/perf_output.cc index 2e812d943..4446400b 100644 --- a/chrome/browser/metrics/perf/perf_output.cc +++ b/chrome/browser/metrics/perf/perf_output.cc
@@ -17,12 +17,12 @@ namespace metrics { PerfOutputCall::PerfOutputCall(chromeos::DebugDaemonClient* debug_daemon_client, - base::TimeDelta duration, - const std::vector<std::string>& perf_args, + const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, DoneCallback callback) : debug_daemon_client_(debug_daemon_client), - duration_(duration), - perf_args_(perf_args), + quipper_args_(quipper_args), + disable_cpu_idle_(disable_cpu_idle), done_callback_(std::move(callback)), pending_stop_(false) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -37,7 +37,7 @@ &PerfOutputCall::OnIOComplete, weak_factory_.GetWeakPtr())); DCHECK(debug_daemon_client_); debug_daemon_client_->GetPerfOutput( - duration_, perf_args_, pipe_write_end.get(), + quipper_args_, disable_cpu_idle_, pipe_write_end.get(), base::BindOnce(&PerfOutputCall::OnGetPerfOutput, weak_factory_.GetWeakPtr())); }
diff --git a/chrome/browser/metrics/perf/perf_output.h b/chrome/browser/metrics/perf/perf_output.h index e533308..070bd85 100644 --- a/chrome/browser/metrics/perf/perf_output.h +++ b/chrome/browser/metrics/perf/perf_output.h
@@ -36,8 +36,8 @@ using DoneCallback = base::OnceCallback<void(std::string perf_stdout)>; PerfOutputCall(chromeos::DebugDaemonClient* debug_daemon_client, - base::TimeDelta duration, - const std::vector<std::string>& perf_args, + const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, DoneCallback callback); PerfOutputCall(const PerfOutputCall&) = delete; @@ -66,8 +66,8 @@ std::unique_ptr<chromeos::PipeReader> perf_data_pipe_reader_; // Saved arguments. - base::TimeDelta duration_; - std::vector<std::string> perf_args_; + std::vector<std::string> quipper_args_; + bool disable_cpu_idle_; DoneCallback done_callback_; // Whether Stop() is called before OnGetPerfOutput() has returned the session
diff --git a/chrome/browser/metrics/perf/perf_output_unittest.cc b/chrome/browser/metrics/perf/perf_output_unittest.cc index fd49f44..28d295f 100644 --- a/chrome/browser/metrics/perf/perf_output_unittest.cc +++ b/chrome/browser/metrics/perf/perf_output_unittest.cc
@@ -50,13 +50,12 @@ return proto; } -// Perf session ID returned by the GetPerfOutputFd DBus method call. +// Perf session ID returned by the GetPerfOutputV2 DBus method call. const uint64_t kFakePerfSssionId = 101; -// Profile collection duration is 4 seconds. -const base::TimeDelta kProfileDuration = base::Seconds(4); -// Perf command line arguments. -const std::vector<std::string> kPerfArgs{"perf", "record", "-a", "-e", - "cycles", "-g", "-c", "4000037"}; +// Quipper command line arguments for running perf. +const std::vector<std::string> kQuipperArgs{ + "--duration", "4", "--", "perf", "record", "-a", + "-e", "cycles", "-g", "-c", "4000037"}; // This fakes DebugDaemonClient by serving example perf data when the profiling // duration elapses. @@ -72,8 +71,8 @@ EXPECT_FALSE(perf_output_file_.IsValid()); } - void GetPerfOutput(base::TimeDelta duration, - const std::vector<std::string>& perf_args, + void GetPerfOutput(const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, int file_descriptor, chromeos::DBusMethodCallback<uint64_t> callback) override { // We will write perf output to this pipe FD. dup() |file_descriptor| @@ -158,7 +157,7 @@ // Test getting perf output after profile duration elapses. TEST_F(PerfOutputCallTest, GetPerfOutput) { perf_output_call_ = std::make_unique<PerfOutputCall>( - debug_daemon_client_.get(), kProfileDuration, kPerfArgs, + debug_daemon_client_.get(), kQuipperArgs, false, base::BindOnce(&PerfOutputCallTest::OnPerfOutputComplete, base::Unretained(this))); // Not yet collected. @@ -178,7 +177,7 @@ // Test stopping the perf session and get perf output right away. TEST_F(PerfOutputCallTest, Stop) { perf_output_call_ = std::make_unique<PerfOutputCall>( - debug_daemon_client_.get(), kProfileDuration, kPerfArgs, + debug_daemon_client_.get(), kQuipperArgs, false, base::BindOnce(&PerfOutputCallTest::OnPerfOutputComplete, base::Unretained(this))); // Not yet collected.
diff --git a/chrome/browser/metrics/perf/profile_provider_unittest_main.cc b/chrome/browser/metrics/perf/profile_provider_unittest_main.cc index cdc71f4f..898433a4c 100644 --- a/chrome/browser/metrics/perf/profile_provider_unittest_main.cc +++ b/chrome/browser/metrics/perf/profile_provider_unittest_main.cc
@@ -153,10 +153,9 @@ std::map<std::string, std::string> field_trial_params; // Only "cycles" event is supported. field_trial_params.insert(std::make_pair( - "PerfCommand::default::0", "50 perf record -a -e cycles -c 1000003")); - field_trial_params.insert( - std::make_pair("PerfCommand::default::1", - "50 perf record -a -e cycles -g -c 4000037")); + "PerfCommand::default::0", "50 -- record -a -e cycles -c 1000003")); + field_trial_params.insert(std::make_pair( + "PerfCommand::default::1", "50 -- record -a -e cycles -g -c 4000037")); ASSERT_TRUE(variations::AssociateVariationParams( "ChromeOSWideProfilingCollection", "group_name", field_trial_params)); field_trial_ = base::FieldTrialList::CreateFieldTrial(
diff --git a/chrome/browser/net/net_export_helper.cc b/chrome/browser/net/net_export_helper.cc index db46203..ef76c7d 100644 --- a/chrome/browser/net/net_export_helper.cc +++ b/chrome/browser/net/net_export_helper.cc
@@ -75,37 +75,35 @@ WinsockLayeredServiceProviderList layered_providers; GetWinsockLayeredServiceProviders(&layered_providers); - auto layered_provider_list = std::make_unique<base::ListValue>(); + base::Value::List layered_provider_list; for (size_t i = 0; i < layered_providers.size(); ++i) { - auto service_dict = std::make_unique<base::DictionaryValue>(); - service_dict->SetString("name", - base::AsString16(layered_providers[i].name)); - service_dict->SetInteger("version", layered_providers[i].version); - service_dict->SetInteger("chain_length", layered_providers[i].chain_length); - service_dict->SetInteger("socket_type", layered_providers[i].socket_type); - service_dict->SetInteger("socket_protocol", - layered_providers[i].socket_protocol); - service_dict->SetString("path", - base::WideToUTF8(layered_providers[i].path)); + base::Value::Dict service_dict; + service_dict.Set("name", base::AsString16(layered_providers[i].name)); + service_dict.Set("version", layered_providers[i].version); + service_dict.Set("chain_length", layered_providers[i].chain_length); + service_dict.Set("socket_type", layered_providers[i].socket_type); + service_dict.Set("socket_protocol", layered_providers[i].socket_protocol); + service_dict.Set("path", base::WideToUTF8(layered_providers[i].path)); - layered_provider_list->Append(std::move(service_dict)); + layered_provider_list.Append(std::move(service_dict)); } - service_providers->Set("service_providers", std::move(layered_provider_list)); + service_providers->GetDict().Set("service_providers", + std::move(layered_provider_list)); WinsockNamespaceProviderList namespace_providers; GetWinsockNamespaceProviders(&namespace_providers); - auto namespace_list = std::make_unique<base::ListValue>(); + base::Value::List namespace_list; for (size_t i = 0; i < namespace_providers.size(); ++i) { - auto namespace_dict = std::make_unique<base::DictionaryValue>(); - namespace_dict->SetString("name", - base::AsString16(namespace_providers[i].name)); - namespace_dict->SetBoolean("active", namespace_providers[i].active); - namespace_dict->SetInteger("version", namespace_providers[i].version); - namespace_dict->SetInteger("type", namespace_providers[i].type); + base::Value::Dict namespace_dict; + namespace_dict.Set("name", base::AsString16(namespace_providers[i].name)); + namespace_dict.Set("active", namespace_providers[i].active); + namespace_dict.Set("version", namespace_providers[i].version); + namespace_dict.Set("type", namespace_providers[i].type); - namespace_list->Append(std::move(namespace_dict)); + namespace_list.Append(std::move(namespace_dict)); } - service_providers->Set("namespace_providers", std::move(namespace_list)); + service_providers->GetDict().Set("namespace_providers", + std::move(namespace_list)); return service_providers; }
diff --git a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc index 025167f..0475c22 100644 --- a/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc +++ b/chrome/browser/optimization_guide/page_content_annotations_service_browsertest.cc
@@ -19,6 +19,8 @@ #include "components/history/core/browser/history_db_task.h" #include "components/history/core/browser/history_service.h" #include "components/optimization_guide/content/browser/page_content_annotations_service.h" +#include "components/optimization_guide/content/browser/test_page_content_annotator.h" +#include "components/optimization_guide/core/execution_status.h" #include "components/optimization_guide/core/optimization_guide_enums.h" #include "components/optimization_guide/core/optimization_guide_features.h" #include "components/optimization_guide/core/optimization_guide_switches.h" @@ -151,7 +153,7 @@ } ~PageContentAnnotationsServicePageTopicsBrowserTest() override = default; - void LoadModel() { + void LoadPageTopicsV2Model() { proto::Any any_metadata; any_metadata.set_type_url( "type.googleapis.com/com.foo.PageTopicsModelMetadata"); @@ -176,8 +178,6 @@ .AppendASCII("optimization_guide") .AppendASCII("page_topics_128_model.tflite"); - base::HistogramTester histogram_tester; - OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()) ->OverrideTargetModelForTesting( proto::OPTIMIZATION_TARGET_PAGE_TOPICS_V2, @@ -186,9 +186,21 @@ .SetModelMetadata(any_metadata) .Build()); - RetryForHistogramUntilCountReached( - &histogram_tester, - "OptimizationGuide.ModelExecutor.ModelFileUpdated.PageTopicsV2", 1); + PageContentAnnotationsService* service = + PageContentAnnotationsServiceFactory::GetForProfile( + browser()->profile()); + ASSERT_TRUE(service); + + base::RunLoop run_loop; + service->RequestAndNotifyWhenModelAvailable( + AnnotationType::kPageTopics, + base::BindOnce( + [](base::RunLoop* run_loop, bool success) { + EXPECT_TRUE(success); + run_loop->Quit(); + }, + &run_loop)); + run_loop.Run(); } private: @@ -206,11 +218,7 @@ PageContentAnnotationsService* service = PageContentAnnotationsServiceFactory::GetForProfile(browser()->profile()); ASSERT_TRUE(service); - - service->RequestAndNotifyWhenModelAvailable(AnnotationType::kPageTopics, - base::DoNothing()); - - LoadModel(); + LoadPageTopicsV2Model(); std::vector<BatchAnnotationResult> results; base::RunLoop run_loop; @@ -328,7 +336,7 @@ OptimizationGuideKeyedServiceFactory::GetForProfile(browser()->profile()) ->OverrideTargetModelForTesting( - proto::OPTIMIZATION_TARGET_PAGE_TOPICS, + proto::OPTIMIZATION_TARGET_PAGE_VISIBILITY, optimization_guide::TestModelInfoBuilder() .SetModelFilePath(model_file_path) .SetModelMetadata(any_metadata) @@ -337,7 +345,7 @@ #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) RetryForHistogramUntilCountReached( &histogram_tester, - "OptimizationGuide.ModelExecutor.ModelFileUpdated.PageTopics", 1); + "OptimizationGuide.ModelExecutor.ModelFileUpdated.PageVisibility", 1); #else base::RunLoop().RunUntilIdle(); #endif @@ -411,6 +419,10 @@ histogram_tester.ExpectUniqueSample( "OptimizationGuide.PageContentAnnotationsService.ContentAnnotated", true, 1); +#else + histogram_tester.ExpectUniqueSample( + "OptimizationGuide.PageContentAnnotationsService.ContentAnnotated", false, + 1); #endif #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) @@ -434,10 +446,7 @@ GetContentAnnotationsForURL(url); ASSERT_TRUE(got_content_annotations.has_value()); EXPECT_NE(-1.0, got_content_annotations->model_annotations.visibility_score); - EXPECT_FALSE(got_content_annotations->model_annotations.categories.empty()); - EXPECT_EQ( - 123, - got_content_annotations->model_annotations.page_topics_model_version); + EXPECT_TRUE(got_content_annotations->model_annotations.categories.empty()); auto entries = ukm_recorder.GetEntriesByName( ukm::builders::PageContentAnnotations::kEntryName); @@ -677,8 +686,41 @@ } ~PageContentAnnotationsServiceBatchVisitTest() override = default; + void SetUpOnMainThread() override { + PageContentAnnotationsServiceNoHistoryTest::SetUpOnMainThread(); + + PageContentAnnotationsService* service = + PageContentAnnotationsServiceFactory::GetForProfile( + browser()->profile()); + + annotator_.UsePageEntities( + /*model_info=*/absl::nullopt, + { + { + "Test Page", + { + ScoredEntityMetadata(0.6, + EntityMetadata("test", "test", {})), + ScoredEntityMetadata(0.4, + EntityMetadata("page", "page", {})), + }, + }, + { + "sometext", + { + ScoredEntityMetadata(0.7, + EntityMetadata("some", "some", {})), + ScoredEntityMetadata(0.3, + EntityMetadata("text", "text", {})), + }, + }, + }); + service->OverridePageContentAnnotatorForTesting(&annotator_); + } + private: base::test::ScopedFeatureList scoped_feature_list_; + TestPageContentAnnotator annotator_; }; IN_PROC_BROWSER_TEST_F(PageContentAnnotationsServiceBatchVisitTest, @@ -735,13 +777,6 @@ } ~PageContentAnnotationsServiceBatchVisitNoAnnotateTest() override = default; - void SetUpCommandLine(base::CommandLine* cmd) override { - // Note: the code after the early return this disables is well tested in - // other places. - cmd->AppendSwitch( - optimization_guide::switches::kStopHistoryVisitBatchAnnotateForTesting); - } - private: base::test::ScopedFeatureList scoped_feature_list_; }; @@ -846,11 +881,11 @@ RetryForHistogramUntilCountReached( &histogram_tester, - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", 1); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", 1); histogram_tester.ExpectUniqueSample( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", false, - 1); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", + ExecutionStatus::kErrorModelFileNotAvailable, 1); LoadAndWaitForModel(); @@ -860,16 +895,16 @@ RetryForHistogramUntilCountReached( &histogram_tester, - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", 2); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", 2); histogram_tester.ExpectBucketCount( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", false, - 1); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", + ExecutionStatus::kErrorModelFileNotAvailable, 1); histogram_tester.ExpectBucketCount( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", true, - 1); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", + ExecutionStatus::kSuccess, 1); histogram_tester.ExpectTotalCount( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", 2); + "OptimizationGuide.ModelExecutor.ExecutionStatus.PageVisibility", 2); } class PageContentAnnotationsServiceValidationTest
diff --git a/chrome/browser/pdf/pdf_extension_test.cc b/chrome/browser/pdf/pdf_extension_test.cc index bad0710..88c160a 100644 --- a/chrome/browser/pdf/pdf_extension_test.cc +++ b/chrome/browser/pdf/pdf_extension_test.cc
@@ -4292,7 +4292,15 @@ testing::ValuesIn(GetAXTestValues()), testing::PrintToStringParamName()); -IN_PROC_BROWSER_TEST_P(PDFExtensionAccessibilityTreeDumpTest, HelloWorld) { +// TODO(crbug.com/1324362): Fix Mac flakes. +#if BUILDFLAG(IS_MAC) +#define MAYBE_HelloWorld DISABLED_HelloWorld +#else +#define MAYBE_HelloWorld HelloWorld +#endif + +IN_PROC_BROWSER_TEST_P(PDFExtensionAccessibilityTreeDumpTest, + MAYBE_HelloWorld) { RunPDFTest(FILE_PATH_LITERAL("hello-world.pdf")); } @@ -4327,7 +4335,15 @@ RunPDFTest(FILE_PATH_LITERAL("highlights.pdf")); } -IN_PROC_BROWSER_TEST_P(PDFExtensionAccessibilityTreeDumpTest, TextFields) { +// TODO(crbug.com/1324362): Fix Mac flakes. +#if BUILDFLAG(IS_MAC) +#define MAYBE_TextFields DISABLED_TextFields +#else +#define MAYBE_TextFields TextFields +#endif + +IN_PROC_BROWSER_TEST_P(PDFExtensionAccessibilityTreeDumpTest, + MAYBE_TextFields) { RunPDFTest(FILE_PATH_LITERAL("text_fields.pdf")); }
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc index 1a5d0d65..a79811e 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc
@@ -1106,22 +1106,26 @@ TrustSafetySentimentService::FeatureArea area; switch (action) { - case (DialogAction::kNoticeOpenSettings): + case DialogAction::kNoticeOpenSettings: area = TrustSafetySentimentService::FeatureArea:: kPrivacySandbox3NoticeSettings; break; - case (DialogAction::kNoticeAcknowledge): + case DialogAction::kNoticeAcknowledge: area = TrustSafetySentimentService::FeatureArea::kPrivacySandbox3NoticeOk; break; - case (DialogAction::kNoticeDismiss): + case DialogAction::kNoticeDismiss: area = TrustSafetySentimentService::FeatureArea:: kPrivacySandbox3NoticeDismiss; break; - case (DialogAction::kConsentAccepted): + case DialogAction::kNoticeLearnMore: + area = TrustSafetySentimentService::FeatureArea:: + kPrivacySandbox3NoticeLearnMore; + break; + case DialogAction::kConsentAccepted: area = TrustSafetySentimentService::FeatureArea:: kPrivacySandbox3ConsentAccept; break; - case (DialogAction::kConsentDeclined): + case DialogAction::kConsentDeclined: area = TrustSafetySentimentService::FeatureArea:: kPrivacySandbox3ConsentDecline; break;
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc index c1f6bafa..afeb03a 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc
@@ -1548,6 +1548,22 @@ PrivacySandboxService::DialogAction::kNoticeClosedNoInteraction); } { + EXPECT_CALL( + *mock_sentiment_service(), + InteractedWithPrivacySandbox3(TrustSafetySentimentService::FeatureArea:: + kPrivacySandbox3NoticeLearnMore)) + .Times(1); + SetupDialogTestState(feature_list(), prefs(), + {/*consent_required=*/false, + /*old_api_pref=*/true, + /*new_api_pref=*/false, + /*notice_displayed=*/false, + /*consent_decision_made=*/false, + /*confirmation_not_shown=*/false}); + privacy_sandbox_service()->DialogActionOccurred( + PrivacySandboxService::DialogAction::kNoticeLearnMore); + } + { EXPECT_CALL(*mock_sentiment_service(), InteractedWithPrivacySandbox3(testing::_)) .Times(0);
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html index 4a9a921..f1e02e2 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.html
@@ -92,6 +92,9 @@ </div> <div class="line"></div> <setting-zippy id="zippy"> + <iron-media-query query="(prefers-color-scheme: dark)" + query-matches="{{isDarkModeActive_}}"> + </iron-media-query> <div slot="title"> [[i18nDynamic(locale, 'assistantScreenContextTitle')]] </div>
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.js b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.js index de1a556..81579b6 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.js +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_related_info.js
@@ -69,6 +69,15 @@ type: String, value: '', }, + + /** + * Whether the marketing opt-in page is being rendered in dark mode. + * @private {boolean} + */ + isDarkModeActive_: { + type: Boolean, + value: false, + }, }; } @@ -244,13 +253,17 @@ reloadContent(data) { this.skipActivityControl_ = !data['activityControlNeeded']; this.childName_ = data['childName']; + const url = this.isDarkModeActive_ ? 'info_outline_gm_grey500_24dp.png' : + 'info_outline_gm_grey600_24dp.png'; this.$.zippy.setAttribute( 'icon-src', 'data:text/html;charset=utf-8,' + encodeURIComponent(this.$.zippy.getWrappedIcon( 'https://www.gstatic.com/images/icons/material/system/2x/' + - 'info_outline_grey600_24dp.png', - this.i18n('assistantScreenContextTitle')))); + url, + this.i18n('assistantScreenContextTitle'), + getComputedStyle(document.body) + .getPropertyValue('--cros-bg-color')))); this.equalWeightButtons_ = data['equalWeightButtons']; this.consentStringLoaded_ = true;
diff --git a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.js b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.js index 0271b6a..e5c10008 100644 --- a/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.js +++ b/chrome/browser/resources/chromeos/assistant_optin/assistant_value_prop.js
@@ -362,8 +362,10 @@ const data = zippy_data[i][j]; const zippy = document.createElement('setting-zippy'); // TODO(crbug.com/1313994) - Remove hard coded colors in OOBE - const background = - this.isMinorMode_ ? '#e8f0fe' /* gblue50 */ : 'white'; + const background = this.isMinorMode_ ? + getComputedStyle(document.body) + .getPropertyValue('--cros-highlight-color' /* gblue50 */) : + getComputedStyle(document.body).getPropertyValue('--cros-bg-color'); zippy.setAttribute( 'icon-src', 'data:text/html;charset=utf-8,' +
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.js index becb763..6586aa0 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/add_input_methods_dialog.js
@@ -2,32 +2,42 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +/** + * @fileoverview 'os-settings-add-input-methods-dialog' is a dialog for + * adding input methods. + */ + +import {html, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {recordSettingChange} from '../metrics_recorder.js'; + +import {Item} from './add_items_dialog.js'; +import {LanguageHelper, LanguagesModel} from './languages_types.js'; + // The IME ID for the Accessibility Common extension used by Dictation. /** @type {string} */ const ACCESSIBILITY_COMMON_IME_ID = '_ext_ime_egfdjlfmgnehecnclamagfafdccgfndpdictation'; -/** - * @fileoverview 'os-settings-add-input-methods-dialog' is a dialog for - * adding input methods. - */ -import {afterNextRender, Polymer, html, flush, Templatizer, TemplateInstanceBase} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +/** @polymer */ +class OsSettingsAddInputMethodsDialogElement extends PolymerElement { + static get is() { + return 'os-settings-add-input-methods-dialog'; + } -import {Item} from './add_items_dialog.js'; -import {recordSettingChange} from '../metrics_recorder.js'; -import {LanguageHelper, LanguagesModel} from './languages_types.js'; + static get template() { + return html`{__html_template__}`; + } -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-add-input-methods-dialog', + static get properties() { + return { + /** @type {!LanguagesModel|undefined} */ + languages: Object, - properties: { - /** @type {!LanguagesModel|undefined} */ - languages: Object, - - /** @type {!LanguageHelper} */ - languageHelper: Object, - }, + /** @type {!LanguageHelper} */ + languageHelper: Object, + }; + } /** * Get suggested input methods based on user's enabled languages and ARC IMEs @@ -41,7 +51,7 @@ ]; return this.languageHelper.getInputMethodsForLanguages(languageCodes) .map(inputMethod => inputMethod.id); - }, + } /** * @return {!Array<!Item>} A list of possible input methods. @@ -67,7 +77,7 @@ searchTerms: inputMethod.tags, disabledByPolicy: !!inputMethod.isProhibitedByPolicy })); - }, + } /** * Add input methods. @@ -79,5 +89,9 @@ this.languageHelper.addInputMethod(id); }); recordSettingChange(); - }, -}); + } +} + +customElements.define( + OsSettingsAddInputMethodsDialogElement.is, + OsSettingsAddInputMethodsDialogElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/add_spellcheck_languages_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/add_spellcheck_languages_dialog.js index 101966da..a0d59439 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/add_spellcheck_languages_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/add_spellcheck_languages_dialog.js
@@ -6,36 +6,49 @@ * @fileoverview 'os-settings-add-spellcheck-language-dialog' is a dialog for * adding spell check languages. */ -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {recordSettingChange} from '../metrics_recorder.js'; -import {PrefsBehavior} from '../prefs_behavior.js'; +import {PrefsBehavior, PrefsBehaviorInterface} from '../prefs_behavior.js'; import {Item} from './add_items_dialog.js'; -import {LanguageHelper, LanguagesModel, SpellCheckLanguageState} from './languages_types.js'; +import {LanguageHelper, LanguagesModel} from './languages_types.js'; -Polymer({ - is: 'os-settings-add-spellcheck-languages-dialog', +/** + * @constructor + * @extends {PolymerElement} + * @implements {PrefsBehaviorInterface} + */ +const OsSettingsAddSpellcheckLanguagesDialogElementBase = + mixinBehaviors([PrefsBehavior], PolymerElement); - _template: html`{__html_template__}`, +/** @polymer */ +class OsSettingsAddSpellcheckLanguagesDialogElement extends + OsSettingsAddSpellcheckLanguagesDialogElementBase { + static get is() { + return 'os-settings-add-spellcheck-languages-dialog'; + } - behaviors: [ - PrefsBehavior, - ], + static get template() { + return html`{__html_template__}`; + } - properties: { - /* Preferences state. */ - prefs: { - type: Object, - notify: true, - }, + static get properties() { + return { + /* Preferences state. */ + prefs: { + type: Object, + notify: true, + }, - /** @type {!LanguagesModel|undefined} */ - languages: Object, + /** @type {!LanguagesModel|undefined} */ + languages: Object, - /** @type {!LanguageHelper} */ - languageHelper: Object, - }, + /** @type {!LanguageHelper} */ + languageHelper: Object, + }; + } /** * Get suggested languages based on enabled languages and input methods. @@ -51,7 +64,7 @@ return this.languages.spellCheckOffLanguages .map(spellCheckLang => spellCheckLang.language.code) .filter(code => languageCodes.has(code)); - }, + } /** * Get the list of languages used for the "all languages" section, filtering @@ -70,7 +83,7 @@ ], disabledByPolicy: spellCheckLang.isManaged, })); - }, + } /** * @param {!chrome.languageSettingsPrivate.Language} language @@ -84,7 +97,7 @@ displayText += ' - ' + language.nativeDisplayName; } return displayText; - }, + } /** * Add spell check languages. @@ -96,5 +109,9 @@ this.languageHelper.toggleSpellCheck(code, true); }); recordSettingChange(); - }, -}); + } +} + +customElements.define( + OsSettingsAddSpellcheckLanguagesDialogElement.is, + OsSettingsAddSpellcheckLanguagesDialogElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js index 7160434b..c6987d93 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/change_device_language_dialog.js
@@ -17,64 +17,77 @@ import './languages.js'; import '../../settings_shared_css.js'; -import {CrScrollableBehavior} from '//resources/cr_elements/cr_scrollable_behavior.m.js'; -import {assert, assertNotReached} from '//resources/js/assert.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {CrScrollableBehavior, CrScrollableBehaviorInterface} from '//resources/cr_elements/cr_scrollable_behavior.m.js'; +import {assert} from '//resources/js/assert.m.js'; +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {LifetimeBrowserProxyImpl} from '../../lifetime_browser_proxy.js'; import {recordSettingChange} from '../metrics_recorder.js'; -import {InputsShortcutReminderState, LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './languages_metrics_proxy.js'; +import {LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './languages_metrics_proxy.js'; import {LanguageHelper, LanguagesModel} from './languages_types.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-change-device-language-dialog', +/** + * @constructor + * @extends {PolymerElement} + * @implements {CrScrollableBehaviorInterface} + * @implements {I18nBehaviorInterface} + */ +const OsSettingsChangeDeviceLanguageDialogElementBase = + mixinBehaviors([CrScrollableBehavior, I18nBehavior], PolymerElement); - behaviors: [ - CrScrollableBehavior, - I18nBehavior, - ], +/** @polymer */ +class OsSettingsChangeDeviceLanguageDialogElement extends + OsSettingsChangeDeviceLanguageDialogElementBase { + static get is() { + return 'os-settings-change-device-language-dialog'; + } - properties: { - /** @type {!LanguagesModel|undefined} */ - languages: Object, + static get template() { + return html`{__html_template__}`; + } - /** @private {!Array<!chrome.languageSettingsPrivate.Language>} */ - displayedLanguages_: { - type: Array, - computed: `getPossibleDeviceLanguages_(languages.supported, - languages.enabled.*, lowercaseQueryString_)`, - }, + static get properties() { + return { + /** @type {!LanguagesModel|undefined} */ + languages: Object, - /** @private {boolean} */ - displayedLanguagesEmpty_: { - type: Boolean, - computed: 'isZero_(displayedLanguages_.length)', - }, + /** @private {!Array<!chrome.languageSettingsPrivate.Language>} */ + displayedLanguages_: { + type: Array, + computed: `getPossibleDeviceLanguages_(languages.supported, + languages.enabled.*, lowercaseQueryString_)`, + }, - /** @type {!LanguageHelper} */ - languageHelper: Object, + /** @private {boolean} */ + displayedLanguagesEmpty_: { + type: Boolean, + computed: 'isZero_(displayedLanguages_.length)', + }, - /** @private {?chrome.languageSettingsPrivate.Language} */ - selectedLanguage_: { - type: Object, - value: null, - }, + /** @type {!LanguageHelper} */ + languageHelper: Object, - /** @private */ - disableActionButton_: { - type: Boolean, - computed: 'shouldDisableActionButton_(selectedLanguage_)', - }, + /** @private {?chrome.languageSettingsPrivate.Language} */ + selectedLanguage_: { + type: Object, + value: null, + }, - /** @private */ - lowercaseQueryString_: { - type: String, - value: '', - }, - }, + /** @private */ + disableActionButton_: { + type: Boolean, + computed: 'shouldDisableActionButton_(selectedLanguage_)', + }, + + /** @private */ + lowercaseQueryString_: { + type: String, + value: '', + }, + }; + } /** * @param {!CustomEvent<string>} e @@ -82,7 +95,7 @@ */ onSearchChanged_(e) { this.lowercaseQueryString_ = e.detail.toLowerCase(); - }, + } /** * @return {!Array<!chrome.languageSettingsPrivate.Language>} A list of @@ -111,7 +124,7 @@ // is not manually specified). return a.nativeDisplayName.localeCompare(b.nativeDisplayName, 'en'); }); - }, + } /** * @param {boolean} selected @@ -119,7 +132,7 @@ */ getItemClass_(selected) { return selected ? 'selected' : ''; - }, + } /** * @param {!chrome.languageSettingsPrivate.Language} item @@ -131,7 +144,7 @@ const instruction = selected ? 'selectedDeviceLanguageInstruction' : 'notSelectedDeviceLanguageInstruction'; return this.i18n(instruction, this.getDisplayText_(item)); - }, + } /** * @param {!chrome.languageSettingsPrivate.Language} language @@ -145,17 +158,17 @@ displayText += ' - ' + language.displayName; } return displayText; - }, + } /** @private */ shouldDisableActionButton_() { return this.selectedLanguage_ === null; - }, + } /** @private */ onCancelButtonTap_() { this.$.dialog.close(); - }, + } /** * Sets device language and restarts device. @@ -175,7 +188,7 @@ LanguagesMetricsProxyImpl.getInstance().recordInteraction( LanguagesPageInteraction.RESTART); LifetimeBrowserProxyImpl.getInstance().signOutAndRestart(); - }, + } /** * @param {!KeyboardEvent} e @@ -188,7 +201,7 @@ } else if (e.key !== 'PageDown' && e.key !== 'PageUp') { this.$.search.scrollIntoViewIfNeeded(); } - }, + } /** * @param {number} num @@ -197,5 +210,9 @@ */ isZero_(num) { return num === 0; - }, -}); + } +} + +customElements.define( + OsSettingsChangeDeviceLanguageDialogElement.is, + OsSettingsChangeDeviceLanguageDialogElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/input_method_options_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/input_method_options_page.js index c16018a..104918d 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/input_method_options_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/input_method_options_page.js
@@ -11,72 +11,89 @@ import '../../settings_shared_css.js'; import {assert, assertNotReached} from '//resources/js/assert.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {afterNextRender, html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; import {Route, Router} from '../../router.js'; import {routes} from '../os_route.js'; -import {PrefsBehavior} from '../prefs_behavior.js'; -import {RouteObserverBehavior} from '../route_observer_behavior.js'; +import {PrefsBehavior, PrefsBehaviorInterface} from '../prefs_behavior.js'; +import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; import {generateOptions, getFirstPartyInputMethodEngineId, getOptionLabelName, getOptionMenuItems, getOptionUiType, getOptionUrl, getUntranslatedOptionLabelName, hasOptionsPageInSettings, isNumberValue, isOptionLabelTranslated, OPTION_DEFAULT, OptionType, UiType} from './input_method_util.js'; import {LanguageHelper} from './languages_types.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'settings-input-method-options-page', +/** + * @constructor + * @extends {PolymerElement} + * @implements {I18nBehaviorInterface} + * @implements {PrefsBehaviorInterface} + * @implements {RouteObserverBehaviorInterface} + */ +const SettingsInputMethodOptionsPageElementBase = mixinBehaviors( + [I18nBehavior, PrefsBehavior, RouteObserverBehavior], PolymerElement); - behaviors: [ - I18nBehavior, - PrefsBehavior, - RouteObserverBehavior, - ], +/** @polymer */ +class SettingsInputMethodOptionsPageElement extends + SettingsInputMethodOptionsPageElementBase { + static get is() { + return 'settings-input-method-options-page'; + } - properties: { - /** @type {!LanguageHelper} */ - languageHelper: Object, + static get template() { + return html`{__html_template__}`; + } - /** Preferences state. */ - prefs: { - type: Object, - notify: true, - }, + static get properties() { + return { + /** @type {!LanguageHelper} */ + languageHelper: Object, + + /** Preferences state. */ + prefs: { + type: Object, + notify: true, + }, + + /** + * Input method ID. + * @private + */ + id_: String, + + /** + * Input method engine ID. + * @private + */ + engineId_: String, + + /** + * The content to be displayed in the page, auto generated every time when + * the user enters the page. + * @private {!Array<!{title: string, options:!Array<!Object<string, *>>}>} + */ + optionSections_: { + type: Array, + value: [], + }, + }; + } + + constructor() { + super(); /** - * Input method ID. + * The root path of input method options in Prefs. + * @const {string} * @private */ - id_: String, - - /** - * Input method engine ID. - * @private - */ - engineId_: String, - - /** - * The content to be displayed in the page, auto generated every time when - * the user enters the page. - * @private {!Array<!{title: string, options:!Array<!Object<string, *>>}>} - */ - optionSections_: { - type: Array, - value: [], - }, - }, - - /** - * The root path of input method options in Prefs. - * @const {string} - * @private - */ - PREFS_PATH: 'settings.language.input_method_specific_settings', + this.PREFS_PATH = 'settings.language.input_method_specific_settings'; + } /** * RouteObserverBehavior * @param {!Route} route - * @param {!Route} oldRoute + * @param {!Route=} oldRoute * @protected */ currentRouteChanged(route, oldRoute) { @@ -96,7 +113,7 @@ `Input method ID '${this.id_}' is invalid`); this.engineId_ = getFirstPartyInputMethodEngineId(this.id_); this.populateOptionSections_(); - }, + } /** * Get menu items for an option, and enrich the items with selected status and @@ -111,7 +128,7 @@ menuItem['name'] ? this.i18n(menuItem['name']) : menuItem['value']; return menuItem; }); - }, + } /** * Generate the sections of options according to the engine ID and Prefs. @@ -160,7 +177,7 @@ options: section.optionNames.map(makeOption, false), }; }); - }, + } /** * @return {string} Prefs prefix for the current engine ID, which is usually @@ -175,7 +192,7 @@ return 'zhuyin'; } return this.engineId_; - }, + } /** * @@ -186,7 +203,7 @@ // TODO(b/189909728): Sometimes the value comes as a string, other times as // an integer, so handle both cases. Try to understand and fix this. return value === '0' || value === 0; - }, + } /** * Handler for toggle button and dropdown change. Update the value of the @@ -204,7 +221,7 @@ afterNextRender(this, () => { this.updatePref_(option.name, option.value); }); - }, + } isSettingValueValid_(name, value) { const uiType = getOptionUiType(name); @@ -213,7 +230,7 @@ } const menuItems = getOptionMenuItems(name); return menuItems.find((item) => item.value === value); - }, + } /** * Update an input method pref. @@ -240,7 +257,7 @@ } updatedSettings[prefix][optionName] = newValue; this.setPrefValue(this.PREFS_PATH, updatedSettings); - }, + } /** * Opens external link in Chrome. @@ -249,7 +266,7 @@ */ navigateToOtherPageInSettings_(e) { Router.getInstance().navigateTo(e.model.option.url); - }, + } /** * @param {string} section the name of the section. @@ -271,7 +288,7 @@ default: assertNotReached(); } - }, + } /** * @param {!UiType} item @@ -280,7 +297,7 @@ */ isToggleButton_(item) { return item === UiType.TOGGLE_BUTTON; - }, + } /** * @param {!UiType} item @@ -289,7 +306,7 @@ */ isDropdown_(item) { return item === UiType.DROPDOWN; - }, + } /** * @param {!UiType} item @@ -298,5 +315,9 @@ */ isLink_(item) { return item === UiType.LINK; - }, -}); + } +} + +customElements.define( + SettingsInputMethodOptionsPageElement.is, + SettingsInputMethodOptionsPageElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js index 061f41e..ae89d46 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/input_page.js
@@ -6,6 +6,7 @@ * @fileoverview 'os-settings-input-page' is the input sub-page * for language and input method settings. */ + import '//resources/cr_components/localized_link/localized_link.js'; import '//resources/cr_elements/cr_button/cr_button.m.js'; import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; @@ -19,159 +20,175 @@ import '../../settings_shared_css.js'; import '../../settings_page/settings_animated_pages.js'; -import {assert, assertNotReached} from '//resources/js/assert.m.js'; +import {assert} from '//resources/js/assert.m.js'; import {focusWithoutInk} from '//resources/js/cr/ui/focus_without_ink.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; import {Route, Router} from '../../router.js'; -import {DeepLinkingBehavior} from '../deep_linking_behavior.js'; +import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; import {routes} from '../os_route.js'; -import {PrefsBehavior} from '../prefs_behavior.js'; -import {RouteObserverBehavior} from '../route_observer_behavior.js'; +import {PrefsBehavior, PrefsBehaviorInterface} from '../prefs_behavior.js'; +import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; -import {generateOptions, getFirstPartyInputMethodEngineId, getOptionLabelName, getOptionMenuItems, getOptionUiType, getOptionUrl, getUntranslatedOptionLabelName, hasOptionsPageInSettings, isNumberValue, isOptionLabelTranslated, OPTION_DEFAULT, OptionType, UiType} from './input_method_util.js'; +import {hasOptionsPageInSettings} from './input_method_util.js'; import {InputsShortcutReminderState, LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './languages_metrics_proxy.js'; import {LanguageHelper, LanguagesModel, LanguageState, SpellCheckLanguageState} from './languages_types.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-input-page', +/** + * @constructor + * @extends {PolymerElement} + * @implements {DeepLinkingBehaviorInterface} + * @implements {I18nBehaviorInterface} + * @implements {PrefsBehaviorInterface} + * @implements {RouteObserverBehaviorInterface} + */ +const OsSettingsInputPageElementBase = mixinBehaviors( + [DeepLinkingBehavior, I18nBehavior, PrefsBehavior, RouteObserverBehavior], + PolymerElement); - behaviors: [ - DeepLinkingBehavior, - I18nBehavior, - PrefsBehavior, - RouteObserverBehavior, - ], +/** @polymer */ +class OsSettingsInputPageElement extends OsSettingsInputPageElementBase { + static get is() { + return 'os-settings-input-page'; + } - properties: { - /* Preferences state. */ - prefs: { - type: Object, - notify: true, - }, + static get template() { + return html`{__html_template__}`; + } - /** @type {!Map<string, (string|Function)>} */ - focusConfig: { - type: Object, - observer: 'focusConfigChanged_', - }, - - /** - * Read-only reference to the languages model provided by the - * 'os-settings-languages' instance. - * @type {!LanguagesModel|undefined} - */ - languages: { - type: Object, - }, - - /** @type {!LanguageHelper} */ - languageHelper: Object, - - /** @private {!Array<!LanguageState|!SpellCheckLanguageState>|undefined} */ - spellCheckLanguages_: { - type: Array, - computed: `getSpellCheckLanguages_(languageSettingsV2Update2Enabled_, - languages.spellCheckOnLanguages.*, languages.enabled.*)`, - }, - - /** @private */ - showAddInputMethodsDialog_: { - type: Boolean, - value: false, - }, - - /** @private */ - showAddSpellcheckLanguagesDialog_: { - type: Boolean, - value: false, - }, - - /** - * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} - */ - supportedSettingIds: { - type: Object, - value: () => new Set([ - chromeos.settings.mojom.Setting.kShowInputOptionsInShelf, - chromeos.settings.mojom.Setting.kAddInputMethod, - chromeos.settings.mojom.Setting.kSpellCheck, - ]), - }, - - /** @private */ - languageSettingsV2Update2Enabled_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); + static get properties() { + return { + /* Preferences state. */ + prefs: { + type: Object, + notify: true, }, - }, - /** @private */ - shouldShowLanguagePacksNotice_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('languagePacksHandwritingEnabled'); + /** @type {!Map<string, (string|Function)>} */ + focusConfig: { + type: Object, + observer: 'focusConfigChanged_', }, - }, - /** - * Whether the shortcut reminder for the last used IME is currently showing. - * @private - */ - showLastUsedIMEShortcutReminder_: { - type: Boolean, - computed: `shouldShowLastUsedIMEShortcutReminder_( - languages.inputMethods.enabled.length, - prefs.ash.shortcut_reminders.last_used_ime_dismissed.value)`, - }, - - /** - * Whether the shortcut reminder for the next IME is currently showing. - * @private - */ - showNextIMEShortcutReminder_: { - type: Boolean, - computed: `shouldShowNextIMEShortcutReminder_( - languages.inputMethods.enabled.length, - prefs.ash.shortcut_reminders.next_ime_dismissed.value)`, - }, - - /** - * The body of the currently showing shortcut reminders. - * @private {!Array<string>} - */ - shortcutReminderBody_: { - type: Array, - computed: `getShortcutReminderBody_(showLastUsedIMEShortcutReminder_, - showNextIMEShortcutReminder_)`, - }, - - /** @private */ - onDeviceGrammarCheckEnabled_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('onDeviceGrammarCheckEnabled'); + /** + * Read-only reference to the languages model provided by the + * 'os-settings-languages' instance. + * @type {!LanguagesModel|undefined} + */ + languages: { + type: Object, }, - }, - }, - /** @private {?LanguagesMetricsProxy} */ - languagesMetricsProxy_: null, + /** @type {!LanguageHelper} */ + languageHelper: Object, + + /** + * @private {!Array<!LanguageState|!SpellCheckLanguageState>|undefined} + */ + spellCheckLanguages_: { + type: Array, + computed: `getSpellCheckLanguages_(languageSettingsV2Update2Enabled_, + languages.spellCheckOnLanguages.*, languages.enabled.*)`, + }, + + /** @private */ + showAddInputMethodsDialog_: { + type: Boolean, + value: false, + }, + + /** @private */ + showAddSpellcheckLanguagesDialog_: { + type: Boolean, + value: false, + }, + + /** + * Used by DeepLinkingBehavior to focus this page's deep links. + * @type {!Set<!chromeos.settings.mojom.Setting>} + */ + supportedSettingIds: { + type: Object, + value: () => new Set([ + chromeos.settings.mojom.Setting.kShowInputOptionsInShelf, + chromeos.settings.mojom.Setting.kAddInputMethod, + chromeos.settings.mojom.Setting.kSpellCheck, + ]), + }, + + /** @private */ + languageSettingsV2Update2Enabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); + }, + }, + + /** @private */ + shouldShowLanguagePacksNotice_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('languagePacksHandwritingEnabled'); + }, + }, + + /** + * Whether the shortcut reminder for the last used IME is currently + * showing. + * @private + */ + showLastUsedIMEShortcutReminder_: { + type: Boolean, + computed: `shouldShowLastUsedIMEShortcutReminder_( + languages.inputMethods.enabled.length, + prefs.ash.shortcut_reminders.last_used_ime_dismissed.value)`, + }, + + /** + * Whether the shortcut reminder for the next IME is currently showing. + * @private + */ + showNextIMEShortcutReminder_: { + type: Boolean, + computed: `shouldShowNextIMEShortcutReminder_( + languages.inputMethods.enabled.length, + prefs.ash.shortcut_reminders.next_ime_dismissed.value)`, + }, + + /** + * The body of the currently showing shortcut reminders. + * @private {!Array<string>} + */ + shortcutReminderBody_: { + type: Array, + computed: `getShortcutReminderBody_(showLastUsedIMEShortcutReminder_, + showNextIMEShortcutReminder_)`, + }, + + /** @private */ + onDeviceGrammarCheckEnabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('onDeviceGrammarCheckEnabled'); + }, + }, + }; + } /** @override */ - created() { + constructor() { + super(); + + /** @private {!LanguagesMetricsProxy} */ this.languagesMetricsProxy_ = LanguagesMetricsProxyImpl.getInstance(); - }, + } /** * @param {!Route} route - * @param {!Route} oldRoute + * @param {!Route=} oldRoute */ currentRouteChanged(route, oldRoute) { // Does not apply to this page. @@ -180,7 +197,7 @@ } this.attemptDeepLink(); - }, + } /** * @param {!Map<string, (string|Function)>} newConfig @@ -194,7 +211,7 @@ this.focusConfig.set( routes.OS_LANGUAGES_EDIT_DICTIONARY.path, () => focusWithoutInk(this.$.editDictionarySubpageTrigger)); - }, + } /** * @param {!Event} e @@ -203,7 +220,7 @@ onShowImeMenuChange_(e) { this.languagesMetricsProxy_.recordToggleShowInputOptionsOnShelf( e.target.checked); - }, + } /** * @return {boolean} @@ -213,7 +230,7 @@ const allowedInputMethodsPref = this.getPref('settings.language.allowed_input_methods'); return !!allowedInputMethodsPref && allowedInputMethodsPref.value.length; - }, + } /** * Handler for click events on an input method on the main page, @@ -232,7 +249,7 @@ this.languagesMetricsProxy_.recordInteraction( LanguagesPageInteraction.SWITCH_INPUT_METHOD); recordSettingChange(); - }, + } /** * Handler for <Enter> events on an input method on the main page, @@ -248,7 +265,7 @@ } this.languageHelper.setCurrentInputMethod(e.model.item.id); - }, + } /** * Opens the input method extension's options page in a new tab (or focuses @@ -258,7 +275,7 @@ */ openExtensionOptionsPage_(e) { this.languageHelper.openInputMethodOptions(e.model.item.id); - }, + } /** @@ -270,7 +287,7 @@ hasOptionsPageInSettings_(id) { return hasOptionsPageInSettings( id, loadTimeData.getBoolean('allowPredictiveWriting')); - }, + } /** * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e @@ -281,7 +298,7 @@ params.append('id', e.model.item.id); Router.getInstance().navigateTo( routes.OS_LANGUAGES_INPUT_METHOD_OPTIONS, params); - }, + } /** * @param {string} id The input method ID. @@ -291,7 +308,7 @@ */ isCurrentInputMethod_(id, currentId) { return id === currentId; - }, + } /** * @param {string} id The input method ID. @@ -301,7 +318,7 @@ */ getInputMethodItemClass_(id, currentId) { return this.isCurrentInputMethod_(id, currentId) ? 'selected' : ''; - }, + } /** * @param {string} id The selected input method ID. @@ -313,7 +330,7 @@ */ getInputMethodTabIndex_(id, currentId) { return id === currentId ? '' : '0'; - }, + } /** * @param {string} inputMethodName @@ -322,24 +339,24 @@ */ getOpenOptionsPageLabel_(inputMethodName) { return this.i18n('openOptionsPage', inputMethodName); - }, + } /** @private */ onAddInputMethodClick_() { this.languagesMetricsProxy_.recordAddInputMethod(); this.showAddInputMethodsDialog_ = true; - }, + } /** @private */ onAddInputMethodsDialogClose_() { this.showAddInputMethodsDialog_ = false; focusWithoutInk(assert(this.$.addInputMethod)); - }, + } /** @private */ onAddSpellcheckLanguagesClick_() { this.showAddSpellcheckLanguagesDialog_ = true; - }, + } /** @private */ onAddSpellcheckLanguagesDialogClose_() { @@ -353,10 +370,11 @@ // Because #addSpellcheckLanguages is not statically created (as it is // within a <template is="dom-if">), we need to use - // this.$$("#addSpellcheckLanguages") instead of + // this.shadowRoot.querySelector("#addSpellcheckLanguages") instead of // this.$.addSpellCheckLanguages. - focusWithoutInk(assert(this.$$('#addSpellcheckLanguages'))); - }, + focusWithoutInk( + assert(this.shadowRoot.querySelector('#addSpellcheckLanguages'))); + } /** * @param {!chrome.languageSettingsPrivate.InputMethod} targetInputMethod @@ -373,7 +391,7 @@ return !this.languages.inputMethods.enabled.some( inputMethod => inputMethod.id !== targetInputMethod.id && this.languageHelper.isComponentIme(inputMethod)); - }, + } /** * @param {!chrome.languageSettingsPrivate.InputMethod} inputMethod @@ -381,7 +399,7 @@ */ getRemoveInputMethodTooltip_(inputMethod) { return this.i18n('removeInputMethodTooltip', inputMethod.displayName); - }, + } /** * @param {!{model: !{item: chrome.languageSettingsPrivate.InputMethod}}} e @@ -390,7 +408,7 @@ onRemoveInputMethodClick_(e) { this.languageHelper.removeInputMethod(e.model.item.id); recordSettingChange(); - }, + } /** * @param {!SpellCheckLanguageState} lang @@ -399,7 +417,7 @@ getRemoveSpellcheckLanguageTooltip_(lang) { return this.i18n( 'removeSpellCheckLanguageTooltip', lang.language.displayName); - }, + } /** * @param {!{model: !{item: SpellCheckLanguageState}}} e @@ -408,7 +426,7 @@ onRemoveSpellcheckLanguageClick_(e) { this.languageHelper.toggleSpellCheck(e.model.item.language.code, false); recordSettingChange(); - }, + } /** * Called whenever the spell check toggle is changed by the user. @@ -459,7 +477,7 @@ // Manually commit the pref change as we've set noSetPref on the toggle // button. toggle.sendPrefChange(); - }, + } /** * Returns the value to use as the |pref| attribute for the policy indicator @@ -470,7 +488,7 @@ getIndicatorPrefForManagedSpellcheckLanguage_(isEnabled) { return isEnabled ? this.getPref('spellcheck.forced_dictionaries') : this.getPref('spellcheck.blocked_dictionaries'); - }, + } /** * Returns an array of spell check languages for the UI. @@ -502,7 +520,7 @@ }); return supportedSpellcheckLanguages; - }, + } /** * Handler for enabling or disabling spell check for a specific language. @@ -517,7 +535,7 @@ this.languageHelper.toggleSpellCheck( item.language.code, !item.spellCheckEnabled); - }, + } /** * Handler for clicking on the name of the language. The action taken must @@ -528,7 +546,7 @@ onSpellCheckNameClick_(e) { assert(!this.isSpellCheckNameClickDisabled_(e.model.item)); this.onSpellCheckLanguageChange_(e); - }, + } /** * Name only supports clicking when language is not managed, supports @@ -540,7 +558,7 @@ isSpellCheckNameClickDisabled_(item) { return item.isManaged || item.downloadDictionaryFailureCount > 0 || !this.getPref('browser.enable_spellchecking').value; - }, + } /** * Handler to initiate another attempt at downloading the spell check @@ -551,7 +569,7 @@ onRetryDictionaryDownloadClick_(e) { assert(e.model.item.downloadDictionaryFailureCount > 0); this.languageHelper.retryDownloadDictionary(e.model.item.language.code); - }, + } /** * @param {!LanguageState} item @@ -562,7 +580,7 @@ return this.i18n( 'languagesDictionaryDownloadRetryDescription', item.language.displayName); - }, + } /** * Opens the Custom Dictionary page. @@ -572,7 +590,7 @@ this.languagesMetricsProxy_.recordInteraction( LanguagesPageInteraction.OPEN_CUSTOM_SPELL_CHECK); Router.getInstance().navigateTo(routes.OS_LANGUAGES_EDIT_DICTIONARY); - }, + } /** * Gets the appropriate CSS class for the Enhanced spell check toggle @@ -581,7 +599,7 @@ */ getEnhancedSpellCheckClass_() { return this.languageSettingsV2Update2Enabled_ ? '' : 'hr'; - }, + } /** * @private @@ -589,7 +607,7 @@ isEnableSpellcheckingDisabled_() { return !this.languageSettingsV2Update2Enabled_ && (this.spellCheckLanguages_ && this.spellCheckLanguages_.length === 0); - }, + } /** * @param {boolean} update2Enabled @@ -598,13 +616,13 @@ */ isCollapseOpened_(update2Enabled, spellCheckOn) { return !update2Enabled || spellCheckOn; - }, + } /** @private */ onLanguagePackNoticeLinkClick_() { this.languagesMetricsProxy_.recordInteraction( LanguagesPageInteraction.OPEN_LANGUAGE_PACKS_LEARN_MORE); - }, + } /** * @return {boolean} @@ -617,7 +635,7 @@ } // Need at least 2 input methods to be shown the reminder. return !!this.languages && this.languages.inputMethods.enabled.length >= 2; - }, + } /** * @return {boolean} @@ -630,7 +648,7 @@ } // Need at least 3 input methods to be shown the reminder. return !!this.languages && this.languages.inputMethods.enabled.length >= 3; - }, + } /** * @return {!Array<string>} @@ -645,7 +663,7 @@ reminderBody.push(this.i18nAdvanced('imeShortcutReminderNext')); } return reminderBody; - }, + } /** * @return {boolean} @@ -654,7 +672,7 @@ shouldShowShortcutReminder_() { return this.languageSettingsV2Update2Enabled_ && this.shortcutReminderBody_ && this.shortcutReminderBody_.length > 0; - }, + } /** @private */ onShortcutReminderDismiss_() { @@ -677,5 +695,8 @@ if (this.showNextIMEShortcutReminder_) { this.setPrefValue('ash.shortcut_reminders.next_ime_dismissed', true); } - }, -}); + } +} + +customElements.define( + OsSettingsInputPageElement.is, OsSettingsInputPageElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_browser_proxy.js b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_browser_proxy.js index b70243f..ebc406e 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_browser_proxy.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_browser_proxy.js
@@ -7,9 +7,7 @@ * to interact with the browser. */ -// clang-format off import {sendWithPromise} from 'chrome://resources/js/cr.m.js'; -// clang-format on /** @interface */ export class LanguagesBrowserProxy {
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js index 2b935664..f019f1e 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/languages_metrics_proxy.js
@@ -2,14 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addSingletonGetter} from 'chrome://resources/js/cr.m.js'; - /** * @fileoverview * Handles metrics for ChromeOS's languages OS settings. * TODO(crbug/1109431): Remove these metrics when languages settings migration * is completed and data analysed. */ + /** * Keeps in sync with SettingsLanguagesPageInteraction * in tools/metrics/histograms/enums.xml. @@ -145,6 +144,17 @@ 'ChromeOS.Settings.Inputs.ShortcutReminderDismissed', value, Object.keys(InputsShortcutReminderState).length); } + + /** @return {!LanguagesMetricsProxy} */ + static getInstance() { + return instance || (instance = new LanguagesMetricsProxyImpl()); + } + + /** @param {!LanguagesMetricsProxy} obj */ + static setInstance(obj) { + instance = obj; + } } -addSingletonGetter(LanguagesMetricsProxyImpl); +/** @type {?LanguagesMetricsProxy} */ +let instance = null;
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.js b/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.js index ec4c75f..28db415 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_add_languages_dialog.js
@@ -6,25 +6,34 @@ * @fileoverview 'os-settings-add-languages-dialog' is a dialog for enabling * languages. */ -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {html, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {Item} from './add_items_dialog.js'; import {LanguageHelper, LanguagesModel} from './languages_types.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-add-languages-dialog', +/** @polymer */ +class OsSettingsAddLanguagesDialogElement extends PolymerElement { + static get is() { + return 'os-settings-add-languages-dialog'; + } - properties: { - /** @type {!LanguagesModel|undefined} */ - languages: { - type: Object, - notify: true, - }, + static get template() { + return html`{__html_template__}`; + } - /** @type {!LanguageHelper} */ - languageHelper: Object, - }, + static get properties() { + return { + /** @type {!LanguagesModel|undefined} */ + languages: { + type: Object, + notify: true, + }, + + /** @type {!LanguageHelper} */ + languageHelper: Object, + }; + } /** * @return {!Array<!Item>} A list of languages to be displayed in the dialog. @@ -39,7 +48,7 @@ searchTerms: [language.displayName, language.nativeDisplayName], disabledByPolicy: false, })); - }, + } /** * @param {!chrome.languageSettingsPrivate.Language} language @@ -53,7 +62,7 @@ displayText += ' - ' + language.nativeDisplayName; } return displayText; - }, + } /** * Enables the checked languages. @@ -64,5 +73,9 @@ e.detail.forEach(languageCode => { this.languageHelper.enableLanguage(languageCode); }); - }, -}); + } +} + +customElements.define( + OsSettingsAddLanguagesDialogElement.is, + OsSettingsAddLanguagesDialogElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_edit_dictionary_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/os_edit_dictionary_page.js index fa31bd68..826fbe77 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_edit_dictionary_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_edit_dictionary_page.js
@@ -7,6 +7,24 @@ * the "dictionary" of custom words used for spell check. */ +import '//resources/cr_elements/cr_button/cr_button.m.js'; +import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; +import '//resources/cr_elements/cr_input/cr_input.m.js'; +import '//resources/cr_elements/icons.m.js'; +import '//resources/polymer/v3_0/iron-a11y-keys/iron-a11y-keys.js'; +import '//resources/polymer/v3_0/iron-list/iron-list.js'; +import '../../settings_shared_css.js'; + +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {Route} from '../../router.js'; +import {GlobalScrollTargetBehavior, GlobalScrollTargetBehaviorInterface} from '../global_scroll_target_behavior.js'; +import {recordSettingChange} from '../metrics_recorder.js'; +import {routes} from '../os_route.js'; + +import {LanguagesBrowserProxy, LanguagesBrowserProxyImpl} from './languages_browser_proxy.js'; + // Max valid word size, keep in sync with kMaxCustomDictionaryWordBytes in // //components/spellcheck/common/spellcheck_common.h const MAX_CUSTOM_DICTIONARY_WORD_BYTES = 99; @@ -19,85 +37,86 @@ WORD_TOO_LONG: 3, }; -import {afterNextRender, Polymer, html, flush, Templatizer, TemplateInstanceBase} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +/** + * @constructor + * @extends {PolymerElement} + * @implements {I18nBehaviorInterface} + * @implements {GlobalScrollTargetBehaviorInterface} + */ +const OsSettingsEditDictionaryPageElementBase = + mixinBehaviors([I18nBehavior, GlobalScrollTargetBehavior], PolymerElement); -import '//resources/cr_elements/cr_button/cr_button.m.js'; -import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; -import '//resources/cr_elements/cr_input/cr_input.m.js'; -import '//resources/cr_elements/icons.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import '//resources/polymer/v3_0/iron-a11y-keys/iron-a11y-keys.js'; -import '//resources/polymer/v3_0/iron-list/iron-list.js'; -import {recordSettingChange} from '../metrics_recorder.js'; -import {routes} from '../os_route.js'; -import {GlobalScrollTargetBehavior, setGlobalScrollTarget} from '../global_scroll_target_behavior.js'; -import '../../settings_shared_css.js'; -import {LanguagesBrowserProxy, LanguagesBrowserProxyImpl} from './languages_browser_proxy.js'; +/** @polymer */ +class OsSettingsEditDictionaryPageElement extends + OsSettingsEditDictionaryPageElementBase { + static get is() { + return 'os-settings-edit-dictionary-page'; + } -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-edit-dictionary-page', + static get template() { + return html`{__html_template__}`; + } - behaviors: [ - I18nBehavior, - GlobalScrollTargetBehavior, - ], + static get properties() { + return { + /** @private */ + newWordValue_: { + type: String, + value: '', + }, - properties: { - /** @private */ - newWordValue_: { - type: String, - value: '', - }, + /** + * Needed for GlobalScrollTargetBehavior. + * @type {!Route} + * @override + */ + subpageRoute: { + type: Object, + value: routes.OS_LANGUAGES_EDIT_DICTIONARY, + }, - /** - * Needed for GlobalScrollTargetBehavior. - * @override - */ - subpageRoute: { - type: Object, - value: routes.OS_LANGUAGES_EDIT_DICTIONARY, - }, + /** @private {!Array<string>} */ + words_: { + type: Array, + value: [], + }, - /** @private {!Array<string>} */ - words_: { - type: Array, - value: [], - }, + /** @private */ + hasWords_: { + type: Boolean, + value: false, + computed: 'computeHasWords_(words_.length)', + }, - /** @private */ - hasWords_: { - type: Boolean, - value: false, - computed: 'computeHasWords_(words_.length)', - }, + /** @private */ + disableAddButton_: { + type: Boolean, + value: true, + computed: 'shouldDisableAddButton_(newWordState_)', + }, - /** @private */ - disableAddButton_: { - type: Boolean, - value: true, - computed: 'shouldDisableAddButton_(newWordState_)', - }, - - /** @private */ - newWordState_: { - type: Number, - value: NewWordState.NO_WORD, - computed: 'updateNewWordState_(newWordValue_, words_.*)', - } - }, - - /** @private {?LanguageSettingsPrivate} */ - languageSettingsPrivate_: null, + /** @private */ + newWordState_: { + type: Number, + value: NewWordState.NO_WORD, + computed: 'updateNewWordState_(newWordValue_, words_.*)', + } + }; + } /** @override */ - created() { + constructor() { + super(); + + /** @private {!LanguageSettingsPrivate} */ this.languageSettingsPrivate_ = LanguagesBrowserProxyImpl.getInstance().getLanguageSettingsPrivate(); - }, + } /** @override */ ready() { + super.ready(); + this.languageSettingsPrivate_.getSpellcheckWords(words => { this.words_ = words; }); @@ -107,7 +126,7 @@ // Add a key handler for the new-word input. this.$.keys.target = this.$.newWord; - }, + } /** * @return {boolean} @@ -115,7 +134,7 @@ */ computeHasWords_() { return this.words_.length > 0; - }, + } /** * Adds the word in the new-word input to the dictionary. @@ -129,7 +148,7 @@ this.languageSettingsPrivate_.addSpellcheckWord(word); recordSettingChange(); } - }, + } /** * @return {string} @@ -137,7 +156,7 @@ */ getTrimmedNewWord_() { return this.newWordValue_.trim(); - }, + } /** * @return {NewWordState} @@ -155,7 +174,7 @@ return NewWordState.WORD_TOO_LONG; } return NewWordState.VALID_WORD; - }, + } /** * @return {boolean} @@ -163,7 +182,7 @@ */ shouldDisableAddButton_() { return this.newWordState_ !== NewWordState.VALID_WORD; - }, + } /** * @return {string} @@ -178,7 +197,7 @@ default: return ''; } - }, + } /** * @return {boolean} @@ -187,7 +206,7 @@ isNewWordInvalid_() { return this.newWordState_ === NewWordState.WORD_TOO_LONG || this.newWordState_ === NewWordState.WORD_ALREADY_ADDED; - }, + } /** * Handles tapping on the Add Word button. @@ -196,7 +215,7 @@ onAddWordTap_() { this.addWordFromInput_(); this.$.newWord.focus(); - }, + } /** * Handles updates to the word list. Additions are unshifted to the top @@ -207,7 +226,10 @@ */ onCustomDictionaryChanged_(added, removed) { for (const word of removed) { - this.arrayDelete('words_', word); + const index = this.words_.indexOf(word); + if (index !== -1) { + this.splice('words_', index, 1); + } } for (const word of added) { @@ -215,7 +237,7 @@ this.unshift('words_', word); } } - }, + } /** * Handles Enter and Escape key presses for the new-word input. @@ -228,7 +250,7 @@ } else if (e.detail.key === 'esc') { e.detail.keyboardEvent.target.value = ''; } - }, + } /** * Handles tapping on a "Remove word" icon button. @@ -239,4 +261,8 @@ this.languageSettingsPrivate_.removeSpellcheckWord(e.model.item); recordSettingChange(); } -}); +} + +customElements.define( + OsSettingsEditDictionaryPageElement.is, + OsSettingsEditDictionaryPageElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js index 8a6ef05..ce0e0dca8 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_page_v2.js
@@ -7,148 +7,163 @@ * for languages and inputs settings. */ -/** - * @type {number} Millisecond delay that can be used when closing an action - * menu to keep it briefly on-screen so users can see the changes. - */ -const kMenuCloseDelay = 100; - -import {afterNextRender, Polymer, html, flush, Templatizer, TemplateInstanceBase} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - import '//resources/cr_elements/cr_button/cr_button.m.js'; import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; import '//resources/js/action_link.js'; import '//resources/cr_elements/action_link_css.m.js'; -import {assert, assertNotReached} from '//resources/js/assert.m.js'; -import {sendWithPromise, removeWebUIListener, addWebUIListener, WebUIListener} from '//resources/js/cr.m.js'; -import {focusWithoutInk} from '//resources/js/cr/ui/focus_without_ink.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; import '//resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; import '//resources/polymer/v3_0/iron-icon/iron-icon.js'; import '//resources/cr_elements/cr_action_menu/cr_action_menu.js'; import '//resources/cr_elements/cr_lazy_render/cr_lazy_render.m.js'; import '//resources/cr_elements/cr_link_row/cr_link_row.js'; import './change_device_language_dialog.js'; -import {LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction, InputsShortcutReminderState} from './languages_metrics_proxy.js'; import './os_add_languages_dialog.js'; import '//resources/cr_components/localized_link/localized_link.js'; import '../../controls/settings_toggle_button.js'; -import {PrefsBehavior} from '../prefs_behavior.js'; -import {DeepLinkingBehavior} from '../deep_linking_behavior.js'; -import {routes} from '../os_route.js'; -import {loadTimeData} from '../../i18n_setup.js'; -import {Router, Route} from '../../router.js'; -import {RouteObserverBehavior} from '../route_observer_behavior.js'; import '../../settings_shared_css.js'; + +import {assert} from '//resources/js/assert.m.js'; +import {focusWithoutInk} from '//resources/js/cr/ui/focus_without_ink.m.js'; +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {loadTimeData} from '../../i18n_setup.js'; +import {Route, Router} from '../../router.js'; +import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {recordSettingChange} from '../metrics_recorder.js'; +import {routes} from '../os_route.js'; +import {PrefsBehavior, PrefsBehaviorInterface} from '../prefs_behavior.js'; +import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; + +import {LanguagesMetricsProxy, LanguagesMetricsProxyImpl, LanguagesPageInteraction} from './languages_metrics_proxy.js'; import {LanguageHelper, LanguagesModel, LanguageState} from './languages_types.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-languages-page-v2', +/** + * @type {number} Millisecond delay that can be used when closing an action + * menu to keep it briefly on-screen so users can see the changes. + */ +const kMenuCloseDelay = 100; - behaviors: [ - DeepLinkingBehavior, - I18nBehavior, - PrefsBehavior, - RouteObserverBehavior, - ], +/** + * @constructor + * @extends {PolymerElement} + * @implements {DeepLinkingBehaviorInterface} + * @implements {I18nBehaviorInterface} + * @implements {PrefsBehaviorInterface} + * @implements {RouteObserverBehaviorInterface} + */ +const OsSettingsLanguagesPageV2ElementBase = mixinBehaviors( + [DeepLinkingBehavior, I18nBehavior, PrefsBehavior, RouteObserverBehavior], + PolymerElement); - properties: { - /** - * Preferences state. - */ - prefs: { - type: Object, - notify: true, - }, +/** @polymer */ +class OsSettingsLanguagesPageV2Element extends + OsSettingsLanguagesPageV2ElementBase { + static get is() { + return 'os-settings-languages-page-v2'; + } - /** - * Read-only reference to the languages model provided by the - * 'os-settings-languages' instance. - * @type {!LanguagesModel|undefined} - */ - languages: { - type: Object, - notify: true, - }, + static get template() { + return html`{__html_template__}`; + } - /** @type {!LanguageHelper} */ - languageHelper: Object, - - /** - * The language to display the details for and its index. - * @type {{state: !LanguageState, index: number}|undefined} - * @private - */ - detailLanguage_: Object, - - /** @private */ - showAddLanguagesDialog_: Boolean, - - /** @private */ - showChangeDeviceLanguageDialog_: { - type: Boolean, - value: false, - }, - - /** @private */ - isGuest_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('isGuest'); + static get properties() { + return { + /** + * Preferences state. + */ + prefs: { + type: Object, + notify: true, }, - }, - /** @private */ - isSecondaryUser_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('isSecondaryUser'); + /** + * Read-only reference to the languages model provided by the + * 'os-settings-languages' instance. + * @type {!LanguagesModel|undefined} + */ + languages: { + type: Object, + notify: true, }, - }, - /** @private */ - primaryUserEmail_: { - type: String, - value() { - return loadTimeData.getString('primaryUserEmail'); + /** @type {!LanguageHelper} */ + languageHelper: Object, + + /** + * The language to display the details for and its index. + * @type {{state: !LanguageState, index: number}|undefined} + * @private + */ + detailLanguage_: Object, + + /** @private */ + showAddLanguagesDialog_: Boolean, + + /** @private */ + showChangeDeviceLanguageDialog_: { + type: Boolean, + value: false, }, - }, - /** - * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} - */ - supportedSettingIds: { - type: Object, - value: () => new Set([ - chromeos.settings.mojom.Setting.kAddLanguage, - chromeos.settings.mojom.Setting.kChangeDeviceLanguage, - chromeos.settings.mojom.Setting.kOfferTranslation, - ]), - }, - - /** @private */ - languageSettingsV2Update2Enabled_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); + /** @private */ + isGuest_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('isGuest'); + }, }, - }, - }, - /** @private {?LanguagesMetricsProxy} */ - languagesMetricsProxy_: null, + /** @private */ + isSecondaryUser_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('isSecondaryUser'); + }, + }, + + /** @private */ + primaryUserEmail_: { + type: String, + value() { + return loadTimeData.getString('primaryUserEmail'); + }, + }, + + /** + * Used by DeepLinkingBehavior to focus this page's deep links. + * @type {!Set<!chromeos.settings.mojom.Setting>} + */ + supportedSettingIds: { + type: Object, + value: () => new Set([ + chromeos.settings.mojom.Setting.kAddLanguage, + chromeos.settings.mojom.Setting.kChangeDeviceLanguage, + chromeos.settings.mojom.Setting.kOfferTranslation, + ]), + }, + + /** @private */ + languageSettingsV2Update2Enabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); + }, + }, + }; + } /** @override */ - created() { + constructor() { + super(); + + /** @private {!LanguagesMetricsProxy} */ this.languagesMetricsProxy_ = LanguagesMetricsProxyImpl.getInstance(); - }, + } /** * @param {!Route} route - * @param {!Route} oldRoute + * @param {!Route=} oldRoute */ currentRouteChanged(route, oldRoute) { // Does not apply to this page. @@ -157,7 +172,7 @@ } this.attemptDeepLink(); - }, + } /** * @param {string} language @@ -166,18 +181,19 @@ */ getLanguageDisplayName_(language) { return this.languageHelper.getLanguage(language).displayName; - }, + } /** @private */ onChangeDeviceLanguageClick_() { this.showChangeDeviceLanguageDialog_ = true; - }, + } /** @private */ onChangeDeviceLanguageDialogClose_() { this.showChangeDeviceLanguageDialog_ = false; - focusWithoutInk(assert(this.$$('#changeDeviceLanguage'))); - }, + focusWithoutInk( + assert(this.shadowRoot.querySelector('#changeDeviceLanguage'))); + } /** * @param {string} language @@ -188,7 +204,7 @@ return this.i18n( 'changeDeviceLanguageButtonDescription', this.getLanguageDisplayName_(language)); - }, + } /** * Stamps and opens the Add Languages dialog, registering a listener to @@ -200,13 +216,13 @@ e.preventDefault(); this.languagesMetricsProxy_.recordAddLanguages(); this.showAddLanguagesDialog_ = true; - }, + } /** @private */ onAddLanguagesDialogClose_() { this.showAddLanguagesDialog_ = false; focusWithoutInk(assert(this.$.addLanguages)); - }, + } /** * Checks if there are supported languages that are not enabled but can be @@ -219,7 +235,7 @@ return languages !== undefined && languages.supported.some(language => { return this.languageHelper.canEnableLanguage(language); }); - }, + } /** * @return {boolean} True if the translate checkbox should be disabled. @@ -241,7 +257,7 @@ return this.languageHelper.convertLanguageCodeForTranslate( languageState.language.code) === this.languages.translateTarget; - }, + } /** * Handler for changes to the translate checkbox. @@ -260,7 +276,7 @@ e.target.checked); recordSettingChange(); this.closeMenuSoon_(); - }, + } /** * Closes the shared action menu after a short delay, so when a checkbox is @@ -268,13 +284,14 @@ * @private */ closeMenuSoon_() { - const menu = /** @type {!CrActionMenuElement} */ (this.$$('#menu').get()); + const menu = /** @type {!CrActionMenuElement} */ ( + this.shadowRoot.querySelector('#menu').get()); setTimeout(() => { if (menu.open) { menu.close(); } }, kMenuCloseDelay); - }, + } /** * @return {boolean} True if the "Move to top" option for |language| should @@ -285,7 +302,7 @@ // "Move To Top" is a no-op for the top language. return this.detailLanguage_ !== undefined && this.detailLanguage_.index === 0; - }, + } /** * @return {boolean} True if the "Move up" option for |language| should @@ -297,7 +314,7 @@ // "Move to top" for the 2nd language. return this.detailLanguage_ !== undefined && this.detailLanguage_.index !== 0 && this.detailLanguage_.index !== 1; - }, + } /** * @return {boolean} True if the "Move down" option for |language| should be @@ -307,7 +324,7 @@ showMoveDown_() { return this.languages !== undefined && this.detailLanguage_ !== undefined && this.detailLanguage_.index !== this.languages.enabled.length - 1; - }, + } /** * Moves the language to the top of the list. @@ -318,7 +335,7 @@ this.languageHelper.moveLanguageToFront( this.detailLanguage_.state.language.code); recordSettingChange(); - }, + } /** * Moves the language up in the list. @@ -329,7 +346,7 @@ this.languageHelper.moveLanguage( this.detailLanguage_.state.language.code, /*upDirection=*/ true); recordSettingChange(); - }, + } /** * Moves the language down in the list. @@ -340,7 +357,7 @@ this.languageHelper.moveLanguage( this.detailLanguage_.state.language.code, /*upDirection=*/ false); recordSettingChange(); - }, + } /** * Disables the language. @@ -351,7 +368,7 @@ this.languageHelper.disableLanguage( this.detailLanguage_.state.language.code); recordSettingChange(); - }, + } /** * @param {!Event} e @@ -368,7 +385,7 @@ const menu = /** @type {!CrActionMenuElement} */ (this.$.menu.get()); menu.showAt(/** @type {!HTMLElement} */ (e.target)); - }, + } /** * @param {!Event} e @@ -376,7 +393,7 @@ */ onTranslateToggleChange_(e) { this.languagesMetricsProxy_.recordToggleTranslate(e.target.checked); - }, + } /** * @param {string} languageCode The language code identifying a language. @@ -389,7 +406,7 @@ translateTarget ? 'translate-target' : 'non-translate-target'; - }, + } /** * @param {boolean} update2Enabled @@ -399,7 +416,7 @@ getOfferTranslationLabel_(update2Enabled) { return this.i18n( update2Enabled ? 'offerGoogleTranslateLabel' : 'offerTranslationLabel'); - }, + } /** * @param {boolean} update2Enabled @@ -408,7 +425,7 @@ */ getOfferTranslationSublabel_(update2Enabled) { return update2Enabled ? '' : this.i18n('offerTranslationSublabel'); - }, + } /** * @param {boolean} update2Enabled @@ -418,7 +435,7 @@ getLanguagePreferenceTitle_(update2Enabled) { return this.i18n( update2Enabled ? 'websiteLanguagesTitle' : 'languagesPreferenceTitle'); - }, + } /** * @param {boolean} update2Enabled @@ -429,18 +446,21 @@ return this.i18nAdvanced( update2Enabled ? 'websiteLanguagesDescription' : 'languagesPreferenceDescription'); - }, + } /** @private */ openManageGoogleAccountLanguage_() { this.languagesMetricsProxy_.recordInteraction( LanguagesPageInteraction.OPEN_MANAGE_GOOGLE_ACCOUNT_LANGUAGE); window.open(loadTimeData.getString('googleAccountLanguagesURL')); - }, + } /** @private */ onLanguagePreferenceDescriptionLinkClick_() { this.languagesMetricsProxy_.recordInteraction( LanguagesPageInteraction.OPEN_WEB_LANGUAGES_LEARN_MORE); - }, -}); + } +} + +customElements.define( + OsSettingsLanguagesPageV2Element.is, OsSettingsLanguagesPageV2Element);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_section.js b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_section.js index 2236c28..bfb73a4 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_section.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/os_languages_section.js
@@ -2,106 +2,124 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +/** + * @fileoverview + * 'os-settings-languages-section' is the top-level settings section for + * languages. + */ + +import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; +import '//resources/cr_elements/shared_vars_css.m.js'; +import './input_page.js'; +import './os_languages_page_v2.js'; +import './smart_inputs_page.js'; +import './input_method_options_page.js'; +import './languages.js'; +import '../../settings_page/settings_animated_pages.js'; +import '../../settings_page/settings_subpage.js'; +import '../../settings_shared_css.js'; +import '../../settings_vars_css.js'; + +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {loadTimeData} from '../../i18n_setup.js'; +import {Router} from '../../router.js'; +import {routes} from '../os_route.js'; + +import {LanguageHelper, LanguagesModel} from './languages_types.js'; + + // The IME ID for the Accessibility Common extension used by Dictation. /** @type {string} */ const ACCESSIBILITY_COMMON_IME_ID = '_ext_ime_egfdjlfmgnehecnclamagfafdccgfndpdictation'; /** - * @fileoverview - * 'os-settings-languages-section' is the top-level settings section for - * languages. + * @constructor + * @extends {PolymerElement} + * @implements {I18nBehaviorInterface} */ -import {afterNextRender, Polymer, html, flush, Templatizer, TemplateInstanceBase} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +const OsSettingsLanguagesSectionElementBase = + mixinBehaviors([I18nBehavior], PolymerElement); -import '//resources/cr_elements/cr_icon_button/cr_icon_button.m.js'; -import '//resources/cr_elements/shared_vars_css.m.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import './input_page.js'; -import './os_languages_page_v2.js'; -import './smart_inputs_page.js'; -import './input_method_options_page.js'; -import {loadTimeData} from '../../i18n_setup.js'; -import './languages.js'; -import {routes} from '../os_route.js'; -import {Router, Route} from '../../router.js'; -import '../../settings_page/settings_animated_pages.js'; -import '../../settings_page/settings_subpage.js'; -import '../../settings_shared_css.js'; -import '../../settings_vars_css.js'; -import {LanguageHelper, LanguagesModel} from './languages_types.js'; +/** @polymer */ +class OsSettingsLanguagesSectionElement extends + OsSettingsLanguagesSectionElementBase { + static get is() { + return 'os-settings-languages-section'; + } -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-languages-section', + static get template() { + return html`{__html_template__}`; + } - behaviors: [ - I18nBehavior, - ], + static get properties() { + return { + prefs: Object, - properties: { - prefs: Object, - - /** @type {!LanguagesModel|undefined} */ - languages: { - type: Object, - notify: true, - }, - - /** @type {!LanguageHelper} */ - languageHelper: Object, - - /** @private {!Map<string, string>} */ - focusConfig_: { - type: Object, - value() { - const map = new Map(); - if (routes.OS_LANGUAGES_SMART_INPUTS) { - map.set( - routes.OS_LANGUAGES_SMART_INPUTS.path, - '#smartInputsSubpageTrigger'); - } - return map; + /** @type {!LanguagesModel|undefined} */ + languages: { + type: Object, + notify: true, }, - }, - /** @private */ - inputPageTitle_: { - type: String, - value() { - const isUpdate2 = - loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); - return this.i18n(isUpdate2 ? 'inputPageTitleV2' : 'inputPageTitle'); - }, - }, + /** @type {!LanguageHelper} */ + languageHelper: Object, - /** - * This is enabled when any of the smart inputs features is allowed. - * @private - * */ - smartInputsEnabled_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('allowAssistivePersonalInfo') || - loadTimeData.getBoolean('allowEmojiSuggestion'); + /** @private {!Map<string, string>} */ + focusConfig_: { + type: Object, + value() { + const map = new Map(); + if (routes.OS_LANGUAGES_SMART_INPUTS) { + map.set( + routes.OS_LANGUAGES_SMART_INPUTS.path, + '#smartInputsSubpageTrigger'); + } + return map; + }, }, - } - }, + + /** @private */ + inputPageTitle_: { + type: String, + value() { + const isUpdate2 = + loadTimeData.getBoolean('enableLanguageSettingsV2Update2'); + return this.i18n(isUpdate2 ? 'inputPageTitleV2' : 'inputPageTitle'); + }, + }, + + /** + * This is enabled when any of the smart inputs features is allowed. + * @private + * */ + smartInputsEnabled_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('allowAssistivePersonalInfo') || + loadTimeData.getBoolean('allowEmojiSuggestion'); + }, + } + + }; + } /** @private */ onLanguagesV2Click_() { Router.getInstance().navigateTo(routes.OS_LANGUAGES_LANGUAGES); - }, + } /** @private */ onInputClick_() { Router.getInstance().navigateTo(routes.OS_LANGUAGES_INPUT); - }, + } /** @private */ onSmartInputsClick_() { Router.getInstance().navigateTo(routes.OS_LANGUAGES_SMART_INPUTS); - }, + } /** * @param {string|undefined} code The language code of the language. @@ -118,7 +136,7 @@ return ''; } return language.displayName; - }, + } /** * @param {string|undefined} id The input method ID. @@ -136,5 +154,8 @@ } return languageHelper.getInputMethodDisplayName(id); - }, -}); + } +} + +customElements.define( + OsSettingsLanguagesSectionElement.is, OsSettingsLanguagesSectionElement);
diff --git a/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js b/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js index d46390a..a7f2083 100644 --- a/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js +++ b/chrome/browser/resources/settings/chromeos/os_languages_page/smart_inputs_page.js
@@ -11,66 +11,80 @@ import '../../controls/settings_toggle_button.js'; import '../../settings_shared_css.js'; -import {I18nBehavior} from '//resources/js/i18n_behavior.m.js'; -import {afterNextRender, flush, html, Polymer, TemplateInstanceBase, Templatizer} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nBehavior, I18nBehaviorInterface} from '//resources/js/i18n_behavior.m.js'; +import {html, mixinBehaviors, PolymerElement} from '//resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {loadTimeData} from '../../i18n_setup.js'; -import {Route, Router} from '../../router.js'; -import {DeepLinkingBehavior} from '../deep_linking_behavior.js'; +import {Route} from '../../router.js'; +import {DeepLinkingBehavior, DeepLinkingBehaviorInterface} from '../deep_linking_behavior.js'; import {routes} from '../os_route.js'; -import {PrefsBehavior} from '../prefs_behavior.js'; -import {RouteObserverBehavior} from '../route_observer_behavior.js'; +import {PrefsBehavior, PrefsBehaviorInterface} from '../prefs_behavior.js'; +import {RouteObserverBehavior, RouteObserverBehaviorInterface} from '../route_observer_behavior.js'; -Polymer({ - _template: html`{__html_template__}`, - is: 'os-settings-smart-inputs-page', +/** + * @constructor + * @extends {PolymerElement} + * @implements {DeepLinkingBehaviorInterface} + * @implements {I18nBehaviorInterface} + * @implements {PrefsBehaviorInterface} + * @implements {RouteObserverBehaviorInterface} + */ +const OsSettingsSmartInputsPageElementBase = mixinBehaviors( + [DeepLinkingBehavior, I18nBehavior, PrefsBehavior, RouteObserverBehavior], + PolymerElement); - behaviors: [ - DeepLinkingBehavior, - I18nBehavior, - PrefsBehavior, - RouteObserverBehavior, - ], +/** @polymer */ +class OsSettingsSmartInputsPageElement extends + OsSettingsSmartInputsPageElementBase { + static get is() { + return 'os-settings-smart-inputs-page'; + } - properties: { - /** Preferences state. */ - prefs: { - type: Object, - notify: true, - }, + static get template() { + return html`{__html_template__}`; + } - /** @private */ - allowAssistivePersonalInfo_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('allowAssistivePersonalInfo'); + static get properties() { + return { + /** Preferences state. */ + prefs: { + type: Object, + notify: true, }, - }, - /** @private */ - allowEmojiSuggestion_: { - type: Boolean, - value() { - return loadTimeData.getBoolean('allowEmojiSuggestion'); + /** @private */ + allowAssistivePersonalInfo_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('allowAssistivePersonalInfo'); + }, }, - }, - /** - * Used by DeepLinkingBehavior to focus this page's deep links. - * @type {!Set<!chromeos.settings.mojom.Setting>} - */ - supportedSettingIds: { - type: Object, - value: () => new Set([ - chromeos.settings.mojom.Setting.kShowPersonalInformationSuggestions, - chromeos.settings.mojom.Setting.kShowEmojiSuggestions, - ]), - }, - }, + /** @private */ + allowEmojiSuggestion_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('allowEmojiSuggestion'); + }, + }, + + /** + * Used by DeepLinkingBehavior to focus this page's deep links. + * @type {!Set<!chromeos.settings.mojom.Setting>} + */ + supportedSettingIds: { + type: Object, + value: () => new Set([ + chromeos.settings.mojom.Setting.kShowPersonalInformationSuggestions, + chromeos.settings.mojom.Setting.kShowEmojiSuggestions, + ]), + }, + }; + } /** * @param {!Route} route - * @param {!Route} oldRoute + * @param {!Route=} oldRoute */ currentRouteChanged(route, oldRoute) { // Does not apply to this page. @@ -79,7 +93,7 @@ } this.attemptDeepLink(); - }, + } /** * Opens Chrome browser's autofill manage addresses setting page. @@ -87,7 +101,7 @@ */ onManagePersonalInfoClick_() { window.open('chrome://settings/addresses'); - }, + } /** * @param {!Event} e @@ -96,5 +110,8 @@ onPersonalInfoSuggestionToggled_(e) { this.setPrefValue( 'assistive_input.personal_info_enabled', e.target.checked); - }, -}); + } +} + +customElements.define( + OsSettingsSmartInputsPageElement.is, OsSettingsSmartInputsPageElement);
diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_browser_proxy.ts b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_browser_proxy.ts index 0690420f..303c9c9 100644 --- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_browser_proxy.ts +++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_browser_proxy.ts
@@ -68,6 +68,11 @@ * @return Signal when the setup is complete. */ initialize(): Promise<void>; + + /** + * @return A promise with the current sync state. + */ + getSyncState(): Promise<UpdateSyncStateEvent>; } export class ClearBrowsingDataBrowserProxyImpl implements @@ -87,6 +92,10 @@ return sendWithPromise('initializeClearBrowsingData'); } + getSyncState() { + return sendWithPromise('getSyncState'); + } + static getInstance(): ClearBrowsingDataBrowserProxy { return instance || (instance = new ClearBrowsingDataBrowserProxyImpl()); }
diff --git a/chrome/browser/resources/settings/lazy_load.ts b/chrome/browser/resources/settings/lazy_load.ts index 6d5c698b..f98f8e12 100644 --- a/chrome/browser/resources/settings/lazy_load.ts +++ b/chrome/browser/resources/settings/lazy_load.ts
@@ -103,7 +103,7 @@ export {ChromeCleanupProxy, ChromeCleanupProxyImpl} from './chrome_cleanup_page/chrome_cleanup_proxy.js'; export {CHROME_CLEANUP_DEFAULT_ITEMS_TO_SHOW, ItemsToRemoveListElement} from './chrome_cleanup_page/items_to_remove_list.js'; // </if> -export {ClearBrowsingDataBrowserProxy, ClearBrowsingDataBrowserProxyImpl, ClearBrowsingDataResult, InstalledApp} from './clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js'; +export {ClearBrowsingDataBrowserProxy, ClearBrowsingDataBrowserProxyImpl, ClearBrowsingDataResult, InstalledApp, UpdateSyncStateEvent} from './clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js'; export {SettingsClearBrowsingDataDialogElement} from './clear_browsing_data_dialog/clear_browsing_data_dialog.js'; export {SettingsHistoryDeletionDialogElement} from './clear_browsing_data_dialog/history_deletion_dialog.js'; export {SettingsPasswordsDeletionDialogElement} from './clear_browsing_data_dialog/passwords_deletion_dialog.js';
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts index 4c350f7..4dd8c77 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_completion_fragment.ts
@@ -15,11 +15,10 @@ import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js'; import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; -import {UpdateSyncStateEvent} from '../../clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js'; +import {ClearBrowsingDataBrowserProxyImpl, UpdateSyncStateEvent} from '../../clear_browsing_data_dialog/clear_browsing_data_browser_proxy.js'; import {loadTimeData} from '../../i18n_setup.js'; import {MetricsBrowserProxy, MetricsBrowserProxyImpl, PrivacyGuideInteractions} from '../../metrics_browser_proxy.js'; import {OpenWindowProxyImpl} from '../../open_window_proxy.js'; -import {SyncBrowserProxyImpl, SyncStatus} from '../../people_page/sync_browser_proxy.js'; import {Router} from '../../router.js'; import {getTemplate} from './privacy_guide_completion_fragment.html.js'; @@ -57,11 +56,12 @@ override ready() { super.ready(); - SyncBrowserProxyImpl.getInstance().getSyncStatus().then( - (status: SyncStatus) => this.updateWaaLink_(status.signedIn!)); this.addWebUIListener( 'update-sync-state', (event: UpdateSyncStateEvent) => this.updateWaaLink_(event.signedIn)); + ClearBrowsingDataBrowserProxyImpl.getInstance().getSyncState().then( + (status: UpdateSyncStateEvent) => + this.updateWaaLink_(status.signedIn)); } override focus() {
diff --git a/chrome/browser/sync/test/integration/apps_helper.cc b/chrome/browser/sync/test/integration/apps_helper.cc index 629cc271..5217aaf2 100644 --- a/chrome/browser/sync/test/integration/apps_helper.cc +++ b/chrome/browser/sync/test/integration/apps_helper.cc
@@ -16,7 +16,9 @@ #include "chrome/browser/sync/test/integration/sync_app_helper.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_extension_helper.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/test/web_app_test_observers.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" @@ -233,18 +235,20 @@ base::RunLoop run_loop; web_app::AppId app_id; auto* provider = web_app::WebAppProvider::GetForTest(profile); - provider->install_manager().InstallWebAppFromInfo( - std::make_unique<WebAppInstallInfo>(info), - /*overwrite_existing_manifest_fields=*/true, - web_app::ForInstallableSite::kYes, - webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON, - base::BindLambdaForTesting( - [&run_loop, &app_id](const web_app::AppId& new_app_id, - webapps::InstallResultCode code) { - DCHECK_EQ(code, webapps::InstallResultCode::kSuccessNewInstall); - app_id = new_app_id; - run_loop.Quit(); - })); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::make_unique<WebAppInstallInfo>(info), + &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/true, + webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON, + base::BindLambdaForTesting( + [&run_loop, &app_id](const web_app::AppId& new_app_id, + webapps::InstallResultCode code) { + DCHECK_EQ(code, webapps::InstallResultCode::kSuccessNewInstall); + app_id = new_app_id; + run_loop.Quit(); + }))); + run_loop.Run(); const web_app::WebAppRegistrar& registrar = provider->registrar();
diff --git a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc index 71bb2bb..40d45149 100644 --- a/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_autofill_sync_test.cc
@@ -59,11 +59,16 @@ TwoClientAutofillProfileSyncTest& operator=( const TwoClientAutofillProfileSyncTest&) = delete; - ~TwoClientAutofillProfileSyncTest() override {} + ~TwoClientAutofillProfileSyncTest() override = default; }; +#if BUILDFLAG(IS_MAC) +#define MAYBE_PersonalDataManagerSanity DISABLED_PersonalDataManagerSanity +#else +#define MAYBE_PersonalDataManagerSanity PersonalDataManagerSanity +#endif IN_PROC_BROWSER_TEST_F(TwoClientAutofillProfileSyncTest, - PersonalDataManagerSanity) { + MAYBE_PersonalDataManagerSanity) { ASSERT_TRUE(SetupSync()); base::HistogramTester histograms;
diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc index 6b1706be..6d0547f 100644 --- a/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_web_apps_bmo_sync_test.cc
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/os_integration/web_app_shortcut_manager.h" #include "chrome/browser/web_applications/test/fake_os_integration_manager.h" @@ -26,7 +27,6 @@ #include "chrome/browser/web_applications/web_app.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_params.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" @@ -143,20 +143,20 @@ base::RunLoop run_loop; AppId app_id; - - WebAppProvider::GetForTest(profile) - ->install_manager() - .InstallWebAppFromInfo( + auto* provider = WebAppProvider::GetForTest(profile); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( std::make_unique<WebAppInstallInfo>(info), - /*overwrite_existing_manifest_fields=*/true, - ForInstallableSite::kYes, source, + &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/true, source, base::BindLambdaForTesting([&run_loop, &app_id]( const AppId& new_app_id, webapps::InstallResultCode code) { DCHECK_EQ(code, webapps::InstallResultCode::kSuccessNewInstall); app_id = new_app_id; run_loop.Quit(); - })); + }))); + run_loop.Run(); const WebAppRegistrar& registrar = GetRegistrar(profile);
diff --git a/chrome/browser/touch_to_fill/android/internal/BUILD.gn b/chrome/browser/touch_to_fill/android/internal/BUILD.gn index 943efb6..6268375 100644 --- a/chrome/browser/touch_to_fill/android/internal/BUILD.gn +++ b/chrome/browser/touch_to_fill/android/internal/BUILD.gn
@@ -15,6 +15,7 @@ "//build/android:build_java", "//chrome/android:chrome_java", "//chrome/browser/flags:java", + "//chrome/browser/password_manager/android:java", "//chrome/browser/profiles/android:java", "//chrome/browser/touch_to_fill/android:public_java", "//chrome/browser/ui/android/favicon:java",
diff --git a/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java index 381ca82..ab3666f 100644 --- a/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java +++ b/chrome/browser/touch_to_fill/android/internal/java/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewBinder.java
@@ -33,6 +33,7 @@ import androidx.appcompat.content.res.AppCompatResources; import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.password_manager.PasswordManagerHelper; import org.chromium.chrome.browser.touch_to_fill.TouchToFillProperties.CredentialProperties; import org.chromium.chrome.browser.touch_to_fill.TouchToFillProperties.ItemType; import org.chromium.chrome.browser.touch_to_fill.data.Credential; @@ -218,7 +219,8 @@ * @return The title of Touch To Fill sheet. */ private static String getTitle(PropertyModel model, Context context) { - if (ChromeFeatureList.isEnabled(ChromeFeatureList.TOUCH_TO_FILL_PASSWORD_SUBMISSION)) { + if (ChromeFeatureList.isEnabled(ChromeFeatureList.TOUCH_TO_FILL_PASSWORD_SUBMISSION) + || PasswordManagerHelper.usesUnifiedPasswordManagerUI()) { return context.getString(R.string.touch_to_fill_sheet_uniform_title); } else { @StringRes
diff --git a/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java b/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java index 43bae93ce..6d31fa98 100644 --- a/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java +++ b/chrome/browser/touch_to_fill/android/javatests/src/org/chromium/chrome/browser/touch_to_fill/TouchToFillViewTest.java
@@ -227,6 +227,54 @@ @Test @MediumTest + @EnableFeatures({ChromeFeatureList.UNIFIED_PASSWORD_MANAGER_ANDROID}) + public void testSingleCredentialTitleDisplayedWithUnifiedPasswordManager() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.get(SHEET_ITEMS) + .add(new MVCListAdapter.ListItem(TouchToFillProperties.ItemType.HEADER, + new PropertyModel.Builder(HeaderProperties.ALL_KEYS) + .with(SINGLE_CREDENTIAL, true) + .with(FORMATTED_URL, "www.example.org") + .with(ORIGIN_SECURE, true) + .with(IMAGE_DRAWABLE_ID, + mResourceProvider.getHeaderImageDrawableId()) + .build())); + mModel.set(VISIBLE, true); + }); + BottomSheetTestSupport.waitForOpen(mBottomSheetController); + TextView title = + mTouchToFillView.getContentView().findViewById(R.id.touch_to_fill_sheet_title); + + assertThat(title.getText(), + is(getActivity().getString(R.string.touch_to_fill_sheet_uniform_title))); + } + + @Test + @MediumTest + @EnableFeatures({ChromeFeatureList.UNIFIED_PASSWORD_MANAGER_ANDROID}) + public void testMultiCredentialTitleDisplayedWithUnifiedPasswordManager() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + mModel.get(SHEET_ITEMS) + .add(new MVCListAdapter.ListItem(TouchToFillProperties.ItemType.HEADER, + new PropertyModel.Builder(HeaderProperties.ALL_KEYS) + .with(SINGLE_CREDENTIAL, false) + .with(FORMATTED_URL, "www.example.org") + .with(ORIGIN_SECURE, true) + .with(IMAGE_DRAWABLE_ID, + mResourceProvider.getHeaderImageDrawableId()) + .build())); + mModel.set(VISIBLE, true); + }); + BottomSheetTestSupport.waitForOpen(mBottomSheetController); + TextView title = + mTouchToFillView.getContentView().findViewById(R.id.touch_to_fill_sheet_title); + + assertThat(title.getText(), + is(getActivity().getString(R.string.touch_to_fill_sheet_uniform_title))); + } + + @Test + @MediumTest public void testSecureSubtitleUrlDisplayed() { TestThreadUtils.runOnUiThreadBlocking(() -> { mModel.get(SHEET_ITEMS)
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index ce5dacf9..d9676a0c 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -953,6 +953,11 @@ "apps/chrome_app_window_client.h", "apps/directory_access_confirmation_dialog.cc", "apps/directory_access_confirmation_dialog.h", + "autofill_assistant/password_change/assistant_display_delegate.h", + "autofill_assistant/password_change/assistant_onboarding_controller.h", + "autofill_assistant/password_change/assistant_onboarding_controller_impl.cc", + "autofill_assistant/password_change/assistant_onboarding_controller_impl.h", + "autofill_assistant/password_change/assistant_onboarding_prompt.h", "blocked_content/framebust_block_tab_helper.cc", "blocked_content/framebust_block_tab_helper.h", "blocked_content/popunder_preventer.cc", @@ -1412,21 +1417,8 @@ "user_education/active_tab_tracker.h", "user_education/browser_feature_promo_snooze_service.cc", "user_education/browser_feature_promo_snooze_service.h", - "user_education/feature_promo_controller.cc", - "user_education/feature_promo_controller.h", - "user_education/feature_promo_registry.cc", - "user_education/feature_promo_registry.h", - "user_education/feature_promo_snooze_service.cc", - "user_education/feature_promo_snooze_service.h", - "user_education/feature_promo_specification.cc", - "user_education/feature_promo_specification.h", - "user_education/help_bubble.cc", - "user_education/help_bubble.h", - "user_education/help_bubble_factory.h", - "user_education/help_bubble_factory_registry.cc", - "user_education/help_bubble_factory_registry.h", - "user_education/help_bubble_params.cc", - "user_education/help_bubble_params.h", + "user_education/browser_tutorial_service.cc", + "user_education/browser_tutorial_service.h", "user_education/reopen_tab_in_product_help.cc", "user_education/reopen_tab_in_product_help.h", "user_education/reopen_tab_in_product_help_factory.cc", @@ -1435,15 +1427,6 @@ "user_education/reopen_tab_in_product_help_trigger.h", "user_education/scoped_new_badge_tracker.cc", "user_education/scoped_new_badge_tracker.h", - "user_education/tutorial/tutorial.cc", - "user_education/tutorial/tutorial.h", - "user_education/tutorial/tutorial_description.cc", - "user_education/tutorial/tutorial_description.h", - "user_education/tutorial/tutorial_identifier.h", - "user_education/tutorial/tutorial_registry.cc", - "user_education/tutorial/tutorial_registry.h", - "user_education/tutorial/tutorial_service.cc", - "user_education/tutorial/tutorial_service.h", "user_education/user_education_service.cc", "user_education/user_education_service.h", "user_education/user_education_service_factory.cc", @@ -1806,6 +1789,7 @@ "//components/services/app_service/public/mojom", "//components/ui_metrics", "//components/url_formatter", + "//components/user_education/common", "//components/user_notes:features", "//components/vector_icons", "//components/web_modal", @@ -4156,6 +4140,8 @@ "views/autofill/save_update_address_profile_icon_view.h", "views/autofill/update_address_profile_view.cc", "views/autofill/update_address_profile_view.h", + "views/autofill_assistant/password_change/assistant_onboarding_view.cc", + "views/autofill_assistant/password_change/assistant_onboarding_view.h", "views/bookmarks/bookmark_bar_view.cc", "views/bookmarks/bookmark_bar_view.h", "views/bookmarks/bookmark_bar_view_observer.h", @@ -4209,8 +4195,6 @@ "views/chrome_typography.h", "views/chrome_typography_provider.cc", "views/chrome_typography_provider.h", - "views/chrome_view_class_properties.cc", - "views/chrome_view_class_properties.h", "views/chrome_views_delegate.cc", "views/chrome_views_delegate.h", "views/chrome_web_dialog_view.cc", @@ -4929,12 +4913,6 @@ "views/user_education/browser_feature_promo_controller.h", "views/user_education/browser_user_education_service.cc", "views/user_education/browser_user_education_service.h", - "views/user_education/help_bubble_factory_views.cc", - "views/user_education/help_bubble_factory_views.h", - "views/user_education/help_bubble_view.cc", - "views/user_education/help_bubble_view.h", - "views/user_education/new_badge_label.cc", - "views/user_education/new_badge_label.h", "views/user_education/tip_marquee_view.cc", "views/user_education/tip_marquee_view.h", "views/web_apps/file_handler_launch_dialog_view.cc", @@ -5044,6 +5022,7 @@ "//components/soda:constants", "//components/tab_count_metrics", "//components/ui_devtools/views", + "//components/user_education/views", "//components/user_notes:features", "//components/user_notes/browser", "//components/user_notes/interfaces", @@ -5122,8 +5101,6 @@ "views/chrome_views_delegate_mac.cc", "views/policy/enterprise_startup_dialog_mac_util.h", "views/policy/enterprise_startup_dialog_mac_util.mm", - "views/user_education/help_bubble_factory_mac.h", - "views/user_education/help_bubble_factory_mac.mm", ] } else { sources += [ @@ -5655,6 +5632,12 @@ if (!is_android) { sources += [ + "autofill_assistant/password_change/mock_assistant_display_delegate.cc", + "autofill_assistant/password_change/mock_assistant_display_delegate.h", + "autofill_assistant/password_change/mock_assistant_onboarding_controller.cc", + "autofill_assistant/password_change/mock_assistant_onboarding_controller.h", + "autofill_assistant/password_change/mock_assistant_onboarding_prompt.cc", + "autofill_assistant/password_change/mock_assistant_onboarding_prompt.h", "exclusive_access/exclusive_access_test.cc", "exclusive_access/exclusive_access_test.h", "exclusive_access/fullscreen_controller_state_test.cc",
diff --git a/chrome/browser/ui/DEPS b/chrome/browser/ui/DEPS index f03777c..fba3bdd 100644 --- a/chrome/browser/ui/DEPS +++ b/chrome/browser/ui/DEPS
@@ -14,6 +14,8 @@ "+components/safety_check", "+components/soda", "+components/translate/content/android", + "+components/user_education/common", + "+components/user_education/test", "+services/content/public", "+services/device/public/mojom", "+components/user_notes",
diff --git a/chrome/browser/ui/android/signin/java/src/org/chromium/chrome/browser/ui/signin/SigninPromoController.java b/chrome/browser/ui/android/signin/java/src/org/chromium/chrome/browser/ui/signin/SigninPromoController.java index 9b081ad..4f30626 100644 --- a/chrome/browser/ui/android/signin/java/src/org/chromium/chrome/browser/ui/signin/SigninPromoController.java +++ b/chrome/browser/ui/android/signin/java/src/org/chromium/chrome/browser/ui/signin/SigninPromoController.java
@@ -119,7 +119,6 @@ private final @Nullable String mSyncPromoDismissedPreferenceTracker; // TODO(https://crbug.com/1254399): Remove these fields related to impressions. private final @Nullable String mImpressionsTilDismissHistogramName; - private final @Nullable String mImpressionsTilSigninButtonsHistogramName; private final @Nullable String mImpressionsTilXButtonHistogramName; private final @StringRes int mTitleStringId; private final @StringRes int mDescriptionStringId; @@ -299,8 +298,6 @@ ChromePreferenceKeys.SIGNIN_PROMO_BOOKMARKS_DECLINED; mImpressionsTilDismissHistogramName = "MobileSignInPromo.BookmarkManager.ImpressionsTilDismiss"; - mImpressionsTilSigninButtonsHistogramName = - "MobileSignInPromo.BookmarkManager.ImpressionsTilSigninButtons"; mImpressionsTilXButtonHistogramName = "MobileSignInPromo.BookmarkManager.ImpressionsTilXButton"; mTitleStringId = R.string.sync_promo_title_bookmarks; @@ -333,7 +330,6 @@ mSyncPromoDismissedPreferenceTracker = ChromePreferenceKeys.SIGNIN_PROMO_NTP_PROMO_DISMISSED; mImpressionsTilDismissHistogramName = null; - mImpressionsTilSigninButtonsHistogramName = null; mImpressionsTilXButtonHistogramName = "MobileSignInPromo.NTPContentSuggestions.ImpressionsTilXButton"; mTitleStringId = R.string.sync_promo_title_ntp_content_suggestions; @@ -364,7 +360,6 @@ "Signin_SigninNewAccountNoExistingAccount_FromRecentTabs"; mSyncPromoDismissedPreferenceTracker = null; mImpressionsTilDismissHistogramName = null; - mImpressionsTilSigninButtonsHistogramName = null; mImpressionsTilXButtonHistogramName = null; mTitleStringId = R.string.sync_promo_title_recent_tabs; if (ChromeFeatureList.isEnabled(ChromeFeatureList.SYNC_ANDROID_PROMOS_WITH_TITLE)) { @@ -392,8 +387,6 @@ ChromePreferenceKeys.SIGNIN_PROMO_SETTINGS_PERSONALIZED_DISMISSED; mImpressionsTilDismissHistogramName = "MobileSignInPromo.SettingsManager.ImpressionsTilDismiss"; - mImpressionsTilSigninButtonsHistogramName = - "MobileSignInPromo.SettingsManager.ImpressionsTilSigninButtons"; mImpressionsTilXButtonHistogramName = "MobileSignInPromo.SettingsManager.ImpressionsTilXButton"; mTitleStringId = R.string.sync_promo_title_settings; @@ -619,10 +612,6 @@ private void recordSigninButtonUsed() { mWasUsed = true; recordShowCountHistogram(UserAction.CONTINUED); - if (mImpressionsTilSigninButtonsHistogramName != null) { - RecordHistogram.recordCount100Histogram( - mImpressionsTilSigninButtonsHistogramName, getNumImpressions()); - } } private void recordShowCountHistogram(@UserAction String actionType) {
diff --git a/chrome/browser/ui/app_list/search/app_search_provider.cc b/chrome/browser/ui/app_list/search/app_search_provider.cc index 734498f..47ca023 100644 --- a/chrome/browser/ui/app_list/search/app_search_provider.cc +++ b/chrome/browser/ui/app_list/search/app_search_provider.cc
@@ -133,10 +133,10 @@ // Linearly maps |score| to the range [min, max]. // |score| is assumed to be within [0.0, 1.0]; if it's greater than 1.0 // then max is returned; if it's less than 0.0, then min is returned. -float ReRange(const float score, const float min, const float max) { - if (score >= 1.0f) +double ReRange(const double score, const double min, const double max) { + if (score >= 1.0) return max; - if (score <= 0.0f) + if (score <= 0.0) return min; return min + score * (max - min); @@ -259,8 +259,8 @@ // Relevance must exceed the threshold to appear as a search result. Exact // matches are always surfaced. - float relevance_threshold() const { return relevance_threshold_; } - void set_relevance_threshold(float threshold) { + double relevance_threshold() const { return relevance_threshold_; } + void set_relevance_threshold(double threshold) { relevance_threshold_ = threshold; } @@ -278,7 +278,7 @@ bool recommendable_ = true; bool searchable_ = true; std::vector<std::u16string> searchable_text_; - float relevance_threshold_ = 0.f; + double relevance_threshold_ = 0.0; // Set to true in case app was installed internally, by sync, policy or as a // default app. const bool installed_internally_; @@ -551,10 +551,10 @@ } else if (find_in_app_list != id_to_app_list_index.end()) { // Case 3: if it's in the app_list_index, set the relevance in [0.1, 0.33] result->set_relevance( - ReRange(1.0f / (1.0f + find_in_app_list->second), 0.1, 0.33)); + ReRange(1.0 / (1.0 + find_in_app_list->second), 0.1, 0.33)); } else { - // Case 4: otherwise set the relevance as 0.0f; - result->set_relevance(0.0f); + // Case 4: otherwise set the relevance as 0.0; + result->set_relevance(0.0); } if (ash::features::IsProductivityLauncherEnabled()) {
diff --git a/chrome/browser/ui/app_list/search/games/game_provider_unittest.cc b/chrome/browser/ui/app_list/search/games/game_provider_unittest.cc index 137ebfa4..14fa0d6e 100644 --- a/chrome/browser/ui/app_list/search/games/game_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/games/game_provider_unittest.cc
@@ -38,7 +38,8 @@ std::make_unique<apps::GameExtras>( absl::make_optional(std::vector<std::u16string>({u"A", u"B", u"C"})), u"SourceName", u"TestGamePublisher", - base::FilePath("/icons/test.png"), GURL("https://game.com/game"))); + base::FilePath("/icons/test.png"), /*is_icon_masking_allowed=*/false, + GURL("https://game.com/game"))); } } // namespace
diff --git a/chrome/browser/ui/app_list/search/games/game_result.cc b/chrome/browser/ui/app_list/search/games/game_result.cc index dde09696..0771de0d 100644 --- a/chrome/browser/ui/app_list/search/games/game_result.cc +++ b/chrome/browser/ui/app_list/search/games/game_result.cc
@@ -74,7 +74,9 @@ DCHECK(game.GetSourceExtras()); DCHECK(game.GetSourceExtras()->AsGameExtras()); - launch_url_ = game.GetSourceExtras()->AsGameExtras()->GetDeeplinkUrl(); + const auto* extras = game.GetSourceExtras()->AsGameExtras(); + launch_url_ = extras->GetDeeplinkUrl(); + is_icon_masking_allowed_ = extras->GetIsIconMaskingAllowed(); set_id(launch_url_.spec()); set_relevance(relevance); @@ -119,8 +121,14 @@ return; } - // TODO(crbug.com/1305880): This code resizes and sets the provided image into - // a white circle. This may change if more game sources are introduced. + if (is_icon_masking_allowed_) { + // TODO(crbug.com/1305880): Check that this is set in unit tests. This + // relies on the AppDiscoveryService. + SetIcon(IconInfo(image, GetAppIconDimension(), IconShape::kCircle)); + return; + } + + // Resize and set the provided image into a white circle. const int radius = dimension_ / 2; const int size = MaxSquareLengthForRadius(radius); const gfx::ImageSkia resized_image =
diff --git a/chrome/browser/ui/app_list/search/games/game_result.h b/chrome/browser/ui/app_list/search/games/game_result.h index a56e665..b52d1fb8 100644 --- a/chrome/browser/ui/app_list/search/games/game_result.h +++ b/chrome/browser/ui/app_list/search/games/game_result.h
@@ -50,6 +50,7 @@ AppListControllerDelegate* list_controller_; GURL launch_url_; + bool is_icon_masking_allowed_; const int dimension_; base::WeakPtrFactory<GameResult> weak_factory_{this};
diff --git a/chrome/browser/ui/app_list/search/games/game_result_unittest.cc b/chrome/browser/ui/app_list/search/games/game_result_unittest.cc index 5c6e96e..db7fbe440 100644 --- a/chrome/browser/ui/app_list/search/games/game_result_unittest.cc +++ b/chrome/browser/ui/app_list/search/games/game_result_unittest.cc
@@ -44,7 +44,8 @@ std::make_unique<apps::GameExtras>( absl::make_optional(std::vector<std::u16string>({u"A", u"B", u"C"})), u"SourceName", u"TestGamePublisher", - base::FilePath("/icons/test.png"), GURL("https://game.com/game"))); + base::FilePath("/icons/test.png"), + /*is_icon_masking_allowed=*/false, GURL("https://game.com/game"))); GameResult result(profile_.get(), &list_controller_, app_discovery_service, apps_result, 0.6, u"SomeGame");
diff --git a/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.cc b/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.cc index 7ebd3bb9..5ad25e1 100644 --- a/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.cc +++ b/chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.cc
@@ -340,18 +340,18 @@ // Convert screen bounds to the frame of reference of the keyboard window. gfx::Rect bounds = BoundsFromScreen(screen_bounds); - auto event_args = std::make_unique<base::ListValue>(); - auto new_bounds = std::make_unique<base::DictionaryValue>(); - new_bounds->SetIntKey("left", bounds.x()); - new_bounds->SetIntKey("top", bounds.y()); - new_bounds->SetIntKey("width", bounds.width()); - new_bounds->SetIntKey("height", bounds.height()); - event_args->Append(std::move(new_bounds)); + std::vector<base::Value> event_args; + base::Value::Dict new_bounds; + new_bounds.Set("left", bounds.x()); + new_bounds.Set("top", bounds.y()); + new_bounds.Set("width", bounds.width()); + new_bounds.Set("height", bounds.height()); + event_args.emplace_back(std::move(new_bounds)); auto event = std::make_unique<extensions::Event>( extensions::events::VIRTUAL_KEYBOARD_PRIVATE_ON_BOUNDS_CHANGED, virtual_keyboard_private::OnBoundsChanged::kEventName, - std::move(*event_args).TakeListDeprecated(), profile); + std::move(event_args), profile); router->BroadcastEvent(std::move(event)); }
diff --git a/chrome/browser/ui/autofill_assistant/OWNERS b/chrome/browser/ui/autofill_assistant/OWNERS new file mode 100644 index 0000000..326430c --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/OWNERS
@@ -0,0 +1,2 @@ +arbesser@google.com +hluca@google.com
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h b/chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h new file mode 100644 index 0000000..4887925 --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h
@@ -0,0 +1,33 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_DISPLAY_DELEGATE_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_DISPLAY_DELEGATE_H_ + +#include <memory> + +namespace views { +class View; +} // namespace views + +// Abstract interface that exposes methods needed for a view to register +// and unregister itself. +class AssistantDisplayDelegate { + public: + AssistantDisplayDelegate() = default; + virtual ~AssistantDisplayDelegate() = default; + + // Takes ownership of |views| and displays it. Returns a raw pointer + // to the view through which the view can still be modified as long as + // it is alive. Previously set views are destroyed. + virtual views::View* SetView(std::unique_ptr<views::View> view) = 0; + + // Returns the currently set view. + virtual views::View* GetView() = 0; + + // Removes the view and thereby destroys it. + virtual void RemoveView() = 0; +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_DISPLAY_DELEGATE_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h new file mode 100644 index 0000000..28ce73f --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h
@@ -0,0 +1,57 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_H_ + +#include <memory> +#include <string> + +#include "base/callback.h" + +class AssistantOnboardingPrompt; + +// Holds information for the consent text. +// TODO(crbug.com/1322387): Add remaining fields, place proper internationalized +// strings. +struct AssistantOnboardingInformation { + std::u16string consent_caption; + std::u16string consent_text; +}; + +// Abstract interface for a controller of an |OnboardingPrompt|. +class AssistantOnboardingController { + public: + // A callback that is called with |true| if consent was given and false + // otherwise (either by denying explicitly or by closing the prompt). + using Callback = base::OnceCallback<void(bool)>; + + // Factory function to create controller that is defined in the file + // `assistant_onboarding_controller_impl.cc`. + static std::unique_ptr<AssistantOnboardingController> Create( + const AssistantOnboardingInformation& onboarding_information); + + AssistantOnboardingController() = default; + virtual ~AssistantOnboardingController() = default; + + // Shows the |OnboardingPrompt|. + virtual void Show(AssistantOnboardingPrompt* prompt, Callback callback) = 0; + + // Registers that the consent was given. + virtual void OnAccept() = 0; + + // Registers that the consent dialog was cancelled, i.e. no consent was given. + virtual void OnCancel() = 0; + + // Registers that the consent prompt was closed without giving consent. + // Depending on the type of the view, this can be due to closing a window, + // closing a sidepanel, etc. + virtual void OnClose() = 0; + + // Provides the "model" behind the controller by returning a struct + // specifying the consent text. + virtual const AssistantOnboardingInformation& GetOnboardingInformation() = 0; +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.cc b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.cc new file mode 100644 index 0000000..fc8e769 --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.cc
@@ -0,0 +1,70 @@ +// 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. + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.h" + +#include <utility> + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" + +AssistantOnboardingControllerImpl::AssistantOnboardingControllerImpl( + const AssistantOnboardingInformation& onboarding_information) + : onboarding_information_(onboarding_information) {} + +AssistantOnboardingControllerImpl::~AssistantOnboardingControllerImpl() { + ClosePrompt(); +} + +void AssistantOnboardingControllerImpl::Show(AssistantOnboardingPrompt* prompt, + Callback callback) { + // If there is another prompt that is controlled by |this|, close it. + ClosePrompt(); + + callback_ = std::move(callback); + prompt_ = prompt; + prompt_->Show(); +} + +void AssistantOnboardingControllerImpl::OnAccept() { + if (prompt_) { + prompt_ = nullptr; + std::move(callback_).Run(true); + } +} + +void AssistantOnboardingControllerImpl::OnCancel() { + if (prompt_) { + prompt_ = nullptr; + std::move(callback_).Run(false); + } +} + +void AssistantOnboardingControllerImpl::OnClose() { + if (prompt_) { + prompt_ = nullptr; + std::move(callback_).Run(false); + } +} + +const AssistantOnboardingInformation& +AssistantOnboardingControllerImpl::GetOnboardingInformation() { + return onboarding_information_; +} + +void AssistantOnboardingControllerImpl::ClosePrompt() { + if (prompt_) { + std::exchange(prompt_, nullptr)->OnControllerGone(); + std::move(callback_).Run(false); + } +} + +// Factory function, declared in `assistant_onboarding_controller.h`. +// static +std::unique_ptr<AssistantOnboardingController> +AssistantOnboardingController::Create( + const AssistantOnboardingInformation& onboarding_information) { + return std::make_unique<AssistantOnboardingControllerImpl>( + onboarding_information); +}
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.h b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.h new file mode 100644 index 0000000..a21bae4 --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.h
@@ -0,0 +1,53 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_IMPL_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_IMPL_H_ + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" + +#include "base/callback.h" +#include "base/memory/raw_ptr.h" + +class OnboardingPrompt; + +// Implementation of the |AssistantOnboardingController| interface that keeps +// a raw pointer to an |AssistantOnboardingPrompt| (i.e. the view component), +// but does not own anything. As a result, it needs to be informed of the +// destruction of the prompt by calling one of its |On*()| methods. +class AssistantOnboardingControllerImpl : public AssistantOnboardingController { + public: + explicit AssistantOnboardingControllerImpl( + const AssistantOnboardingInformation& onboarding_information); + ~AssistantOnboardingControllerImpl() override; + + // OnboardingController: + void Show(AssistantOnboardingPrompt* prompt, Callback callback) override; + // For the below "On*" methods, the controller does not take care of closing + // the view - this is done by the view itself. + void OnAccept() override; + void OnCancel() override; + void OnClose() override; + const AssistantOnboardingInformation& GetOnboardingInformation() override; + + private: + // If the controller has a non-null |OnboardingPrompt|, notify its + // |OnControllerGone()| method and null the controller's reference to the + // prompt. + void ClosePrompt(); + + // The data representing the "model" behind the controller. + const AssistantOnboardingInformation onboarding_information_; + + // Callback triggered when dialog is accepted, canceled or closed. + Callback callback_; + + // A reference to the view implementing the |OnboardingPrompt| interface. + // Since the view might outlive the controller, it must call one of the + // |OnAccept()|, |OnCancel()|, or |OnClose()| methods before destruction + // so that the controller can invalidate its reference to it. + raw_ptr<AssistantOnboardingPrompt> prompt_ = nullptr; +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_CONTROLLER_IMPL_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl_unittest.cc b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl_unittest.cc new file mode 100644 index 0000000..5c65026 --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl_unittest.cc
@@ -0,0 +1,88 @@ +// 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. + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl.h" + +#include <memory> + +#include "base/test/mock_callback.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::testing::StrictMock; + +class AssistantOnboardingControllerImplTest : public ::testing::Test { + public: + AssistantOnboardingControllerImplTest() { + controller_ = + AssistantOnboardingController::Create(AssistantOnboardingInformation()); + } + ~AssistantOnboardingControllerImplTest() override = default; + + protected: + // The controller to test. + std::unique_ptr<AssistantOnboardingController> controller_; +}; + +TEST_F(AssistantOnboardingControllerImplTest, ShowPromptAndAccept) { + StrictMock<MockAssistantOnboardingPrompt> prompt; + base::MockCallback<AssistantOnboardingController::Callback> callback; + + EXPECT_CALL(prompt, Show); + controller_->Show(&prompt, callback.Get()); + + // Simulate click on accept. + EXPECT_CALL(callback, Run(true)); + controller_->OnAccept(); +} + +TEST_F(AssistantOnboardingControllerImplTest, ShowPromptAndCancel) { + StrictMock<MockAssistantOnboardingPrompt> prompt; + base::MockCallback<AssistantOnboardingController::Callback> callback; + + EXPECT_CALL(prompt, Show); + controller_->Show(&prompt, callback.Get()); + + // Simulate click on cancel. + EXPECT_CALL(callback, Run(false)); + controller_->OnCancel(); +} + +TEST_F(AssistantOnboardingControllerImplTest, ShowPromptAndClose) { + StrictMock<MockAssistantOnboardingPrompt> prompt; + base::MockCallback<AssistantOnboardingController::Callback> callback; + + EXPECT_CALL(prompt, Show); + controller_->Show(&prompt, callback.Get()); + + // Simulate click on cancel. + EXPECT_CALL(callback, Run(false)); + controller_->OnClose(); + + // A second call does not do anything. + controller_->OnClose(); +} + +TEST_F(AssistantOnboardingControllerImplTest, ShowTwoPromptsAndAcceptSecond) { + StrictMock<MockAssistantOnboardingPrompt> first_prompt; + base::MockCallback<AssistantOnboardingController::Callback> first_callback; + + EXPECT_CALL(first_prompt, Show); + controller_->Show(&first_prompt, first_callback.Get()); + + StrictMock<MockAssistantOnboardingPrompt> second_prompt; + base::MockCallback<AssistantOnboardingController::Callback> second_callback; + + // The second prompt closes the first. + EXPECT_CALL(first_prompt, OnControllerGone); + EXPECT_CALL(first_callback, Run(false)); + EXPECT_CALL(second_prompt, Show); + controller_->Show(&second_prompt, second_callback.Get()); + + // Simulate click on accept. + EXPECT_CALL(second_callback, Run(true)); + controller_->OnAccept(); +}
diff --git a/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h new file mode 100644 index 0000000..c3cdce2d --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h
@@ -0,0 +1,32 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_PROMPT_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_PROMPT_H_ + +class AssistantOnboardingController; +class AssistantDisplayDelegate; + +// Abstract interface to describe the methods of an onboarding prompt view +// necessary for the controller to control it. +class AssistantOnboardingPrompt { + public: + // Factory function to create onboarding prompts on desktop platforms. The + // actual implementation is in the `assistant_onboarding_view.cc` file. + static AssistantOnboardingPrompt* Create( + AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate); + + AssistantOnboardingPrompt() = default; + virtual ~AssistantOnboardingPrompt() = default; + + // Shows the view of the prompt. + virtual void Show() = 0; + + // Notifies that view that the controller was destroyed so that the view + // can invalidate its pointer to the controller. + virtual void OnControllerGone() = 0; +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_PROMPT_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.cc b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.cc new file mode 100644 index 0000000..b6a24d3f --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.cc
@@ -0,0 +1,9 @@ +// 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. + +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.h" + +MockAssistantDisplayDelegate::MockAssistantDisplayDelegate() = default; + +MockAssistantDisplayDelegate::~MockAssistantDisplayDelegate() = default;
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.h b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.h new file mode 100644 index 0000000..ee7bafb --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.h
@@ -0,0 +1,26 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_DISPLAY_DELEGATE_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_DISPLAY_DELEGATE_H_ + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "ui/views/view.h" + +// Mocked AssistantDisplayDelegate used in unit tests. +class MockAssistantDisplayDelegate : public AssistantDisplayDelegate { + public: + MockAssistantDisplayDelegate(); + ~MockAssistantDisplayDelegate() override; + + MOCK_METHOD(views::View*, + SetView, + (std::unique_ptr<views::View>), + (override)); + MOCK_METHOD(views::View*, GetView, (), (override)); + MOCK_METHOD(void, RemoveView, (), (override)); +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_DISPLAY_DELEGATE_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.cc b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.cc new file mode 100644 index 0000000..14ea06b --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.cc
@@ -0,0 +1,11 @@ +// 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. + +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.h" + +MockAssistantOnboardingController::MockAssistantOnboardingController() = + default; + +MockAssistantOnboardingController::~MockAssistantOnboardingController() = + default;
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.h b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.h new file mode 100644 index 0000000..f7457be --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.h
@@ -0,0 +1,30 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_CONTROLLER_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_CONTROLLER_H_ + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "testing/gmock/include/gmock/gmock.h" + +// Mocked AssistantOnboardingController used in unit tests. +class MockAssistantOnboardingController : public AssistantOnboardingController { + public: + MockAssistantOnboardingController(); + ~MockAssistantOnboardingController() override; + + MOCK_METHOD(void, + Show, + (AssistantOnboardingPrompt*, Callback callback), + (override)); + MOCK_METHOD(void, OnAccept, (), (override)); + MOCK_METHOD(void, OnCancel, (), (override)); + MOCK_METHOD(void, OnClose, (), (override)); + MOCK_METHOD(const AssistantOnboardingInformation&, + GetOnboardingInformation, + (), + (override)); +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_CONTROLLER_H_
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.cc b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.cc new file mode 100644 index 0000000..0d6827a --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.cc
@@ -0,0 +1,9 @@ +// 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. + +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.h" + +MockAssistantOnboardingPrompt::MockAssistantOnboardingPrompt() = default; + +MockAssistantOnboardingPrompt::~MockAssistantOnboardingPrompt() = default;
diff --git a/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.h b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.h new file mode 100644 index 0000000..890a030 --- /dev/null +++ b/chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_prompt.h
@@ -0,0 +1,21 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_PROMPT_H_ +#define CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_PROMPT_H_ + +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" +#include "testing/gmock/include/gmock/gmock.h" + +// Mocked AssistantOnboardingPrompt used in unit tests. +class MockAssistantOnboardingPrompt : public AssistantOnboardingPrompt { + public: + MockAssistantOnboardingPrompt(); + ~MockAssistantOnboardingPrompt() override; + + MOCK_METHOD(void, Show, (), (override)); + MOCK_METHOD(void, OnControllerGone, (), (override)); +}; + +#endif // CHROME_BROWSER_UI_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_MOCK_ASSISTANT_ONBOARDING_PROMPT_H_
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 353d4c2..4749d10 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc
@@ -82,7 +82,6 @@ #include "chrome/browser/ui/tabs/tab_group_model.h" #include "chrome/browser/ui/translate/translate_bubble_ui_action_logger.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/user_education/reopen_tab_in_product_help.h" #include "chrome/browser/ui/user_education/reopen_tab_in_product_help_factory.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h" @@ -121,6 +120,7 @@ #include "components/tab_groups/tab_group_id.h" #include "components/tab_groups/tab_group_visual_data.h" #include "components/translate/core/browser/language_state.h" +#include "components/user_education/common/feature_promo_controller.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "components/zoom/page_zoom.h" #include "components/zoom/zoom_controller.h"
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 9ed405a48..973f327 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h
@@ -23,11 +23,11 @@ #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" #include "chrome/browser/ui/hats/hats_service.h" #include "chrome/browser/ui/page_action/page_action_icon_type.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" #include "chrome/common/buildflags.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/translate/core/common/translate_errors.h" +#include "components/user_education/common/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_specification.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/base_window.h" #include "ui/base/interaction/element_identifier.h" @@ -583,7 +583,8 @@ // Gets the windows's FeaturePromoController which manages display of // in-product help. Will return null in incognito and guest profiles. - virtual FeaturePromoController* GetFeaturePromoController() = 0; + virtual user_education::FeaturePromoController* + GetFeaturePromoController() = 0; // Returns whether the promo bubble associated with `iph_feature` is visible. // If `include_continued_promos` is true, will also return true if @@ -597,9 +598,10 @@ // In cases where there is no promo controller, immediately returns false. virtual bool MaybeShowFeaturePromo( const base::Feature& iph_feature, - FeaturePromoSpecification::StringReplacements body_text_replacements = {}, - FeaturePromoController::BubbleCloseCallback close_callback = - base::DoNothing()) = 0; + user_education::FeaturePromoSpecification::StringReplacements + body_text_replacements = {}, + user_education::FeaturePromoController::BubbleCloseCallback + close_callback = base::DoNothing()) = 0; // Closes the in-product help promo for `iph_feature` if it is showing; // returns true if the promo was closed, false if it was not showing. @@ -609,8 +611,8 @@ // handle that can be used to end the promo when it is destructed. The handle // will be valid (i.e. have a true boolean value) if the promo was showing, // invalid otherwise. - virtual FeaturePromoController::PromoHandle CloseFeaturePromoAndContinue( - const base::Feature& iph_feature) = 0; + virtual user_education::FeaturePromoController::PromoHandle + CloseFeaturePromoAndContinue(const base::Feature& iph_feature) = 0; // Records that the user has engaged with a particular feature that has an // associated promo; this information is used to determine whether to show
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index 543d585..c0dbfc9 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc
@@ -461,6 +461,11 @@ ShowSettingsSubPage(browser, kPrivacySandboxAdPersonalizationSubPage); } +void ShowPrivacySandboxLearnMore(Browser* browser) { + base::RecordAction(UserMetricsAction("Options_ShowPrivacySandbox")); + ShowSettingsSubPage(browser, kPrivacySandboxLearnMoreSubPage); +} + #if BUILDFLAG(IS_CHROMEOS_ASH) void ShowEnterpriseManagementPageInTabbedBrowser(Browser* browser) { // Management shows in a tab because it has a "back" arrow that takes the
diff --git a/chrome/browser/ui/chrome_pages.h b/chrome/browser/ui/chrome_pages.h index b5e1bdc6..c41cdad 100644 --- a/chrome/browser/ui/chrome_pages.h +++ b/chrome/browser/ui/chrome_pages.h
@@ -166,6 +166,7 @@ void ShowWebStore(Browser* browser); void ShowPrivacySandboxSettings(Browser* browser); void ShowPrivacySandboxAdPersonalization(Browser* browser); +void ShowPrivacySandboxLearnMore(Browser* browser); #if BUILDFLAG(IS_CHROMEOS_ASH) // Shows the enterprise management info page in a browser tab.
diff --git a/chrome/browser/ui/hats/hats_service.cc b/chrome/browser/ui/hats/hats_service.cc index 514ca99..5fb6986 100644 --- a/chrome/browser/ui/hats/hats_service.cc +++ b/chrome/browser/ui/hats/hats_service.cc
@@ -59,6 +59,8 @@ "ts-ps3-notice-ok"; constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeSettings[] = "ts-ps3-notice-settings"; +constexpr char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeLearnMore[] = + "ts-ps3-notice-learn-more"; constexpr char kHatsSurveyTriggerTrustSafetyPrivacySettings[] = "ts-privacy-settings"; constexpr char kHatsSurveyTriggerTrustSafetyTrustedSurface[] = @@ -221,6 +223,14 @@ .Get(), std::vector<std::string>{"Stable channel", "3P cookies blocked", "Privacy Sandbox enabled"}); + survey_configs.emplace_back( + &features::kTrustSafetySentimentSurvey, + kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeLearnMore, + features:: + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreTriggerId + .Get(), + std::vector<std::string>{"Stable channel", "3P cookies blocked", + "Privacy Sandbox enabled"}); // Accuracy tips survey. survey_configs.emplace_back(
diff --git a/chrome/browser/ui/hats/hats_service.h b/chrome/browser/ui/hats/hats_service.h index 81cd29d..81ba148 100644 --- a/chrome/browser/ui/hats/hats_service.h +++ b/chrome/browser/ui/hats/hats_service.h
@@ -58,6 +58,7 @@ extern const char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeDismiss[]; extern const char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeOk[]; extern const char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeSettings[]; +extern const char kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeLearnMore[]; extern const char kHatsSurveyTriggerTrustSafetyPrivacySettings[]; extern const char kHatsSurveyTriggerTrustSafetyTrustedSurface[]; extern const char kHatsSurveyTriggerTrustSafetyTransactions[];
diff --git a/chrome/browser/ui/hats/trust_safety_sentiment_service.cc b/chrome/browser/ui/hats/trust_safety_sentiment_service.cc index 94b019bd..8b511ad8 100644 --- a/chrome/browser/ui/hats/trust_safety_sentiment_service.cc +++ b/chrome/browser/ui/hats/trust_safety_sentiment_service.cc
@@ -70,6 +70,9 @@ case (TrustSafetySentimentService::FeatureArea:: kPrivacySandbox3NoticeSettings): return kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeSettings; + case (TrustSafetySentimentService::FeatureArea:: + kPrivacySandbox3NoticeLearnMore): + return kHatsSurveyTriggerTrustSafetyPrivacySandbox3NoticeLearnMore; default: NOTREACHED(); return ""; @@ -118,6 +121,12 @@ features:: kTrustSafetySentimentSurveyPrivacySandbox3NoticeSettingsProbability .Get(); + case (TrustSafetySentimentService::FeatureArea:: + kPrivacySandbox3NoticeLearnMore): + return base::RandDouble() < + features:: + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreProbability + .Get(); default: NOTREACHED(); return false;
diff --git a/chrome/browser/ui/hats/trust_safety_sentiment_service.h b/chrome/browser/ui/hats/trust_safety_sentiment_service.h index e2db7648..781e8bec 100644 --- a/chrome/browser/ui/hats/trust_safety_sentiment_service.h +++ b/chrome/browser/ui/hats/trust_safety_sentiment_service.h
@@ -91,7 +91,8 @@ kPrivacySandbox3NoticeDismiss = 6, kPrivacySandbox3NoticeOk = 7, kPrivacySandbox3NoticeSettings = 8, - kMaxValue = kPrivacySandbox3NoticeSettings, + kPrivacySandbox3NoticeLearnMore = 9, + kMaxValue = kPrivacySandbox3NoticeLearnMore, }; // Called when the user interacts with Privacy Sandbox 3, |feature_area|
diff --git a/chrome/browser/ui/shared_highlighting/shared_highlighting_promo.cc b/chrome/browser/ui/shared_highlighting/shared_highlighting_promo.cc index 4bd7eed..be86f3a 100644 --- a/chrome/browser/ui/shared_highlighting/shared_highlighting_promo.cc +++ b/chrome/browser/ui/shared_highlighting/shared_highlighting_promo.cc
@@ -8,8 +8,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "components/feature_engagement/public/feature_constants.h" +#include "components/user_education/common/feature_promo_controller.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -19,7 +19,8 @@ namespace { void OnGetExistingSelectorsComplete( - base::WeakPtr<FeaturePromoController> feature_promo_controller, + base::WeakPtr<user_education::FeaturePromoController> + feature_promo_controller, const std::vector<std::string>& selectors) { if (feature_promo_controller && selectors.size() > 0) { feature_promo_controller->MaybeShowPromo(
diff --git a/chrome/browser/ui/side_search/side_search_tab_contents_helper.cc b/chrome/browser/ui/side_search/side_search_tab_contents_helper.cc index 4e22d34..5febbc7da 100644 --- a/chrome/browser/ui/side_search/side_search_tab_contents_helper.cc +++ b/chrome/browser/ui/side_search/side_search_tab_contents_helper.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/ui/side_search/side_search_tab_contents_helper.h" +#include "base/metrics/histogram_functions.h" #include "chrome/browser/page_load_metrics/page_load_metrics_initialize.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/task_manager/web_contents_tags.h" @@ -107,6 +108,17 @@ if (side_panel_contents_) UpdateSideContentsNavigation(); } + + // Trigger the timer only when the side panel first becomes available. The + // timer should only be cleared when the side panel is no longer available. + if (!could_show_for_last_committed_navigation_ && + CanShowSidePanelForCommittedNavigation()) { + available_timer_ = base::ElapsedTimer(); + } else if (!CanShowSidePanelForCommittedNavigation()) { + available_timer_.reset(); + } + could_show_for_last_committed_navigation_ = + CanShowSidePanelForCommittedNavigation(); } void SideSearchTabContentsHelper::OnSideSearchConfigChanged() { @@ -144,6 +156,16 @@ GetConfig()->is_side_panel_srp_available(); } +void SideSearchTabContentsHelper:: + MaybeRecordDurationSidePanelAvailableToFirstOpen() { + if (!available_timer_) + return; + base::UmaHistogramMediumTimes( + "SideSearch.TimeSinceSidePanelAvailableToFirstOpen", + available_timer_->Elapsed()); + available_timer_.reset(); +} + void SideSearchTabContentsHelper::SetDelegate( base::WeakPtr<Delegate> delegate) { delegate_ = std::move(delegate);
diff --git a/chrome/browser/ui/side_search/side_search_tab_contents_helper.h b/chrome/browser/ui/side_search/side_search_tab_contents_helper.h index 2bc4dfa..dc6b70ac 100644 --- a/chrome/browser/ui/side_search/side_search_tab_contents_helper.h +++ b/chrome/browser/ui/side_search/side_search_tab_contents_helper.h
@@ -7,6 +7,7 @@ #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" +#include "base/timer/elapsed_timer.h" #include "chrome/browser/ui/side_search/side_search_config.h" #include "chrome/browser/ui/side_search/side_search_side_contents_helper.h" #include "content/public/browser/web_contents_observer.h" @@ -94,6 +95,12 @@ // navigation entry. bool CanShowSidePanelForCommittedNavigation(); + // This is called to log the duration between when the side panel was made + // available to the first time it was opened for the `last_search_url_`. This + // resets the `available_timer_` to avoid logging multiple times in the case a + // user closes and opens the panel repeatedly for the same `last_search_url_`. + void MaybeRecordDurationSidePanelAvailableToFirstOpen(); + void SetDelegate(base::WeakPtr<Delegate> delegate); const absl::optional<SidePanelRedirectInfo>& @@ -173,6 +180,13 @@ // available. Reset every time `TestSRPAvailability()` is called. std::unique_ptr<network::SimpleURLLoader> simple_loader_; + // Time since the side panel became available for the `last_search_url_`. + absl::optional<base::ElapsedTimer> available_timer_; + + // True if the side panel could be shown for the previously committed + // navigation. + bool could_show_for_last_committed_navigation_ = false; + base::ScopedObservation<SideSearchConfig, SideSearchConfig::Observer> config_observation_{this};
diff --git a/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc index 9aa401cc..b144996 100644 --- a/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc +++ b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc
@@ -21,7 +21,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/signin_view_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" @@ -39,6 +38,7 @@ #include "components/signin/public/base/account_consistency_method.h" #include "components/signin/public/base/signin_metrics.h" #include "components/sync/driver/test_sync_service.h" +#include "components/user_education/common/feature_promo_controller.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_navigation_observer.h" @@ -152,8 +152,8 @@ // Needed for profile switch IPH testing. AvatarToolbarButton::SetIPHMinDelayAfterCreationForTesting( base::Seconds(0)); - test_lock_ = - FeaturePromoControllerCommon::BlockActiveWindowCheckForTesting(); + test_lock_ = user_education::FeaturePromoControllerCommon:: + BlockActiveWindowCheckForTesting(); } // Returns true if the profile switch IPH has been shown. @@ -275,7 +275,7 @@ base::UserActionTester user_action_tester_; CoreAccountId account_id_; - FeaturePromoControllerCommon::TestLock test_lock_; + user_education::FeaturePromoControllerCommon::TestLock test_lock_; }; // Shows and closes the fre dialog.
diff --git a/chrome/browser/ui/signin_reauth_view_controller.cc b/chrome/browser/ui/signin_reauth_view_controller.cc index 929ec997..17f00ef3 100644 --- a/chrome/browser/ui/signin_reauth_view_controller.cc +++ b/chrome/browser/ui/signin_reauth_view_controller.cc
@@ -29,6 +29,7 @@ #include "components/consent_auditor/consent_auditor.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/navigation_handle.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" @@ -56,6 +57,8 @@ void ReauthWebContentsObserver::DidFinishNavigation( content::NavigationHandle* navigation_handle) { + if (!navigation_handle->IsInPrimaryMainFrame()) + return; delegate_->OnGaiaReauthPageNavigated(); }
diff --git a/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc b/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc index 1f80efa..c4c8a61 100644 --- a/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc +++ b/chrome/browser/ui/signin_reauth_view_controller_browsertest.cc
@@ -32,8 +32,10 @@ #include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_test_utils.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/fenced_frame_test_util.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" #include "google_apis/gaia/core_account_id.h" @@ -675,3 +677,51 @@ &prefers_dark_mode)); EXPECT_EQ(prefers_dark_mode, false); } + +class SigninReauthViewControllerFencedFrameBrowserTest + : public SigninReauthViewControllerBrowserTest { + public: + SigninReauthViewControllerFencedFrameBrowserTest() = default; + ~SigninReauthViewControllerFencedFrameBrowserTest() override = default; + + content::test::FencedFrameTestHelper& fenced_frame_test_helper() { + return fenced_frame_test_helper_; + } + + private: + content::test::FencedFrameTestHelper fenced_frame_test_helper_; +}; + +// Tests that SigninReauthViewController proceeds Reauth only with the primary +// main frame. +IN_PROC_BROWSER_TEST_F(SigninReauthViewControllerFencedFrameBrowserTest, + FencedFrame) { + const GURL target_url = https_server()->GetURL("/title1.html"); + ShowReauthPrompt(); + RedirectGaiaChallengeTo(target_url); + + // Reauth page is shown along with the primary main frame navigation. + ReauthTestObserver reauth_observer(signin_reauth_view_controller()); + ASSERT_TRUE(login_ui_test_utils::ConfirmReauthConfirmationDialog( + browser(), kReauthDialogTimeout)); + reauth_observer.WaitUntilGaiaReauthPageIsShown(); + + content::WebContents* target_contents = + signin_reauth_view_controller()->GetModalDialogWebContentsForTesting(); + const GURL fenced_frame_url = + https_server()->GetURL("/fenced_frames/title1.html"); + base::HistogramTester histogram_tester; + // Creates a fenced frame inside the primary main frame. + content::RenderFrameHost* fenced_frame = + fenced_frame_test_helper().CreateFencedFrame( + &target_contents->GetPrimaryPage().GetMainDocument(), + fenced_frame_url); + EXPECT_EQ(fenced_frame->GetLastCommittedURL(), fenced_frame_url); + // Fenced Frame navigation doesn't have any actions for Reauth. + histogram_tester.ExpectBucketCount( + kReauthUserActionHistogramName, + SigninReauthViewController::UserAction::kClickNextButton, 0); + + SimulateCloseButtonClick(); + EXPECT_EQ(WaitForReauthResult(), signin::ReauthResult::kDismissedByUser); +}
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 5e360948..0810cea2 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -62,6 +62,7 @@ #include "components/custom_handlers/protocol_handler_registry.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/prefs/pref_service.h" +#include "components/privacy_sandbox/privacy_sandbox_features.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/dom_storage_context.h" #include "content/public/browser/storage_partition.h" @@ -384,16 +385,24 @@ auto* privacy_sandbox_serivce = PrivacySandboxServiceFactory::GetForProfile(profile_); - const bool privacy_sandbox_confirmation_required = + const bool will_use_new_notice_ui = + privacy_sandbox::kPrivacySandboxSettings3NewNotice.Get() && + (privacy_sandbox_serivce && + privacy_sandbox_serivce->GetRequiredDialogType() == + PrivacySandboxService::DialogType::kNotice); + // Don't add any tabs for the new notice UI. It is a bubble instead of the + // modal dialog and it will stay up even while the user is navigating. + const bool privacy_sandbox_dialog_required = privacy_sandbox_serivce && privacy_sandbox_serivce->GetRequiredDialogType() != - PrivacySandboxService::DialogType::kNone; + PrivacySandboxService::DialogType::kNone && + !will_use_new_notice_ui; auto result = DetermineStartupTabs( StartupTabProviderImpl(), process_startup, is_incognito_or_guest, is_post_crash_launch, has_incompatible_applications, promotional_tabs_enabled, welcome_enabled, whats_new_enabled, - privacy_sandbox_confirmation_required); + privacy_sandbox_dialog_required); StartupTabs tabs = std::move(result.tabs); // Return immediately if we start an async restore, since the remainder of @@ -463,7 +472,7 @@ bool promotional_tabs_enabled, bool welcome_enabled, bool whats_new_enabled, - bool privacy_sandbox_confirmation_required) { + bool privacy_sandbox_dialog_required) { #if BUILDFLAG(IS_CHROMEOS_LACROS) { // If URLs are passed via crosapi, forcibly opens those tabs. @@ -568,7 +577,7 @@ // Potentially add a tab appropriate to display the Privacy Sandbox // confirmaton dialog on top of. Ideally such a tab will already exist // in |tabs|, and no additional tab will be required. - if (onboarding_tabs.empty() && privacy_sandbox_confirmation_required && + if (onboarding_tabs.empty() && privacy_sandbox_dialog_required && launch_result == LaunchResult::kNormally) { AppendTabs(provider.GetPrivacySandboxTabs(profile_, tabs), &tabs); }
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc index f45699ae..5528c8b 100644 --- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
@@ -38,11 +38,13 @@ int pending_index = web_contents->GetController().GetPendingEntryIndex(); if (pending_index == i) return web_contents->GetController().GetPendingEntry(); - NavigationEntry* entry = web_contents->GetController().GetEntryAtIndex(i); - // ShouldSync() should return false if `web_contents` is on the initial - // NavigationEntry, preventing calls to this function. - DCHECK(!entry || !entry->IsInitialEntry()); + // Don't use the entry for sync if it doesn't exist or is the initial + // NavigationEntry. + // TODO(https://crbug.com/1240138): Guarantee this won't be called when on the + // initial NavigationEntry instead of bailing out here. + if (!entry || entry->IsInitialEntry()) + return nullptr; return entry; }
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index fe26d2d1..b0a5a05 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -27,7 +27,6 @@ #include "chrome/browser/ui/tabs/tab_group.h" #include "chrome/browser/ui/tabs/tab_group_model.h" #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" -#include "chrome/browser/ui/user_education/mock_feature_promo_controller.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" #include "components/tab_groups/tab_group_color.h"
diff --git a/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.cc b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.cc index bc09a2f..433b9f2a 100644 --- a/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.cc +++ b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.cc
@@ -61,7 +61,7 @@ pref_data->RemovePath(iph_feature.name); } -absl::optional<FeaturePromoSnoozeService::SnoozeData> +absl::optional<user_education::FeaturePromoSnoozeService::SnoozeData> BrowserFeaturePromoSnoozeService::ReadSnoozeData( const base::Feature& iph_feature) { std::string path_prefix = std::string(iph_feature.name) + "."; @@ -112,7 +112,7 @@ void BrowserFeaturePromoSnoozeService::SaveSnoozeData( const base::Feature& iph_feature, - const FeaturePromoSnoozeService::SnoozeData& snooze_data) { + const user_education::FeaturePromoSnoozeService::SnoozeData& snooze_data) { std::string path_prefix = std::string(iph_feature.name) + "."; DictionaryPrefUpdate update(profile_->GetPrefs(), kIPHSnoozeDataPath);
diff --git a/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h index c252808..0247104 100644 --- a/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h +++ b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h
@@ -7,13 +7,14 @@ #include "base/memory/raw_ptr.h" #include "base/time/time.h" -#include "chrome/browser/ui/user_education/feature_promo_snooze_service.h" +#include "components/user_education/common/feature_promo_snooze_service.h" #include "third_party/abseil-cpp/absl/types/optional.h" class Profile; class PrefRegistrySimple; -class BrowserFeaturePromoSnoozeService : public FeaturePromoSnoozeService { +class BrowserFeaturePromoSnoozeService + : public user_education::FeaturePromoSnoozeService { public: explicit BrowserFeaturePromoSnoozeService(Profile* profile); ~BrowserFeaturePromoSnoozeService() override;
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service_unittest.cc similarity index 76% rename from chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc rename to chrome/browser/ui/user_education/browser_feature_promo_snooze_service_unittest.cc index 8ca1f34..02e55f9 100644 --- a/chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc +++ b/chrome/browser/ui/user_education/browser_feature_promo_snooze_service_unittest.cc
@@ -24,36 +24,27 @@ } // namespace -class FeaturePromoSnoozeServiceTest : public testing::Test { +// Repeats some of the tests in FeaturePromoSnoozeServiceTest except that a live +// test profile is used to back the service instead of a dummy data map. +class BrowserFeaturePromoSnoozeServiceTest : public testing::Test { public: - FeaturePromoSnoozeServiceTest() + BrowserFeaturePromoSnoozeServiceTest() : task_environment_{base::test::SingleThreadTaskEnvironment::TimeSource:: MOCK_TIME}, service_{&profile_} {} - void SetNonClickerPolicy(base::test::ScopedFeatureList& feature_list, - FeaturePromoSnoozeService::NonClickerPolicy policy) { - std::map<std::string, std::string> parameters = { - {"x_iph_snooze_non_clicker_policy", - policy == FeaturePromoSnoozeService::NonClickerPolicy::kDismiss - ? "dismiss" - : "long_snooze"}}; - feature_list.InitAndEnableFeatureWithParameters(kTestIPHFeature, - parameters); - } - protected: content::BrowserTaskEnvironment task_environment_; TestingProfile profile_; BrowserFeaturePromoSnoozeService service_; }; -TEST_F(FeaturePromoSnoozeServiceTest, AllowFirstTimeIPH) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, AllowFirstTimeIPH) { service_.Reset(kTestIPHFeature); EXPECT_FALSE(service_.IsBlocked(kTestIPHFeature)); } -TEST_F(FeaturePromoSnoozeServiceTest, BlockDismissedIPH) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, BlockDismissedIPH) { service_.Reset(kTestIPHFeature); service_.OnPromoShown(kTestIPHFeature); service_.OnUserDismiss(kTestIPHFeature); @@ -62,14 +53,14 @@ EXPECT_FALSE(service_.IsBlocked(kTestIPHFeature)); } -TEST_F(FeaturePromoSnoozeServiceTest, BlockSnoozedIPH) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, BlockSnoozedIPH) { service_.Reset(kTestIPHFeature); service_.OnPromoShown(kTestIPHFeature); service_.OnUserSnooze(kTestIPHFeature); EXPECT_TRUE(service_.IsBlocked(kTestIPHFeature)); } -TEST_F(FeaturePromoSnoozeServiceTest, ReleaseSnoozedIPH) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, ReleaseSnoozedIPH) { service_.Reset(kTestIPHFeature); service_.OnPromoShown(kTestIPHFeature); service_.OnUserSnooze(kTestIPHFeature, base::Hours(1)); @@ -78,7 +69,7 @@ EXPECT_FALSE(service_.IsBlocked(kTestIPHFeature)); } -TEST_F(FeaturePromoSnoozeServiceTest, MultipleIPH) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, MultipleIPH) { service_.Reset(kTestIPHFeature); service_.Reset(kTestIPHFeature2); service_.OnPromoShown(kTestIPHFeature); @@ -95,7 +86,7 @@ EXPECT_FALSE(service_.IsBlocked(kTestIPHFeature2)); } -TEST_F(FeaturePromoSnoozeServiceTest, SnoozeNonClicker) { +TEST_F(BrowserFeaturePromoSnoozeServiceTest, SnoozeNonClicker) { base::test::ScopedFeatureList feature_list; service_.Reset(kTestIPHFeature); service_.OnPromoShown(kTestIPHFeature);
diff --git a/chrome/browser/ui/user_education/browser_tutorial_service.cc b/chrome/browser/ui/user_education/browser_tutorial_service.cc new file mode 100644 index 0000000..b7ce2144 --- /dev/null +++ b/chrome/browser/ui/user_education/browser_tutorial_service.cc
@@ -0,0 +1,20 @@ +// 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. + +#include "chrome/browser/ui/user_education/browser_tutorial_service.h" + +#include "chrome/grit/generated_resources.h" +#include "ui/base/l10n/l10n_util.h" + +BrowserTutorialService::BrowserTutorialService( + user_education::TutorialRegistry* tutorial_registry, + user_education::HelpBubbleFactoryRegistry* help_bubble_factory_registry) + : TutorialService(tutorial_registry, help_bubble_factory_registry) {} + +BrowserTutorialService::~BrowserTutorialService() = default; + +std::u16string BrowserTutorialService::GetBodyIconAltText( + bool is_last_step) const { + return l10n_util::GetStringUTF16(IDS_CHROME_TIP); +}
diff --git a/chrome/browser/ui/user_education/browser_tutorial_service.h b/chrome/browser/ui/user_education/browser_tutorial_service.h new file mode 100644 index 0000000..f633250 --- /dev/null +++ b/chrome/browser/ui/user_education/browser_tutorial_service.h
@@ -0,0 +1,26 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_USER_EDUCATION_BROWSER_TUTORIAL_SERVICE_H_ +#define CHROME_BROWSER_UI_USER_EDUCATION_BROWSER_TUTORIAL_SERVICE_H_ + +#include "components/user_education/common/tutorial_service.h" + +namespace user_education { +class TutorialRegistry; +class HelpBubbleFactoryRegistry; +} // namespace user_education + +class BrowserTutorialService : public user_education::TutorialService { + public: + BrowserTutorialService( + user_education::TutorialRegistry* tutorial_registry, + user_education::HelpBubbleFactoryRegistry* help_bubble_factory_registry); + ~BrowserTutorialService() override; + + // TutorialService: + std::u16string GetBodyIconAltText(bool is_last_step) const override; +}; + +#endif // CHROME_BROWSER_UI_USER_EDUCATION_BROWSER_TUTORIAL_SERVICE_H_
diff --git a/chrome/browser/ui/user_education/reopen_tab_in_product_help.cc b/chrome/browser/ui/user_education/reopen_tab_in_product_help.cc index 38383ad..cb017da8 100644 --- a/chrome/browser/ui/user_education/reopen_tab_in_product_help.cc +++ b/chrome/browser/ui/user_education/reopen_tab_in_product_help.cc
@@ -13,10 +13,10 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "components/feature_engagement/public/event_constants.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" +#include "components/user_education/common/feature_promo_controller.h" ReopenTabInProductHelp::ReopenTabInProductHelp(Profile* profile, const base::TickClock* clock)
diff --git a/chrome/browser/ui/user_education/reopen_tab_in_product_help_unittest.cc b/chrome/browser/ui/user_education/reopen_tab_in_product_help_unittest.cc index c7b794b4..200cf89 100644 --- a/chrome/browser/ui/user_education/reopen_tab_in_product_help_unittest.cc +++ b/chrome/browser/ui/user_education/reopen_tab_in_product_help_unittest.cc
@@ -15,13 +15,13 @@ #include "base/test/simple_test_tick_clock.h" #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/user_education/mock_feature_promo_controller.h" #include "chrome/browser/ui/user_education/reopen_tab_in_product_help_trigger.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/test_browser_window.h" #include "chrome/test/base/testing_profile.h" #include "components/feature_engagement/public/event_constants.h" #include "components/feature_engagement/public/feature_constants.h" +#include "components/user_education/test/mock_feature_promo_controller.h" #include "content/public/test/browser_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -57,14 +57,16 @@ // This test only supports one window. DCHECK(!mock_promo_controller_); - mock_promo_controller_ = static_cast<MockFeaturePromoController*>( - test_window->SetFeaturePromoController( - std::make_unique<MockFeaturePromoController>())); + mock_promo_controller_ = + static_cast<user_education::test::MockFeaturePromoController*>( + test_window->SetFeaturePromoController( + std::make_unique< + user_education::test::MockFeaturePromoController>())); return test_window; } base::SimpleTestTickClock* clock() { return &clock_; } - MockFeaturePromoController* mock_promo_controller() { + user_education::test::MockFeaturePromoController* mock_promo_controller() { return mock_promo_controller_; } @@ -72,7 +74,8 @@ base::test::ScopedFeatureList scoped_feature_list_; base::SimpleTestTickClock clock_; - raw_ptr<MockFeaturePromoController> mock_promo_controller_ = nullptr; + raw_ptr<user_education::test::MockFeaturePromoController> + mock_promo_controller_ = nullptr; }; TEST_F(ReopenTabInProductHelpTest, TriggersIPH) {
diff --git a/chrome/browser/ui/user_education/scoped_new_badge_tracker.cc b/chrome/browser/ui/user_education/scoped_new_badge_tracker.cc index c5fa810..2bd98ee 100644 --- a/chrome/browser/ui/user_education/scoped_new_badge_tracker.cc +++ b/chrome/browser/ui/user_education/scoped_new_badge_tracker.cc
@@ -4,54 +4,13 @@ #include "chrome/browser/ui/user_education/scoped_new_badge_tracker.h" -#include "base/containers/contains.h" -#include "base/feature_list.h" #include "chrome/browser/feature_engagement/tracker_factory.h" -#include "components/feature_engagement/public/tracker.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" ScopedNewBadgeTracker::ScopedNewBadgeTracker(content::BrowserContext* profile) - : tracker_( + : ScopedNewBadgeTrackerBase( feature_engagement::TrackerFactory::GetForBrowserContext(profile)) {} -ScopedNewBadgeTracker::~ScopedNewBadgeTracker() { - // TODO(crbug.com/1258216): When we have the ability to do concurrent FE - // promos, dismiss all of the badge promos here instead of in - // TryShowNewBadge(). -} - -bool ScopedNewBadgeTracker::TryShowNewBadge( - const base::Feature& badge_feature, - const base::Feature* promoted_feature) { - // In the event of a submenu that the user could open multiple times while - // navigating the same top-level menu, and we don't want to count those as - // separate times the user sees the New Badge: - if (base::Contains(active_badge_features_, &badge_feature)) - return true; - - // If there is no tracker available or the feature being promoted is disabled, - // do not show the New Badge. - if (!tracker_) - return false; - if (promoted_feature && !base::FeatureList::IsEnabled(*promoted_feature)) - return false; - - const bool result = tracker_->ShouldTriggerHelpUI(badge_feature); - if (result) { - active_badge_features_.insert(&badge_feature); - // TODO(crbug.com/1258216): Immediately dismiss to work around an issue - // where the FE backend disallows concurrent promos; move the call to - // Dismiss() to the destructor when concurrency is added. - // - // Note that "Dismiss" in this case does not dismiss the UI. It's telling - // the FE backend that the promo is done so that other promos can run. A - // badge showing in a menu should not block e.g. other badges from - // displaying (never mind help bubbles). - tracker_->Dismissed(badge_feature); - } - return result; -} - -void ScopedNewBadgeTracker::ActionPerformed(const char* event_name) { - if (tracker_) - tracker_->NotifyEvent(event_name); -} +ScopedNewBadgeTracker::ScopedNewBadgeTracker(Browser* browser) + : ScopedNewBadgeTracker(browser->profile()) {}
diff --git a/chrome/browser/ui/user_education/scoped_new_badge_tracker.h b/chrome/browser/ui/user_education/scoped_new_badge_tracker.h index 22ef2d6..3d5671c 100644 --- a/chrome/browser/ui/user_education/scoped_new_badge_tracker.h +++ b/chrome/browser/ui/user_education/scoped_new_badge_tracker.h
@@ -5,132 +5,25 @@ #ifndef CHROME_BROWSER_UI_USER_EDUCATION_SCOPED_NEW_BADGE_TRACKER_H_ #define CHROME_BROWSER_UI_USER_EDUCATION_SCOPED_NEW_BADGE_TRACKER_H_ -#include <set> - -#include "base/memory/raw_ptr.h" - -namespace base { -struct Feature; -} +#include "components/user_education/common/scoped_new_badge_tracker_base.h" namespace content { class BrowserContext; } -namespace feature_engagement { -class Tracker; -} +class Browser; -// Works with the Feature Engagement system to determine when/how many times a -// New Badge is displayed to the user. Wraps a feature_engagement::Tracker so -// the correct calls are made to the Feature Engagement backend. +// Implementation of ScopedNewBadgeTrackerBase that allows you to pass a +// Browser or Profile to the constructor. // -// The lifespan of a ScopedNewBadgeTracker should match the time the dialog or -// menu containing the New Badge is visible to the user. -// -// You may use a single ScopedNewBadgeTracker for New Badges on multiple -// features in the same menu or dialog, but make sure the feature flags and -// event names are distinct. -// -// Usage: -// -// * Menus -// -// Below is an example of using a ScopedNewBadgeTracker to add a New Badge to a -// menu where the object implementing ui::SimpleMenuModel::Delegate is created -// each time the menu is shown (e.g. AppMenuModel, TabContextMenuContents, -// etc.) The case where the delegate object is persistent will be discussed -// later. -// -// // Menu model constructor: -// MyMenuModelDelegate::MyMenuModelDelegate(Browser* browser, ...) : ... -// new_badge_tracker_(browser->profile()), -// -// // In OnMenuWillShow(menu): -// menu->SetIsNewFeatureAt( -// menu->GetIndexOfCommandId(IDC_MY_FEATURE), -// new_badge_tracker_.TryShowNewBadge( -// feature_engagement::kIPHMyFeatureNewBadge, -// &ui_features::kMyFeature)); -// -// // In ExecuteCommand(): -// case IDC_MY_FEATURE: -// new_badge_tracker_.EventPerformed("my_feature_activated"); -// ... -// break; -// -// If the New Badge is in the top-level menu, you can move the call to -// SetIsNewFeatureAt() to immediately after the menu model is initialized -// (typically in the constructor or "Init" method) and you will not have to -// override OnMenuWillBeShown(). -// -// If you are handling multiple New Badges for different features, you will -// want to check the result of GetIndexOfCommand() to make sure the menu being -// shown is the one that contains the item receiving the new badge. -// -// If the ui::SimpleMenuModel::Delegate is a persistent object and is not -// created each time the menu is displayed, you will need to move the tracker -// down into the ui::SimpleMenuModel for your menu, and move your code from -// OnMenuWillShow() to MenuWillShow() and from ExecuteCommand() to -// ActivatedAt(int, int). Be sure to invoke base class behavior when overriding -// these methods! -// -// * Dialogs -// -// Add a ScopedNewBadgeTracker member variable to your DialogDelegateView. -// Dialogs are typically not re-usable; we create a new DialogDelegateView for -// each time we show them. If you are following this pattern, include this in -// your constructor or "Init" function after creating the NewBadgeLabel (but -// before showing the dialog): -// -// new_badge_label_->SetDisplayNewBadge( -// new_badge_tracker_.TryShowNewBadge( -// feature_engagement::kIPHMyFeatureNewBadge, -// &ui_features::kMyFeature)); -// -// Then in the callback for the button that activates the feature being -// promoted, call: -// -// new_badge_tracker_.EventPerformed("my_feature_activated"); -// -// If for some reason you are re-using a dialog delegate, you must dynamically -// create and destroy the tracker when the dialog is shown and hidden. -class ScopedNewBadgeTracker { +// See documentation on ScopedNewBadgeTrackerBase. +class ScopedNewBadgeTracker : public user_education::ScopedNewBadgeTrackerBase { public: // Constructs a scoped tracker for browser with |profile|. explicit ScopedNewBadgeTracker(content::BrowserContext* profile); - // This object should be destructed when the New Badge is going away, such as - // when a menu with a New Badge or a dialog with a NewBadgeLabel is closing. - // If TryShowNewBadge() returned true, the tracker will be informed that the - // promo has ended. - ~ScopedNewBadgeTracker(); - - ScopedNewBadgeTracker(const ScopedNewBadgeTracker& other) = delete; - void operator=(const ScopedNewBadgeTracker& other) = delete; - - // Returns whether the New Badge should be shown. - // - // |badge_feature| is the feature flag for the New Badge itself. - // - // |promoted_feature|, if specified, is the flag for the feature the New Badge - // is promoting. You generally want to specify this feature even if the two - // flags are controlled by the same Finch study, because the user could - // override one but not the other. This parameter is optional because a New - // Badge promo could be shown for a feature without a flag, or for a feature - // that has already rolled to 100% and whose flag has been removed. - bool TryShowNewBadge(const base::Feature& badge_feature, - const base::Feature* promoted_feature = nullptr); - - // Indicates that the user performed a promoted action. |action_event_name| - // should be the value referenced in the "event_used" parameter of your field - // trial configuration. - // Note: this is a wrapper around feature_engagement::Tracker::NotifyEvent(). - void ActionPerformed(const char* action_event_name); - - private: - const raw_ptr<feature_engagement::Tracker> tracker_; - std::set<const base::Feature*> active_badge_features_; + // Constructs a scoped tracker for browser from |browser|. + explicit ScopedNewBadgeTracker(Browser* browser); }; #endif // CHROME_BROWSER_UI_USER_EDUCATION_SCOPED_NEW_BADGE_TRACKER_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_identifier.h b/chrome/browser/ui/user_education/tutorial/tutorial_identifier.h deleted file mode 100644 index cf17644..0000000 --- a/chrome/browser/ui/user_education/tutorial/tutorial_identifier.h +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_IDENTIFIER_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_IDENTIFIER_H_ - -// TutorialIdentifier is used as a handle for Tutorials. -using TutorialIdentifier = std::string; - -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_IDENTIFIER_H_
diff --git a/chrome/browser/ui/user_education/user_education_service.cc b/chrome/browser/ui/user_education/user_education_service.cc index a00e40ac..0c52ce1 100644 --- a/chrome/browser/ui/user_education/user_education_service.cc +++ b/chrome/browser/ui/user_education/user_education_service.cc
@@ -6,9 +6,9 @@ #include <memory> -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/tutorial_registry.h" UserEducationService::UserEducationService() : tutorial_service_(&tutorial_registry_, &help_bubble_factory_registry_) {}
diff --git a/chrome/browser/ui/user_education/user_education_service.h b/chrome/browser/ui/user_education/user_education_service.h index 948c4550..11f5592 100644 --- a/chrome/browser/ui/user_education/user_education_service.h +++ b/chrome/browser/ui/user_education/user_education_service.h
@@ -5,31 +5,36 @@ #ifndef CHROME_BROWSER_UI_USER_EDUCATION_USER_EDUCATION_SERVICE_H_ #define CHROME_BROWSER_UI_USER_EDUCATION_USER_EDUCATION_SERVICE_H_ -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" +#include "chrome/browser/ui/user_education/browser_tutorial_service.h" #include "components/keyed_service/core/keyed_service.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_registry.h" class UserEducationService : public KeyedService { public: UserEducationService(); ~UserEducationService() override; - TutorialRegistry& tutorial_registry() { return tutorial_registry_; } - TutorialService& tutorial_service() { return tutorial_service_; } - HelpBubbleFactoryRegistry& help_bubble_factory_registry() { + user_education::TutorialRegistry& tutorial_registry() { + return tutorial_registry_; + } + user_education::TutorialService& tutorial_service() { + return tutorial_service_; + } + user_education::HelpBubbleFactoryRegistry& help_bubble_factory_registry() { return help_bubble_factory_registry_; } - FeaturePromoRegistry& feature_promo_registry() { + user_education::FeaturePromoRegistry& feature_promo_registry() { return feature_promo_registry_; } private: - TutorialRegistry tutorial_registry_; - HelpBubbleFactoryRegistry help_bubble_factory_registry_; - FeaturePromoRegistry feature_promo_registry_; - TutorialService tutorial_service_; + user_education::TutorialRegistry tutorial_registry_; + user_education::HelpBubbleFactoryRegistry help_bubble_factory_registry_; + user_education::FeaturePromoRegistry feature_promo_registry_; + BrowserTutorialService tutorial_service_; }; #endif // CHROME_BROWSER_UI_USER_EDUCATION_USER_EDUCATION_SERVICE_H_
diff --git a/chrome/browser/ui/views/DEPS b/chrome/browser/ui/views/DEPS index 364c7fc5..273916b 100644 --- a/chrome/browser/ui/views/DEPS +++ b/chrome/browser/ui/views/DEPS
@@ -3,6 +3,7 @@ "+components/fullscreen_control", "+components/live_caption", "+components/services/app_service/public", + "+components/user_education/views", "+third_party/libaddressinput", "+services/tracing/public", ]
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc index c8908f01..d565ac22 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
@@ -23,7 +23,6 @@ #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/passwords/ui_utils.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/autofill/autofill_popup_view_utils.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" @@ -39,6 +38,7 @@ #include "components/feature_engagement/public/feature_constants.h" #include "components/omnibox/browser/vector_icons.h" #include "components/strings/grit/components_strings.h" +#include "components/user_education/common/feature_promo_controller.h" #include "components/vector_icons/vector_icons.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/accessibility/ax_node_data.h"
diff --git a/chrome/browser/ui/views/autofill_assistant/OWNERS b/chrome/browser/ui/views/autofill_assistant/OWNERS new file mode 100644 index 0000000..326430c --- /dev/null +++ b/chrome/browser/ui/views/autofill_assistant/OWNERS
@@ -0,0 +1,2 @@ +arbesser@google.com +hluca@google.com
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.cc b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.cc new file mode 100644 index 0000000..9d807610 --- /dev/null +++ b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.cc
@@ -0,0 +1,69 @@ +// 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. + +#include "chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.h" + +#include <string> +#include <utility> +#include <vector> + +#include "base/bind.h" +#include "base/memory/ptr_util.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/views/view.h" + +// Factory function to create onboarding prompts on desktop platforms. +AssistantOnboardingPrompt* AssistantOnboardingPrompt::Create( + AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate) { + return new AssistantOnboardingView(controller, display_delegate); +} + +AssistantOnboardingView::AssistantOnboardingView( + AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate) + : controller_(controller), display_delegate_(display_delegate) { + // Since display_delegate_ owns |this|, it must never be a nullptr. + DCHECK(display_delegate_); + display_delegate_->SetView(base::WrapUnique(this)); +} + +AssistantOnboardingView::~AssistantOnboardingView() { + if (controller_) { + std::exchange(controller_, nullptr)->OnClose(); + } +} + +void AssistantOnboardingView::Show() { + // TODO(crbug.com/1322387): Set up proper layout and content. +} + +void AssistantOnboardingView::OnControllerGone() { + controller_ = nullptr; + Close(); +} + +void AssistantOnboardingView::Close() { + DCHECK(!controller_); + display_delegate_->RemoveView(); +} + +void AssistantOnboardingView::OnAccept() { + if (controller_) { + std::exchange(controller_, nullptr)->OnAccept(); + } + Close(); +} + +void AssistantOnboardingView::OnCancel() { + if (controller_) { + std::exchange(controller_, nullptr)->OnCancel(); + } + Close(); +} + +BEGIN_METADATA(AssistantOnboardingView, views::View) +END_METADATA
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.h b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.h new file mode 100644 index 0000000..b1e3623 --- /dev/null +++ b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.h
@@ -0,0 +1,57 @@ +// 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. + +#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_VIEW_H_ +#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_VIEW_H_ + +#include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_display_delegate.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_controller.h" +#include "chrome/browser/ui/autofill_assistant/password_change/assistant_onboarding_prompt.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/views/view.h" + +// View that displays the onboarding/ consent prompt for autofill assistant. +// It uses the legal text supplied by the AssistantOnboardingController +// to which it holds a raw pointer. +// The AssistantOnboardingView is owned by the |views::View| that it is a child +// of. It therefore needs to be created via new/ a factory method and passes +// ownership of itself to the |AssistantDisplayDelegate| during its +// construction. +// The View and its controller notify each other when one is destroyed so +// that the other can invalidate the pointer it holds. +// TODO(crbug.com/1322387): Check whether the derive from BoxView or FlexView. +class AssistantOnboardingView : public views::View, + public AssistantOnboardingPrompt { + public: + METADATA_HEADER(AssistantOnboardingView); + AssistantOnboardingView(AssistantOnboardingController* controller, + AssistantDisplayDelegate* display_delegate); + ~AssistantOnboardingView() override; + + AssistantOnboardingView(const AssistantOnboardingView&) = delete; + AssistantOnboardingView& operator=(const AssistantOnboardingView&) = delete; + + // AssistantOnboardingPrompt: + void Show() override; + void OnControllerGone() override; + + // Callbacks for the dialog buttons that inform the controller, null the + // controller and close the view. + void OnCancel(); + void OnAccept(); + + private: + // Closes the view by removing itself from the display. CHECKs that the raw + // pointer to the controller is a nullptr. + void Close(); + + // The controller belonging to this view. + raw_ptr<AssistantOnboardingController> controller_; + + // The display that owns this view. + raw_ptr<AssistantDisplayDelegate> display_delegate_; +}; + +#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_ASSISTANT_PASSWORD_CHANGE_ASSISTANT_ONBOARDING_VIEW_H_
diff --git a/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view_unittest.cc b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view_unittest.cc new file mode 100644 index 0000000..980df75 --- /dev/null +++ b/chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view_unittest.cc
@@ -0,0 +1,95 @@ +// 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. + +#include "chrome/browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view.h" + +#include <memory> + +#include "base/callback_helpers.h" +#include "base/memory/raw_ptr.h" +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_display_delegate.h" +#include "chrome/browser/ui/autofill_assistant/password_change/mock_assistant_onboarding_controller.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/views/view.h" + +using ::testing::StrictMock; + +class AssistantOnboardingViewTest : public ::testing::Test { + public: + AssistantOnboardingViewTest() { + // Take ownership of the display. + ON_CALL(display_delegate_, SetView) + .WillByDefault([&view = view_](std::unique_ptr<views::View> display) { + view = std::move(display); + return view.get(); + }); + + // Destroy the display if we currently own it. + ON_CALL(display_delegate_, RemoveView).WillByDefault([&view = view_]() { + view.reset(); + }); + } + ~AssistantOnboardingViewTest() override = default; + + protected: + AssistantOnboardingView* onboarding_view() { + return static_cast<AssistantOnboardingView*>(view_.get()); + } + + // Mock display delegate and controller. + StrictMock<MockAssistantDisplayDelegate> display_delegate_; + StrictMock<MockAssistantOnboardingController> controller_; + + // Variable required to simulate the display delegate. + std::unique_ptr<views::View> view_; +}; + +TEST_F(AssistantOnboardingViewTest, CreateAndShowView) { + // The display delegate is notified that a view wants to register itself. + EXPECT_CALL(display_delegate_, SetView); + + EXPECT_CALL(controller_, Show); + controller_.Show( + AssistantOnboardingPrompt::Create(&controller_, &display_delegate_), + base::DoNothing()); + + // Controller gets notified once the view is destroyed. + EXPECT_CALL(controller_, OnClose); + view_.reset(); +} + +TEST_F(AssistantOnboardingViewTest, CreateShowAndAcceptView) { + // The display delegate is notified that a view wants to register itself. + EXPECT_CALL(display_delegate_, SetView); + + EXPECT_CALL(controller_, Show); + controller_.Show( + AssistantOnboardingPrompt::Create(&controller_, &display_delegate_), + base::DoNothing()); + + // The controller is notified when the view is accepted. + EXPECT_CALL(controller_, OnAccept); + EXPECT_CALL(display_delegate_, RemoveView); + onboarding_view()->OnAccept(); + + // No further calls to the controller take place. +} + +TEST_F(AssistantOnboardingViewTest, CreateShowAndCancelView) { + // The display delegate is notified that a view wants to register itself. + EXPECT_CALL(display_delegate_, SetView); + + EXPECT_CALL(controller_, Show); + controller_.Show( + AssistantOnboardingPrompt::Create(&controller_, &display_delegate_), + base::DoNothing()); + + // The controller is notified when the view is cancelled. + EXPECT_CALL(controller_, OnCancel); + EXPECT_CALL(display_delegate_, RemoveView); + onboarding_view()->OnCancel(); + + // No further calls to the controller take place. +}
diff --git a/chrome/browser/ui/views/chrome_view_class_properties.h b/chrome/browser/ui/views/chrome_view_class_properties.h deleted file mode 100644 index a5ceaaf4..0000000 --- a/chrome/browser/ui/views/chrome_view_class_properties.h +++ /dev/null
@@ -1,15 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_CHROME_VIEW_CLASS_PROPERTIES_H_ -#define CHROME_BROWSER_UI_VIEWS_CHROME_VIEW_CLASS_PROPERTIES_H_ - -#include "ui/base/class_property.h" - -// Set to true for a View if an in-product help promo is showing for it. -// The View can respond however is appropriate, i.e. with a highlight or -// a color change. -extern const ui::ClassProperty<bool>* const kHasInProductHelpPromoKey; - -#endif // CHROME_BROWSER_UI_VIEWS_CHROME_VIEW_CLASS_PROPERTIES_H_
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 7db1e25e5..01615eb 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -82,7 +82,6 @@ #include "chrome/browser/ui/toolbar/app_menu_model.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" #include "chrome/browser/ui/user_education/reopen_tab_in_product_help.h" #include "chrome/browser/ui/user_education/reopen_tab_in_product_help_factory.h" #include "chrome/browser/ui/user_education/user_education_service.h" @@ -157,7 +156,6 @@ #include "chrome/browser/ui/views/update_recommended_message_box.h" #include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h" #include "chrome/browser/ui/views/user_education/browser_user_education_service.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/window_sizer/window_sizer.h" #include "chrome/common/channel_info.h" @@ -187,6 +185,8 @@ #include "components/startup_metric_utils/browser/startup_metric_utils.h" #include "components/translate/core/browser/language_state.h" #include "components/translate/core/browser/translate_manager.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/views/help_bubble_view.h" #include "components/version_info/channel.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "components/webapps/browser/banners/app_banner_manager.h" @@ -2139,17 +2139,17 @@ if (toolbar_ && toolbar_->app_menu_button()) { views::DialogDelegate* bubble = toolbar_->app_menu_button()->GetProperty(views::kAnchoredDialogKey); - if ((!bubble || HelpBubbleView::IsHelpBubble(bubble)) && + if ((!bubble || user_education::HelpBubbleView::IsHelpBubble(bubble)) && GetLocationBarView()) bubble = GetLocationBarView()->GetProperty(views::kAnchoredDialogKey); - if ((!bubble || HelpBubbleView::IsHelpBubble(bubble)) && + if ((!bubble || user_education::HelpBubbleView::IsHelpBubble(bubble)) && toolbar_button_provider_ && toolbar_button_provider_->GetAvatarToolbarButton()) { bubble = toolbar_button_provider_->GetAvatarToolbarButton()->GetProperty( views::kAnchoredDialogKey); } - if (bubble && !HelpBubbleView::IsHelpBubble(bubble)) { + if (bubble && !user_education::HelpBubbleView::IsHelpBubble(bubble)) { View* focusable = bubble->GetInitiallyFocusedView(); // A PermissionPromptBubbleView will explicitly return nullptr due to @@ -4316,8 +4316,10 @@ bool BrowserView::MaybeShowFeaturePromo( const base::Feature& iph_feature, - FeaturePromoSpecification::StringReplacements body_text_replacements, - FeaturePromoController::BubbleCloseCallback close_callback) { + user_education::FeaturePromoSpecification::StringReplacements + body_text_replacements, + user_education::FeaturePromoController::BubbleCloseCallback + close_callback) { if (!feature_promo_controller_) return false; return feature_promo_controller_->MaybeShowPromo( @@ -4329,10 +4331,10 @@ feature_promo_controller_->CloseBubble(iph_feature); } -FeaturePromoController::PromoHandle BrowserView::CloseFeaturePromoAndContinue( - const base::Feature& iph_feature) { +user_education::FeaturePromoController::PromoHandle +BrowserView::CloseFeaturePromoAndContinue(const base::Feature& iph_feature) { if (!IsFeaturePromoActive(iph_feature)) - return FeaturePromoController::PromoHandle(); + return user_education::FeaturePromoController::PromoHandle(); return feature_promo_controller_->CloseBubbleAndContinuePromo(iph_feature); }
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 405b8ab..70f50e6 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -571,12 +571,13 @@ bool include_continued_promos = false) const override; bool MaybeShowFeaturePromo( const base::Feature& iph_feature, - FeaturePromoSpecification::StringReplacements body_text_replacements = {}, - FeaturePromoController::BubbleCloseCallback close_callback = - base::DoNothing()) override; + user_education::FeaturePromoSpecification::StringReplacements + body_text_replacements = {}, + user_education::FeaturePromoController::BubbleCloseCallback + close_callback = base::DoNothing()) override; bool CloseFeaturePromo(const base::Feature& iph_feature) override; - FeaturePromoController::PromoHandle CloseFeaturePromoAndContinue( - const base::Feature& iph_feature) override; + user_education::FeaturePromoController::PromoHandle + CloseFeaturePromoAndContinue(const base::Feature& iph_feature) override; void NotifyFeatureEngagementEvent(const char* event_name) override; void ShowIncognitoClearBrowsingDataDialog() override;
diff --git a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc index c071f840..5b8b308 100644 --- a/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc +++ b/chrome/browser/ui/views/frame/webui_tab_strip_container_view.cc
@@ -36,7 +36,6 @@ #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" #include "chrome/browser/ui/views/frame/top_container_view.h"
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.cc b/chrome/browser/ui/views/intent_picker_bubble_view.cc index fabf6344..1ecdcac 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view.cc
@@ -46,10 +46,6 @@ #include "ui/views/layout/box_layout.h" #include "ui/views/layout/grid_layout.h" -#if BUILDFLAG(IS_CHROMEOS) -#include "components/arc/common/intent_helper/arc_intent_helper_package.h" // nogncheck -#endif // BUILDFLAG(IS_CHROMEOS) - namespace { constexpr char kInvalidLaunchName[] = ""; @@ -299,27 +295,14 @@ scrollable_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical)); - size_t i = 0; - size_t to_erase = app_info_.size(); - for (const auto& app_info : app_info_) { -#if BUILDFLAG(IS_CHROMEOS) - if (app_info.launch_name == arc::kArcIntentHelperPackageName) { - to_erase = i; - continue; - } -#endif // BUILDFLAG(IS_CHROMEOS) + for (size_t i = 0; i < app_info_.size(); i++) { auto app_button = std::make_unique<IntentPickerLabelButton>( base::BindRepeating(&IntentPickerBubbleView::AppButtonPressed, base::Unretained(this), i), - app_info.icon_model, app_info.display_name); - scrollable_view->AddChildViewAt(std::move(app_button), i++); + app_info_[i].icon_model, app_info_[i].display_name); + scrollable_view->AddChildViewAt(std::move(app_button), i); } - // We should delete at most one entry, this is the case when Chrome is listed - // as a candidate to handle a given URL. - if (to_erase != app_info_.size()) - app_info_.erase(app_info_.begin() + to_erase); - auto scroll_view = std::make_unique<views::ScrollView>(); scroll_view->SetBackgroundThemeColorId(ui::kColorBubbleBackground); scroll_view->SetContents(std::move(scrollable_view));
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc index c3849d5..e0c359d 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view_unittest.cc
@@ -47,23 +47,6 @@ using content::OpenURLParams; using content::Referrer; -// There is logic inside IntentPickerBubbleView that filters out the intent -// helper by checking IsIntentHelperPackage() on them. That logic is -// ChromeOS-only, so for this unit test to match the behavior of -// IntentPickerBubbleView on non-ChromeOS platforms, if needs to not filter any -// packages. -#if BUILDFLAG(IS_CHROMEOS) -const char* kArcIntentHelperPackageName = arc::kArcIntentHelperPackageName; -bool IsIntentHelperPackage(const base::StringPiece package_name) { - return package_name == arc::kArcIntentHelperPackageName; -} -#else -constexpr char kArcIntentHelperPackageName[] = "unused_intent_helper"; -bool IsIntentHelperPackage(const base::StringPiece package_name) { - return false; -} -#endif - class IntentPickerBubbleViewTest : public TestWithBrowserView { public: IntentPickerBubbleViewTest() = default; @@ -94,10 +77,6 @@ "package_1", "dank app 1"); app_info_.emplace_back(apps::PickerEntryType::kArc, ui::ImageModel(), "package_2", "dank_app_2"); - // Also adding the corresponding Chrome's package name on ARC, even if this - // is given to the picker UI as input it should be ignored. - app_info_.emplace_back(apps::PickerEntryType::kArc, ui::ImageModel(), - kArcIntentHelperPackageName, "legit_chrome"); if (use_icons) FillAppListWithDummyIcons(); @@ -188,13 +167,8 @@ BubbleType::kLinkCapturing, /*initiating_origin=*/absl::nullopt); size_t size = app_info_.size(); - size_t chrome_package_repetitions = 0; - for (const AppInfo& app_info : app_info_) { - if (IsIntentHelperPackage(app_info.launch_name)) - ++chrome_package_repetitions; - } - EXPECT_EQ(size, bubble_->GetScrollViewSize() + chrome_package_repetitions); + EXPECT_EQ(size, bubble_->GetScrollViewSize()); } // Verifies that the first item is activated by default when creating a new @@ -246,19 +220,6 @@ views::InkDropState::ACTIVATED); } -// Check that none of the app candidates within the picker corresponds to the -// Chrome browser. -TEST_F(IntentPickerBubbleViewTest, ChromeNotInCandidates) { - CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/true, - BubbleType::kLinkCapturing, - /*initiating_origin=*/absl::nullopt); - size_t size = bubble_->GetScrollViewSize(); - for (size_t i = 0; i < size; ++i) { - EXPECT_FALSE( - IsIntentHelperPackage(bubble_->app_info_for_testing()[i].launch_name)); - } -} - // Check that a non nullptr WebContents() has been created and observed. TEST_F(IntentPickerBubbleViewTest, WebContentsTiedToBubble) { CreateBubbleView(/*use_icons=*/false, /*show_stay_in_chrome=*/false,
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index 36e2d77..3ee8cf0 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -14,11 +14,11 @@ #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/content_setting_bubble_contents.h" #include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h" #include "chrome/grit/generated_resources.h" +#include "components/user_education/common/feature_promo_specification.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/l10n/l10n_util.h" @@ -282,7 +282,7 @@ content_setting_image_model_->ShouldShowPromo(web_contents)) { critical_promo_bubble_ = BrowserFeaturePromoController::GetForView(this)->ShowCriticalPromo( - FeaturePromoSpecification::CreateForLegacyPromo( + user_education::FeaturePromoSpecification::CreateForLegacyPromo( /* feature =*/nullptr, ui::ElementIdentifier(), IDS_NOTIFICATIONS_QUIET_PERMISSION_NEW_REQUEST_PROMO), views::ElementTrackerViews::GetInstance()->GetElementForView(this,
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h index 514db6f..7f0cc97 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
@@ -9,9 +9,9 @@ #include "base/memory/raw_ptr.h" #include "chrome/browser/ui/content_settings/content_setting_image_model.h" -#include "chrome/browser/ui/user_education/help_bubble.h" #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/user_education/common/help_bubble.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/gfx/animation/animation_delegate.h" #include "ui/gfx/animation/slide_animation.h" @@ -94,7 +94,7 @@ void reset_animation_for_testing() { IconLabelBubbleView::ResetSlideAnimation(true); } - HelpBubble* critical_promo_bubble_for_testing() { + user_education::HelpBubble* critical_promo_bubble_for_testing() { return critical_promo_bubble_.get(); } @@ -118,7 +118,7 @@ // Has a value that is not is_zero() if a promo is showing, or has an // is_zero() value if the promo was considered but it was decided not to show // it. - std::unique_ptr<HelpBubble> critical_promo_bubble_; + std::unique_ptr<user_education::HelpBubble> critical_promo_bubble_; }; #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc index 37db2158..e01e712 100644 --- a/chrome/browser/ui/views/location_bar/star_view.cc +++ b/chrome/browser/ui/views/location_bar/star_view.cc
@@ -24,7 +24,6 @@ #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/grit/generated_resources.h" #include "components/bookmarks/common/bookmark_pref_names.h" #include "components/feature_engagement/public/event_constants.h" @@ -32,6 +31,7 @@ #include "components/feature_engagement/public/tracker.h" #include "components/omnibox/browser/vector_icons.h" #include "components/strings/grit/components_strings.h" +#include "components/user_education/common/user_education_class_properties.h" #include "components/variations/variations_associated_data.h" #include "content/public/browser/web_contents.h" #include "ui/base/l10n/l10n_util.h" @@ -66,9 +66,10 @@ void StarView::AfterPropertyChange(const void* key, int64_t old_value) { View::AfterPropertyChange(key, old_value); - if (key == kHasInProductHelpPromoKey) { + if (key == user_education::kHasInProductHelpPromoKey) { views::InkDropState next_state; - if (GetProperty(kHasInProductHelpPromoKey) || GetVisible()) { + if (GetProperty(user_education::kHasInProductHelpPromoKey) || + GetVisible()) { next_state = views::InkDropState::ACTIVATED; } else { next_state = views::InkDropState::DEACTIVATED;
diff --git a/chrome/browser/ui/views/location_bar/star_view.h b/chrome/browser/ui/views/location_bar/star_view.h index ea84eca..52cf84b 100644 --- a/chrome/browser/ui/views/location_bar/star_view.h +++ b/chrome/browser/ui/views/location_bar/star_view.h
@@ -8,9 +8,9 @@ #include <memory> #include "base/memory/raw_ptr.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "components/prefs/pref_member.h" +#include "components/user_education/common/feature_promo_controller.h" #include "ui/base/metadata/metadata_header_macros.h" class Browser;
diff --git a/chrome/browser/ui/views/page_action/pwa_install_view.cc b/chrome/browser/ui/views/page_action/pwa_install_view.cc index f3d6743..18b3e6cb 100644 --- a/chrome/browser/ui/views/page_action/pwa_install_view.cc +++ b/chrome/browser/ui/views/page_action/pwa_install_view.cc
@@ -16,8 +16,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" #include "chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.h" #include "chrome/browser/ui/web_applications/web_app_dialog_utils.h" #include "chrome/browser/web_applications/web_app_constants.h" @@ -27,6 +25,7 @@ #include "components/feature_engagement/public/feature_constants.h" #include "components/omnibox/browser/vector_icons.h" #include "components/site_engagement/content/site_engagement_service.h" +#include "components/user_education/common/feature_promo_controller.h" #include "components/webapps/browser/banners/app_banner_manager.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/ui/views/passwords/password_save_update_view.cc b/chrome/browser/ui/views/passwords/password_save_update_view.cc index ee804f89..53ec4b5a 100644 --- a/chrome/browser/ui/views/passwords/password_save_update_view.cc +++ b/chrome/browser/ui/views/passwords/password_save_update_view.cc
@@ -22,8 +22,6 @@ #include "chrome/browser/ui/passwords/password_dialog_prompts.h" #include "chrome/browser/ui/passwords/passwords_model_delegate.h" #include "chrome/browser/ui/passwords/ui_utils.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/passwords/credentials_item_view.h" @@ -36,6 +34,8 @@ #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" #include "components/password_manager/core/common/password_manager_features.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble_params.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "ui/base/interaction/element_identifier.h" @@ -697,11 +697,11 @@ } break; case IPHType::kFailedReauth: { - FeaturePromoSpecification promo_spec = - FeaturePromoSpecification::CreateForLegacyPromo( + auto promo_spec = + user_education::FeaturePromoSpecification::CreateForLegacyPromo( /* feature =*/nullptr, ui::ElementIdentifier(), IDS_PASSWORD_MANAGER_IPH_BODY_SAVE_REAUTH_FAIL); - promo_spec.SetBubbleArrow(HelpBubbleArrow::kRightCenter); + promo_spec.SetBubbleArrow(user_education::HelpBubbleArrow::kRightCenter); auto* const anchor_element = views::ElementTrackerViews::GetInstance()->GetElementForView(
diff --git a/chrome/browser/ui/views/passwords/password_save_update_view.h b/chrome/browser/ui/views/passwords/password_save_update_view.h index 42d8874..c41cdc67 100644 --- a/chrome/browser/ui/views/passwords/password_save_update_view.h +++ b/chrome/browser/ui/views/passwords/password_save_update_view.h
@@ -9,8 +9,8 @@ #include "base/scoped_observation.h" #include "base/token.h" #include "chrome/browser/ui/passwords/bubble_controllers/save_update_bubble_controller.h" -#include "chrome/browser/ui/user_education/help_bubble.h" #include "chrome/browser/ui/views/passwords/password_bubble_view_base.h" +#include "components/user_education/common/help_bubble.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/views/layout/animating_layout_manager.h" #include "ui/views/view.h" @@ -112,7 +112,7 @@ // When showing kReauthFailure IPH, the promo controller gives back an // ID. This is used to close the bubble later. - std::unique_ptr<HelpBubble> failed_reauth_promo_bubble_; + std::unique_ptr<user_education::HelpBubble> failed_reauth_promo_bubble_; // Hidden view that will contain status text for immediate output by // screen readers when the bubble changes state between Save and Update.
diff --git a/chrome/browser/ui/views/permission_bubble/permission_bubble_interactive_uitest.cc b/chrome/browser/ui/views/permission_bubble/permission_bubble_interactive_uitest.cc index b4865fc..d4050ac 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_bubble_interactive_uitest.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_bubble_interactive_uitest.cc
@@ -159,10 +159,18 @@ EXPECT_EQ(0u, views::test::WidgetTest::GetAllWidgets().size()); } +#if BUILDFLAG(IS_MAC) +// TODO(crbug.com/1324444): For Mac builders, the test fails after activating +// the browser and cannot spot the widget. Needs investigation and fix. +#define MAYBE_SwitchTabs DISABLED_SwitchTabs +#else +#define MAYBE_SwitchTabs SwitchTabs +#endif + // Add a tab, ensure we can switch away and back using Ctrl+Tab and // Ctrl+Shift+Tab at aura and using Cmd+Alt+Left/Right and curly braces at // MacOS. -IN_PROC_BROWSER_TEST_F(PermissionBubbleInteractiveUITest, SwitchTabs) { +IN_PROC_BROWSER_TEST_F(PermissionBubbleInteractiveUITest, MAYBE_SwitchTabs) { EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); EXPECT_TRUE(test_api_->GetPromptWindow());
diff --git a/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_notice_bubble_view.cc b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_notice_bubble_view.cc index c6feea4..0b995656 100644 --- a/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_notice_bubble_view.cc +++ b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_notice_bubble_view.cc
@@ -215,7 +215,7 @@ } void PrivacySandboxNoticeBubbleView::OpenAboutAdPersonalizationSettings() { - chrome::ShowPrivacySandboxSettings(browser_); + chrome::ShowPrivacySandboxLearnMore(browser_); NotifyServiceAboutDialogAction(browser_->profile(), DialogAction::kNoticeLearnMore); GetWidget()->CloseWithReason(
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc index 35fc099..6b3366aa 100644 --- a/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc +++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button.cc
@@ -28,13 +28,13 @@ #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "chrome/grit/generated_resources.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" +#include "components/user_education/common/user_education_class_properties.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/models/menu_model.h" @@ -269,8 +269,9 @@ void AvatarToolbarButton::AfterPropertyChange(const void* key, int64_t old_value) { - if (key == kHasInProductHelpPromoKey) - delegate_->SetHasInProductHelpPromo(GetProperty(kHasInProductHelpPromoKey)); + if (key == user_education::kHasInProductHelpPromoKey) + delegate_->SetHasInProductHelpPromo( + GetProperty(user_education::kHasInProductHelpPromoKey)); ToolbarButton::AfterPropertyChange(key, old_value); }
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc index b63a320..fa2b003a 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -24,13 +24,13 @@ #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/signin/profile_colors_util.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/hover_button.h" #include "chrome/browser/ui/views/profiles/incognito_menu_view.h" #include "chrome/grit/generated_resources.h" #include "components/feature_engagement/public/feature_constants.h" +#include "components/user_education/common/feature_promo_controller.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/metadata/metadata_impl_macros.h"
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc index 23292ed..d9cd683 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_browsertest.cc
@@ -42,7 +42,6 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/test/test_browser_dialog.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/profiles/profile_menu_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" @@ -66,6 +65,7 @@ #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" #include "components/sync/test/fake_server/fake_server_network_resources.h" +#include "components/user_education/common/feature_promo_controller.h" #include "content/public/browser/navigation_entry.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_navigation_observer.h"
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index 87f721d..5901bf2 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
@@ -543,8 +543,7 @@ void OpenProfileFromPicker(const base::FilePath& profile_path, bool open_settings) { base::ListValue args; - args.Append( - base::Value::ToUniquePtrValue(base::FilePathToValue(profile_path))); + args.GetList().Append(base::FilePathToValue(profile_path)); profile_picker_handler()->HandleLaunchSelectedProfile(open_settings, &args); } @@ -1307,10 +1306,10 @@ // Imitate creating a new profile through the profile picker. ProfilePickerHandler* handler = profile_picker_handler(); base::ListValue args; - args.Append(u"My Profile"); // Profile name. - args.Append(std::make_unique<base::Value>()); // Profile color. - args.Append(0); // Avatar index. - args.Append(false); // Create shortcut. + args.GetList().Append(u"My Profile"); // Profile name. + args.GetList().Append(base::Value()); // Profile color. + args.GetList().Append(0); // Avatar index. + args.GetList().Append(false); // Create shortcut. handler->HandleCreateProfile(&args); BrowserAddedWaiter(1u).Wait(); @@ -1559,7 +1558,7 @@ // Simulate clicking on the confirm switch button. ProfilePickerHandler* handler = profile_picker_handler(); base::ListValue args; - args.Append(base::Value::ToUniquePtrValue(base::FilePathToValue(other_path))); + args.GetList().Append(base::FilePathToValue(other_path)); handler->HandleConfirmProfileSwitch(&args); // Browser for a pre-existing profile is displayed.
diff --git a/chrome/browser/ui/views/side_panel/side_panel_web_ui_view.cc b/chrome/browser/ui/views/side_panel/side_panel_web_ui_view.cc index 41fe2018..8ba68491 100644 --- a/chrome/browser/ui/views/side_panel/side_panel_web_ui_view.cc +++ b/chrome/browser/ui/views/side_panel/side_panel_web_ui_view.cc
@@ -12,7 +12,6 @@ #include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h"
diff --git a/chrome/browser/ui/views/side_search/side_search_browser_controller.cc b/chrome/browser/ui/views/side_search/side_search_browser_controller.cc index 294b1d66..c5eac2e 100644 --- a/chrome/browser/ui/views/side_search/side_search_browser_controller.cc +++ b/chrome/browser/ui/views/side_search/side_search_browser_controller.cc
@@ -16,7 +16,6 @@ #include "chrome/browser/ui/page_action/page_action_icon_type.h" #include "chrome/browser/ui/side_search/side_search_utils.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" @@ -29,6 +28,7 @@ #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/public/tracker.h" #include "components/url_formatter/elide_url.h" +#include "components/user_education/common/feature_promo_controller.h" #include "components/vector_icons/vector_icons.h" #include "content/public/browser/navigation_handle.h" #include "ui/base/l10n/l10n_util.h" @@ -458,6 +458,7 @@ void SideSearchBrowserController::OpenSidePanel() { RecordSideSearchOpenAction( SideSearchOpenActionType::kTapOnSideSearchToolbarButton); + RecordSidePanelOpenedMetrics(); // Close the Side Search IPH if it is showing. browser_view_->CloseFeaturePromo(feature_engagement::kIPHSideSearchFeature); auto* tracker = feature_engagement::TrackerFactory::GetForBrowserContext( @@ -622,3 +623,13 @@ if (web_view_->GetVisible()) web_view_->web_contents()->Focus(); } + +void SideSearchBrowserController::RecordSidePanelOpenedMetrics() { + auto* active_contents = browser_view_->GetActiveWebContents(); + if (!active_contents) + return; + + auto* helper = SideSearchTabContentsHelper::FromWebContents(active_contents); + if (helper) + helper->MaybeRecordDurationSidePanelAvailableToFirstOpen(); +}
diff --git a/chrome/browser/ui/views/side_search/side_search_browser_controller.h b/chrome/browser/ui/views/side_search/side_search_browser_controller.h index cea3b94..f7257812 100644 --- a/chrome/browser/ui/views/side_search/side_search_browser_controller.h +++ b/chrome/browser/ui/views/side_search/side_search_browser_controller.h
@@ -100,6 +100,9 @@ // manager to update the visibility of its web_view_ child. void OnWebViewVisibilityChanged(); + // Called after the side panel is toggled open to emit relevant UMA metrics. + void RecordSidePanelOpenedMetrics(); + base::CallbackListSubscription web_view_visibility_subscription_; raw_ptr<ToolbarButton> toolbar_button_ = nullptr;
diff --git a/chrome/browser/ui/views/side_search/side_search_browser_controller_interactive_uitest.cc b/chrome/browser/ui/views/side_search/side_search_browser_controller_interactive_uitest.cc index 261f32e5..fb039c1 100644 --- a/chrome/browser/ui/views/side_search/side_search_browser_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/side_search/side_search_browser_controller_interactive_uitest.cc
@@ -479,6 +479,8 @@ histogram_tester_.ExpectBucketCount( "SideSearch.OpenAction", SideSearchOpenActionType::kTapOnSideSearchToolbarButton, 1); + histogram_tester_.ExpectTotalCount( + "SideSearch.TimeSinceSidePanelAvailableToFirstOpen", 1); // Toggling the close button should close the side panel. NotifyCloseButtonClick(browser()); @@ -617,6 +619,8 @@ NotifyButtonClick(browser()); TestSidePanelOpenEntrypointState(browser()); EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); + histogram_tester_.ExpectTotalCount( + "SideSearch.TimeSinceSidePanelAvailableToFirstOpen", 1); ActivateTabAt(browser(), 0); EXPECT_TRUE(GetSidePanelButtonFor(browser())->GetVisible()); @@ -627,6 +631,8 @@ NotifyButtonClick(browser()); TestSidePanelOpenEntrypointState(browser()); EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); + histogram_tester_.ExpectTotalCount( + "SideSearch.TimeSinceSidePanelAvailableToFirstOpen", 2); ActivateTabAt(browser(), 1); TestSidePanelOpenEntrypointState(browser()); @@ -747,6 +753,21 @@ EXPECT_NE(nullptr, GetSidePanelContentsFor(browser(), 0)); } +IN_PROC_BROWSER_TEST_P(SideSearchBrowserControllerTest, + TimeUntilOpenMetricEmittedCorrectlyMultipleNavigations) { + // Perform a search and navigate multiple times to non-matching pages before + // finally opening the side panel. + NavigateActiveTab(browser(), GetMatchingSearchUrl()); + NavigateActiveTab(browser(), GetNonMatchingUrl()); + NavigateActiveTab(browser(), GetNonMatchingUrl()); + NavigateActiveTab(browser(), GetNonMatchingUrl()); + NotifyButtonClick(browser()); + TestSidePanelOpenEntrypointState(browser()); + EXPECT_TRUE(GetSidePanelFor(browser())->GetVisible()); + histogram_tester_.ExpectTotalCount( + "SideSearch.TimeSinceSidePanelAvailableToFirstOpen", 1); +} + // Only test the side search icon view chip in the DSE configuration. using SideSearchIconViewTest = SideSearchBrowserControllerTest; INSTANTIATE_TEST_SUITE_P(All, SideSearchIconViewTest, testing::Values(true));
diff --git a/chrome/browser/ui/views/tabs/tab_hover_card_controller.cc b/chrome/browser/ui/views/tabs/tab_hover_card_controller.cc index 077401f..4f3ef37 100644 --- a/chrome/browser/ui/views/tabs/tab_hover_card_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_hover_card_controller.cc
@@ -15,7 +15,6 @@ #include "chrome/browser/metrics/tab_count_metrics.h" #include "chrome/browser/ui/tabs/tab_style.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" @@ -24,10 +23,11 @@ #include "chrome/browser/ui/views/tabs/tab_hover_card_thumbnail_observer.h" #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "components/omnibox/browser/omnibox_edit_model.h" #include "components/omnibox/browser/omnibox_popup_view.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/events/event_observer.h" #include "ui/events/types/event_type.h" @@ -96,13 +96,15 @@ // Hover card should always render above help bubbles (see crbug.com/1309238). if (browser_view->GetFeaturePromoController()) { - HelpBubbleFactoryRegistry* const registry = + auto* const registry = browser_view->GetFeaturePromoController()->bubble_factory_registry(); auto* const help_bubble = registry->GetHelpBubble(browser_view->GetElementContext()); - if (help_bubble && help_bubble->IsA<HelpBubbleViews>()) { + if (help_bubble && help_bubble->IsA<user_education::HelpBubbleViews>()) { widget->StackAboveWidget( - help_bubble->AsA<HelpBubbleViews>()->bubble_view()->GetWidget()); + help_bubble->AsA<user_education::HelpBubbleViews>() + ->bubble_view() + ->GetWidget()); } }
diff --git a/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc b/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc index 4b10e24..be702b4 100644 --- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc +++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.cc
@@ -19,7 +19,6 @@ #include "chrome/browser/ui/color/chrome_color_id.h" #include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/toolbar/app_menu_model.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/toolbar/app_menu.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" @@ -27,6 +26,7 @@ #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/feature_engagement/public/feature_constants.h" +#include "components/user_education/common/feature_promo_controller.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/base/resource/resource_bundle.h"
diff --git a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h index 6a57d2ba..9f651d6 100644 --- a/chrome/browser/ui/views/toolbar/browser_app_menu_button.h +++ b/chrome/browser/ui/views/toolbar/browser_app_menu_button.h
@@ -9,8 +9,8 @@ #include "base/memory/weak_ptr.h" #include "base/scoped_observation.h" #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" #include "chrome/browser/ui/views/frame/app_menu_button.h" +#include "components/user_education/common/feature_promo_controller.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/view.h" @@ -61,7 +61,7 @@ // Our owning toolbar view. const raw_ptr<ToolbarView> toolbar_view_; - FeaturePromoController::PromoHandle reopen_tab_promo_handle_; + user_education::FeaturePromoController::PromoHandle reopen_tab_promo_handle_; base::CallbackListSubscription subscription_ = ui::TouchUiController::Get()->RegisterCallback(
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_item_view.cc b/chrome/browser/ui/views/toolbar/chrome_labs_item_view.cc index 23e9706..3eb2407 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_item_view.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_item_view.cc
@@ -12,9 +12,9 @@ #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model.h" -#include "chrome/browser/ui/views/user_education/new_badge_label.h" #include "chrome/grit/generated_resources.h" #include "components/flags_ui/feature_entry.h" +#include "components/user_education/views/new_badge_label.h" #include "extensions/browser/api/feedback_private/feedback_private_api.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -116,8 +116,8 @@ DISTANCE_CONTROL_LIST_VERTICAL), 0))); - experiment_name_ = - AddChildView(std::make_unique<NewBadgeLabel>(lab.visible_name)); + experiment_name_ = AddChildView( + std::make_unique<user_education::NewBadgeLabel>(lab.visible_name)); // The NewBadgeLabel’s default visibility is true. However, we only want the // new badge to show if PrefService conditions are met. Here we set the // default to false. Then, when the bubble is being shown the view controller @@ -125,7 +125,7 @@ experiment_name_->SetDisplayNewBadge(false); experiment_name_->SetHorizontalAlignment(gfx::ALIGN_LEFT); experiment_name_->SetBadgePlacement( - NewBadgeLabel::BadgePlacement::kImmediatelyAfterText); + user_education::NewBadgeLabel::BadgePlacement::kImmediatelyAfterText); views::Label* experiment_description; AddChildView(
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_item_view.h b/chrome/browser/ui/views/toolbar/chrome_labs_item_view.h index 0a597677..b4f62f6 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_item_view.h +++ b/chrome/browser/ui/views/toolbar/chrome_labs_item_view.h
@@ -11,13 +11,16 @@ #include "ui/views/view.h" class Browser; -class NewBadgeLabel; struct LabInfo; namespace flags_ui { struct FeatureEntry; } +namespace user_education { +class NewBadgeLabel; +} + namespace views { class Combobox; class MdTextButton; @@ -50,12 +53,14 @@ return feedback_button_; } - NewBadgeLabel* GetNewBadgeForTesting() { return experiment_name_; } + user_education::NewBadgeLabel* GetNewBadgeForTesting() { + return experiment_name_; + } const flags_ui::FeatureEntry* GetFeatureEntry(); private: - raw_ptr<NewBadgeLabel> experiment_name_; + raw_ptr<user_education::NewBadgeLabel> experiment_name_; // Combobox with selected state of the lab. views::Combobox* lab_state_combobox_;
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_unittest.cc b/chrome/browser/ui/views/toolbar/chrome_labs_unittest.cc index 7228014..4d43d6c 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_unittest.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_unittest.cc
@@ -21,12 +21,12 @@ #include "chrome/browser/ui/views/toolbar/chrome_labs_utils.h" #include "chrome/browser/ui/views/toolbar/chrome_labs_view_controller.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "chrome/browser/ui/views/user_education/new_badge_label.h" #include "chrome/browser/unexpire_flags.h" #include "chrome/test/base/testing_browser_process.h" #include "components/flags_ui/feature_entry_macros.h" #include "components/flags_ui/flags_state.h" #include "components/flags_ui/pref_service_flags_storage.h" +#include "components/user_education/views/new_badge_label.h" #include "components/version_info/channel.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/events/event_utils.h"
diff --git a/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc b/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc index 36f54f0..fe53ac5 100644 --- a/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc +++ b/chrome/browser/ui/views/toolbar/side_panel_toolbar_button.cc
@@ -14,7 +14,6 @@ #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/read_later/reading_list_model_factory.h" #include "chrome/browser/ui/ui_features.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/side_panel/read_later_side_panel_web_view.h" #include "chrome/browser/ui/views/side_panel/side_panel.h"
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc index 20cc89f..f5672ad 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_button.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -24,8 +24,8 @@ #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" +#include "components/user_education/common/user_education_class_properties.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_node_data.h" @@ -548,8 +548,9 @@ void ToolbarButton::AfterPropertyChange(const void* key, int64_t old_value) { View::AfterPropertyChange(key, old_value); - if (key == kHasInProductHelpPromoKey) - SetHasInProductHelpPromo(GetProperty(kHasInProductHelpPromoKey)); + if (key == user_education::kHasInProductHelpPromoKey) + SetHasInProductHelpPromo( + GetProperty(user_education::kHasInProductHelpPromoKey)); } void ToolbarButton::SetHasInProductHelpPromo(bool has_in_product_help_promo) {
diff --git a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc index bba0cca..04879d73a 100644 --- a/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc +++ b/chrome/browser/ui/views/toolbar/webui_tab_counter_button.cc
@@ -23,11 +23,11 @@ #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/flying_indicator.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h" #include "chrome/grit/generated_resources.h" +#include "components/user_education/common/user_education_class_properties.h" #include "components/vector_icons/vector_icons.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" @@ -525,7 +525,7 @@ const SkColor normal_text_color = color_provider->GetColor(kColorToolbarButtonIcon); const SkColor current_text_color = - GetProperty(kHasInProductHelpPromoKey) + GetProperty(user_education::kHasInProductHelpPromoKey) ? color_provider->GetColor(kColorToolbarFeaturePromoHighlight) : normal_text_color; @@ -601,7 +601,7 @@ void WebUITabCounterButton::AfterPropertyChange(const void* key, int64_t old_value) { View::AfterPropertyChange(key, old_value); - if (key != kHasInProductHelpPromoKey) + if (key != user_education::kHasInProductHelpPromoKey) return; UpdateColors(); }
diff --git a/chrome/browser/ui/views/user_education/browser_feature_promo_controller.cc b/chrome/browser/ui/views/user_education/browser_feature_promo_controller.cc index a5ee6f9..66ed018 100644 --- a/chrome/browser/ui/views/user_education/browser_feature_promo_controller.cc +++ b/chrome/browser/ui/views/user_education/browser_feature_promo_controller.cc
@@ -9,9 +9,11 @@ #include "build/build_config.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/grit/generated_resources.h" +#include "components/feature_engagement/public/event_constants.h" +#include "components/feature_engagement/public/feature_constants.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/l10n/l10n_util.h" #include "ui/views/accessible_pane_view.h" @@ -22,10 +24,10 @@ BrowserFeaturePromoController::BrowserFeaturePromoController( BrowserView* browser_view, feature_engagement::Tracker* feature_engagement_tracker, - FeaturePromoRegistry* registry, - HelpBubbleFactoryRegistry* help_bubble_registry, - FeaturePromoSnoozeService* snooze_service, - TutorialService* tutorial_service) + user_education::FeaturePromoRegistry* registry, + user_education::HelpBubbleFactoryRegistry* help_bubble_registry, + user_education::FeaturePromoSnoozeService* snooze_service, + user_education::TutorialService* tutorial_service) : FeaturePromoControllerCommon(feature_engagement_tracker, registry, help_bubble_registry, @@ -82,14 +84,6 @@ return browser_view_; } -std::u16string BrowserFeaturePromoController::GetSnoozeButtonText() const { - return l10n_util::GetStringUTF16(IDS_PROMO_SNOOZE_BUTTON); -} - -std::u16string BrowserFeaturePromoController::GetDismissButtonText() const { - return l10n_util::GetStringUTF16(IDS_PROMO_DISMISS_BUTTON); -} - std::u16string BrowserFeaturePromoController::GetTutorialScreenReaderHint() const { ui::Accelerator accelerator; @@ -114,12 +108,13 @@ std::u16string BrowserFeaturePromoController::GetFocusHelpBubbleScreenReaderHint( - FeaturePromoSpecification::PromoType promo_type, + user_education::FeaturePromoSpecification::PromoType promo_type, ui::TrackedElement* anchor_element, bool is_critical_promo) const { // No message is required as this is a background bubble with a // screen reader-specific prompt and will dismiss itself. - if (promo_type == FeaturePromoSpecification::PromoType::kToast) + if (promo_type == + user_education::FeaturePromoSpecification::PromoType::kToast) return std::u16string(); ui::Accelerator accelerator; @@ -132,7 +127,8 @@ // Present the user with the full help bubble navigation shortcut. auto* const anchor_view = anchor_element->AsA<views::TrackedElementViews>(); - if (promo_type == FeaturePromoSpecification::PromoType::kTutorial || + if (promo_type == + user_education::FeaturePromoSpecification::PromoType::kTutorial || (anchor_view && (anchor_view->view()->IsAccessibilityFocusable() || views::IsViewClass<views::AccessiblePaneView>(anchor_view->view())))) { @@ -149,3 +145,17 @@ return l10n_util::GetStringFUTF16(IDS_FOCUS_HELP_BUBBLE_DESCRIPTION, accelerator_text); } + +std::u16string BrowserFeaturePromoController::GetBodyIconAltText() const { + return l10n_util::GetStringUTF16(IDS_CHROME_TIP); +} + +const base::Feature* +BrowserFeaturePromoController::GetScreenReaderPromptPromoFeature() const { + return &feature_engagement::kIPHFocusHelpBubbleScreenReaderPromoFeature; +} + +const char* BrowserFeaturePromoController::GetScreenReaderPromptPromoEventName() + const { + return feature_engagement::events::kFocusHelpBubbleAcceleratorPromoRead; +}
diff --git a/chrome/browser/ui/views/user_education/browser_feature_promo_controller.h b/chrome/browser/ui/views/user_education/browser_feature_promo_controller.h index 67ba5d5..a3455f15 100644 --- a/chrome/browser/ui/views/user_education/browser_feature_promo_controller.h +++ b/chrome/browser/ui/views/user_education/browser_feature_promo_controller.h
@@ -5,19 +5,13 @@ #ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_BROWSER_FEATURE_PROMO_CONTROLLER_H_ #define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_BROWSER_FEATURE_PROMO_CONTROLLER_H_ +#include <string> #include "base/gtest_prod_util.h" #include "base/memory/raw_ptr.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" +#include "components/user_education/common/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_specification.h" #include "ui/base/interaction/element_identifier.h" -class BrowserView; -class FeaturePromoRegistry; -class FeaturePromoSnoozeService; -class HelpBubbleFactoryRegistry; -class TutorialService; - namespace feature_engagement { class Tracker; } @@ -27,9 +21,18 @@ class TrackedElement; } // namespace ui +namespace user_education { +class FeaturePromoRegistry; +class FeaturePromoSnoozeService; +class HelpBubbleFactoryRegistry; +class TutorialService; +} // namespace user_education + namespace views { class View; -} // namespace views +} + +class BrowserView; // Browser implementation of FeaturePromoController. There is one instance per // browser window. @@ -37,16 +40,17 @@ // This is implemented in c/b/ui/views specifically because some of the logic // requires understanding of the existence of views, not because this is a // views-specific implementation. -class BrowserFeaturePromoController : public FeaturePromoControllerCommon { +class BrowserFeaturePromoController + : public user_education::FeaturePromoControllerCommon { public: // Create the instance for the given |browser_view|. BrowserFeaturePromoController( BrowserView* browser_view, feature_engagement::Tracker* feature_engagement_tracker, - FeaturePromoRegistry* registry, - HelpBubbleFactoryRegistry* help_bubble_registry, - FeaturePromoSnoozeService* snooze_service, - TutorialService* tutorial_service); + user_education::FeaturePromoRegistry* registry, + user_education::HelpBubbleFactoryRegistry* help_bubble_registry, + user_education::FeaturePromoSnoozeService* snooze_service, + user_education::TutorialService* tutorial_service); ~BrowserFeaturePromoController() override; // Get the appropriate instance for |view|. This finds the BrowserView @@ -55,7 +59,7 @@ static BrowserFeaturePromoController* GetForView(views::View* view); // Returns true if IPH are allowed to show in an inactive window or app. - // False by default, but bunit tests may modify this behavior via + // False by default, but unit tests may modify this behavior via // BlockActiveWindowCheckForTesting(). Exposed here for testing purposes. static bool active_window_check_blocked_for_testing() { return active_window_check_blocked(); @@ -73,13 +77,14 @@ ui::ElementContext GetAnchorContext() const override; bool CanShowPromo(ui::TrackedElement* anchor_element) const override; const ui::AcceleratorProvider* GetAcceleratorProvider() const override; - std::u16string GetSnoozeButtonText() const override; - std::u16string GetDismissButtonText() const override; std::u16string GetTutorialScreenReaderHint() const override; std::u16string GetFocusHelpBubbleScreenReaderHint( - FeaturePromoSpecification::PromoType promo_type, + user_education::FeaturePromoSpecification::PromoType promo_type, ui::TrackedElement* anchor_element, bool is_critical_promo) const override; + std::u16string GetBodyIconAltText() const override; + const base::Feature* GetScreenReaderPromptPromoFeature() const override; + const char* GetScreenReaderPromptPromoEventName() const override; private: // The browser window this instance is responsible for.
diff --git a/chrome/browser/ui/views/user_education/browser_feature_promo_controller_unittest.cc b/chrome/browser/ui/views/user_education/browser_feature_promo_controller_unittest.cc index e79927c..e40c58a8 100644 --- a/chrome/browser/ui/views/user_education/browser_feature_promo_controller_unittest.cc +++ b/chrome/browser/ui/views/user_education/browser_feature_promo_controller_unittest.cc
@@ -14,29 +14,30 @@ #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/feature_promo_snooze_service.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" #include "chrome/browser/ui/user_education/user_education_service.h" #include "chrome/browser/ui/user_education/user_education_service_factory.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/test_with_browser_view.h" #include "chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h" #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/testing_profile.h" #include "components/feature_engagement/test/mock_tracker.h" +#include "components/user_education/common/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/feature_promo_snooze_service.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_service.h" +#include "components/user_education/common/user_education_class_properties.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_tracker.h" @@ -63,6 +64,18 @@ constexpr char kTestTutorialIdentifier[] = "Test Tutorial"; } // namespace +using user_education::FeaturePromoController; +using user_education::FeaturePromoRegistry; +using user_education::FeaturePromoSnoozeService; +using user_education::FeaturePromoSpecification; +using user_education::HelpBubble; +using user_education::HelpBubbleArrow; +using user_education::HelpBubbleFactoryRegistry; +using user_education::HelpBubbleParams; +using user_education::HelpBubbleView; +using user_education::HelpBubbleViews; +using user_education::TutorialDescription; + class BrowserFeaturePromoControllerTest : public TestWithBrowserView { public: void SetUp() override { @@ -506,13 +519,16 @@ .Times(1) .WillOnce(Return(true)); - EXPECT_FALSE(GetAnchorView()->GetProperty(kHasInProductHelpPromoKey)); + EXPECT_FALSE( + GetAnchorView()->GetProperty(user_education::kHasInProductHelpPromoKey)); ASSERT_TRUE(controller_->MaybeShowPromo(kTestIPHFeature)); - EXPECT_TRUE(GetAnchorView()->GetProperty(kHasInProductHelpPromoKey)); + EXPECT_TRUE( + GetAnchorView()->GetProperty(user_education::kHasInProductHelpPromoKey)); controller_->CloseBubble(kTestIPHFeature); - EXPECT_FALSE(GetAnchorView()->GetProperty(kHasInProductHelpPromoKey)); + EXPECT_FALSE( + GetAnchorView()->GetProperty(user_education::kHasInProductHelpPromoKey)); } TEST_F(BrowserFeaturePromoControllerTest, TestCanBlockPromos) {
diff --git a/chrome/browser/ui/views/user_education/browser_user_education_service.cc b/chrome/browser/ui/views/user_education/browser_user_education_service.cc index effe970f..35c8486e 100644 --- a/chrome/browser/ui/views/user_education/browser_user_education_service.cc +++ b/chrome/browser/ui/views/user_education/browser_user_education_service.cc
@@ -10,19 +10,23 @@ #include "build/chromeos_buildflags.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/app/vector_icons/vector_icons.h" +#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" +#include "chrome/browser/ui/color/chrome_color_id.h" +#include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/strings/grit/components_strings.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_registry.h" +#include "components/user_education/views/help_bubble_delegate.h" +#include "components/user_education/views/help_bubble_factory_views.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" @@ -33,7 +37,7 @@ #include "ui/views/widget/widget.h" #if BUILDFLAG(IS_MAC) -#include "chrome/browser/ui/views/user_education/help_bubble_factory_mac.h" +#include "components/user_education/views/help_bubble_factory_mac.h" #endif namespace { @@ -41,11 +45,10 @@ const char kTabGroupTutorialMetricPrefix[] = "TabGroup"; constexpr char kTabGroupHeaderElementName[] = "TabGroupHeader"; -class BrowserHelpBubbleAcceleratorDelegate - : public HelpBubbleAcceleratorDelegate { +class BrowserHelpBubbleDelegate : public user_education::HelpBubbleDelegate { public: - BrowserHelpBubbleAcceleratorDelegate() = default; - ~BrowserHelpBubbleAcceleratorDelegate() override = default; + BrowserHelpBubbleDelegate() = default; + ~BrowserHelpBubbleDelegate() override = default; std::vector<ui::Accelerator> GetPaneNavigationAccelerators( ui::TrackedElement* anchor_element) const override { @@ -73,21 +76,68 @@ } return result; } + + int GetTitleTextContext() const override { + return ChromeTextContext::CONTEXT_IPH_BUBBLE_TITLE; + } + int GetBodyTextContext() const override { + return ChromeTextContext::CONTEXT_IPH_BUBBLE_BODY; + } + int GetButtonTextContext() const override { + return ChromeTextContext::CONTEXT_IPH_BUBBLE_BUTTON; + } + + // These methods return color codes that will be handled by the app's theming + // system. + int GetHelpBubbleBackgroundColor() const override { + return ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BACKGROUND; + } + int GetHelpBubbleForegroundColor() const override { + return ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND; + } + int GetHelpBubbleDefaultButtonBackgroundColor() const override { + return ThemeProperties:: + COLOR_FEATURE_PROMO_BUBBLE_DEFAULT_BUTTON_BACKGROUND; + } + int GetHelpBubbleDefaultButtonForegroundColor() const override { + return ThemeProperties:: + COLOR_FEATURE_PROMO_BUBBLE_DEFAULT_BUTTON_FOREGROUND; + } + int GetHelpBubbleButtonBorderColor() const override { + return ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BUTTON_BORDER; + } + int GetHelpBubbleCloseButtonInkDropColor() const override { + return ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_CLOSE_BUTTON_INK_DROP; + } + ui::ColorId GetHelpBubbleBackgroundColorId() const override { + return kColorFeaturePromoBubbleBackground; + } }; } // namespace const char kTabGroupTutorialId[] = "Tab Group Tutorial"; -void RegisterChromeHelpBubbleFactories(HelpBubbleFactoryRegistry& registry) { - static base::NoDestructor<BrowserHelpBubbleAcceleratorDelegate> delegate; - registry.MaybeRegister<HelpBubbleFactoryViews>(delegate.get()); +user_education::HelpBubbleDelegate* GetHelpBubbleDelegate() { + static base::NoDestructor<BrowserHelpBubbleDelegate> delegate; + return delegate.get(); +} + +void RegisterChromeHelpBubbleFactories( + user_education::HelpBubbleFactoryRegistry& registry) { + const user_education::HelpBubbleDelegate* const delegate = + GetHelpBubbleDelegate(); + registry.MaybeRegister<user_education::HelpBubbleFactoryViews>(delegate); #if BUILDFLAG(IS_MAC) - registry.MaybeRegister<HelpBubbleFactoryMac>(); + registry.MaybeRegister<user_education::HelpBubbleFactoryMac>(delegate); #endif } -void MaybeRegisterChromeFeaturePromos(FeaturePromoRegistry& registry) { +void MaybeRegisterChromeFeaturePromos( + user_education::FeaturePromoRegistry& registry) { + using user_education::FeaturePromoSpecification; + using user_education::HelpBubbleArrow; + // Verify that we haven't already registered the expected features. // TODO(dfried): figure out if we should do something more sophisticated here. if (registry.IsFeatureRegistered( @@ -105,9 +155,10 @@ .SetBubbleArrow(HelpBubbleArrow::kLeftCenter))); // kIPHDesktopPwaInstallFeature: - registry.RegisterFeature(FeaturePromoSpecification::CreateForLegacyPromo( - &feature_engagement::kIPHDesktopPwaInstallFeature, kInstallPwaElementId, - IDS_DESKTOP_PWA_INSTALL_PROMO)); + registry.RegisterFeature( + user_education::FeaturePromoSpecification::CreateForLegacyPromo( + &feature_engagement::kIPHDesktopPwaInstallFeature, + kInstallPwaElementId, IDS_DESKTOP_PWA_INSTALL_PROMO)); // kIPHDesktopTabGroupsNewGroupFeature: registry.RegisterFeature( @@ -209,7 +260,11 @@ .SetBubbleArrow(HelpBubbleArrow::kNone))); } -void MaybeRegisterChromeTutorials(TutorialRegistry& tutorial_registry) { +void MaybeRegisterChromeTutorials( + user_education::TutorialRegistry& tutorial_registry) { + using user_education::HelpBubbleArrow; + using user_education::TutorialDescription; + // TODO (dfried): we might want to do something more sophisticated in the // future. if (tutorial_registry.IsTutorialRegistered(kTabGroupTutorialId)) @@ -290,7 +345,7 @@ description.steps.emplace_back(std::move(success_step)); description.histograms = - MakeTutorialHistograms<kTabGroupTutorialMetricPrefix>( + user_education::MakeTutorialHistograms<kTabGroupTutorialMetricPrefix>( description.steps.size()); tutorial_registry.AddTutorial(kTabGroupTutorialId, std::move(description)); }
diff --git a/chrome/browser/ui/views/user_education/browser_user_education_service.h b/chrome/browser/ui/views/user_education/browser_user_education_service.h index dc0b0cb..815751b5 100644 --- a/chrome/browser/ui/views/user_education/browser_user_education_service.h +++ b/chrome/browser/ui/views/user_education/browser_user_education_service.h
@@ -7,15 +7,21 @@ #include "chrome/browser/ui/user_education/user_education_service.h" +namespace user_education { class FeaturePromoRegistry; class HelpBubbleFactoryRegistry; class TutorialRegistry; +class HelpBubbleDelegate; +} // namespace user_education extern const char kTabGroupTutorialId[]; +extern user_education::HelpBubbleDelegate* GetHelpBubbleDelegate(); extern void RegisterChromeHelpBubbleFactories( - HelpBubbleFactoryRegistry& registry); -extern void MaybeRegisterChromeFeaturePromos(FeaturePromoRegistry& registry); -extern void MaybeRegisterChromeTutorials(TutorialRegistry& registry); + user_education::HelpBubbleFactoryRegistry& registry); +extern void MaybeRegisterChromeFeaturePromos( + user_education::FeaturePromoRegistry& registry); +extern void MaybeRegisterChromeTutorials( + user_education::TutorialRegistry& registry); #endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_BROWSER_USER_EDUCATION_SERVICE_H_
diff --git a/chrome/browser/ui/views/user_education/feature_promo_dialog_interactive_uitest.cc b/chrome/browser/ui/views/user_education/feature_promo_dialog_interactive_uitest.cc index 70397c7..4cc46b92 100644 --- a/chrome/browser/ui/views/user_education/feature_promo_dialog_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/feature_promo_dialog_interactive_uitest.cc
@@ -52,8 +52,8 @@ // Returns an appropriate set of string replacements; passing the wrong number // of replacements for the body text of the IPH will cause a DCHECK. -FeaturePromoSpecification::StringReplacements GetReplacementsForFeature( - const base::Feature& feature) { +user_education::FeaturePromoSpecification::StringReplacements +GetReplacementsForFeature(const base::Feature& feature) { if (&feature == &feature_engagement::kIPHDesktopPwaInstallFeature) return {u"Placeholder Text"}; return {};
diff --git a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc index e657faf..24eb2ef 100644 --- a/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/feature_promo_snooze_interactive_uitest.cc
@@ -11,17 +11,17 @@ #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/user_education/feature_promo_snooze_service.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/feature_engagement/public/feature_constants.h" #include "components/feature_engagement/test/mock_tracker.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" +#include "components/user_education/common/feature_promo_snooze_service.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -69,7 +69,7 @@ if (!promo_controller_->registry()->IsFeatureRegistered( kSnoozeTestFeature)) { promo_controller_->registry()->RegisterFeature( - FeaturePromoSpecification::CreateForSnoozePromo( + user_education::FeaturePromoSpecification::CreateForSnoozePromo( kSnoozeTestFeature, kAppMenuButtonElementId, IDS_TAB_GROUPS_NEW_GROUP_PROMO)); } @@ -133,7 +133,7 @@ absl::optional<base::Time> last_show_time, base::Time last_snooze_time, base::TimeDelta last_snooze_duration) { - FeaturePromoSnoozeService::SnoozeData data; + user_education::FeaturePromoSnoozeService::SnoozeData data; data.is_dismissed = is_dismissed; if (show_count) data.show_count = *show_count; @@ -168,9 +168,9 @@ } } - HelpBubbleView* GetPromoBubbleView() { + user_education::HelpBubbleView* GetPromoBubbleView() { return promo_controller_->promo_bubble_for_testing() - ->AsA<HelpBubbleViews>() + ->AsA<user_education::HelpBubbleViews>() ->bubble_view(); } @@ -184,7 +184,7 @@ raw_ptr<NiceMock<feature_engagement::test::MockTracker>> mock_tracker_; raw_ptr<BrowserFeaturePromoController> promo_controller_; - raw_ptr<FeaturePromoSnoozeService> snooze_service_; + raw_ptr<user_education::FeaturePromoSnoozeService> snooze_service_; private: static void RegisterMockTracker(content::BrowserContext* context) {
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_mac.h b/chrome/browser/ui/views/user_education/help_bubble_factory_mac.h deleted file mode 100644 index df75cbe..0000000 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_mac.h +++ /dev/null
@@ -1,26 +0,0 @@ -// 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. - -#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_MAC_H_ -#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_MAC_H_ - -#include "chrome/browser/ui/user_education/help_bubble_factory.h" - -// Factory implementation for HelpBubbleViews. -class HelpBubbleFactoryMac : public HelpBubbleFactory { - public: - HelpBubbleFactoryMac(); - ~HelpBubbleFactoryMac() override; - - DECLARE_FRAMEWORK_SPECIFIC_METADATA() - - // HelpBubbleFactory: - std::unique_ptr<HelpBubble> CreateBubble(ui::TrackedElement* element, - HelpBubbleParams params) override; - bool CanBuildBubbleForTrackedElement( - const ui::TrackedElement* element) const override; -}; - -#endif // #ifndef - // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_MAC_H_
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_registry_interactive_uitest.cc b/chrome/browser/ui/views/user_education/help_bubble_factory_registry_interactive_uitest.cc index b18260e..a4a2432 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_registry_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/help_bubble_factory_registry_interactive_uitest.cc
@@ -7,7 +7,6 @@ #include "build/build_config.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/tabs/tab_menu_model.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" @@ -15,10 +14,11 @@ #include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/interaction/interaction_test_util_browser.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "ui/base/interaction/expect_call_in_scope.h" #include "ui/base/interaction/interaction_sequence.h" @@ -36,10 +36,10 @@ ~HelpBubbleFactoryRegistryInteractiveUitest() override = default; protected: - HelpBubbleParams GetBubbleParams() { - HelpBubbleParams params; + user_education::HelpBubbleParams GetBubbleParams() { + user_education::HelpBubbleParams params; params.body_text = u"To X, do Y"; - params.arrow = HelpBubbleArrow::kRightTop; + params.arrow = user_education::HelpBubbleArrow::kRightTop; return params; } @@ -51,7 +51,7 @@ return browser()->window()->GetElementContext(); } - HelpBubbleFactoryRegistry* GetRegistry() { + user_education::HelpBubbleFactoryRegistry* GetRegistry() { return GetBrowserView() ->GetFeaturePromoController() ->bubble_factory_registry();
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc b/chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc index b6c843e..d412637 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc +++ b/chrome/browser/ui/views/user_education/help_bubble_factory_views_browsertest.cc
@@ -10,14 +10,14 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/test/test_browser_dialog.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/test/interaction/interaction_test_util_browser.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" @@ -31,10 +31,10 @@ public: // DialogBrowserTest: void ShowUi(const std::string& name) override { - HelpBubbleParams params; - params.arrow = HelpBubbleArrow::kTopRight; + user_education::HelpBubbleParams params; + params.arrow = user_education::HelpBubbleArrow::kTopRight; params.body_text = u"Hello world, I am a tutorial"; - params.tutorial_progress = std::make_pair(3, 5); + params.progress = std::make_pair(3, 5); params.timeout = base::TimeDelta(); help_bubble_ = @@ -46,7 +46,7 @@ return browser()->window()->GetElementContext(); } - HelpBubbleFactoryRegistry* registry() { + user_education::HelpBubbleFactoryRegistry* registry() { return BrowserView::GetBrowserViewForBrowser(browser()) ->GetFeaturePromoController() ->bubble_factory_registry(); @@ -59,7 +59,7 @@ ->app_menu_button()); } - std::unique_ptr<HelpBubble> help_bubble_; + std::unique_ptr<user_education::HelpBubble> help_bubble_; }; IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsBrowsertest, InvokeUi_default) { @@ -67,19 +67,19 @@ } IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsBrowsertest, ShowAndClose) { - HelpBubbleParams params; + user_education::HelpBubbleParams params; params.body_text = u"Hello world!"; help_bubble_ = registry()->CreateHelpBubble(GetAnchorElement(), std::move(params)); ASSERT_TRUE(help_bubble_); - ASSERT_TRUE(help_bubble_->IsA<HelpBubbleViews>()); + ASSERT_TRUE(help_bubble_->IsA<user_education::HelpBubbleViews>()); EXPECT_TRUE(help_bubble_->is_open()); EXPECT_TRUE(help_bubble_->Close()); EXPECT_FALSE(help_bubble_->is_open()); } IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsBrowsertest, GetContext) { - HelpBubbleParams params; + user_education::HelpBubbleParams params; params.body_text = u"Hello world!"; help_bubble_ = registry()->CreateHelpBubble(GetAnchorElement(), std::move(params)); @@ -92,7 +92,7 @@ // adjustments to the logic as necessary (specifically how we adjust the // browser size to force the help bubble to move). IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsBrowsertest, GetAndUpdateBounds) { - HelpBubbleParams params; + user_education::HelpBubbleParams params; params.body_text = u"Hello world!"; help_bubble_ = registry()->CreateHelpBubble(GetAnchorElement(), std::move(params));
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_views_interactive_uitest.cc b/chrome/browser/ui/views/user_education/help_bubble_factory_views_interactive_uitest.cc index 3e38672..a426b2a 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_views_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/help_bubble_factory_views_interactive_uitest.cc
@@ -8,15 +8,15 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/interaction/interaction_test_util_browser.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" @@ -30,7 +30,7 @@ return browser()->window()->GetElementContext(); } - HelpBubbleFactoryRegistry* registry() { + user_education::HelpBubbleFactoryRegistry* registry() { return BrowserView::GetBrowserViewForBrowser(browser()) ->GetFeaturePromoController() ->bubble_factory_registry(); @@ -48,17 +48,17 @@ // not reliable when running alongside other tests). IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsUiTest, ToggleFocusForAccessibility) { - HelpBubbleParams params; + user_education::HelpBubbleParams params; params.body_text = u"Hello world!"; - HelpBubbleButtonParams button_params; + user_education::HelpBubbleButtonParams button_params; button_params.text = u"Button"; button_params.is_default = true; params.buttons.emplace_back(std::move(button_params)); - std::unique_ptr<HelpBubble> help_bubble = + std::unique_ptr<user_education::HelpBubble> help_bubble = registry()->CreateHelpBubble(GetAnchorElement(), std::move(params)); - HelpBubbleView* const bubble_view = - help_bubble->AsA<HelpBubbleViews>()->bubble_view(); + auto* const bubble_view = + help_bubble->AsA<user_education::HelpBubbleViews>()->bubble_view(); // Toggle focus to the help widget and then wait for it to be focused. { @@ -97,13 +97,13 @@ IN_PROC_BROWSER_TEST_F(HelpBubbleFactoryViewsUiTest, ToggleFocusViaAccelerator) { - HelpBubbleParams params; + user_education::HelpBubbleParams params; params.body_text = u"Hello world!"; auto help_bubble_ptr = registry()->CreateHelpBubble(GetAnchorElement(), std::move(params)); auto* const browser_view = BrowserView::GetBrowserViewForBrowser(browser()); auto* const bubble_view = - help_bubble_ptr->AsA<HelpBubbleViews>()->bubble_view(); + help_bubble_ptr->AsA<user_education::HelpBubbleViews>()->bubble_view(); #if BUILDFLAG(IS_MAC)
diff --git a/chrome/browser/ui/views/user_education/help_bubble_view_interactive_uitest.cc b/chrome/browser/ui/views/user_education/help_bubble_view_interactive_uitest.cc index 50b31f68..2412597 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/help_bubble_view_interactive_uitest.cc
@@ -2,19 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/threading/thread_task_runner_handle.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" - #include "base/test/bind.h" +#include "base/threading/thread_task_runner_handle.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/tabs/tab_group_header.h" #include "chrome/browser/ui/views/toolbar/browser_app_menu_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "chrome/browser/ui/views/user_education/browser_user_education_service.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/interactive_test_utils.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "ui/base/interaction/expect_call_in_scope.h" #include "ui/base/interaction/interaction_sequence.h" @@ -24,6 +25,10 @@ #include "ui/views/test/widget_test.h" #include "ui/views/view_utils.h" +using user_education::HelpBubbleArrow; +using user_education::HelpBubbleParams; +using user_education::HelpBubbleView; + class HelpBubbleViewInteractiveTest : public InProcessBrowserTest { public: HelpBubbleViewInteractiveTest() = default; @@ -57,8 +62,8 @@ views::View* const initial_focused_view = focus_manager->GetFocusedView(); EXPECT_NE(nullptr, initial_focused_view); - auto* const bubble = - new HelpBubbleView(GetAnchorElement()->view(), std::move(params)); + auto* const bubble = new HelpBubbleView( + GetHelpBubbleDelegate(), GetAnchorElement()->view(), std::move(params)); views::test::WidgetVisibleWaiter(bubble->GetWidget()).Wait(); EXPECT_TRUE(browser_view->GetWidget()->IsActive()); @@ -113,7 +118,8 @@ HelpBubbleParams params; params.body_text = u"foo"; help_bubble_view = - new HelpBubbleView(anchor_view, std::move(params)); + new HelpBubbleView(GetHelpBubbleDelegate(), + anchor_view, std::move(params)); })) .Build()) .AddStep(
diff --git a/chrome/browser/ui/views/user_education/help_bubble_view_timeout_unittest.cc b/chrome/browser/ui/views/user_education/help_bubble_view_timeout_unittest.cc new file mode 100644 index 0000000..2f4fef73 --- /dev/null +++ b/chrome/browser/ui/views/user_education/help_bubble_view_timeout_unittest.cc
@@ -0,0 +1,170 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> + +#include "base/bind.h" +#include "base/callback_forward.h" +#include "base/callback_helpers.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/mock_callback.h" +#include "base/test/task_environment.h" +#include "base/time/time.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/frame/test_with_browser_view.h" +#include "chrome/browser/ui/views/user_education/browser_user_education_service.h" +#include "chrome/test/data/grit/chrome_test_resources.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_view.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "ui/base/interaction/expect_call_in_scope.h" +#include "ui/views/widget/widget_observer.h" + +using user_education::HelpBubbleArrow; +using user_education::HelpBubbleButtonParams; +using user_education::HelpBubbleParams; +using user_education::HelpBubbleView; + +namespace { +class TestHelpBubbleView : public HelpBubbleView { + public: + using HelpBubbleView::HelpBubbleView; + using HelpBubbleView::OnWidgetActivationChanged; +}; +} // namespace + +// Testing timeouts can be flaky on some platforms without the full browser view +// and its message pump, so we do these tests here rather than in the +// user_education component. +class HelpBubbleViewTimeoutTest : public TestWithBrowserView { + public: + HelpBubbleViewTimeoutTest() + : TestWithBrowserView( + base::test::SingleThreadTaskEnvironment::TimeSource::MOCK_TIME) {} + ~HelpBubbleViewTimeoutTest() override = default; + + protected: + HelpBubbleParams GetBubbleParams() { + HelpBubbleParams params; + params.body_text = u"To X, do Y"; + params.arrow = HelpBubbleArrow::kTopRight; + return params; + } + + TestHelpBubbleView* CreateHelpBubbleView(HelpBubbleParams params) { + return new TestHelpBubbleView(GetHelpBubbleDelegate(), + browser_view()->contents_container(), + std::move(params)); + } +}; + +class MockWidgetObserver : public views::WidgetObserver { + public: + MOCK_METHOD(void, OnWidgetClosing, (views::Widget*), ()); +}; + +TEST_F(HelpBubbleViewTimeoutTest, DismissOnTimeout) { + HelpBubbleParams params = GetBubbleParams(); + params.timeout = base::Seconds(30); + HelpBubbleView* const bubble = CreateHelpBubbleView(std::move(params)); + MockWidgetObserver dismiss_observer; + EXPECT_CALL(dismiss_observer, OnWidgetClosing(testing::_)).Times(1); + bubble->GetWidget()->AddObserver(&dismiss_observer); + task_environment()->FastForwardBy(base::Minutes(1)); + task_environment()->RunUntilIdle(); +} + +TEST_F(HelpBubbleViewTimeoutTest, NoAutoDismissWithoutTimeout) { + // Without a button, there is a default timeout; with a button there is none. + HelpBubbleParams params = GetBubbleParams(); + HelpBubbleButtonParams button_params; + button_params.text = u"button"; + params.buttons.push_back(std::move(button_params)); + HelpBubbleView* const bubble = CreateHelpBubbleView(std::move(params)); + MockWidgetObserver dismiss_observer; + EXPECT_CALL(dismiss_observer, OnWidgetClosing(testing::_)).Times(0); + bubble->GetWidget()->AddObserver(&dismiss_observer); + task_environment()->FastForwardBy(base::Minutes(1)); + task_environment()->RunUntilIdle(); + // WidgetObserver checks if it is in an observer list in its destructor. + // Need to remove it from widget manually. + bubble->GetWidget()->RemoveObserver(&dismiss_observer); +} + +TEST_F(HelpBubbleViewTimeoutTest, TimeoutCallback) { + base::MockRepeatingClosure timeout_callback; + + HelpBubbleParams params = GetBubbleParams(); + params.timeout = base::Seconds(10); + params.timeout_callback = timeout_callback.Get(); + + CreateHelpBubbleView(std::move(params)); + + EXPECT_CALL(timeout_callback, Run()).Times(1); + task_environment()->FastForwardBy(base::Seconds(10)); +} + +TEST_F(HelpBubbleViewTimeoutTest, NoTimeoutIfSetToZero) { + base::MockRepeatingClosure timeout_callback; + + HelpBubbleParams params = GetBubbleParams(); + params.timeout = base::TimeDelta(); + params.timeout_callback = timeout_callback.Get(); + + CreateHelpBubbleView(std::move(params)); + + EXPECT_CALL(timeout_callback, Run()).Times(0); + + // Fast forward by a long time to check bubble does not time out. + task_environment()->FastForwardBy(base::Hours(1)); +} + +TEST_F(HelpBubbleViewTimeoutTest, RespectsProvidedTimeoutBeforeActivate) { + base::MockRepeatingClosure timeout_callback; + + HelpBubbleParams params = GetBubbleParams(); + params.timeout = base::Seconds(20); + params.timeout_callback = timeout_callback.Get(); + + CreateHelpBubbleView(std::move(params)); + + EXPECT_CALL(timeout_callback, Run()).Times(0); + task_environment()->FastForwardBy(base::Seconds(19)); + + EXPECT_CALL(timeout_callback, Run()).Times(1); + task_environment()->FastForwardBy(base::Seconds(1)); +} + +TEST_F(HelpBubbleViewTimeoutTest, RespectsProvidedTimeoutAfterActivate) { + base::MockRepeatingClosure timeout_callback; + + HelpBubbleParams params = GetBubbleParams(); + params.timeout = base::Seconds(10); + params.timeout_callback = timeout_callback.Get(); + + EXPECT_CALL(timeout_callback, Run()).Times(0); + + TestHelpBubbleView* const bubble = CreateHelpBubbleView(std::move(params)); + + task_environment()->FastForwardBy(base::Seconds(9)); + + // Simulate bubble activation. We won't actually activate the bubble since + // bubble visibility and activation don't work well in this mock environment. + bubble->OnWidgetActivationChanged(bubble->GetWidget(), true); + + // The bubble should not time out since it is active. + task_environment()->FastForwardBy(base::Seconds(4)); + + // Deactivating the widget should restart the timer. + bubble->OnWidgetActivationChanged(bubble->GetWidget(), false); + + // Wait most of the timeout, but not all of it. + task_environment()->FastForwardBy(base::Seconds(9)); + + EXPECT_CALL(timeout_callback, Run()).Times(1); + + // Finishing the timeout should dismiss the bubble. + task_environment()->FastForwardBy(base::Seconds(1)); +}
diff --git a/chrome/browser/ui/views/user_education/help_bubble_view_unittest.cc b/chrome/browser/ui/views/user_education/help_bubble_view_unittest.cc deleted file mode 100644 index c88a4dc..0000000 --- a/chrome/browser/ui/views/user_education/help_bubble_view_unittest.cc +++ /dev/null
@@ -1,227 +0,0 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" - -#include <memory> - -#include "base/bind.h" -#include "base/callback_forward.h" -#include "base/callback_helpers.h" -#include "base/strings/utf_string_conversions.h" -#include "base/test/mock_callback.h" -#include "base/test/task_environment.h" -#include "base/time/time.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/frame/test_with_browser_view.h" -#include "chrome/test/data/grit/chrome_test_resources.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "ui/base/interaction/expect_call_in_scope.h" -#include "ui/base/interaction/interaction_test_util.h" -#include "ui/views/interaction/interaction_test_util_views.h" -#include "ui/views/widget/widget_observer.h" - -class HelpBubbleViewTest : public TestWithBrowserView { - public: - HelpBubbleViewTest() - : TestWithBrowserView( - base::test::SingleThreadTaskEnvironment::TimeSource::MOCK_TIME) {} - - protected: - // If |button_callback| is non-nil, creates the bubble with one button calling - // that callback. Otherwise has no buttons. - HelpBubbleParams GetBubbleParams( - base::RepeatingClosure button_callback = base::DoNothing()) { - HelpBubbleParams params; - params.body_text = u"To X, do Y"; - params.arrow = HelpBubbleArrow::kTopRight; - - if (button_callback) { - HelpBubbleButtonParams button_params; - button_params.text = u"Go away"; - button_params.is_default = true; - button_params.callback = std::move(button_callback); - params.buttons.push_back(std::move(button_params)); - } - - return params; - } - - HelpBubbleView* CreateHelpBubbleView(HelpBubbleParams params) { - return new HelpBubbleView(browser_view()->contents_container(), - std::move(params)); - } - - HelpBubbleView* CreateHelpBubbleView( - base::RepeatingClosure button_callback = base::DoNothing()) { - return CreateHelpBubbleView(GetBubbleParams(button_callback)); - } -}; - -class MockWidgetObserver : public views::WidgetObserver { - public: - MOCK_METHOD(void, OnWidgetClosing, (views::Widget*), ()); -}; - -TEST_F(HelpBubbleViewTest, CallButtonCallback_Mouse) { - UNCALLED_MOCK_CALLBACK(base::RepeatingClosure, mock_callback); - - HelpBubbleView* const bubble = CreateHelpBubbleView(mock_callback.Get()); - - // Simulate clicks on dismiss button. - EXPECT_CALL_IN_SCOPE( - mock_callback, Run, - views::test::InteractionTestUtilSimulatorViews::PressButton( - bubble->GetDefaultButtonForTesting(), - ui::test::InteractionTestUtil::InputType::kMouse)); - - bubble->GetWidget()->Close(); -} - -TEST_F(HelpBubbleViewTest, CallButtonCallback_Keyboard) { - UNCALLED_MOCK_CALLBACK(base::RepeatingClosure, mock_callback); - - HelpBubbleView* const bubble = CreateHelpBubbleView(mock_callback.Get()); - - // Simulate clicks on dismiss button. - EXPECT_CALL_IN_SCOPE( - mock_callback, Run, - views::test::InteractionTestUtilSimulatorViews::PressButton( - bubble->GetDefaultButtonForTesting(), - ui::test::InteractionTestUtil::InputType::kKeyboard)); - - bubble->GetWidget()->Close(); -} - -TEST_F(HelpBubbleViewTest, StableButtonOrder) { - HelpBubbleParams params; - params.body_text = u"To X, do Y"; - params.arrow = HelpBubbleArrow::kTopRight; - - constexpr char16_t kButton1Text[] = u"button 1"; - constexpr char16_t kButton2Text[] = u"button 2"; - constexpr char16_t kButton3Text[] = u"button 3"; - - HelpBubbleButtonParams button1; - button1.text = kButton1Text; - button1.is_default = false; - params.buttons.push_back(std::move(button1)); - - HelpBubbleButtonParams button2; - button2.text = kButton2Text; - button2.is_default = true; - params.buttons.push_back(std::move(button2)); - - HelpBubbleButtonParams button3; - button3.text = kButton3Text; - button3.is_default = false; - params.buttons.push_back(std::move(button3)); - - auto* bubble = new HelpBubbleView(browser_view()->contents_container(), - std::move(params)); - EXPECT_EQ(kButton1Text, bubble->GetNonDefaultButtonForTesting(0)->GetText()); - EXPECT_EQ(kButton2Text, bubble->GetDefaultButtonForTesting()->GetText()); - EXPECT_EQ(kButton3Text, bubble->GetNonDefaultButtonForTesting(1)->GetText()); -} - -TEST_F(HelpBubbleViewTest, DismissOnTimeout) { - HelpBubbleParams params = GetBubbleParams(); - params.timeout = base::Seconds(30); - HelpBubbleView* const bubble = CreateHelpBubbleView(std::move(params)); - MockWidgetObserver dismiss_observer; - EXPECT_CALL(dismiss_observer, OnWidgetClosing(testing::_)).Times(1); - bubble->GetWidget()->AddObserver(&dismiss_observer); - task_environment()->FastForwardBy(base::Minutes(1)); - task_environment()->RunUntilIdle(); -} - -TEST_F(HelpBubbleViewTest, NoAutoDismissWithoutTimeout) { - HelpBubbleView* const bubble = CreateHelpBubbleView(); - MockWidgetObserver dismiss_observer; - EXPECT_CALL(dismiss_observer, OnWidgetClosing(testing::_)).Times(0); - bubble->GetWidget()->AddObserver(&dismiss_observer); - task_environment()->FastForwardBy(base::Minutes(1)); - task_environment()->RunUntilIdle(); - // WidgetObserver checks if it is in an observer list in its destructor. - // Need to remove it from widget manually. - bubble->GetWidget()->RemoveObserver(&dismiss_observer); -} - -TEST_F(HelpBubbleViewTest, TimeoutCallback) { - base::MockRepeatingClosure timeout_callback; - - HelpBubbleParams params = GetBubbleParams(); - params.timeout = base::Seconds(10); - params.timeout_callback = timeout_callback.Get(); - - CreateHelpBubbleView(std::move(params)); - - EXPECT_CALL(timeout_callback, Run()).Times(1); - task_environment()->FastForwardBy(base::Seconds(10)); -} - -TEST_F(HelpBubbleViewTest, NoTimeoutIfSetToZero) { - base::MockRepeatingClosure timeout_callback; - - HelpBubbleParams params = GetBubbleParams(base::RepeatingClosure()); - params.timeout = base::TimeDelta(); - params.timeout_callback = timeout_callback.Get(); - - CreateHelpBubbleView(std::move(params)); - - EXPECT_CALL(timeout_callback, Run()).Times(0); - - // Fast forward by a long time to check bubble does not time out. - task_environment()->FastForwardBy(base::Hours(1)); -} - -TEST_F(HelpBubbleViewTest, RespectsProvidedTimeoutBeforeActivate) { - base::MockRepeatingClosure timeout_callback; - - HelpBubbleParams params = GetBubbleParams(base::RepeatingClosure()); - params.timeout = base::Seconds(20); - params.timeout_callback = timeout_callback.Get(); - - CreateHelpBubbleView(std::move(params)); - - EXPECT_CALL(timeout_callback, Run()).Times(0); - task_environment()->FastForwardBy(base::Seconds(19)); - - EXPECT_CALL(timeout_callback, Run()).Times(1); - task_environment()->FastForwardBy(base::Seconds(1)); -} - -TEST_F(HelpBubbleViewTest, RespectsProvidedTimeoutAfterActivate) { - base::MockRepeatingClosure timeout_callback; - - HelpBubbleParams params = GetBubbleParams(base::RepeatingClosure()); - params.timeout = base::Seconds(10); - params.timeout_callback = timeout_callback.Get(); - - EXPECT_CALL(timeout_callback, Run()).Times(0); - - HelpBubbleView* const bubble = CreateHelpBubbleView(std::move(params)); - - task_environment()->FastForwardBy(base::Seconds(9)); - - // Simulate bubble activation. We won't actually activate the bubble since - // bubble visibility and activation don't work well in this mock environment. - bubble->OnWidgetActivationChanged(bubble->GetWidget(), true); - - // The bubble should not time out since it is active. - task_environment()->FastForwardBy(base::Seconds(4)); - - // Deactivating the widget should restart the timer. - bubble->OnWidgetActivationChanged(bubble->GetWidget(), false); - - // Wait most of the timeout, but not all of it. - task_environment()->FastForwardBy(base::Seconds(9)); - - EXPECT_CALL(timeout_callback, Run()).Times(1); - - // Finishing the timeout should dismiss the bubble. - task_environment()->FastForwardBy(base::Seconds(1)); -}
diff --git a/chrome/browser/ui/views/user_education/tutorial_interactive_uitest.cc b/chrome/browser/ui/views/user_education/tutorial_interactive_uitest.cc index 47c0125..d4f64223 100644 --- a/chrome/browser/ui/views/user_education/tutorial_interactive_uitest.cc +++ b/chrome/browser/ui/views/user_education/tutorial_interactive_uitest.cc
@@ -10,14 +10,17 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_element_identifiers.h" #include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/interaction/interaction_test_util_browser.h" +#include "components/user_education/common/feature_promo_controller.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_registry.h" +#include "components/user_education/common/tutorial_service.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "content/public/test/browser_test.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" @@ -34,6 +37,12 @@ DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE(kCustomEventType1); } // namespace +using user_education::FeaturePromoControllerCommon; +using user_education::HelpBubbleArrow; +using user_education::HelpBubbleViews; +using user_education::TutorialDescription; +using user_education::TutorialService; + class TutorialInteractiveUitest : public InProcessBrowserTest { public: void SetUpOnMainThread() override {
diff --git a/chrome/browser/ui/webui/internals/internals_ui.cc b/chrome/browser/ui/webui/internals/internals_ui.cc index d7eccf4..287a16e 100644 --- a/chrome/browser/ui/webui/internals/internals_ui.cc +++ b/chrome/browser/ui/webui/internals/internals_ui.cc
@@ -121,10 +121,9 @@ mojo::PendingReceiver< mojom::user_education_internals::UserEducationInternalsPageHandler> receiver) { - mojo::MakeSelfOwnedReceiver( - std::make_unique<UserEducationInternalsPageHandlerImpl>(web_ui(), - profile_), - std::move(receiver)); + user_education_handler_ = + std::make_unique<UserEducationInternalsPageHandlerImpl>( + web_ui(), profile_, std::move(receiver)); } #endif // BUILDFLAG(IS_ANDROID)
diff --git a/chrome/browser/ui/webui/internals/internals_ui.h b/chrome/browser/ui/webui/internals/internals_ui.h index f66afba..e065282 100644 --- a/chrome/browser/ui/webui/internals/internals_ui.h +++ b/chrome/browser/ui/webui/internals/internals_ui.h
@@ -48,6 +48,12 @@ raw_ptr<Profile> profile_; raw_ptr<content::WebUIDataSource> source_; + +#if !BUILDFLAG(IS_ANDROID) + std::unique_ptr< + mojom::user_education_internals::UserEducationInternalsPageHandler> + user_education_handler_; +#endif // !BUILDFLAG(IS_ANDROID) }; #endif // CHROME_BROWSER_UI_WEBUI_INTERNALS_INTERNALS_UI_H_
diff --git a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc index 1238cfc2..7f50ee1 100644 --- a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc +++ b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc
@@ -17,7 +17,7 @@ namespace { -TutorialService* GetTutorialService(Profile* profile) { +user_education::TutorialService* GetTutorialService(Profile* profile) { auto* service = UserEducationServiceFactory::GetForProfile(profile); return service ? &service->tutorial_service() : nullptr; } @@ -26,10 +26,14 @@ UserEducationInternalsPageHandlerImpl::UserEducationInternalsPageHandlerImpl( content::WebUI* web_ui, - Profile* profile) + Profile* profile, + mojo::PendingReceiver< + mojom::user_education_internals::UserEducationInternalsPageHandler> + receiver) : tutorial_service_(GetTutorialService(profile)), web_ui_(web_ui), - profile_(profile) {} + profile_(profile), + receiver_(this, std::move(receiver)) {} UserEducationInternalsPageHandlerImpl:: ~UserEducationInternalsPageHandlerImpl() = default; @@ -98,7 +102,7 @@ return; } - FeaturePromoController* feature_promo_controller = + user_education::FeaturePromoController* feature_promo_controller = chrome::FindBrowserWithWebContents(web_ui_->GetWebContents()) ->window() ->GetFeaturePromoController(); @@ -116,7 +120,7 @@ const std::string UserEducationInternalsPageHandlerImpl::GetTitleFromFeaturePromoData( const base::Feature* feature, - const FeaturePromoSpecification& spec) { + const user_education::FeaturePromoSpecification& spec) { return (!spec.demo_page_info().display_title.empty() ? spec.demo_page_info().display_title : feature->name);
diff --git a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.h b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.h index bef8980..038c2b7 100644 --- a/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.h +++ b/chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.h
@@ -7,9 +7,11 @@ #include "base/memory/raw_ptr.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" #include "chrome/browser/ui/webui/internals/user_education/user_education_internals.mojom.h" +#include "components/user_education/common/tutorial_service.h" #include "content/public/browser/web_ui_data_source.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/receiver.h" namespace base { struct Feature; @@ -19,14 +21,20 @@ class WebUI; } // namespace content +namespace user_education { class FeaturePromoSpecification; +} class UserEducationInternalsPageHandlerImpl : public mojom::user_education_internals:: UserEducationInternalsPageHandler { public: - explicit UserEducationInternalsPageHandlerImpl(content::WebUI* web_ui, - Profile* profile); + UserEducationInternalsPageHandlerImpl( + content::WebUI* web_ui, + Profile* profile, + mojo::PendingReceiver< + mojom::user_education_internals::UserEducationInternalsPageHandler> + receiver); ~UserEducationInternalsPageHandlerImpl() override; UserEducationInternalsPageHandlerImpl( @@ -45,11 +53,15 @@ private: const std::string GetTitleFromFeaturePromoData( const base::Feature* feature, - const FeaturePromoSpecification& spec); + const user_education::FeaturePromoSpecification& spec); - raw_ptr<TutorialService> tutorial_service_ = nullptr; + raw_ptr<user_education::TutorialService> tutorial_service_ = nullptr; raw_ptr<content::WebUI> web_ui_ = nullptr; raw_ptr<Profile> profile_ = nullptr; + + mojo::Receiver< + mojom::user_education_internals::UserEducationInternalsPageHandler> + receiver_; }; #endif // CHROME_BROWSER_UI_WEBUI_INTERNALS_USER_EDUCATION_USER_EDUCATION_INTERNALS_PAGE_HANDLER_IMPL_H_
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 901e380..19426e4a 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -52,11 +52,13 @@ #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/commands/run_on_os_login_command.h" #include "chrome/browser/web_applications/extension_status_utils.h" #include "chrome/browser/web_applications/extensions/bookmark_app_util.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" @@ -1263,10 +1265,12 @@ install_params.add_to_quick_launch_bar = false; install_params.add_to_applications_menu = true; - web_app_provider_->install_manager().InstallWebAppFromInfo( - std::move(web_app), /*overwrite_existing_manifest_fields=*/false, - web_app::ForInstallableSite::kUnknown, install_params, - webapps::WebappInstallSource::SYNC, std::move(install_complete_callback)); + web_app_provider_->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(web_app), &web_app_provider_->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::SYNC, + std::move(install_complete_callback), install_params)); } void AppLauncherHandler::OnExtensionPreferenceChanged() {
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc index ff908fd..127cfd096 100644 --- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc +++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.cc
@@ -104,6 +104,10 @@ "initializeClearBrowsingData", base::BindRepeating(&ClearBrowsingDataHandler::HandleInitialize, base::Unretained(this))); + web_ui()->RegisterMessageCallback( + "getSyncState", + base::BindRepeating(&ClearBrowsingDataHandler::HandleGetSyncState, + base::Unretained(this))); } void ClearBrowsingDataHandler::OnJavascriptAllowed() { @@ -430,11 +434,22 @@ ResolveJavascriptCallback(callback_id, base::Value() /* Promise<void> */); } +void ClearBrowsingDataHandler::HandleGetSyncState( + const base::Value::List& args) { + AllowJavascript(); + const base::Value& callback_id = args[0]; + ResolveJavascriptCallback(callback_id, CreateSyncStateEvent()); +} + void ClearBrowsingDataHandler::OnStateChanged(syncer::SyncService* sync) { UpdateSyncState(); } void ClearBrowsingDataHandler::UpdateSyncState() { + FireWebUIListener("update-sync-state", CreateSyncStateEvent()); +} + +base::DictionaryValue ClearBrowsingDataHandler::CreateSyncStateEvent() { signin::IdentityManager* identity_manager = IdentityManagerFactory::GetForProfile(profile_); base::DictionaryValue event; @@ -469,7 +484,7 @@ : l10n_util::GetStringUTF16( IDS_SETTINGS_CLEAR_NON_GOOGLE_SEARCH_HISTORY_NON_PREPOPULATED_DSE)); } - FireWebUIListener("update-sync-state", event); + return event; } void ClearBrowsingDataHandler::RefreshHistoryNotice() {
diff --git a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h index 3276231..798bb9a 100644 --- a/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h +++ b/chrome/browser/ui/webui/settings/settings_clear_browsing_data_handler.h
@@ -95,12 +95,18 @@ // Initializes the dialog UI. Called by JavaScript when the DOM is ready. void HandleInitialize(const base::Value::List& args); + // Returns the current sync state to the WebUI. + void HandleGetSyncState(const base::Value::List& args); + // Implementation of SyncServiceObserver. void OnStateChanged(syncer::SyncService* sync) override; // Updates the footer of the dialog when the sync state changes. virtual void UpdateSyncState(); + // Create a SyncStateEvent containing the current sync state. + base::DictionaryValue CreateSyncStateEvent(); + // Finds out whether we should show notice about other forms of history stored // in user's account. void RefreshHistoryNotice();
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index 967b751a..fb90493 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -21,6 +21,8 @@ "commands/clear_browsing_data_command.h", "commands/fetch_manifest_and_install_command.cc", "commands/fetch_manifest_and_install_command.h", + "commands/install_from_info_command.cc", + "commands/install_from_info_command.h", "commands/install_web_app_with_params_command.cc", "commands/install_web_app_with_params_command.h", "commands/run_on_os_login_command.cc", @@ -637,6 +639,7 @@ sources = [ "commands/fetch_manifest_and_install_command_browsertest.cc", + "commands/install_from_info_command_browsertest.cc", "commands/install_web_app_with_params_command_browsertest.cc", "externally_managed_app_manager_impl_browsertest.cc", "isolated_app_browsertest.cc",
diff --git a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc index 250305f..5222d18 100644 --- a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc +++ b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.cc
@@ -17,6 +17,7 @@ #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" #include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" #include "fetch_manifest_and_install_command.h"
diff --git a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h index b5519938..77955a3 100644 --- a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h +++ b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command.h
@@ -10,6 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/values.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_params.h" #include "components/webapps/browser/install_result_code.h"
diff --git a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command_browsertest.cc b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command_browsertest.cc index 0915bd65..6252f90d 100644 --- a/chrome/browser/web_applications/commands/fetch_manifest_and_install_command_browsertest.cc +++ b/chrome/browser/web_applications/commands/fetch_manifest_and_install_command_browsertest.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/web_applications/web_app_registry_update.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" +#include "testing/gtest/include/gtest/gtest.h" namespace web_app {
diff --git a/chrome/browser/web_applications/commands/install_from_info_command.cc b/chrome/browser/web_applications/commands/install_from_info_command.cc new file mode 100644 index 0000000..d7686f5 --- /dev/null +++ b/chrome/browser/web_applications/commands/install_from_info_command.cc
@@ -0,0 +1,129 @@ +// 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. + +#include "chrome/browser/web_applications/commands/install_from_info_command.h" + +#include <utility> + +#include "base/bind.h" +#include "base/memory/weak_ptr.h" +#include "base/strings/stringprintf.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" +#include "chrome/browser/web_applications/web_app_helpers.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_install_finalizer.h" +#include "chrome/browser/web_applications/web_app_install_utils.h" +#include "components/webapps/browser/install_result_code.h" +#include "components/webapps/browser/installable/installable_metrics.h" + +namespace web_app { + +InstallFromInfoCommand::InstallFromInfoCommand( + std::unique_ptr<WebAppInstallInfo> install_info, + WebAppInstallFinalizer* install_finalizer, + bool overwrite_existing_manifest_fields, + webapps::WebappInstallSource install_surface, + OnceInstallCallback install_callback) + : WebAppCommand(WebAppCommandLock::CreateForAppLock( + {GenerateAppId(install_info->manifest_id, install_info->start_url)})), + app_id_( + GenerateAppId(install_info->manifest_id, install_info->start_url)), + install_info_(std::move(install_info)), + install_finalizer_(install_finalizer), + overwrite_existing_manifest_fields_(overwrite_existing_manifest_fields), + install_surface_(install_surface), + install_callback_(std::move(install_callback)) {} + +InstallFromInfoCommand::InstallFromInfoCommand( + std::unique_ptr<WebAppInstallInfo> install_info, + WebAppInstallFinalizer* install_finalizer, + bool overwrite_existing_manifest_fields, + webapps::WebappInstallSource install_surface, + OnceInstallCallback install_callback, + const WebAppInstallParams& install_params) + : WebAppCommand(WebAppCommandLock::CreateForAppLock( + {GenerateAppId(install_info->manifest_id, install_info->start_url)})), + app_id_( + GenerateAppId(install_info->manifest_id, install_info->start_url)), + install_info_(std::move(install_info)), + install_finalizer_(install_finalizer), + overwrite_existing_manifest_fields_(overwrite_existing_manifest_fields), + install_surface_(install_surface), + install_callback_(std::move(install_callback)), + install_params_(install_params) { + if (!install_params.locally_installed) { + DCHECK(!install_params.add_to_applications_menu); + DCHECK(!install_params.add_to_desktop); + DCHECK(!install_params.add_to_quick_launch_bar); + } + DCHECK(install_info_->start_url.is_valid()); +} +InstallFromInfoCommand::~InstallFromInfoCommand() = default; + +void InstallFromInfoCommand::Start() { + PopulateProductIcons(install_info_.get(), + /*icons_map=*/nullptr); + // No IconsMap to populate shortcut item icons from. + + if (install_params_) { + ApplyParamsToWebAppInstallInfo(*install_params_, *install_info_); + } + + if (webapps::InstallableMetrics::IsReportableInstallSource( + install_surface_)) { + webapps::InstallableMetrics::TrackInstallEvent(install_surface_); + } + + WebAppInstallFinalizer::FinalizeOptions options(install_surface_); + options.locally_installed = true; + options.overwrite_existing_manifest_fields = + overwrite_existing_manifest_fields_; + + if (install_params_) { + ApplyParamsToFinalizeOptions(*install_params_, options); + } else { + options.bypass_os_hooks = true; + } + + install_finalizer_->FinalizeInstall( + *install_info_, options, + base::BindOnce(&InstallFromInfoCommand::OnInstallCompleted, + weak_factory_.GetWeakPtr())); +} + +void InstallFromInfoCommand::Abort(webapps::InstallResultCode code) { + if (!install_callback_) + return; + webapps::InstallableMetrics::TrackInstallResult(false); + SignalCompletionAndSelfDestruct( + CommandResult::kFailure, + base::BindOnce(std::move(install_callback_), app_id_, code)); +} + +void InstallFromInfoCommand::OnInstallCompleted(const AppId& app_id, + webapps::InstallResultCode code, + OsHooksErrors os_hooks_errors) { + webapps::InstallableMetrics::TrackInstallResult(webapps::IsSuccess(code)); + SignalCompletionAndSelfDestruct( + webapps::IsSuccess(code) ? CommandResult::kSuccess + : CommandResult::kFailure, + base::BindOnce(std::move(install_callback_), app_id, code)); +} + +void InstallFromInfoCommand::OnBeforeForcedUninstallFromSync() { + // TODO(crbug.com/1320086): remove after uninstall from sync is async. + Abort(webapps::InstallResultCode::kAppNotInRegistrarAfterCommit); + return; +} + +void InstallFromInfoCommand::OnShutdown() { + Abort(webapps::InstallResultCode::kCancelledOnWebAppProviderShuttingDown); + return; +} + +base::Value InstallFromInfoCommand::ToDebugValue() const { + return base::Value(base::StringPrintf("InstallFromInfoCommand %d, app_id: %s", + id(), app_id_.c_str())); +} +} // namespace web_app
diff --git a/chrome/browser/web_applications/commands/install_from_info_command.h b/chrome/browser/web_applications/commands/install_from_info_command.h new file mode 100644 index 0000000..44a21e3 --- /dev/null +++ b/chrome/browser/web_applications/commands/install_from_info_command.h
@@ -0,0 +1,81 @@ +// 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. + +#ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_INSTALL_FROM_INFO_COMMAND_H_ +#define CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_INSTALL_FROM_INFO_COMMAND_H_ + +#include <memory> + +#include "base/memory/weak_ptr.h" +#include "base/values.h" +#include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" +#include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_install_info.h" +#include "chrome/browser/web_applications/web_app_install_params.h" +#include "components/webapps/browser/installable/installable_metrics.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h" + +namespace web_app { + +class WebAppInstallFinalizer; + +// Starts a web app installation process using prefilled +// |install_info| which holds all the data needed for installation. +// This doesn't fetch a manifest and doesn't perform all required steps for +// External installed apps: use |ExternallyManagedAppManager::Install| +// instead. +// +// The web app can be simultaneously installed from multiple sources. +// If the web app already exists and `overwrite_existing_manifest_fields` is +// false then manifest fields in `install_info` are treated only as +// fallback manifest values. If `overwrite_existing_manifest_fields` is true +// then the existing web app manifest fields will be overwritten. +// If `install_info` contains data freshly fetched from the web app's +// site then `overwrite_existing_manifest_fields` should be true. +class InstallFromInfoCommand : public WebAppCommand { + public: + InstallFromInfoCommand(std::unique_ptr<WebAppInstallInfo> install_info, + WebAppInstallFinalizer* install_finalizer, + bool overwrite_existing_manifest_fields, + webapps::WebappInstallSource install_surface, + OnceInstallCallback install_callback); + + InstallFromInfoCommand(std::unique_ptr<WebAppInstallInfo> install_info, + WebAppInstallFinalizer* install_finalizer, + bool overwrite_existing_manifest_fields, + webapps::WebappInstallSource install_surface, + OnceInstallCallback install_callback, + const WebAppInstallParams& install_params); + + ~InstallFromInfoCommand() override; + + void Start() override; + void OnBeforeForcedUninstallFromSync() override; + void OnShutdown() override; + + base::Value ToDebugValue() const override; + + private: + void Abort(webapps::InstallResultCode code); + + void OnInstallCompleted(const AppId& app_id, + webapps::InstallResultCode code, + OsHooksErrors os_hooks_errors); + + AppId app_id_; + std::unique_ptr<WebAppInstallInfo> install_info_; + raw_ptr<WebAppInstallFinalizer> install_finalizer_; + bool overwrite_existing_manifest_fields_; + webapps::WebappInstallSource install_surface_; + OnceInstallCallback install_callback_; + absl::optional<WebAppInstallParams> install_params_; + + base::WeakPtrFactory<InstallFromInfoCommand> weak_factory_{this}; +}; + +} // namespace web_app + +#endif // CHROME_BROWSER_WEB_APPLICATIONS_COMMANDS_INSTALL_FROM_INFO_COMMAND_H_
diff --git a/chrome/browser/web_applications/commands/install_from_info_command_browsertest.cc b/chrome/browser/web_applications/commands/install_from_info_command_browsertest.cc new file mode 100644 index 0000000..0510513b --- /dev/null +++ b/chrome/browser/web_applications/commands/install_from_info_command_browsertest.cc
@@ -0,0 +1,130 @@ +// 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. + +#include <map> +#include <memory> +#include <utility> + +#include "base/run_loop.h" +#include "base/test/bind.h" +#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h" +#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" +#include "chrome/browser/web_applications/test/fake_os_integration_manager.h" +#include "chrome/browser/web_applications/test/web_app_icon_test_utils.h" +#include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" +#include "chrome/browser/web_applications/web_app_icon_manager.h" +#include "chrome/browser/web_applications/web_app_install_info.h" +#include "chrome/browser/web_applications/web_app_provider.h" +#include "chrome/browser/web_applications/web_app_registrar.h" +#include "chrome/browser/web_applications/web_app_utils.h" +#include "components/webapps/browser/install_result_code.h" +#include "content/public/test/browser_test.h" +#include "install_from_info_command.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/skia/include/core/SkBitmap.h" + +namespace web_app { + +class InstallFromInfoCommandTest : public WebAppControllerBrowserTest { + public: + InstallFromInfoCommandTest() { + WebAppProvider::SetOsIntegrationManagerFactoryForTesting( + [](Profile* profile) -> std::unique_ptr<OsIntegrationManager> { + return std::make_unique<FakeOsIntegrationManager>( + profile, nullptr, nullptr, nullptr, nullptr); + }); + } + + std::map<SquareSizePx, SkBitmap> ReadIcons(const AppId& app_id, + IconPurpose purpose, + const SortedSizesPx& sizes_px) { + std::map<SquareSizePx, SkBitmap> result; + base::RunLoop run_loop; + provider().icon_manager().ReadIcons( + app_id, purpose, sizes_px, + base::BindLambdaForTesting( + [&](std::map<SquareSizePx, SkBitmap> icon_bitmaps) { + result = std::move(icon_bitmaps); + run_loop.Quit(); + })); + run_loop.Run(); + return result; + } +}; + +IN_PROC_BROWSER_TEST_F(InstallFromInfoCommandTest, SuccessInstall) { + auto info = std::make_unique<WebAppInstallInfo>(); + info->title = u"Test name"; + info->start_url = GURL("http://test.com/path"); + + const webapps::WebappInstallSource install_source = + AreSystemWebAppsSupported() + ? webapps::WebappInstallSource::SYSTEM_DEFAULT + : webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON; + + base::RunLoop loop; + AppId result_app_id; + provider().command_manager().ScheduleCommand( + std::make_unique<InstallFromInfoCommand>( + std::move(info), &provider().install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, install_source, + base::BindLambdaForTesting( + [&](const AppId& app_id, webapps::InstallResultCode code) { + EXPECT_EQ(code, webapps::InstallResultCode::kSuccessNewInstall); + result_app_id = app_id; + loop.Quit(); + }))); + loop.Run(); + + EXPECT_TRUE(provider().registrar().IsActivelyInstalled(result_app_id)); + EXPECT_EQ(provider() + .os_integration_manager() + .AsTestOsIntegrationManager() + ->num_create_shortcuts_calls(), + 0u); + + const WebApp* web_app = provider().registrar().GetAppById(result_app_id); + ASSERT_TRUE(web_app); + + std::map<SquareSizePx, SkBitmap> icon_bitmaps = + ReadIcons(result_app_id, IconPurpose::ANY, + web_app->downloaded_icon_sizes(IconPurpose::ANY)); + + // Make sure that icons have been generated for all sub sizes. + EXPECT_TRUE(ContainsOneIconOfEachSize(icon_bitmaps)); +} + +IN_PROC_BROWSER_TEST_F(InstallFromInfoCommandTest, InstallWithParams) { + auto info = std::make_unique<WebAppInstallInfo>(); + info->title = u"Test name"; + info->start_url = GURL("http://test.com/path"); + + web_app::WebAppInstallParams install_params; + install_params.bypass_os_hooks = false; + install_params.add_to_applications_menu = true; + install_params.add_to_desktop = true; + + base::RunLoop loop; + provider().command_manager().ScheduleCommand( + std::make_unique<InstallFromInfoCommand>( + std::move(info), &provider().install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::MENU_BROWSER_TAB, + base::BindLambdaForTesting( + [&](const AppId& app_id, webapps::InstallResultCode code) { + EXPECT_EQ(code, webapps::InstallResultCode::kSuccessNewInstall); + EXPECT_TRUE(provider().registrar().IsActivelyInstalled(app_id)); + loop.Quit(); + }), + install_params)); + loop.Run(); + EXPECT_EQ(provider() + .os_integration_manager() + .AsTestOsIntegrationManager() + ->num_create_shortcuts_calls(), + 1u); +} + +} // namespace web_app
diff --git a/chrome/browser/web_applications/commands/web_app_install_command.cc b/chrome/browser/web_applications/commands/web_app_install_command.cc index 6a6885b..991b5e4ce 100644 --- a/chrome/browser/web_applications/commands/web_app_install_command.cc +++ b/chrome/browser/web_applications/commands/web_app_install_command.cc
@@ -11,6 +11,7 @@ #include "base/strings/stringprintf.h" #include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_data_retriever.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/common/chrome_features.h" #include "content/public/browser/web_contents.h"
diff --git a/chrome/browser/web_applications/commands/web_app_install_command.h b/chrome/browser/web_applications/commands/web_app_install_command.h index 0d1ec8e..45c7d70 100644 --- a/chrome/browser/web_applications/commands/web_app_install_command.h +++ b/chrome/browser/web_applications/commands/web_app_install_command.h
@@ -10,6 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/values.h" #include "chrome/browser/web_applications/commands/web_app_command.h" +#include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_params.h" #include "chrome/browser/web_applications/web_app_install_task.h" #include "components/webapps/browser/installable/installable_metrics.h"
diff --git a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc index 8e6205c..eeb9e60e 100644 --- a/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc +++ b/chrome/browser/web_applications/extensions/externally_managed_app_install_task_unittest.cc
@@ -38,7 +38,6 @@ #include "chrome/browser/web_applications/web_app_id.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" @@ -307,8 +306,8 @@ registrar.get()); install_finalizer_ = install_finalizer.get(); - auto install_manager = std::make_unique<WebAppInstallManager>(profile()); - install_manager_ = install_manager.get(); + auto command_manager = std::make_unique<WebAppCommandManager>(profile()); + command_manager_ = command_manager.get(); auto os_integration_manager = std::make_unique<FakeOsIntegrationManager>( profile(), /*app_shortcut_manager=*/nullptr, @@ -319,23 +318,19 @@ auto ui_manager = std::make_unique<FakeWebAppUiManager>(); ui_manager_ = ui_manager.get(); - auto command_manager = std::make_unique<WebAppCommandManager>(profile()); - auto sync_bridge = std::make_unique<WebAppSyncBridge>(registrar.get()); sync_bridge->SetSubsystems(&provider->GetDatabaseFactory(), - install_manager_, command_manager.get()); + /*install_delegate=*/nullptr, + command_manager.get()); provider->SetRegistrar(std::move(registrar)); provider->SetSyncBridge(std::move(sync_bridge)); - provider->SetInstallManager(std::move(install_manager)); provider->SetInstallFinalizer(std::move(install_finalizer)); provider->SetWebAppUiManager(std::move(ui_manager)); provider->SetOsIntegrationManager(std::move(os_integration_manager)); provider->SetCommandManager(std::move(command_manager)); provider->Start(); - // Start only WebAppInstallManager for real. - install_manager_->Start(); } protected: @@ -346,7 +341,7 @@ TestExternallyManagedAppInstallFinalizer* finalizer() { return install_finalizer_; } - WebAppInstallManager* install_manager() { return install_manager_; } + WebAppCommandManager* command_manager() { return command_manager_; } FakeDataRetriever* data_retriever() { return data_retriever_; } @@ -384,7 +379,7 @@ auto task = std::make_unique<ExternallyManagedAppInstallTask>( profile(), url_loader_.get(), registrar_, ui_manager_, - install_finalizer_, install_manager_, std::move(options)); + install_finalizer_, command_manager_, std::move(options)); task->SetDataRetrieverFactoryForTesting( GetFactoryForRetriever(std::move(data_retriever))); return task; @@ -392,7 +387,7 @@ private: std::unique_ptr<TestWebAppUrlLoader> url_loader_; - raw_ptr<WebAppInstallManager> install_manager_ = nullptr; + raw_ptr<WebAppCommandManager> command_manager_ = nullptr; raw_ptr<WebAppRegistrar> registrar_ = nullptr; raw_ptr<FakeDataRetriever> data_retriever_ = nullptr; raw_ptr<TestExternallyManagedAppInstallFinalizer> install_finalizer_ = @@ -951,7 +946,7 @@ ExternalInstallSource::kInternalDefault); ExternallyManagedAppInstallTask install_task( profile(), &url_loader(), registrar(), ui_manager(), finalizer(), - install_manager(), install_options); + command_manager(), install_options); url_loader().SetPrepareForLoadResultLoaded(); url_loader().SetNextLoadUrlResult(GURL(), result_pair.loader_result); @@ -973,7 +968,7 @@ ExternalInstallSource::kInternalDefault); ExternallyManagedAppInstallTask install_task( profile(), &url_loader(), registrar(), ui_manager(), finalizer(), - install_manager(), install_options); + command_manager(), install_options); url_loader().SetPrepareForLoadResultLoaded(); url_loader().SetNextLoadUrlResult( GURL(), WebAppUrlLoader::Result::kFailedWebContentsDestroyed); @@ -1002,7 +997,7 @@ ExternallyManagedAppInstallTask task(profile(), /*url_loader=*/nullptr, registrar(), ui_manager(), finalizer(), - install_manager(), std::move(options)); + command_manager(), std::move(options)); finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, webapps::InstallResultCode::kSuccessNewInstall); @@ -1051,7 +1046,7 @@ ExternallyManagedAppInstallTask task(profile(), /*url_loader=*/nullptr, registrar(), ui_manager(), finalizer(), - install_manager(), std::move(options)); + command_manager(), std::move(options)); finalizer()->SetNextFinalizeInstallResult( kWebAppUrl, webapps::InstallResultCode::kWriteDataFailed);
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.cc b/chrome/browser/web_applications/externally_managed_app_install_task.cc index ec0cd57..b49062b 100644 --- a/chrome/browser/web_applications/externally_managed_app_install_task.cc +++ b/chrome/browser/web_applications/externally_managed_app_install_task.cc
@@ -16,6 +16,7 @@ #include "build/chromeos_buildflags.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/security_state_tab_helper.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/commands/install_web_app_with_params_command.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app.h" @@ -23,9 +24,7 @@ #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" -#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_ui_manager.h" #include "components/webapps/browser/install_result_code.h" #include "components/webapps/browser/installable/installable_manager.h" @@ -43,13 +42,13 @@ WebAppRegistrar* registrar, WebAppUiManager* ui_manager, WebAppInstallFinalizer* install_finalizer, - WebAppInstallManager* install_manager, + WebAppCommandManager* command_manager, ExternalInstallOptions install_options) : profile_(profile), url_loader_(url_loader), registrar_(registrar), install_finalizer_(install_finalizer), - install_manager_(install_manager), + command_manager_(command_manager), ui_manager_(ui_manager), externally_installed_app_prefs_(profile_->GetPrefs()), install_options_(std::move(install_options)) {} @@ -167,13 +166,14 @@ web_app_info->additional_search_terms.push_back(std::move(search_term)); } web_app_info->install_url = install_params.install_url; - install_manager_->InstallWebAppFromInfo( - std::move(web_app_info), + command_manager_->ScheduleCommand(std::make_unique<InstallFromInfoCommand>( + std::move(web_app_info), install_finalizer_, /*overwrite_existing_manifest_fields=*/install_params.force_reinstall, - ForInstallableSite::kYes, install_params, internal_install_source, + internal_install_source, base::BindOnce(&ExternallyManagedAppInstallTask::OnWebAppInstalled, weak_ptr_factory_.GetWeakPtr(), /* is_placeholder=*/false, - /*offline_install=*/true, std::move(result_callback))); + /*offline_install=*/true, std::move(result_callback)), + install_params)); } void ExternallyManagedAppInstallTask::UninstallPlaceholderApp( @@ -222,14 +222,12 @@ auto install_source = ConvertExternalInstallSourceToInstallSource( install_options_.install_source); - WebAppProvider* provider = WebAppProvider::GetForLocalAppsUnchecked(profile_); - if (!data_retriever_factory_) { data_retriever_factory_ = base::BindRepeating( []() { return std::make_unique<WebAppDataRetriever>(); }); } - provider->command_manager().ScheduleCommand( + command_manager_->ScheduleCommand( std::make_unique<InstallWebAppWithParamsCommand>( web_contents->GetWeakPtr(), install_params, install_source, install_finalizer_, registrar_,
diff --git a/chrome/browser/web_applications/externally_managed_app_install_task.h b/chrome/browser/web_applications/externally_managed_app_install_task.h index 2466847..406e211b 100644 --- a/chrome/browser/web_applications/externally_managed_app_install_task.h +++ b/chrome/browser/web_applications/externally_managed_app_install_task.h
@@ -35,7 +35,7 @@ class WebAppUrlLoader; class WebAppInstallFinalizer; -class WebAppInstallManager; +class WebAppCommandManager; class WebAppUiManager; class WebAppDataRetriever; @@ -55,7 +55,7 @@ WebAppRegistrar* registrar, WebAppUiManager* ui_manager, WebAppInstallFinalizer* install_finalizer, - WebAppInstallManager* install_manager, + WebAppCommandManager* command_manager, ExternalInstallOptions install_options); ExternallyManagedAppInstallTask(const ExternallyManagedAppInstallTask&) = @@ -132,7 +132,7 @@ const raw_ptr<WebAppUrlLoader> url_loader_; const raw_ptr<WebAppRegistrar> registrar_; const raw_ptr<WebAppInstallFinalizer> install_finalizer_; - const raw_ptr<WebAppInstallManager> install_manager_; + const raw_ptr<WebAppCommandManager> command_manager_; const raw_ptr<WebAppUiManager> ui_manager_; ExternallyInstalledWebAppPrefs externally_installed_app_prefs_;
diff --git a/chrome/browser/web_applications/externally_managed_app_manager.cc b/chrome/browser/web_applications/externally_managed_app_manager.cc index d5a99a4..da4450ce 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager.cc +++ b/chrome/browser/web_applications/externally_managed_app_manager.cc
@@ -69,12 +69,12 @@ WebAppRegistrar* registrar, WebAppUiManager* ui_manager, WebAppInstallFinalizer* finalizer, - WebAppInstallManager* install_manager, + WebAppCommandManager* command_manager, WebAppSyncBridge* sync_bridge) { registrar_ = registrar; ui_manager_ = ui_manager; finalizer_ = finalizer; - install_manager_ = install_manager; + command_manager_ = command_manager; sync_bridge_ = sync_bridge; }
diff --git a/chrome/browser/web_applications/externally_managed_app_manager.h b/chrome/browser/web_applications/externally_managed_app_manager.h index 7cfe87f..6de1f69 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager.h +++ b/chrome/browser/web_applications/externally_managed_app_manager.h
@@ -26,7 +26,7 @@ class WebAppRegistrar; class WebAppInstallFinalizer; -class WebAppInstallManager; +class WebAppCommandManager; class WebAppUiManager; class WebAppSyncBridge; @@ -91,7 +91,7 @@ void SetSubsystems(WebAppRegistrar* registrar, WebAppUiManager* ui_manager, WebAppInstallFinalizer* finalizer, - WebAppInstallManager* install_manager, + WebAppCommandManager* command_manager, WebAppSyncBridge* sync_bridge); // Queues an installation operation with the highest priority. Essentially @@ -161,7 +161,7 @@ WebAppRegistrar* registrar() { return registrar_; } WebAppUiManager* ui_manager() { return ui_manager_; } WebAppInstallFinalizer* finalizer() { return finalizer_; } - WebAppInstallManager* install_manager() { return install_manager_; } + WebAppCommandManager* command_manager() { return command_manager_; } WebAppSyncBridge* sync_bridge() { return sync_bridge_; } virtual void OnRegistrationFinished(const GURL& launch_url, @@ -201,7 +201,7 @@ raw_ptr<WebAppRegistrar> registrar_ = nullptr; raw_ptr<WebAppUiManager> ui_manager_ = nullptr; raw_ptr<WebAppInstallFinalizer> finalizer_ = nullptr; - raw_ptr<WebAppInstallManager> install_manager_ = nullptr; + raw_ptr<WebAppCommandManager> command_manager_ = nullptr; raw_ptr<WebAppSyncBridge> sync_bridge_ = nullptr; base::flat_map<ExternalInstallSource, SynchronizeRequest>
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl.cc index c3c2cf6..10479e05 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager_impl.cc +++ b/chrome/browser/web_applications/externally_managed_app_manager_impl.cc
@@ -16,8 +16,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/externally_managed_app_registration_task.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_registry_update.h" @@ -125,7 +125,7 @@ ExternalInstallOptions install_options) { return std::make_unique<ExternallyManagedAppInstallTask>( profile_, url_loader_.get(), registrar(), ui_manager(), finalizer(), - install_manager(), std::move(install_options)); + command_manager(), std::move(install_options)); } std::unique_ptr<ExternallyManagedAppRegistrationTaskBase>
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc b/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc index e1511678..aa54267 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc +++ b/chrome/browser/web_applications/externally_managed_app_manager_impl_unittest.cc
@@ -31,9 +31,9 @@ #include "chrome/browser/web_applications/test/web_app_test_utils.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/test/base/testing_profile.h" @@ -282,7 +282,7 @@ externally_managed_app_manager_impl->registrar(), externally_managed_app_manager_impl->ui_manager(), externally_managed_app_manager_impl->finalizer(), - externally_managed_app_manager_impl->install_manager(), + externally_managed_app_manager_impl->command_manager(), std::move(install_options)), externally_managed_app_manager_impl_( externally_managed_app_manager_impl), @@ -413,7 +413,7 @@ void SetUp() override { WebAppTest::SetUp(); - install_manager_ = std::make_unique<WebAppInstallManager>(profile()); + command_manager_ = std::make_unique<WebAppCommandManager>(profile()); fake_registry_controller_ = std::make_unique<FakeWebAppRegistryController>(); @@ -428,12 +428,17 @@ ui_manager_ = std::make_unique<FakeWebAppUiManager>(); externally_managed_app_manager_impl().SetSubsystems( - ®istrar(), &ui_manager(), &install_finalizer(), &install_manager(), + ®istrar(), &ui_manager(), &install_finalizer(), &command_manager(), &sync_bridge()); controller().Init(); } + void TearDown() override { + command_manager_->Shutdown(); + WebAppTest::TearDown(); + } + protected: std::pair<GURL, webapps::InstallResultCode> InstallAndWait( ExternallyManagedAppManager* externally_managed_app_manager, @@ -555,10 +560,10 @@ FakeInstallFinalizer& install_finalizer() { return *install_finalizer_; } - WebAppInstallManager& install_manager() { return *install_manager_; } + WebAppCommandManager& command_manager() { return *command_manager_; } private: - std::unique_ptr<WebAppInstallManager> install_manager_; + std::unique_ptr<WebAppCommandManager> command_manager_; std::unique_ptr<FakeWebAppRegistryController> fake_registry_controller_; std::unique_ptr<TestExternallyManagedAppManager> externally_managed_app_manager_impl_;
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager_browsertest.cc b/chrome/browser/web_applications/policy/web_app_policy_manager_browsertest.cc index 18b74d3..41b31d0 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager_browsertest.cc +++ b/chrome/browser/web_applications/policy/web_app_policy_manager_browsertest.cc
@@ -9,14 +9,15 @@ #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/policy/web_app_policy_constants.h" #include "chrome/browser/web_applications/test/fake_web_app_registry_controller.h" #include "chrome/browser/web_applications/test/web_app_test_utils.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_id.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/pref_names.h" @@ -207,11 +208,13 @@ install_info->install_url = GURL(kInstallUrl); UpdateWebAppInfoFromManifest(*manifest, GURL(kManifestUrl), install_info.get()); - WebAppProvider::GetForTest(profile()) - ->install_manager() - .InstallWebAppFromInfo( - std::move(install_info), true, ForInstallableSite::kYes, - webapps::WebappInstallSource::EXTERNAL_POLICY, base::DoNothing()); + + auto* provider = WebAppProvider::GetForTest(profile()); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(install_info), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/true, + webapps::WebappInstallSource::EXTERNAL_POLICY, base::DoNothing())); externally_installed_app_prefs().Insert( GURL(kInstallUrl), GenerateAppId(absl::nullopt, GURL(kStartUrl)),
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc index ad547b6..f772753 100644 --- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc +++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_unittest.cc
@@ -40,6 +40,7 @@ #include "chrome/browser/web_applications/test/web_app_test_utils.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_icon_generator.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" @@ -154,6 +155,7 @@ test_system_web_app_manager_ = std::make_unique<TestSystemWebAppManager>(profile()); test_ui_manager_ = std::make_unique<FakeWebAppUiManager>(); + command_manager_ = std::make_unique<WebAppCommandManager>(profile()); install_finalizer().SetSubsystems( &install_manager(), &controller().registrar(), &ui_manager(), @@ -169,7 +171,7 @@ externally_managed_app_manager().SetSubsystems( &controller().registrar(), &ui_manager(), &install_finalizer(), - &install_manager(), &controller().sync_bridge()); + &command_manager(), &controller().sync_bridge()); web_app_policy_manager().SetSubsystems( &externally_managed_app_manager(), &controller().registrar(), @@ -188,6 +190,8 @@ void DestroyManagers() { // The reverse order of creation: + command_manager_->Shutdown(); + command_manager_.reset(); test_ui_manager_.reset(); test_system_web_app_manager_.reset(); fake_externally_managed_app_manager_impl_.reset(); @@ -214,6 +218,8 @@ WebAppInstallManager& install_manager() { return *install_manager_; } + WebAppCommandManager& command_manager() { return *command_manager_; } + FakeExternallyManagedAppManager& externally_managed_app_manager() { return *fake_externally_managed_app_manager_impl_; } @@ -284,6 +290,7 @@ fake_externally_managed_app_manager_impl_; std::unique_ptr<TestSystemWebAppManager> test_system_web_app_manager_; std::unique_ptr<FakeWebAppUiManager> test_ui_manager_; + std::unique_ptr<WebAppCommandManager> command_manager_; }; // Test that System Apps do install with the feature enabled. @@ -819,6 +826,7 @@ system_web_app_manager().set_current_version(base::Version("3.0.0.0")); system_web_app_manager().Start(); base::RunLoop().RunUntilIdle(); + command_manager().AwaitAllCommandsCompleteForTesting(); externally_managed_app_manager().ClearSynchronizeRequestsForTesting(); EXPECT_EQ(6u, install_requests.size()); @@ -891,6 +899,7 @@ system_web_app_manager().set_current_locale("fr/fr"); system_web_app_manager().Start(); base::RunLoop().RunUntilIdle(); + command_manager().AwaitAllCommandsCompleteForTesting(); externally_managed_app_manager().ClearSynchronizeRequestsForTesting(); }
diff --git a/chrome/browser/web_applications/test/web_app_install_test_utils.cc b/chrome/browser/web_applications/test/web_app_install_test_utils.cc index fa3b82d..8dc9cf3 100644 --- a/chrome/browser/web_applications/test/web_app_install_test_utils.cc +++ b/chrome/browser/web_applications/test/web_app_install_test_utils.cc
@@ -9,12 +9,13 @@ #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" #include "build/build_config.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/test/fake_web_app_provider.h" #include "chrome/browser/web_applications/user_display_mode.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/common/buildflags.h" @@ -94,15 +95,16 @@ auto* provider = WebAppProvider::GetForTest(profile); DCHECK(provider); WaitUntilReady(provider); - provider->install_manager().InstallWebAppFromInfo( - std::move(web_app_info), overwrite_existing_manifest_fields, - ForInstallableSite::kYes, install_source, - base::BindLambdaForTesting( - [&](const AppId& installed_app_id, webapps::InstallResultCode code) { + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(web_app_info), &provider->install_finalizer(), + overwrite_existing_manifest_fields, install_source, + base::BindLambdaForTesting([&](const AppId& installed_app_id, + webapps::InstallResultCode code) { EXPECT_EQ(webapps::InstallResultCode::kSuccessNewInstall, code); app_id = installed_app_id; run_loop.Quit(); - })); + }))); run_loop.Run(); // Allow updates to be published to App Service listeners.
diff --git a/chrome/browser/web_applications/web_app_command_manager.cc b/chrome/browser/web_applications/web_app_command_manager.cc index a3d6375..5c82249 100644 --- a/chrome/browser/web_applications/web_app_command_manager.cc +++ b/chrome/browser/web_applications/web_app_command_manager.cc
@@ -11,6 +11,7 @@ #include "base/callback.h" #include "base/containers/contains.h" #include "base/memory/weak_ptr.h" +#include "base/run_loop.h" #include "base/strings/strcat.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chrome/browser/web_applications/commands/web_app_command.h" @@ -202,6 +203,13 @@ return false; } +void WebAppCommandManager::AwaitAllCommandsCompleteForTesting() { + if (commands_.empty()) + return; + + run_loop_for_testing_.Run(); +} + void WebAppCommandManager::OnCommandComplete( WebAppCommand* running_command, CommandResult result, @@ -214,6 +222,9 @@ commands_.erase(command_it); std::move(completion_callback).Run(); + + if (commands_.empty() && run_loop_for_testing_.running()) + run_loop_for_testing_.Quit(); } void WebAppCommandManager::AddValueToLog(base::Value value) {
diff --git a/chrome/browser/web_applications/web_app_command_manager.h b/chrome/browser/web_applications/web_app_command_manager.h index bc052d4..c512732c 100644 --- a/chrome/browser/web_applications/web_app_command_manager.h +++ b/chrome/browser/web_applications/web_app_command_manager.h
@@ -13,6 +13,7 @@ #include "base/containers/flat_set.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" +#include "base/run_loop.h" #include "base/sequence_checker.h" #include "base/types/pass_key.h" #include "base/values.h" @@ -75,6 +76,8 @@ std::size_t GetCommandCountForTesting() { return commands_.size(); } + void AwaitAllCommandsCompleteForTesting(); + protected: friend class WebAppCommand; @@ -113,6 +116,8 @@ raw_ptr<WebAppInstallManager> install_manager_; + base::RunLoop run_loop_for_testing_; + base::WeakPtrFactory<WebAppCommandManager> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc b/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc index 9353de6..12cc99b 100644 --- a/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc +++ b/chrome/browser/web_applications/web_app_icon_manager_browsertest.cc
@@ -13,11 +13,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/web_applications/web_app_browser_controller.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "chrome/browser/web_applications/user_display_mode.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_icon_generator.h" #include "chrome/browser/web_applications/web_app_install_info.h" -#include "chrome/browser/web_applications/web_app_install_manager.h" #include "chrome/browser/web_applications/web_app_install_utils.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/test/base/in_process_browser_test.h" @@ -86,21 +87,21 @@ install_info->icon_bitmaps.any[icon_size::k32] = std::move(bitmap); } - WebAppInstallManager& install_manager = - WebAppProvider::GetForTest(browser()->profile())->install_manager(); - base::RunLoop run_loop; - install_manager.InstallWebAppFromInfo( - std::move(install_info), - /*overwrite_existing_manifest_fields=*/false, ForInstallableSite::kYes, - webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON, - base::BindLambdaForTesting( - [&app_id, &run_loop](const AppId& installed_app_id, - webapps::InstallResultCode code) { + + auto* provider = WebAppProvider::GetForTest(browser()->profile()); + provider->command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(install_info), &provider->install_finalizer(), + /*overwrite_existing_manifest_fields=*/false, + webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON, + base::BindLambdaForTesting([&app_id, &run_loop]( + const AppId& installed_app_id, + webapps::InstallResultCode code) { EXPECT_EQ(webapps::InstallResultCode::kSuccessNewInstall, code); app_id = installed_app_id; run_loop.Quit(); - })); + }))); run_loop.Run(); }
diff --git a/chrome/browser/web_applications/web_app_install_manager.cc b/chrome/browser/web_applications/web_app_install_manager.cc index 93a5389..f9b6034 100644 --- a/chrome/browser/web_applications/web_app_install_manager.cc +++ b/chrome/browser/web_applications/web_app_install_manager.cc
@@ -163,42 +163,6 @@ EnqueueTask(std::move(task), std::move(start_task)); } -void WebAppInstallManager::InstallWebAppFromInfo( - std::unique_ptr<WebAppInstallInfo> install_info, - bool overwrite_existing_manifest_fields, - ForInstallableSite for_installable_site, - webapps::WebappInstallSource install_surface, - OnceInstallCallback callback) { - InstallWebAppFromInfo(std::move(install_info), - overwrite_existing_manifest_fields, - for_installable_site, absl::nullopt, install_surface, - std::move(callback)); -} - -void WebAppInstallManager::InstallWebAppFromInfo( - std::unique_ptr<WebAppInstallInfo> install_info, - bool overwrite_existing_manifest_fields, - ForInstallableSite for_installable_site, - const absl::optional<WebAppInstallParams>& install_params, - webapps::WebappInstallSource install_surface, - OnceInstallCallback callback) { - if (!started_) - return; - - auto task = std::make_unique<WebAppInstallTask>(profile_, finalizer_, - data_retriever_factory_.Run(), - registrar_, install_surface); - if (install_params) { - task->SetInstallParams(install_params.value()); - } - task->InstallWebAppFromInfo( - std::move(install_info), overwrite_existing_manifest_fields, - base::BindOnce(&WebAppInstallManager::OnInstallTaskCompleted, - GetWeakPtr(), task.get(), std::move(callback))); - - tasks_.insert(std::move(task)); -} - base::WeakPtr<WebAppInstallManager> WebAppInstallManager::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); }
diff --git a/chrome/browser/web_applications/web_app_install_manager.h b/chrome/browser/web_applications/web_app_install_manager.h index f6262f26..0ddab13 100644 --- a/chrome/browser/web_applications/web_app_install_manager.h +++ b/chrome/browser/web_applications/web_app_install_manager.h
@@ -69,33 +69,6 @@ const GURL& install_url, OnceInstallCallback callback); - // Starts a web app installation process using prefilled - // |install_info| which holds all the data needed for installation. - // This doesn't fetch a manifest and doesn't perform all required steps for - // External installed apps: use |ExternallyManagedAppManager::Install| - // instead. - // - // The web app can be simultaneously installed from multiple sources. - // If the web app already exists and `overwrite_existing_manifest_fields` is - // false then manifest fields in `install_info` are treated only as - // fallback manifest values. If `overwrite_existing_manifest_fields` is true - // then the existing web app manifest fields will be overwritten. - // If `install_info` contains data freshly fetched from the web app's - // site then `overwrite_existing_manifest_fields` should be true. - void InstallWebAppFromInfo(std::unique_ptr<WebAppInstallInfo> install_info, - bool overwrite_existing_manifest_fields, - ForInstallableSite for_installable_site, - webapps::WebappInstallSource install_source, - OnceInstallCallback callback); - - void InstallWebAppFromInfo( - std::unique_ptr<WebAppInstallInfo> install_info, - bool overwrite_existing_manifest_fields, - ForInstallableSite for_installable_site, - const absl::optional<WebAppInstallParams>& install_params, - webapps::WebappInstallSource install_source, - OnceInstallCallback callback); - // Returns whether the an installation is already running with the // same web contents. bool IsInstallingForWebContents(
diff --git a/chrome/browser/web_applications/web_app_install_manager_unittest.cc b/chrome/browser/web_applications/web_app_install_manager_unittest.cc index 44774d8..e6dc905 100644 --- a/chrome/browser/web_applications/web_app_install_manager_unittest.cc +++ b/chrome/browser/web_applications/web_app_install_manager_unittest.cc
@@ -18,6 +18,7 @@ #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "build/chromeos_buildflags.h" +#include "chrome/browser/web_applications/commands/install_from_info_command.h" #include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/policy/web_app_policy_manager.h" #include "chrome/browser/web_applications/test/fake_data_retriever.h" @@ -33,6 +34,7 @@ #include "chrome/browser/web_applications/test/web_app_test_utils.h" #include "chrome/browser/web_applications/user_display_mode.h" #include "chrome/browser/web_applications/web_app.h" +#include "chrome/browser/web_applications/web_app_command_manager.h" #include "chrome/browser/web_applications/web_app_helpers.h" #include "chrome/browser/web_applications/web_app_icon_generator.h" #include "chrome/browser/web_applications/web_app_icon_manager.h" @@ -193,6 +195,8 @@ &controller().os_integration_manager(), install_finalizer_.get()); + command_manager_ = std::make_unique<WebAppCommandManager>(profile()); + auto test_url_loader = std::make_unique<TestWebAppUrlLoader>(); test_url_loader_ = test_url_loader.get(); @@ -216,6 +220,7 @@ } WebAppRegistrar& registrar() { return controller().registrar(); } + WebAppCommandManager& command_manager() { return *command_manager_; } WebAppInstallManager& install_manager() { return *install_manager_; } WebAppInstallFinalizer& finalizer() { return *install_finalizer_; } WebAppIconManager& icon_manager() { return *icon_manager_; } @@ -333,15 +338,17 @@ webapps::WebappInstallSource install_source) { InstallResult result; base::RunLoop run_loop; - install_manager().InstallWebAppFromInfo( - std::move(install_info), overwrite_existing_manifest_fields, - ForInstallableSite::kYes, install_source, - base::BindLambdaForTesting([&](const AppId& installed_app_id, - webapps::InstallResultCode code) { - result.app_id = installed_app_id; - result.code = code; - run_loop.Quit(); - })); + command_manager().ScheduleCommand( + std::make_unique<web_app::InstallFromInfoCommand>( + std::move(install_info), &finalizer(), + overwrite_existing_manifest_fields, install_source, + base::BindLambdaForTesting([&](const AppId& installed_app_id, + webapps::InstallResultCode code) { + result.app_id = installed_app_id; + result.code = code; + run_loop.Quit(); + }))); + run_loop.Run(); return result; } @@ -412,6 +419,9 @@ void DestroyManagers() { // The reverse order of creation: + if (command_manager_) + command_manager_->Shutdown(); + command_manager_.reset(); ui_manager_.reset(); policy_manager_.reset(); icon_manager_.reset(); @@ -445,6 +455,7 @@ std::unique_ptr<FakeWebAppUiManager> ui_manager_; std::unique_ptr<ExternallyInstalledWebAppPrefs> externally_installed_app_prefs_; + std::unique_ptr<WebAppCommandManager> command_manager_; // A weak ptr. The original is owned by install_manager_. raw_ptr<TestWebAppUrlLoader> test_url_loader_ = nullptr; @@ -1099,45 +1110,6 @@ EXPECT_FALSE(registrar().IsActivelyInstalled(app_id)); } -TEST_P(WebAppInstallManagerTest, InstallWebAppFromInfo) { - InitEmptyRegistrar(); - - const GURL url("https://example.com/path"); - const AppId expected_app_id = - GenerateAppId(/*manifest_id=*/absl::nullopt, url); - - auto server_web_app_info = std::make_unique<WebAppInstallInfo>(); - server_web_app_info->start_url = url; - server_web_app_info->scope = url; - server_web_app_info->title = u"Test web app"; - server_web_app_info->install_url = url; - - const webapps::WebappInstallSource install_source = - AreSystemWebAppsSupported() - ? webapps::WebappInstallSource::SYSTEM_DEFAULT - : webapps::WebappInstallSource::OMNIBOX_INSTALL_ICON; - - EXPECT_FALSE(registrar().IsActivelyInstalled(expected_app_id)); - - InstallResult result = InstallWebAppFromInfo( - std::move(server_web_app_info), - /*overwrite_existing_manifest_fields=*/false, install_source); - EXPECT_EQ(webapps::InstallResultCode::kSuccessNewInstall, result.code); - EXPECT_EQ(expected_app_id, result.app_id); - - EXPECT_TRUE(registrar().IsActivelyInstalled(expected_app_id)); - - const WebApp* web_app = registrar().GetAppById(expected_app_id); - ASSERT_TRUE(web_app); - - std::map<SquareSizePx, SkBitmap> icon_bitmaps = - ReadIcons(expected_app_id, IconPurpose::ANY, - web_app->downloaded_icon_sizes(IconPurpose::ANY)); - - // Make sure that icons have been generated for all sub sizes. - EXPECT_TRUE(ContainsOneIconOfEachSize(icon_bitmaps)); -} - TEST_P(WebAppInstallManagerTest, TaskQueueWebContentsReadyRace) { InitEmptyRegistrar();
diff --git a/chrome/browser/web_applications/web_app_install_task.cc b/chrome/browser/web_applications/web_app_install_task.cc index d23e9e75..f19e9fc 100644 --- a/chrome/browser/web_applications/web_app_install_task.cc +++ b/chrome/browser/web_applications/web_app_install_task.cc
@@ -311,7 +311,8 @@ GetWeakPtr(), install_url)); } -void UpdateFinalizerClientData( +// static +void WebAppInstallTask::UpdateFinalizerClientData( const absl::optional<WebAppInstallParams>& params, WebAppInstallFinalizer::FinalizeOptions* options) { if (params) { @@ -361,8 +362,9 @@ options.overwrite_existing_manifest_fields = overwrite_existing_manifest_fields; - UpdateFinalizerClientData(install_params_, &options); - if (!install_params_) { + if (install_params_) { + ApplyParamsToFinalizeOptions(*install_params_, options); + } else { options.bypass_os_hooks = true; } @@ -929,7 +931,7 @@ install_params_->force_reinstall; finalize_options.parent_app_id = install_params_->parent_app_id; - UpdateFinalizerClientData(install_params_, &finalize_options); + ApplyParamsToFinalizeOptions(*install_params_, finalize_options); if (install_params_->user_display_mode.has_value()) web_app_info_copy.user_display_mode = install_params_->user_display_mode;
diff --git a/chrome/browser/web_applications/web_app_install_task.h b/chrome/browser/web_applications/web_app_install_task.h index 5879d9c3..15dddaf 100644 --- a/chrome/browser/web_applications/web_app_install_task.h +++ b/chrome/browser/web_applications/web_app_install_task.h
@@ -185,6 +185,10 @@ void SetFlowForTesting(WebAppInstallFlow flow) { flow_ = flow; } + static void UpdateFinalizerClientData( + const absl::optional<WebAppInstallParams>& params, + WebAppInstallFinalizer::FinalizeOptions* options); + private: void CheckInstallPreconditions(); void RecordInstallEvent();
diff --git a/chrome/browser/web_applications/web_app_install_utils.cc b/chrome/browser/web_applications/web_app_install_utils.cc index a3a3410e..17655066 100644 --- a/chrome/browser/web_applications/web_app_install_utils.cc +++ b/chrome/browser/web_applications/web_app_install_utils.cc
@@ -1018,4 +1018,30 @@ web_app_info.install_url = install_params.install_url; } +void ApplyParamsToFinalizeOptions( + const WebAppInstallParams& install_params, + WebAppInstallFinalizer::FinalizeOptions& options) { + if (IsChromeOsDataMandatory()) { + options.chromeos_data.emplace(); + options.chromeos_data->show_in_launcher = + install_params.add_to_applications_menu; + options.chromeos_data->show_in_search = install_params.add_to_search; + options.chromeos_data->show_in_management = + install_params.add_to_management; + options.chromeos_data->is_disabled = install_params.is_disabled; + options.chromeos_data->oem_installed = install_params.oem_installed; + options.chromeos_data->handles_file_open_intents = + install_params.handles_file_open_intents; + } + options.bypass_os_hooks = install_params.bypass_os_hooks; + options.add_to_applications_menu = install_params.add_to_applications_menu; + options.add_to_desktop = install_params.add_to_desktop; + options.add_to_quick_launch_bar = install_params.add_to_quick_launch_bar; + if (install_params.system_app_type.has_value()) { + options.system_web_app_data.emplace(); + options.system_web_app_data->system_app_type = + install_params.system_app_type.value(); + } +} + } // namespace web_app
diff --git a/chrome/browser/web_applications/web_app_install_utils.h b/chrome/browser/web_applications/web_app_install_utils.h index 414b7930..1d8d6b0 100644 --- a/chrome/browser/web_applications/web_app_install_utils.h +++ b/chrome/browser/web_applications/web_app_install_utils.h
@@ -11,6 +11,7 @@ #include "chrome/browser/web_applications/os_integration/os_integration_manager.h" #include "chrome/browser/web_applications/web_app_constants.h" #include "chrome/browser/web_applications/web_app_id.h" +#include "chrome/browser/web_applications/web_app_install_finalizer.h" #include "chrome/browser/web_applications/web_app_install_info.h" #include "chrome/browser/web_applications/web_app_install_params.h" #include "components/services/app_service/public/cpp/file_handler.h" @@ -131,10 +132,14 @@ // Returns true if web app is allowed to update its identity (name and/or icon). bool CanWebAppUpdateIdentity(const WebApp* web_app); -// Update WebAppInstallInfo with fields dfrom WebAppInstallParams. +// Update |web_app_info| using |install_params|. void ApplyParamsToWebAppInstallInfo(const WebAppInstallParams& install_params, WebAppInstallInfo& web_app_info); +// Update |options| using |install_params|. +void ApplyParamsToFinalizeOptions( + const WebAppInstallParams& install_params, + WebAppInstallFinalizer::FinalizeOptions& options); } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_INSTALL_UTILS_H_
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc index d2dc1b0..edabd71 100644 --- a/chrome/browser/web_applications/web_app_provider.cc +++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -316,7 +316,7 @@ sync_bridge_.get()); externally_managed_app_manager_->SetSubsystems( registrar_.get(), ui_manager_.get(), install_finalizer_.get(), - install_manager_.get(), sync_bridge_.get()); + command_manager_.get(), sync_bridge_.get()); preinstalled_web_app_manager_->SetSubsystems( registrar_.get(), ui_manager_.get(), externally_managed_app_manager_.get());
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index c31435d..fd42ef9 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1652227090-194c47dd88bc3fb6c2d8a61535454d9de84ebb9b.profdata +chrome-linux-main-1652248601-6c7649e11a4188ef71eb9515493eedf790075a7a.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index df34932f..58c1427e 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1652205556-73ed408b21c83e1179086079a772db3d0398100e.profdata +chrome-mac-arm-main-1652248601-7d5b53262b0458bfe36360a4ac691f81b054b0d9.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 159b2afb..b40ed3b 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1652205556-f04d0f9f69920b666e7a4ea2ef3ac790db0f7d3b.profdata +chrome-mac-main-1652248601-c82c003d327a1a867a1b72fc302fc19e1b81ec98.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 9e479ee..24f02cc 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1652205556-38032fd4da609b1dbe6d773d2ceb88933dd4ed75.profdata +chrome-win32-main-1652248601-f5be7624dc8d1c44f5ae31d3c8656c2b17c1d738.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 359f23a..4ee07b2 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1652205556-4ec78781226a20199fad6c6a154c702205211acd.profdata +chrome-win64-main-1652248601-b52b4da93ba156586a2b6a1039248e7ad9d02b4a.profdata
diff --git a/chrome/chrome_elf/crash/crash_helper.cc b/chrome/chrome_elf/crash/crash_helper.cc index 886372e1..c5fe247 100644 --- a/chrome/chrome_elf/crash/crash_helper.cc +++ b/chrome/chrome_elf/crash/crash_helper.cc
@@ -67,10 +67,10 @@ if (g_crash_helper_enabled) return true; -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) assert(g_crash_reports == nullptr); assert(g_set_unhandled_exception_filter == nullptr); -#endif // _DEBUG +#endif // defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) // No global objects with destructors, so using global pointers. // DllMain on detach will clean these up. @@ -98,16 +98,19 @@ // Please refer to the comment on g_set_unhandled_exception_filter for more // information about why we intercept the SetUnhandledExceptionFilter API. void DisableSetUnhandledExceptionFilter() { - if (!g_crash_helper_enabled) - return; +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) + // Should never patch SetUnhandledExceptionFilter before crashpad has called + // it. + assert(g_crash_helper_enabled); +#endif // defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) if (g_set_unhandled_exception_filter->Hook( ::GetModuleHandle(nullptr), "kernel32.dll", "SetUnhandledExceptionFilter", reinterpret_cast<void*>(SetUnhandledExceptionFilterPatch)) != NO_ERROR) { -#ifdef _DEBUG +#if defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) assert(false); -#endif // _DEBUG +#endif // defined(_DEBUG) || defined(DCHECK_ALWAYS_ON) } }
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index d4c4efa0..56bd6e8 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -641,11 +641,6 @@ const base::Feature kIPHInWebUIDemo{"IPHInWebUIDemo", base::FEATURE_DISABLED_BY_DEFAULT}; -#if BUILDFLAG(IS_CHROMEOS_ASH) -const base::Feature kKernelnextVMs{"KernelnextVMs", - base::FEATURE_DISABLED_BY_DEFAULT}; -#endif - #if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) COMPONENT_EXPORT(CHROME_FEATURES) const base::Feature kLinuxLowMemoryMonitor{"LinuxLowMemoryMonitor", @@ -1040,6 +1035,10 @@ kTrustSafetySentimentSurveyPrivacySandbox3NoticeSettingsProbability{ &kTrustSafetySentimentSurvey, "privacy-sandbox-3-notice-settings-probability", 0.8}; +const base::FeatureParam<double> + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreProbability{ + &kTrustSafetySentimentSurvey, + "privacy-sandbox-3-notice-learn-more-probability", 0.2}; // The HaTS trigger IDs, which determine which survey is delivered from the HaTS // backend. const base::FeatureParam<std::string> @@ -1071,6 +1070,10 @@ kTrustSafetySentimentSurveyPrivacySandbox3NoticeSettingsTriggerId{ &kTrustSafetySentimentSurvey, "privacy-sandbox-3-notice-settings-trigger-id", ""}; +extern const base::FeatureParam<std::string> + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreTriggerId{ + &kTrustSafetySentimentSurvey, + "privacy-sandbox-3-notice-learn-more-trigger-id", ""}; // The time the user must remain on settings after interacting with a privacy // setting to be considered. const base::FeatureParam<base::TimeDelta>
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 66198144..bc467d9 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -451,11 +451,6 @@ COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kIPHInWebUIDemo; -#if BUILDFLAG(IS_CHROMEOS_ASH) -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kKernelnextVMs; -#endif - #if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kLinuxLowMemoryMonitor; @@ -710,6 +705,9 @@ extern const base::FeatureParam<double> kTrustSafetySentimentSurveyPrivacySandbox3NoticeSettingsProbability; COMPONENT_EXPORT(CHROME_FEATURES) +extern const base::FeatureParam<double> + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreProbability; +COMPONENT_EXPORT(CHROME_FEATURES) extern const base::FeatureParam<std::string> kTrustSafetySentimentSurveyPrivacySettingsTriggerId; COMPONENT_EXPORT(CHROME_FEATURES) @@ -734,6 +732,9 @@ extern const base::FeatureParam<std::string> kTrustSafetySentimentSurveyPrivacySandbox3NoticeSettingsTriggerId; COMPONENT_EXPORT(CHROME_FEATURES) +extern const base::FeatureParam<std::string> + kTrustSafetySentimentSurveyPrivacySandbox3NoticeLearnMoreTriggerId; +COMPONENT_EXPORT(CHROME_FEATURES) extern const base::FeatureParam<base::TimeDelta> kTrustSafetySentimentSurveyPrivacySettingsTime; COMPONENT_EXPORT(CHROME_FEATURES)
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 50ede85..59bc2fc 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc
@@ -366,12 +366,14 @@ #endif break; -#if BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_CHROMEOS) case chrome::FILE_RESOURCES_FOR_SHARING_PACK: if (!GetDefaultUserDataDirectory(&cur)) return false; cur = cur.Append(FILE_PATH_LITERAL("resources_for_sharing.rspak")); break; +#endif +#if BUILDFLAG(IS_CHROMEOS_LACROS) case chrome::FILE_ASH_RESOURCES_PACK: if (!base::PathService::Get(chromeos::lacros_paths::ASH_RESOURCES_DIR, &cur))
diff --git a/chrome/common/chrome_paths.h b/chrome/common/chrome_paths.h index fc349f2..d23f2b2 100644 --- a/chrome/common/chrome_paths.h +++ b/chrome/common/chrome_paths.h
@@ -94,7 +94,7 @@ // This includes data for internal pages (e.g., html // files and images), unless these resources are // purposefully split into a separate file. -#if BUILDFLAG(IS_CHROMEOS_LACROS) +#if BUILDFLAG(IS_CHROMEOS) FILE_RESOURCES_FOR_SHARING_PACK, // Full path to the shared_resources.pak // tile containing binary data. This // includes mapping table from lacros @@ -102,6 +102,8 @@ // fallback resources info consists of // resources not included in // ASH_RESOURCES_PACK. +#endif +#if BUILDFLAG(IS_CHROMEOS_LACROS) FILE_ASH_RESOURCES_PACK, // Full path to ash resources.pak file. #endif FILE_DEV_UI_RESOURCES_PACK, // Full path to the .pak file containing
diff --git a/chrome/common/extensions/api/enterprise_reporting_private.idl b/chrome/common/extensions/api/enterprise_reporting_private.idl index c2c6a8c..71f03a7 100644 --- a/chrome/common/extensions/api/enterprise_reporting_private.idl +++ b/chrome/common/extensions/api/enterprise_reporting_private.idl
@@ -104,6 +104,27 @@ // Invoked by <code>getCertificate</code> to return the selected certificate. callback CertificateCallback = void(Certificate certificate); + // Captures the type of event so it can be associated with user or device in + // Chrome for reporting purposes + [platforms = ("chromeos", "lacros")] + enum EventType { DEVICE, USER }; + + // Composite object that captures the information we need to report events. + // Some fields like the record and priority are serialized to avoid any + // dependency on proto definitions here, given the fact that they will likely + // change in the future. These will be deserialized and validated in Chrome. + [platforms = ("chromeos", "lacros")] + dictionary EnqueueRecordRequest { + // Serialized record data binary based on the proto definition in + // //components/reporting/proto/synced/record.proto. + [instanceOf=Uint8Array] ArrayBufferView recordData; + // Serialized priority based on the proto definition in + // //components/reporting/proto/synced/record_constants.proto. Used to + // determine which records are shed first. + long priority; + EventType eventType; + }; + interface Functions { // Gets the identity of device that Chrome browser is running on. The ID is // retrieved from the local device and used by the Google admin console. @@ -146,6 +167,15 @@ // AutoSelectCertificateForUrls policy for <code>url</code>. [supportsPromises] static void getCertificate(DOMString url, CertificateCallback callback); + + // Enqueues a record for upload to the reporting service + // |request|: Composite object that captures everything + // we need for uploading records. + // |callback|: Callback that is triggered upon completion + [platforms = ("chromeos", "lacros"), supportsPromises] + static void enqueueRecord( + EnqueueRecordRequest request, + optional DoneCallback callback); }; };
diff --git a/chrome/common/extensions/api/file_manager_private.idl b/chrome/common/extensions/api/file_manager_private.idl index 1636509..8f6e711c4 100644 --- a/chrome/common/extensions/api/file_manager_private.idl +++ b/chrome/common/extensions/api/file_manager_private.idl
@@ -1287,18 +1287,17 @@ [instanceOf=Entry] object[] entries, ResolveEntriesCallback callback); - // Mounts a resource or a file. - // |source| Mount point source. For compressed files it is the relative file - // path within the external file system. - // |password| Optional password to decrypt the file. + // Mounts a resource or an archive. + // |fileUrl| Mount point source. + // |password| Optional password to decrypt the archive. // |callback| Callback called with the source path of the mount. - static void addMount(DOMString source, optional DOMString password, + static void addMount(DOMString fileUrl, optional DOMString password, AddMountCallback callback); // Cancels an archive mounting operation. - // |source| Mount point source. It is the relative file path within the - // external file system. - static void cancelMounting(DOMString source, SimpleCallback callback); + // |fileUrl| Mount point source. Should be same as the one passed to addMount. + // |callback| + static void cancelMounting(DOMString fileUrl, SimpleCallback callback); // Unmounts a mounted resource. // |volumeId| An ID of the volume.
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 4cc333af..eece713 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -565,6 +565,8 @@ const char kPeopleSubPage[] = "people"; const char kPrivacySandboxAdPersonalizationSubPage[] = "privacySandbox?view=adPersonalizationDialog"; +const char kPrivacySandboxLearnMoreSubPage[] = + "privacySandbox?view=learnMoreDialog"; const char kPrivacySandboxSubPage[] = "privacySandbox"; #if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index d05e82ad..8b3f93d 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -499,6 +499,7 @@ extern const char kSyncSetupSubPage[]; extern const char kTriggeredResetProfileSettingsSubPage[]; extern const char kPrivacySandboxAdPersonalizationSubPage[]; +extern const char kPrivacySandboxLearnMoreSubPage[]; extern const char kPrivacySandboxSubPage[]; #if !BUILDFLAG(IS_ANDROID)
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index 7ec7d43..6507421 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -1755,6 +1755,7 @@ } } +#if BUILDFLAG(IS_ANDROID) // Tests that TryToShowTouchToFill() works correctly for fillable and // non-fillable fields. TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFillUsername) { @@ -1777,11 +1778,9 @@ EXPECT_EQ(WebAutofillState::kPreviewed, username_element_.GetAutofillState()); EXPECT_EQ(WebAutofillState::kPreviewed, password_element_.GetAutofillState()); -#if BUILDFLAG(IS_ANDROID) EXPECT_CALL( fake_driver_, ShowTouchToFill(autofill::mojom::SubmissionReadinessState::kEmptyFields)); -#endif base::RunLoop().RunUntilIdle(); } @@ -1793,15 +1792,12 @@ EXPECT_TRUE(password_autofill_agent_->ShouldSuppressKeyboard()); EXPECT_EQ(WebAutofillState::kPreviewed, password_element_.GetAutofillState()); -#if BUILDFLAG(IS_ANDROID) EXPECT_CALL( fake_driver_, ShowTouchToFill(autofill::mojom::SubmissionReadinessState::kEmptyFields)); -#endif base::RunLoop().RunUntilIdle(); } -#if BUILDFLAG(IS_ANDROID) TEST_F(PasswordAutofillAgentTest, TryToShowTouchToFillButDontEnableSubmission) { LoadHTML(kPasswordChangeFormHTML); UpdateUrlForHTML(kPasswordChangeFormHTML); @@ -1962,7 +1958,6 @@ ShowTouchToFill(autofill::mojom::SubmissionReadinessState::kTwoFields)); base::RunLoop().RunUntilIdle(); } -#endif TEST_F(PasswordAutofillAgentTest, DontTryToShowTouchToFillReadonlyPassword) { SetElementReadOnly(password_element_, true); @@ -1998,6 +1993,7 @@ EXPECT_FALSE( password_autofill_agent_->TryToShowTouchToFill(password_element_)); } +#endif // Tests that |FillIntoFocusedField| doesn't fill read-only text fields. TEST_F(PasswordAutofillAgentTest, FillIntoFocusedReadonlyTextField) {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 29c33ff..7866754 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -203,6 +203,7 @@ "//components/safe_browsing/content/renderer/phishing_classifier:unit_tests_support", "//components/security_interstitials/content:security_interstitial_page", "//components/spellcheck/renderer", + "//components/user_education/common", "//ui/webui", ] @@ -267,6 +268,7 @@ "//components/sync_sessions:test_support", "//components/sync_user_events:test_support", "//components/update_client:test_support", + "//components/user_education/test", "//components/user_prefs", "//components/variations:test_support", "//components/web_resource:test_support", @@ -628,7 +630,10 @@ "views/chrome_views_test_base.cc", "views/chrome_views_test_base.h", ] - deps += [ "//chrome/browser/ui/color:mixers" ] + deps += [ + "//chrome/browser/ui/color:mixers", + "//components/user_education/views", + ] } if (enable_extensions) { @@ -1396,6 +1401,8 @@ "//components/url_formatter/spoof_checks/top_domains:browsertest_top500_domains", "//components/url_formatter/spoof_checks/top_domains:browsertest_top500_domains_header", "//components/url_formatter/spoof_checks/top_domains:generate_top_domains_browsertest_trie", + "//components/user_education/common", + "//components/user_education/test", "//components/user_manager", "//components/variations/service", "//components/variations/service:constants", @@ -3314,6 +3321,7 @@ "//components/page_info/core:proto", "//components/send_tab_to_self", "//components/send_tab_to_self:test_support", + "//components/user_education/views", "//ui/base/dragdrop:types", "//ui/views", "//url", @@ -5717,6 +5725,8 @@ "//components/unified_consent", "//components/url_formatter/spoof_checks/common_words:common", "//components/url_formatter/spoof_checks/common_words:common_words_dafsa", + "//components/user_education/common", + "//components/user_education/test", "//components/user_manager", "//components/variations:test_support", "//components/version_info:generate_version_info", @@ -6447,6 +6457,7 @@ "../browser/ui/autofill/payments/offer_notification_bubble_controller_impl_unittest.cc", "../browser/ui/autofill/payments/save_card_bubble_controller_impl_unittest.cc", "../browser/ui/autofill/save_update_address_profile_bubble_controller_impl_unittest.cc", + "../browser/ui/autofill_assistant/password_change/assistant_onboarding_controller_impl_unittest.cc", "../browser/ui/bookmarks/bookmark_context_menu_controller_unittest.cc", "../browser/ui/bookmarks/bookmark_editor_unittest.cc", "../browser/ui/bookmarks/bookmark_ui_utils_desktop_unittest.cc", @@ -6553,16 +6564,12 @@ "../browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc", "../browser/ui/toolbar/toolbar_actions_model_unittest.cc", "../browser/ui/user_education/active_tab_tracker_unittest.cc", - "../browser/ui/user_education/help_bubble_factory_registry_unittest.cc", - "../browser/ui/user_education/mock_feature_promo_controller.cc", - "../browser/ui/user_education/mock_feature_promo_controller.h", "../browser/ui/user_education/reopen_tab_in_product_help_trigger_unittest.cc", "../browser/ui/user_education/reopen_tab_in_product_help_unittest.cc", - "../browser/ui/user_education/test_help_bubble.cc", - "../browser/ui/user_education/test_help_bubble.h", "../browser/ui/views/autofill/edit_address_profile_view_unittest.cc", "../browser/ui/views/autofill/save_address_profile_view_unittest.cc", "../browser/ui/views/autofill/update_address_profile_view_unittest.cc", + "../browser/ui/views/autofill_assistant/password_change/assistant_onboarding_view_unittest.cc", "../browser/ui/views/file_system_access/file_system_access_ui_helpers_unittest.cc", "../browser/ui/views/location_bar/permission_chip_unittest.cc", "../browser/ui/views/passwords/move_to_account_store_bubble_view_unittest.cc", @@ -6809,6 +6816,8 @@ "//components/signin/public/base:signin_buildflags", "//components/soda:constants", "//components/sync:test_support", + "//components/user_education/common", + "//components/user_education/test", "//components/user_notes:features", "//components/user_notes/browser", "//components/user_notes/interfaces", @@ -6894,6 +6903,7 @@ "../browser/enterprise/reporting/android_app_info_generator_unittest.cc", "../browser/extensions/api/terminal/crostini_startup_status_unittest.cc", "../browser/google/google_brand_code_map_chromeos_unittest.cc", + "../browser/lifetime/application_lifetime_chromeos_unittest.cc", "../browser/media/webrtc/desktop_media_list_ash_unittest.cc", "../browser/metrics/per_user_state_manager_chromeos_unittest.cc", "../browser/metrics/perf/metric_collector_unittest.cc", @@ -7758,7 +7768,10 @@ if (is_chromeos) { sources += [ "//chrome/browser/chromeos/extensions/contact_center_insights/contact_center_insights_extension_manager_unittest.cc" ] - deps += [ "//chrome/browser/chromeos/extensions/login_screen:unit_tests" ] + deps += [ + "//chrome/browser/chromeos/extensions/login_screen:unit_tests", + "//chromeos/dbus/missive:missive", + ] } if (is_chromeos_ash) { @@ -8226,6 +8239,7 @@ "//components/media_message_center", "//components/media_router/browser:test_support", "//components/media_router/common:test_support", + "//components/user_education/views", "//components/web_modal:test_support", "//content/test:test_support", "//ui/base/dragdrop:types", @@ -8245,8 +8259,6 @@ "../../ui/views/controls/webview/webview_unittest.cc", "../browser/ui/media_router/media_route_starter_unittest.cc", "../browser/ui/media_router/media_router_ui_unittest.cc", - "../browser/ui/user_education/feature_promo_snooze_service_unittest.cc", - "../browser/ui/user_education/tutorial/tutorial_unittest.cc", "../browser/ui/views/accelerator_table_unittest.cc", "../browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc", "../browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc", @@ -8349,8 +8361,7 @@ "../browser/ui/views/toolbar/toolbar_button_unittest.cc", "../browser/ui/views/translate/translate_bubble_view_unittest.cc", "../browser/ui/views/user_education/browser_feature_promo_controller_unittest.cc", - "../browser/ui/views/user_education/help_bubble_view_unittest.cc", - "../browser/ui/views/user_education/new_badge_label_unittest.cc", + "../browser/ui/views/user_education/help_bubble_view_timeout_unittest.cc", "../browser/ui/views/user_education/tip_marquee_view_unittest.cc", "../browser/ui/window_name_prompt/window_name_prompt_unittest.cc", ] @@ -9027,6 +9038,8 @@ "//components/translate/content/browser:test_support", "//components/ukm:test_support", "//components/ukm:ukm_test_helper", + "//components/user_education/common", + "//components/user_education/test", "//content/app/resources", "//content/test:browsertest_support", "//content/test:test_support", @@ -9187,6 +9200,7 @@ "//components/live_caption:utils", "//components/optimization_guide/core:test_support", "//components/optimization_guide/proto:optimization_guide_proto", + "//components/user_education/views", "//ui/base/dragdrop:types", "//ui/base/dragdrop/mojom", "//ui/views",
diff --git a/chrome/test/DEPS b/chrome/test/DEPS index f6b6327..a4e60c1 100644 --- a/chrome/test/DEPS +++ b/chrome/test/DEPS
@@ -69,6 +69,7 @@ "+components/sync_preferences", "+components/unified_consent", "+components/update_client", + "+components/user_education", "+components/user_manager", "+components/user_prefs", "+components/version_info",
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc index 8b1bffd..caebcea 100644 --- a/chrome/test/base/test_browser_window.cc +++ b/chrome/test/base/test_browser_window.cc
@@ -10,7 +10,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_list_observer.h" #include "chrome/browser/ui/find_bar/find_bar.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_controller.h" #include "content/public/browser/keyboard_event_processing_result.h" #include "ui/base/interaction/element_identifier.h" #include "ui/color/color_provider_manager.h" @@ -344,7 +344,8 @@ void TestBrowserWindow::MaybeRestoreSideSearchStatePerWindow( const std::map<std::string, std::string>& extra_data) {} -FeaturePromoController* TestBrowserWindow::GetFeaturePromoController() { +user_education::FeaturePromoController* +TestBrowserWindow::GetFeaturePromoController() { return feature_promo_controller_.get(); } @@ -358,8 +359,10 @@ bool TestBrowserWindow::MaybeShowFeaturePromo( const base::Feature& iph_feature, - FeaturePromoSpecification::StringReplacements body_text_replacements, - FeaturePromoController::BubbleCloseCallback close_callback) { + user_education::FeaturePromoSpecification::StringReplacements + body_text_replacements, + user_education::FeaturePromoController::BubbleCloseCallback + close_callback) { return feature_promo_controller_ && feature_promo_controller_->MaybeShowPromo( iph_feature, body_text_replacements, std::move(close_callback)); @@ -370,19 +373,21 @@ feature_promo_controller_->CloseBubble(iph_feature); } -FeaturePromoController::PromoHandle +user_education::FeaturePromoController::PromoHandle TestBrowserWindow::CloseFeaturePromoAndContinue( const base::Feature& iph_feature) { return feature_promo_controller_ ? feature_promo_controller_->CloseBubbleAndContinuePromo( iph_feature) - : FeaturePromoController::PromoHandle(); + : user_education::FeaturePromoController::PromoHandle(); } void TestBrowserWindow::NotifyFeatureEngagementEvent(const char* event_name) {} -FeaturePromoController* TestBrowserWindow::SetFeaturePromoController( - std::unique_ptr<FeaturePromoController> feature_promo_controller) { +user_education::FeaturePromoController* +TestBrowserWindow::SetFeaturePromoController( + std::unique_ptr<user_education::FeaturePromoController> + feature_promo_controller) { feature_promo_controller_ = std::move(feature_promo_controller); return feature_promo_controller_.get(); }
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index f4d71be4..ce937232 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h
@@ -24,7 +24,6 @@ #include "chrome/browser/apps/intent_helper/apps_navigation_types.h" #endif // !BUILDFLAG(IS_ANDROID) -class FeaturePromoController; class LocationBarTesting; class OmniboxView; @@ -40,6 +39,10 @@ class SharingHubBubbleView; } // namespace sharing_hub +namespace user_education { +class FeaturePromoController; +} // namespace user_education + // An implementation of BrowserWindow used for testing. TestBrowserWindow only // contains a valid LocationBar, all other getters return NULL. // However, some of them can be preset to a specific value. @@ -233,24 +236,26 @@ void MaybeRestoreSideSearchStatePerWindow( const std::map<std::string, std::string>& extra_data) override; - FeaturePromoController* GetFeaturePromoController() override; + user_education::FeaturePromoController* GetFeaturePromoController() override; bool IsFeaturePromoActive( const base::Feature& iph_feature, bool include_continued_promos = false) const override; bool MaybeShowFeaturePromo( const base::Feature& iph_feature, - FeaturePromoSpecification::StringReplacements body_text_replacements = {}, - FeaturePromoController::BubbleCloseCallback close_callback = - base::DoNothing()) override; + user_education::FeaturePromoSpecification::StringReplacements + body_text_replacements = {}, + user_education::FeaturePromoController::BubbleCloseCallback + close_callback = base::DoNothing()) override; bool CloseFeaturePromo(const base::Feature& iph_feature) override; - FeaturePromoController::PromoHandle CloseFeaturePromoAndContinue( - const base::Feature& iph_feature) override; + user_education::FeaturePromoController::PromoHandle + CloseFeaturePromoAndContinue(const base::Feature& iph_feature) override; void NotifyFeatureEngagementEvent(const char* event_name) override; // Sets the controller returned by GetFeaturePromoController(). // Deletes the existing one, if any. - FeaturePromoController* SetFeaturePromoController( - std::unique_ptr<FeaturePromoController> feature_promo_controller); + user_education::FeaturePromoController* SetFeaturePromoController( + std::unique_ptr<user_education::FeaturePromoController> + feature_promo_controller); void set_workspace(std::string workspace) { workspace_ = workspace; } void set_visible_on_all_workspaces(bool visible_on_all_workspaces) { @@ -299,7 +304,8 @@ bool is_active_ = false; bool is_tab_strip_editable_ = true; - std::unique_ptr<FeaturePromoController> feature_promo_controller_; + std::unique_ptr<user_education::FeaturePromoController> + feature_promo_controller_; base::OnceClosure close_callback_; };
diff --git a/chrome/test/data/webui/settings/chromeos/input_page_test.js b/chrome/test/data/webui/settings/chromeos/input_page_test.js index c3fb6976..23874064 100644 --- a/chrome/test/data/webui/settings/chromeos/input_page_test.js +++ b/chrome/test/data/webui/settings/chromeos/input_page_test.js
@@ -102,7 +102,7 @@ // Sets up test metrics proxy. metricsProxy = new TestLanguagesMetricsProxy(); - LanguagesMetricsProxyImpl.instance_ = metricsProxy; + LanguagesMetricsProxyImpl.setInstance(metricsProxy); // Set up fake languageSettingsPrivate API. const languageSettingsPrivate = browserProxy.getLanguageSettingsPrivate(); @@ -137,7 +137,8 @@ loadTimeData.overrideValues({languagePacksHandwritingEnabled: true}); flush(); - assertTrue(isVisible(inputPage.$$('#languagePacksNotice'))); + assertTrue(isVisible( + inputPage.shadowRoot.querySelector('#languagePacksNotice'))); }); test('is hidden when needed', () => { @@ -145,13 +146,15 @@ loadTimeData.overrideValues({languagePacksHandwritingEnabled: false}); flush(); - assertFalse(isVisible(inputPage.$$('#languagePacksNotice'))); + assertFalse(isVisible( + inputPage.shadowRoot.querySelector('#languagePacksNotice'))); }); }); suite('input method list', () => { test('displays correctly', () => { - const inputMethodsList = inputPage.$$('#inputMethodsList'); + const inputMethodsList = + inputPage.shadowRoot.querySelector('#inputMethodsList'); assertTrue(!!inputMethodsList); // The test input methods should appear. @@ -231,14 +234,15 @@ test('shows managed input methods label', () => { const inputMethodsManagedbyPolicy = - inputPage.$$('#inputMethodsManagedbyPolicy'); + inputPage.shadowRoot.querySelector('#inputMethodsManagedbyPolicy'); assertFalse(!!inputMethodsManagedbyPolicy); inputPage.setPrefValue( 'settings.language.allowed_input_methods', ['xkb:us::eng']); flush(); - assertTrue(!!inputPage.$$('#inputMethodsManagedbyPolicy')); + assertTrue( + !!inputPage.shadowRoot.querySelector('#inputMethodsManagedbyPolicy')); }); }); @@ -250,8 +254,9 @@ flush(); - const deepLinkElement = inputPage.$$('#enableSpellcheckingToggle') - .shadowRoot.querySelector('cr-toggle'); + const deepLinkElement = + inputPage.shadowRoot.querySelector('#enableSpellcheckingToggle') + .shadowRoot.querySelector('cr-toggle'); await waitAfterNextRender(deepLinkElement); assertEquals( deepLinkElement, getDeepActiveElement(), @@ -267,23 +272,25 @@ let actionButton; setup(() => { - assertFalse(!!inputPage.$$('os-settings-add-input-methods-dialog')); - inputPage.$$('#addInputMethod').click(); + assertFalse(!!inputPage.shadowRoot.querySelector( + 'os-settings-add-input-methods-dialog')); + inputPage.shadowRoot.querySelector('#addInputMethod').click(); flush(); - dialog = inputPage.$$('os-settings-add-input-methods-dialog') - .$$('os-settings-add-items-dialog'); + dialog = inputPage.shadowRoot + .querySelector('os-settings-add-input-methods-dialog') + .shadowRoot.querySelector('os-settings-add-items-dialog'); assertTrue(!!dialog); - actionButton = dialog.$$('.action-button'); + actionButton = dialog.shadowRoot.querySelector('.action-button'); assertTrue(!!actionButton); - cancelButton = dialog.$$('.cancel-button'); + cancelButton = dialog.shadowRoot.querySelector('.cancel-button'); assertTrue(!!cancelButton); - suggestedList = dialog.$$('#suggested-items-list'); + suggestedList = dialog.shadowRoot.querySelector('#suggested-items-list'); assertTrue(!!suggestedList); - allImesList = dialog.$$('#filtered-items-list'); + allImesList = dialog.shadowRoot.querySelector('#filtered-items-list'); assertTrue(!!allImesList); // No input methods has been selected, so the action button is disabled. @@ -384,7 +391,7 @@ languageHelper.setPrefValue('settings.language.preferred_languages', ''); flush(); - suggestedList = dialog.$$('#suggestedInputMethods'); + suggestedList = dialog.shadowRoot.querySelector('#suggestedInputMethods'); // suggested input methods is rendered previously. assertFalse(isVisible(suggestedList)); }); @@ -400,17 +407,18 @@ }); flush(); - suggestedList = dialog.$$('#suggestedInputMethods'); + suggestedList = dialog.shadowRoot.querySelector('#suggestedInputMethods'); assertFalse(isVisible(suggestedList)); }); test('searches input methods correctly', () => { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); const getItems = function() { return allImesList.querySelectorAll('.list-item:not([hidden])'); }; - assertTrue(isVisible(dialog.$$('#filtered-items-label'))); + assertTrue( + isVisible(dialog.shadowRoot.querySelector('#filtered-items-label'))); assertTrue(isVisible(suggestedList)); // Expecting a few languages to be displayed when no query exists. @@ -419,7 +427,8 @@ // Search hides the suggested list and the label for all IMEs. searchInput.setValue('v'); flush(); - assertFalse(isVisible(dialog.$$('#filtered-items-label'))); + assertFalse( + isVisible(dialog.shadowRoot.querySelector('#filtered-items-label'))); assertFalse(isVisible(suggestedList)); // Search input methods name @@ -436,7 +445,7 @@ }); test('has escape key behavior working correctly', function() { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); searchInput.setValue('dummyquery'); // Test that dialog is not closed if 'Escape' is pressed on the input @@ -455,7 +464,7 @@ suite('records metrics', () => { test('when deactivating show ime menu', async () => { inputPage.setPrefValue('settings.language.ime_menu_activated', true); - inputPage.$$('#showImeMenu').click(); + inputPage.shadowRoot.querySelector('#showImeMenu').click(); flush(); assertFalse( @@ -464,7 +473,7 @@ test('when activating show ime menu', async () => { inputPage.setPrefValue('settings.language.ime_menu_activated', false); - inputPage.$$('#showImeMenu').click(); + inputPage.shadowRoot.querySelector('#showImeMenu').click(); flush(); assertTrue( @@ -472,14 +481,15 @@ }); test('when adding input methods', async () => { - inputPage.$$('#addInputMethod').click(); + inputPage.shadowRoot.querySelector('#addInputMethod').click(); flush(); await metricsProxy.whenCalled('recordAddInputMethod'); }); test('when switch input method', async () => { - const inputMethodsList = inputPage.$$('#inputMethodsList'); + const inputMethodsList = + inputPage.shadowRoot.querySelector('#inputMethodsList'); assertTrue(!!inputMethodsList); // The test input methods should appear. @@ -498,7 +508,8 @@ // Default shortcut reminder with two elements should show "last used IME" // reminder. - inputPage.$$('keyboard-shortcut-banner').$.dismiss.click(); + inputPage.shadowRoot.querySelector('keyboard-shortcut-banner') + .$.dismiss.click(); assertEquals( InputsShortcutReminderState.LAST_USED_IME, await metricsProxy.whenCalled('recordShortcutReminderDismissed')); @@ -510,7 +521,8 @@ flush(); // Shortcut reminder should show "next IME" shortcut. - inputPage.$$('keyboard-shortcut-banner').$.dismiss.click(); + inputPage.shadowRoot.querySelector('keyboard-shortcut-banner') + .$.dismiss.click(); assertEquals( InputsShortcutReminderState.NEXT_IME, await metricsProxy.whenCalled('recordShortcutReminderDismissed')); @@ -524,7 +536,8 @@ flush(); // Shortcut reminder should show both shortcuts. - inputPage.$$('keyboard-shortcut-banner').$.dismiss.click(); + inputPage.shadowRoot.querySelector('keyboard-shortcut-banner') + .$.dismiss.click(); assertEquals( InputsShortcutReminderState.LAST_USED_IME_AND_NEXT_IME, await metricsProxy.whenCalled('recordShortcutReminderDismissed')); @@ -535,8 +548,8 @@ loadTimeData.overrideValues({languagePacksHandwritingEnabled: true}); flush(); - const anchor = - inputPage.$$('#languagePacksNotice').shadowRoot.querySelector('a'); + const anchor = inputPage.shadowRoot.querySelector('#languagePacksNotice') + .shadowRoot.querySelector('a'); // The below would normally create a new window, which would change the // focus from this test to the new window. // Prevent this from happening by adding an event listener on the anchor @@ -568,11 +581,13 @@ flush(); // spell check is initially on - spellCheckToggle = inputPage.$$('#enableSpellcheckingToggle'); + spellCheckToggle = + inputPage.shadowRoot.querySelector('#enableSpellcheckingToggle'); assertTrue(!!spellCheckToggle); assertTrue(spellCheckToggle.checked); - spellCheckListContainer = inputPage.$$('#spellCheckLanguagesList'); + spellCheckListContainer = + inputPage.shadowRoot.querySelector('#spellCheckLanguagesList'); assertTrue(!!spellCheckListContainer); // two languages are in the list, with en-US on and sw off. @@ -850,7 +865,7 @@ test('toggle off disables enhanced spell check', () => { const enhancedSpellCheckToggle = - inputPage.$$('#enhancedSpellCheckToggle'); + inputPage.shadowRoot.querySelector('#enhancedSpellCheckToggle'); assertFalse(enhancedSpellCheckToggle.disabled); spellCheckToggle.click(); @@ -859,7 +874,7 @@ test('toggle off disables edit dictionary', () => { const editDictionarySubpageTrigger = - inputPage.$$('#editDictionarySubpageTrigger'); + inputPage.shadowRoot.querySelector('#editDictionarySubpageTrigger'); assertFalse(editDictionarySubpageTrigger.disabled); spellCheckToggle.click(); @@ -868,7 +883,7 @@ test('opens edit dictionary page', () => { const editDictionarySubpageTrigger = - inputPage.$$('#editDictionarySubpageTrigger'); + inputPage.shadowRoot.querySelector('#editDictionarySubpageTrigger'); editDictionarySubpageTrigger.click(); const router = Router.getInstance(); assertEquals( @@ -897,11 +912,13 @@ flush(); // Spell check is initially on. - spellCheckToggle = inputPage.$$('#enableSpellcheckingToggle'); + spellCheckToggle = + inputPage.shadowRoot.querySelector('#enableSpellcheckingToggle'); assertTrue(!!spellCheckToggle); assertTrue(spellCheckToggle.checked); - spellCheckListContainer = inputPage.$$('#spellCheckLanguagesListV2'); + spellCheckListContainer = + inputPage.shadowRoot.querySelector('#spellCheckLanguagesListV2'); assertTrue(!!spellCheckListContainer); // The spell check list should only have en-US (excluding the "add @@ -1229,7 +1246,7 @@ test('toggle off disables edit dictionary', () => { const editDictionarySubpageTrigger = - inputPage.$$('#editDictionarySubpageTrigger'); + inputPage.shadowRoot.querySelector('#editDictionarySubpageTrigger'); assertFalse(editDictionarySubpageTrigger.disabled); spellCheckToggle.click(); @@ -1238,7 +1255,7 @@ test('opens edit dictionary page', () => { const editDictionarySubpageTrigger = - inputPage.$$('#editDictionarySubpageTrigger'); + inputPage.shadowRoot.querySelector('#editDictionarySubpageTrigger'); editDictionarySubpageTrigger.click(); const router = Router.getInstance(); assertEquals( @@ -1295,24 +1312,25 @@ loadTimeData.overrideValues({enableLanguageSettingsV2Update2: true}); flush(); - assertFalse( - !!inputPage.$$('os-settings-add-spellcheck-languages-dialog')); - inputPage.$$('#addSpellcheckLanguages').click(); + assertFalse(!!inputPage.shadowRoot.querySelector( + 'os-settings-add-spellcheck-languages-dialog')); + inputPage.shadowRoot.querySelector('#addSpellcheckLanguages').click(); flush(); - dialog = inputPage.$$('os-settings-add-spellcheck-languages-dialog') - .$$('os-settings-add-items-dialog'); + dialog = inputPage.shadowRoot + .querySelector('os-settings-add-spellcheck-languages-dialog') + .shadowRoot.querySelector('os-settings-add-items-dialog'); assertTrue(!!dialog); assertTrue(dialog.$.dialog.open); - suggestedList = dialog.$$('#suggested-items-list'); + suggestedList = dialog.shadowRoot.querySelector('#suggested-items-list'); assertTrue(!!suggestedList); - allLangsList = dialog.$$('#filtered-items-list'); + allLangsList = dialog.shadowRoot.querySelector('#filtered-items-list'); assertTrue(!!allLangsList); - actionButton = dialog.$$('.action-button'); + actionButton = dialog.shadowRoot.querySelector('.action-button'); assertTrue(!!actionButton); - cancelButton = dialog.$$('.cancel-button'); + cancelButton = dialog.shadowRoot.querySelector('.cancel-button'); assertTrue(!!cancelButton); }); @@ -1361,11 +1379,13 @@ assertTrue(checkboxes.every(checkbox => !checkbox.checked)); // There should be a label for both sections. - const suggestedLabel = dialog.$$('#suggested-items-label'); + const suggestedLabel = + dialog.shadowRoot.querySelector('#suggested-items-label'); assertTrue(!!suggestedLabel); assertTrue(isVisible(suggestedLabel)); - const allLangsLabel = dialog.$$('#filtered-items-label'); + const allLangsLabel = + dialog.shadowRoot.querySelector('#filtered-items-label'); assertTrue(!!allLangsLabel); assertTrue(isVisible(allLangsLabel)); }); @@ -1467,7 +1487,7 @@ }); test('searches languages on display name', () => { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); // Expecting a few languages to be displayed when no query exists. assertGE(getAllLanguagesCheckboxWithPolicies().length, 1); @@ -1488,11 +1508,12 @@ searchInput.setValue('egaugnal'); flush(); assertEquals(getAllLanguagesCheckboxWithPolicies().length, 0); - assertTrue(isVisible(dialog.$$('#no-search-results'))); + assertTrue( + isVisible(dialog.shadowRoot.querySelector('#no-search-results'))); }); test('has escape key behavior working correctly', function() { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); searchInput.setValue('dummyquery'); // Test that dialog is not closed if 'Escape' is pressed on the input
diff --git a/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js b/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js index 7630c35..b574486 100644 --- a/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js +++ b/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.js
@@ -60,7 +60,7 @@ // Sets up test metrics proxy. metricsProxy = new TestLanguagesMetricsProxy(); - LanguagesMetricsProxyImpl.instance_ = metricsProxy; + LanguagesMetricsProxyImpl.setInstance(metricsProxy); // Sets up fake languageSettingsPrivate API. const languageSettingsPrivate = browserProxy.getLanguageSettingsPrivate(); @@ -413,7 +413,8 @@ flush(); - const deepLinkElement = languagesPage.$$('#addLanguages'); + const deepLinkElement = + languagesPage.shadowRoot.querySelector('#addLanguages'); await waitAfterNextRender(deepLinkElement); assertEquals( deepLinkElement, getDeepActiveElement(), @@ -448,17 +449,18 @@ } setup(() => { - assertFalse( - !!languagesPage.$$('os-settings-change-device-language-dialog')); - languagesPage.$$('#changeDeviceLanguage').click(); + assertFalse(!!languagesPage.shadowRoot.querySelector( + 'os-settings-change-device-language-dialog')); + languagesPage.shadowRoot.querySelector('#changeDeviceLanguage').click(); flush(); - dialog = languagesPage.$$('os-settings-change-device-language-dialog'); + dialog = languagesPage.shadowRoot.querySelector( + 'os-settings-change-device-language-dialog'); assertTrue(!!dialog); - actionButton = dialog.$$('.action-button'); + actionButton = dialog.shadowRoot.querySelector('.action-button'); assertTrue(!!actionButton); - cancelButton = dialog.$$('.cancel-button'); + cancelButton = dialog.shadowRoot.querySelector('.cancel-button'); assertTrue(!!cancelButton); // The fixed-height dialog's iron-list should stamp far fewer than @@ -539,7 +541,7 @@ // Test that searching languages works whether the displayed or native // language name is queried. test('searches languages', function() { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); // Expecting a few languages to be displayed when no query exists. assertGE(getListItems().length, 1); @@ -562,7 +564,7 @@ }); test('has escape key behavior working correctly', function() { - const searchInput = dialog.$$('cr-search-field'); + const searchInput = dialog.shadowRoot.querySelector('cr-search-field'); searchInput.setValue('dummyquery'); // Test that dialog is not closed if 'Escape' is pressed on the input @@ -603,14 +605,14 @@ suite('records metrics', () => { test('when adding languages', async () => { - languagesPage.$$('#addLanguages').click(); + languagesPage.shadowRoot.querySelector('#addLanguages').click(); flush(); await metricsProxy.whenCalled('recordAddLanguages'); }); test('when disabling translate.enable toggle', async () => { languagesPage.setPrefValue('translate.enabled', true); - languagesPage.$$('#offerTranslation').click(); + languagesPage.shadowRoot.querySelector('#offerTranslation').click(); flush(); assertFalse(await metricsProxy.whenCalled('recordToggleTranslate')); @@ -618,7 +620,7 @@ test('when enabling translate.enable toggle', async () => { languagesPage.setPrefValue('translate.enabled', false); - languagesPage.$$('#offerTranslation').click(); + languagesPage.shadowRoot.querySelector('#offerTranslation').click(); flush(); assertTrue(await metricsProxy.whenCalled('recordToggleTranslate')); @@ -634,7 +636,8 @@ // would change the focus from this test to the new window. // Prevent this from happening by overriding `window.open`. window.open = () => {}; - languagesPage.$$('#manageGoogleAccountLanguage').click(); + languagesPage.shadowRoot.querySelector('#manageGoogleAccountLanguage') + .click(); flush(); assertEquals( await metricsProxy.whenCalled('recordInteraction'), @@ -647,8 +650,9 @@ loadTimeData.overrideValues({enableLanguageSettingsV2Update2: false}); flush(); - const anchor = languagesPage.$$('#webLanguagesDescription') - .shadowRoot.querySelector('a'); + const anchor = + languagesPage.shadowRoot.querySelector('#webLanguagesDescription') + .shadowRoot.querySelector('a'); // The below would normally create a new window, which would change the // focus from this test to the new window. // Prevent this from happening by adding an event listener on the anchor @@ -666,8 +670,9 @@ loadTimeData.overrideValues({enableLanguageSettingsV2Update2: true}); flush(); - const anchor = languagesPage.$$('#webLanguagesDescription') - .shadowRoot.querySelector('a'); + const anchor = + languagesPage.shadowRoot.querySelector('#webLanguagesDescription') + .shadowRoot.querySelector('a'); // The below would normally create a new window, which would change the // focus from this test to the new window. // Prevent this from happening by adding an event listener on the anchor @@ -694,8 +699,9 @@ document.body.appendChild(page); flush(); - assertFalse(!!page.$$('#changeDeviceLanguage')); - assertFalse(!!page.$$('#changeDeviceLanguagePolicyIndicator')); + assertFalse(!!page.shadowRoot.querySelector('#changeDeviceLanguage')); + assertFalse(!!page.shadowRoot.querySelector( + '#changeDeviceLanguagePolicyIndicator')); }); test('is disabled for secondary users', () => { @@ -705,12 +711,13 @@ document.body.appendChild(page); flush(); - const changeDeviceLanguageButton = page.$$('#changeDeviceLanguage'); + const changeDeviceLanguageButton = + page.shadowRoot.querySelector('#changeDeviceLanguage'); assertTrue(changeDeviceLanguageButton.disabled); assertFalse(changeDeviceLanguageButton.hidden); const changeDeviceLanguagePolicyIndicator = - page.$$('#changeDeviceLanguagePolicyIndicator'); + page.shadowRoot.querySelector('#changeDeviceLanguagePolicyIndicator'); assertFalse(changeDeviceLanguagePolicyIndicator.hidden); assertEquals( 'test.com', changeDeviceLanguagePolicyIndicator.indicatorSourceName); @@ -725,10 +732,12 @@ document.body.appendChild(page); flush(); - const changeDeviceLanguageButton = page.$$('#changeDeviceLanguage'); + const changeDeviceLanguageButton = + page.shadowRoot.querySelector('#changeDeviceLanguage'); assertFalse(changeDeviceLanguageButton.disabled); assertFalse(changeDeviceLanguageButton.hidden); - assertFalse(!!page.$$('#changeDeviceLanguagePolicyIndicator')); + assertFalse(!!page.shadowRoot.querySelector( + '#changeDeviceLanguagePolicyIndicator')); }); });
diff --git a/chrome/test/data/webui/settings/test_clear_browsing_data_browser_proxy.ts b/chrome/test/data/webui/settings/test_clear_browsing_data_browser_proxy.ts index d69898d..3f345b5 100644 --- a/chrome/test/data/webui/settings/test_clear_browsing_data_browser_proxy.ts +++ b/chrome/test/data/webui/settings/test_clear_browsing_data_browser_proxy.ts
@@ -4,7 +4,7 @@ // clang-format off import {webUIListenerCallback} from 'chrome://resources/js/cr.m.js'; -import {ClearBrowsingDataBrowserProxy, ClearBrowsingDataResult, InstalledApp} from 'chrome://settings/lazy_load.js'; +import {ClearBrowsingDataBrowserProxy, ClearBrowsingDataResult, InstalledApp, UpdateSyncStateEvent} from 'chrome://settings/lazy_load.js'; import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; // clang-format on @@ -58,4 +58,16 @@ this.methodCalled('initialize'); return Promise.resolve(); } + + getSyncState(): Promise<UpdateSyncStateEvent> { + this.methodCalled('getSyncState'); + return Promise.resolve({ + signedIn: false, + syncConsented: false, + syncingHistory: false, + shouldShowCookieException: false, + isNonGoogleDse: false, + nonGoogleSearchHistoryString: 'somestring', + }); + } }
diff --git a/chrome/test/interaction/interaction_test_util_interactive_uitest.cc b/chrome/test/interaction/interaction_test_util_interactive_uitest.cc index 66be0a7..e80ad1d0 100644 --- a/chrome/test/interaction/interaction_test_util_interactive_uitest.cc +++ b/chrome/test/interaction/interaction_test_util_interactive_uitest.cc
@@ -15,6 +15,7 @@ #include "content/public/test/browser_test.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/expect_call_in_scope.h" +#include "ui/base/interaction/interaction_sequence.h" #include "ui/views/interaction/element_tracker_views.h" // This allows us to test features of InteractionTestUtil that only work in a
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 9fcc4079d7..db0d18c 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14792.0.0 \ No newline at end of file +14800.0.0 \ No newline at end of file
diff --git a/chromeos/components/cros_elements/button/button.ts b/chromeos/components/cros_elements/button/button.ts index b9ff2aa..fb1f1376 100644 --- a/chromeos/components/cros_elements/button/button.ts +++ b/chromeos/components/cros_elements/button/button.ts
@@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. import { Button as MwcButton } from '//resources/mwc/@material/mwc-button/mwc-button.js'; -import { css, customElement, property, query, CSSResult, CSSResultArray } from '//resources/mwc/lit-element/lit-element.js'; +import { css, CSSResult } from '//resources/mwc/lit-element/lit-element.js'; +import { customElement, property, query } from '//resources/mwc/lit/decorators.js'; function linearGradientOf(color : CSSResult) : CSSResult { return css`linear-gradient(${color}, ${color})`; @@ -70,7 +71,7 @@ this.updateAriaLabels(); } - static getStyles(): CSSResultArray { + static override get styles() { const crosStyles = css` :host { /* Public API */ @@ -188,7 +189,7 @@ box-shadow: none; } `; - return [MwcButton.styles, crosStyles]; + return [...MwcButton.styles, crosStyles]; } }
diff --git a/chromeos/components/mojo_service_manager/BUILD.gn b/chromeos/components/mojo_service_manager/BUILD.gn new file mode 100644 index 0000000..5ba6344 --- /dev/null +++ b/chromeos/components/mojo_service_manager/BUILD.gn
@@ -0,0 +1,18 @@ +# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("mojo_service_manager") { + sources = [ + "connection.cc", + "connection.h", + ] + deps = [ + "//base", + "//mojo/public/cpp/bindings", + ] + public_deps = [ "//chromeos/components/mojo_service_manager/mojom" ] + defines = [ "IS_CHROMEOS_MOJO_SERVICE_MANAGER_IMPL" ] +}
diff --git a/chromeos/components/mojo_service_manager/connection.cc b/chromeos/components/mojo_service_manager/connection.cc new file mode 100644 index 0000000..914d57d2 --- /dev/null +++ b/chromeos/components/mojo_service_manager/connection.cc
@@ -0,0 +1,105 @@ +// 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. + +#include "chromeos/components/mojo_service_manager/connection.h" + +#include <errno.h> +#include <sys/socket.h> +#include <sys/un.h> + +#include <cstdlib> +#include <utility> + +#include "base/check_op.h" +#include "base/no_destructor.h" +#include "base/posix/eintr_wrapper.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "mojo/public/cpp/platform/platform_channel.h" +#include "mojo/public/cpp/system/invitation.h" + +namespace chromeos::mojo_service_manager { +namespace { + +// The socket path to connect to the service manager. +constexpr char kServiceManagerSocketPath[] = "/run/mojo/service_manager"; +// The default mojo pipe name for bootstrap the mojo. +constexpr int kDefaultMojoInvitationPipeName = 0; + +base::ScopedFD ConnectToServiceManagerUnixSocket() { + base::ScopedFD sock{socket(AF_UNIX, SOCK_STREAM, 0)}; + if (!sock.is_valid()) { + PLOG(ERROR) << "Failed to create socket."; + return base::ScopedFD{}; + } + + struct sockaddr_un unix_addr { + .sun_family = AF_UNIX, + }; + static_assert(sizeof(kServiceManagerSocketPath) <= + sizeof(unix_addr.sun_path)); + strncpy(unix_addr.sun_path, kServiceManagerSocketPath, + sizeof(kServiceManagerSocketPath)); + + int rc = HANDLE_EINTR(connect(sock.get(), + reinterpret_cast<const sockaddr*>(&unix_addr), + sizeof(unix_addr))); + if (rc == -1 && errno != EISCONN) { + PLOG(ERROR) << "Failed to connect to service manager unix socket."; + return base::ScopedFD{}; + } + return sock; +} + +mojo::PendingRemote<mojom::ServiceManager> ConnectToMojoServiceManager() { + base::ScopedFD sock = ConnectToServiceManagerUnixSocket(); + if (!sock.is_valid()) + return mojo::PendingRemote<mojom::ServiceManager>{}; + auto invitation = mojo::IncomingInvitation::Accept( + mojo::PlatformChannelEndpoint(mojo::PlatformHandle(std::move(sock)))); + mojo::ScopedMessagePipeHandle pipe = + invitation.ExtractMessagePipe(kDefaultMojoInvitationPipeName); + return mojo::PendingRemote<mojom::ServiceManager>(std::move(pipe), 0u); +} + +mojo::Remote<mojom::ServiceManager>& GetRemote() { + static base::NoDestructor<mojo::Remote<mojom::ServiceManager>> instance; + return *instance; +} + +} // namespace + +bool BootstrapServiceManagerConnection() { + CHECK(!GetRemote().is_bound()) << "remote_ has already bound."; + mojo::PendingRemote<mojom::ServiceManager> remote = + ConnectToMojoServiceManager(); + if (!remote.is_valid()) + return false; + GetRemote().Bind(std::move(remote)); + GetRemote().reset_on_disconnect(); + return true; +} + +bool IsServiceManagerConnected() { + // Because reset_on_disconnect() is set, is_bound() will be the same as + // is_connected(). + DCHECK_EQ(GetRemote().is_bound(), GetRemote().is_connected()); + return GetRemote().is_bound(); +} + +void ResetServiceManagerConnection() { + GetRemote().reset(); +} + +mojom::ServiceManagerProxy* GetServiceManagerProxy() { + return GetRemote().get(); +} + +void SetServiceManagerRemoteForTesting( // IN-TEST + mojo::PendingRemote<mojom::ServiceManager> remote) { + CHECK(remote.is_valid()); + GetRemote().Bind(std::move(remote)); + GetRemote().reset_on_disconnect(); +} + +} // namespace chromeos::mojo_service_manager
diff --git a/chromeos/components/mojo_service_manager/connection.h b/chromeos/components/mojo_service_manager/connection.h new file mode 100644 index 0000000..2cad8ec8 --- /dev/null +++ b/chromeos/components/mojo_service_manager/connection.h
@@ -0,0 +1,38 @@ +// 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. + +#ifndef CHROMEOS_COMPONENTS_MOJO_SERVICE_MANAGER_CONNECTION_H_ +#define CHROMEOS_COMPONENTS_MOJO_SERVICE_MANAGER_CONNECTION_H_ + +#include "base/component_export.h" +#include "chromeos/components/mojo_service_manager/mojom/mojo_service_manager.mojom.h" +#include "mojo/public/cpp/bindings/pending_remote.h" + +namespace chromeos::mojo_service_manager { + +// Connects to the mojo service manager. Returns false if cannot connect. +// This will will block until finishes. +COMPONENT_EXPORT(CHROMEOS_MOJO_SERVICE_MANAGER) +bool BootstrapServiceManagerConnection(); + +// Returns whether connects to the mojo service manager. +COMPONENT_EXPORT(CHROMEOS_MOJO_SERVICE_MANAGER) +bool IsServiceManagerConnected(); + +// Resets the connection to the mojo service manager. +COMPONENT_EXPORT(CHROMEOS_MOJO_SERVICE_MANAGER) +void ResetServiceManagerConnection(); + +// Returns the interface to access the service manager. +COMPONENT_EXPORT(CHROMEOS_MOJO_SERVICE_MANAGER) +mojom::ServiceManagerProxy* GetServiceManagerProxy(); + +// Sets the mojo remote for testing. +COMPONENT_EXPORT(CHROMEOS_MOJO_SERVICE_MANAGER) +void SetServiceManagerRemoteForTesting( + mojo::PendingRemote<mojom::ServiceManager> remote); + +} // namespace chromeos::mojo_service_manager + +#endif // CHROMEOS_COMPONENTS_MOJO_SERVICE_MANAGER_CONNECTION_H_
diff --git a/chromeos/components/quick_answers/utils/spell_checker.cc b/chromeos/components/quick_answers/utils/spell_checker.cc index 347380b0..be1259a 100644 --- a/chromeos/components/quick_answers/utils/spell_checker.cc +++ b/chromeos/components/quick_answers/utils/spell_checker.cc
@@ -234,7 +234,7 @@ void SpellChecker::OnPathExistsComplete(bool path_exists) { // If the dictionary is not available, try to download it from the server. - if (path_exists) { + if (!path_exists) { auto url = GetDictionaryURL(dictionary_file_path_.BaseName().MaybeAsASCII());
diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.cc b/chromeos/dbus/debug_daemon/debug_daemon_client.cc index 8075a0eb..6a9dd22 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.cc
@@ -211,16 +211,16 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } - void GetPerfOutput(base::TimeDelta duration, - const std::vector<std::string>& perf_args, + void GetPerfOutput(const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, int file_descriptor, DBusMethodCallback<uint64_t> callback) override { DCHECK(file_descriptor); dbus::MethodCall method_call(debugd::kDebugdInterface, - debugd::kGetPerfOutputFd); + debugd::kGetPerfOutputV2); dbus::MessageWriter writer(&method_call); - writer.AppendUint32(duration.InSeconds()); - writer.AppendArrayOfStrings(perf_args); + writer.AppendArrayOfStrings(quipper_args); + writer.AppendBool(disable_cpu_idle); writer.AppendFileDescriptor(file_descriptor); debugdaemon_proxy_->CallMethod(
diff --git a/chromeos/dbus/debug_daemon/debug_daemon_client.h b/chromeos/dbus/debug_daemon/debug_daemon_client.h index 8b73c92..569a590 100644 --- a/chromeos/dbus/debug_daemon/debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/debug_daemon_client.h
@@ -91,16 +91,16 @@ virtual void GetNetworkInterfaces( DBusMethodCallback<std::string> callback) = 0; - // Runs perf (via quipper) with arguments for |duration| (converted to - // seconds) and returns data collected over the passed |file_descriptor|. + // Runs perf (via quipper) with |quipper_args| and returns data collected + // over the passed |file_descriptor|. // |callback| is called on the completion of the D-Bus call. // Note that quipper failures may occur after successfully running the D-Bus // method. Such errors can be detected by |file_descriptor| and all its // duplicates being closed with no data written. // This method duplicates |file_descriptor| so it's OK to close the FD without // waiting for the result. - virtual void GetPerfOutput(base::TimeDelta duration, - const std::vector<std::string>& perf_args, + virtual void GetPerfOutput(const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, int file_descriptor, DBusMethodCallback<uint64_t> callback) = 0;
diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc index 84032bc..3eab7f1 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.cc
@@ -110,8 +110,8 @@ } void FakeDebugDaemonClient::GetPerfOutput( - base::TimeDelta duration, - const std::vector<std::string>& perf_args, + const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, int file_descriptor, DBusMethodCallback<uint64_t> error_callback) {}
diff --git a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h index ea8c181..50b083d 100644 --- a/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h +++ b/chromeos/dbus/debug_daemon/fake_debug_daemon_client.h
@@ -55,8 +55,8 @@ void SetKstaledRatio(uint8_t val, KstaledRatioCallback callback) override; void GetNetworkStatus(DBusMethodCallback<std::string> callback) override; void GetNetworkInterfaces(DBusMethodCallback<std::string> callback) override; - void GetPerfOutput(base::TimeDelta duration, - const std::vector<std::string>& perf_args, + void GetPerfOutput(const std::vector<std::string>& quipper_args, + bool disable_cpu_idle, int file_descriptor, DBusMethodCallback<uint64_t> callback) override; void StopPerf(uint64_t session_id, VoidDBusMethodCallback callback) override;
diff --git a/chromeos/dbus/power/fake_power_manager_client.cc b/chromeos/dbus/power/fake_power_manager_client.cc index 48f47f5..581ac11 100644 --- a/chromeos/dbus/power/fake_power_manager_client.cc +++ b/chromeos/dbus/power/fake_power_manager_client.cc
@@ -189,6 +189,8 @@ power_manager::RequestRestartReason reason, const std::string& description) { ++num_request_restart_calls_; + if (restart_callback_) + std::move(restart_callback_).Run(); } void FakePowerManagerClient::RequestShutdown(
diff --git a/chromeos/dbus/power/fake_power_manager_client.h b/chromeos/dbus/power/fake_power_manager_client.h index 5eb5901..84ca3bf 100644 --- a/chromeos/dbus/power/fake_power_manager_client.h +++ b/chromeos/dbus/power/fake_power_manager_client.h
@@ -86,6 +86,9 @@ int level) { peripheral_battery_refresh_levels_[address] = level; } + void set_restart_callback(base::OnceClosure callback) { + restart_callback_ = std::move(callback); + } // PowerManagerClient overrides: void AddObserver(Observer* observer) override; @@ -316,6 +319,9 @@ // If non-empty, called by SetPowerPolicy(). base::OnceClosure power_policy_quit_closure_; + // Callback that will be run, if set, when RequestRestart() is called. + base::OnceClosure restart_callback_; + // If non-empty, called by NotifyUserActivity(). base::RepeatingClosure user_activity_callback_;
diff --git a/chromeos/memory/userspace_swap/userspace_swap.cc b/chromeos/memory/userspace_swap/userspace_swap.cc index 376fad0..488f55e37 100644 --- a/chromeos/memory/userspace_swap/userspace_swap.cc +++ b/chromeos/memory/userspace_swap/userspace_swap.cc
@@ -504,17 +504,17 @@ uintptr_t current_area = 0; uint64_t current_area_length = 0; - std::bitset<base::kMaxSuperPagesInPool> alloc_bitset; + std::bitset<partition_alloc::kMaxSuperPagesInPool> alloc_bitset; pool_manager->GetPoolUsedSuperPages(ph, alloc_bitset); for (size_t i = 0; i < alloc_bitset.size() && superpages_remaining; ++i) { if (alloc_bitset.test(i)) { superpages_remaining--; if (!current_area) { - current_area = pool_base + (i * base::kSuperPageSize); + current_area = pool_base + (i * partition_alloc::kSuperPageSize); } - current_area_length += base::kSuperPageSize; + current_area_length += partition_alloc::kSuperPageSize; } else { if (current_area) { regions.emplace_back(absl::in_place, current_area,
diff --git a/chromeos/memory/userspace_swap/userspace_swap_unittest.cc b/chromeos/memory/userspace_swap/userspace_swap_unittest.cc index 13d0f797..4517b08 100644 --- a/chromeos/memory/userspace_swap/userspace_swap_unittest.cc +++ b/chromeos/memory/userspace_swap/userspace_swap_unittest.cc
@@ -35,7 +35,7 @@ // Allocate 1000 different memory areas between 128 bytes and 20 superpages in // size. constexpr size_t kNumAllocations = 1000; - constexpr size_t kMaxAllocationSize = 2 * base::kSuperPageSize; + constexpr size_t kMaxAllocationSize = 2 * partition_alloc::kSuperPageSize; constexpr size_t kMinAllocationSize = 128; uintptr_t mem_area[kNumAllocations] = {}; @@ -63,7 +63,7 @@ TEST(UserspaceSwap, LimitSuperpagesReturned) { // Allocate 1000 different memory areas. constexpr size_t kNumAllocations = 50; - constexpr size_t kMaxAllocationSize = 5 * base::kSuperPageSize; + constexpr size_t kMaxAllocationSize = 5 * partition_alloc::kSuperPageSize; constexpr size_t kMinAllocationSize = 1024; uintptr_t mem_area[kNumAllocations] = {}; @@ -84,7 +84,7 @@ for (size_t i = 0; i < regions.size(); ++i) { total_length += regions[i]->length; } - ASSERT_LE(total_length, 5 * base::kSuperPageSize); + ASSERT_LE(total_length, 5 * partition_alloc::kSuperPageSize); // Cleanup for (size_t i = 0; i < kNumAllocations; ++i) {
diff --git a/chromeos/services/cros_healthd/private/cpp/BUILD.gn b/chromeos/services/cros_healthd/private/cpp/BUILD.gn index 7d6b85df..8d213ca 100644 --- a/chromeos/services/cros_healthd/private/cpp/BUILD.gn +++ b/chromeos/services/cros_healthd/private/cpp/BUILD.gn
@@ -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("//build/config/chromeos/args.gni") import("//build/config/chromeos/ui_mode.gni") assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") @@ -17,9 +18,19 @@ ] deps = [ "//base", - "//chromeos/services/cros_healthd/private/mojom", "//chromeos/services/network_health/public/mojom", + "//content/public/browser:browser", + "//ui/events/devices", + "//ui/events/ozone/evdev:event_device_info", ] + public_deps = [ "//chromeos/services/cros_healthd/private/mojom" ] + defines = [] + if (is_chromeos_device) { + defines += [ "USE_EVDEV_GESTURES" ] + } + if (use_libinput) { + defines += [ "USE_LIBINPUT" ] + } } source_set("unit_tests") { @@ -31,10 +42,12 @@ deps = [ ":cpp", "//base/test:test_support", - "//chromeos/services/cros_healthd/private/mojom", + "//content/test:test_support", "//mojo/core/embedder", "//mojo/public/cpp/bindings", "//testing/gmock", "//testing/gtest", + "//ui/events/devices", + "//ui/events/devices:test_support", ] }
diff --git a/chromeos/services/cros_healthd/private/cpp/DEPS b/chromeos/services/cros_healthd/private/cpp/DEPS new file mode 100644 index 0000000..3e6ae05 --- /dev/null +++ b/chromeos/services/cros_healthd/private/cpp/DEPS
@@ -0,0 +1,10 @@ +include_rules = [ + "+ui/events", + "+content/public/browser", +] + +specific_include_rules = { + ".*unittest\.cc": [ + "+content/public/test", + ], +}
diff --git a/chromeos/services/cros_healthd/private/cpp/data_collector.cc b/chromeos/services/cros_healthd/private/cpp/data_collector.cc index c5bc0b1..5de888e1 100644 --- a/chromeos/services/cros_healthd/private/cpp/data_collector.cc +++ b/chromeos/services/cros_healthd/private/cpp/data_collector.cc
@@ -4,10 +4,18 @@ #include "chromeos/services/cros_healthd/private/cpp/data_collector.h" +#include <fcntl.h> + #include "base/check_op.h" +#include "base/files/file_enumerator.h" #include "base/no_destructor.h" #include "base/notreached.h" +#include "base/posix/eintr_wrapper.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" #include "mojo/public/cpp/bindings/receiver_set.h" +#include "ui/events/devices/device_data_manager.h" +#include "ui/events/ozone/evdev/event_device_info.h" namespace chromeos { namespace cros_healthd { @@ -33,8 +41,39 @@ DataCollectorDelegateImpl::~DataCollectorDelegateImpl() = default; std::string DataCollectorDelegateImpl::GetTouchpadLibraryName() { - NOTIMPLEMENTED(); - return ""; +#if defined(USE_LIBINPUT) + base::FileEnumerator file_enum(base::FilePath("/dev/input/"), false, + base::FileEnumerator::FileType::FILES); + for (auto path = file_enum.Next(); !path.empty(); path = file_enum.Next()) { + base::ScopedFD fd( + HANDLE_EINTR(open(path.value().c_str(), O_RDWR | O_NONBLOCK))); + if (fd.get() < 0) { + LOG(ERROR) << "Couldn't open device path " << path; + continue; + } + + auto devinfo = std::make_unique<ui::EventDeviceInfo>(); + if (!devinfo->Initialize(fd.get(), path)) { + LOG(ERROR) << "Failed to get device info for " << path; + continue; + } + + if (!devinfo->HasTouchpad() || + devinfo->device_type() != ui::InputDeviceType::INPUT_DEVICE_INTERNAL) { + continue; + } + + if (devinfo->UseLibinput()) { + return "libinput"; + } + } +#endif + +#if defined(USE_EVDEV_GESTURES) + return "gestures"; +#else + return "Default EventConverterEvdev"; +#endif } DataCollectorDelegateImpl* GetDataCollectorDelegate() { @@ -75,9 +114,52 @@ receiver_set_.Add(this, std::move(receiver)); } +mojom::InputDevice::ConnectionType GetInputDeviceConnectionType( + ui::InputDeviceType type) { + switch (type) { + case ui::INPUT_DEVICE_INTERNAL: + return mojom::InputDevice::ConnectionType::kInternal; + case ui::INPUT_DEVICE_USB: + return mojom::InputDevice::ConnectionType::kUSB; + case ui::INPUT_DEVICE_BLUETOOTH: + return mojom::InputDevice::ConnectionType::kBluetooth; + case ui::INPUT_DEVICE_UNKNOWN: + return mojom::InputDevice::ConnectionType::kUnknown; + } +} + +void GetTouchscreenDevicesOnUIThread( + DataCollectorImpl::GetTouchscreenDevicesCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + const std::vector<ui::TouchscreenDevice>& devices = + ui::DeviceDataManager::GetInstance()->GetTouchscreenDevices(); + std::vector<mojom::TouchscreenDevicePtr> results; + for (const auto& device : devices) { + auto result = mojom::TouchscreenDevice::New(); + result->input_device = mojom::InputDevice::New(); + result->input_device->name = device.name; + result->input_device->connection_type = + GetInputDeviceConnectionType(device.type); + result->input_device->physical_location = device.phys; + result->input_device->is_enabled = device.enabled; + result->input_device->sysfs_path = device.sys_path.value(); + + result->touch_points = device.touch_points; + result->has_stylus = device.has_stylus; + result->has_stylus_garage_switch = device.has_stylus_garage_switch; + results.push_back(std::move(result)); + } + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), std::move(results))); +} + void DataCollectorImpl::GetTouchscreenDevices( GetTouchscreenDevicesCallback callback) { - NOTIMPLEMENTED(); + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce(&GetTouchscreenDevicesOnUIThread, std::move(callback))); } void DataCollectorImpl::GetTouchpadLibraryName(
diff --git a/chromeos/services/cros_healthd/private/cpp/data_collector_unittest.cc b/chromeos/services/cros_healthd/private/cpp/data_collector_unittest.cc index 1feca3e..912dd3b3 100644 --- a/chromeos/services/cros_healthd/private/cpp/data_collector_unittest.cc +++ b/chromeos/services/cros_healthd/private/cpp/data_collector_unittest.cc
@@ -6,9 +6,11 @@ #include "base/notreached.h" #include "base/test/bind.h" -#include "base/test/task_environment.h" +#include "content/public/test/browser_task_environment.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/events/devices/device_data_manager.h" +#include "ui/events/devices/device_data_manager_test_api.h" namespace chromeos { namespace cros_healthd { @@ -30,6 +32,7 @@ class DataCollectorTest : public testing::Test { protected: void SetUp() override { + ui::DeviceDataManager::CreateInstance(); DataCollector::InitializeWithDelegateForTesting(&delegate_); DataCollector::Get()->BindReceiver(remote_.BindNewPipeAndPassReceiver()); } @@ -37,10 +40,11 @@ void TearDown() override { remote_.reset(); DataCollector::Shutdown(); + ui::DeviceDataManager::DeleteInstance(); } // The test environment. - base::test::TaskEnvironment env_; + content::BrowserTaskEnvironment env_; // The mojo remote to the data collector. mojo::Remote<mojom::ChromiumDataCollector> remote_; // The fake delegate for DataCollector. @@ -48,7 +52,30 @@ }; TEST_F(DataCollectorTest, GetTouchscreenDevices) { - NOTIMPLEMENTED(); + ui::TouchscreenDevice touchscreen_device; + touchscreen_device.name = "DeviceName"; + touchscreen_device.type = ui::InputDeviceType::INPUT_DEVICE_BLUETOOTH; + touchscreen_device.phys = "phys"; + touchscreen_device.enabled = true; + touchscreen_device.sys_path = base::FilePath{"sys_path"}; + touchscreen_device.touch_points = 42; + touchscreen_device.has_stylus = true; + touchscreen_device.has_stylus_garage_switch = true; + ui::DeviceDataManagerTestApi().SetTouchscreenDevices({touchscreen_device}); + + base::RunLoop run_loop; + remote_->GetTouchscreenDevices(base::BindLambdaForTesting( + [&](std::vector<mojom::TouchscreenDevicePtr> devices) { + std::vector<mojom::TouchscreenDevicePtr> expected; + expected.push_back(mojom::TouchscreenDevice::New( + mojom::InputDevice::New( + "DeviceName", mojom::InputDevice::ConnectionType::kBluetooth, + "phys", true, "sys_path"), + 42, true, true)); + EXPECT_EQ(devices, expected); + run_loop.Quit(); + })); + run_loop.Run(); } TEST_F(DataCollectorTest, GetTouchpadLibraryName) {
diff --git a/components/BUILD.gn b/components/BUILD.gn index 8fdc8e1..9ee4b49 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -255,6 +255,7 @@ "//components/global_media_controls:unit_tests", "//components/media_message_center:unit_tests", "//components/ui_devtools:unit_tests", + "//components/user_education/views:unit_tests", ] } @@ -391,6 +392,7 @@ "//components/translate/content/renderer:unit_tests", "//components/ukm/content:unit_tests", "//components/url_rewrite:unit_tests", + "//components/user_education/common:unit_tests", "//components/value_store:unit_tests", "//components/visitedlink/test:unit_tests", "//components/web_cache/browser:unit_tests",
diff --git a/components/arc/common/intent_helper/arc_intent_helper_mojo_delegate.h b/components/arc/common/intent_helper/arc_intent_helper_mojo_delegate.h index 92f439f..8c798f7 100644 --- a/components/arc/common/intent_helper/arc_intent_helper_mojo_delegate.h +++ b/components/arc/common/intent_helper/arc_intent_helper_mojo_delegate.h
@@ -91,7 +91,7 @@ bool is_preferred, absl::optional<std::string> fallback_url); IntentHandlerInfo(const IntentHandlerInfo& other); - IntentHandlerInfo& operator=(const IntentHandlerInfo&) = delete; + IntentHandlerInfo& operator=(const IntentHandlerInfo&) = default; ~IntentHandlerInfo(); // The name of the package used as a description text.
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index 5822fe9..fc1ccfbf 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -1130,7 +1130,7 @@ if (input_element.IsNull() && !form_util::IsTextAreaElement(element)) return; -#if defined(ANDROID) +#if BUILDFLAG(IS_ANDROID) password_autofill_agent_->TryToShowTouchToFill(element); #endif
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 141ac23..a8535c03 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1038,8 +1038,7 @@ return touch_to_fill_state_ == TouchToFillState::kIsShowing; } -// TODO(crbug.com/1299430): Disable |TryToShowTouchToFill| and -// |touch_to_fill_state_| on Desktop. +#if BUILDFLAG(IS_ANDROID) bool PasswordAutofillAgent::TryToShowTouchToFill( const WebFormControlElement& control_element) { if (touch_to_fill_state_ != TouchToFillState::kShouldShow) @@ -1075,7 +1074,6 @@ focused_input_element_ = input_element; -#if BUILDFLAG(IS_ANDROID) WebFormElement form = password_element.Form(); std::unique_ptr<FormData> form_data = form.IsNull() ? GetFormDataFromUnownedInputElements() @@ -1084,11 +1082,11 @@ form_data ? CalculateSubmissionReadiness(*form_data, username_element, password_element) : mojom::SubmissionReadinessState::kNoInformation); -#endif touch_to_fill_state_ = TouchToFillState::kIsShowing; return true; } +#endif bool PasswordAutofillAgent::ShowSuggestions( const WebInputElement& element,
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h index e467948..83caeef 100644 --- a/components/autofill/content/renderer/password_autofill_agent.h +++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -195,10 +195,12 @@ // Returns whether the soft keyboard should be suppressed. bool ShouldSuppressKeyboard(); +#if BUILDFLAG(IS_ANDROID) // Asks the agent to show the touch to fill UI for |control_element|. Returns // whether the agent was able to do so. bool TryToShowTouchToFill( const blink::WebFormControlElement& control_element); +#endif // Shows an Autofill popup with username suggestions for |element|. If // |show_all| is |true|, will show all possible suggestions for that element, @@ -602,6 +604,7 @@ // triggered. FieldRendererId field_renderer_id_to_submit_; + // TODO(crbug.com/1299430): Disable |touch_to_fill_state_| on Desktop. // Current state of Touch To Fill. This is reset during // CleanupOnDocumentShutdown. TouchToFillState touch_to_fill_state_ = TouchToFillState::kShouldShow;
diff --git a/components/autofill_assistant/browser/batch_element_checker.cc b/components/autofill_assistant/browser/batch_element_checker.cc index bd487429..4dd8817 100644 --- a/components/autofill_assistant/browser/batch_element_checker.cc +++ b/components/autofill_assistant/browser/batch_element_checker.cc
@@ -76,19 +76,13 @@ } void BatchElementChecker::EnableObserver( - base::TimeDelta max_wait_time, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout) { - DCHECK(!use_observers_); + const SelectorObserver::Settings& settings) { + DCHECK(!observer_settings_); DCHECK(!started_); DCHECK(get_field_value_callbacks_.empty()) << "Observer-based BatchElementChecker doesn't work with " "AddFieldValueCheck"; - - use_observers_ = true; - observer_max_wait_time_ = max_wait_time; - observer_periodic_check_interval_ = periodic_check_interval; - observer_extra_timeout_ = extra_timeout; + observer_settings_.emplace(settings); } void BatchElementChecker::Run(WebController* web_controller) { @@ -97,7 +91,7 @@ for (size_t i = 0; i < element_condition_checks_.size(); ++i) { AddElementConditionResults(element_condition_checks_[i].proto, i); } - if (use_observers_) { + if (observer_settings_) { RunWithObserver(web_controller); return; } @@ -149,6 +143,7 @@ DCHECK(get_field_value_callbacks_.empty()) << "Observer-based BatchElementChecker doesn't work with " "AddFieldValueCheck"; + DCHECK(observer_settings_); DCHECK(!started_); std::vector<SelectorObserver::ObservableSelector> selectors; @@ -164,8 +159,7 @@ } started_ = true; auto result = web_controller->ObserveSelectors( - selectors, observer_max_wait_time_, observer_periodic_check_interval_, - observer_extra_timeout_, + selectors, *observer_settings_, base::BindRepeating(&BatchElementChecker::OnResultsUpdated, weak_ptr_factory_.GetWeakPtr())
diff --git a/components/autofill_assistant/browser/batch_element_checker.h b/components/autofill_assistant/browser/batch_element_checker.h index b26f4ac..9052da9 100644 --- a/components/autofill_assistant/browser/batch_element_checker.h +++ b/components/autofill_assistant/browser/batch_element_checker.h
@@ -84,9 +84,7 @@ // Turns on observer mode. When BatchElementChecker runs in observer mode, it // waits until any element condition checks or element checks become true. - void EnableObserver(base::TimeDelta max_wait_time, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout); + void EnableObserver(const SelectorObserver::Settings& settings); // Runs the checks. Once all checks are done, calls the callbacks registered // to AddAllDoneCallback(). @@ -207,11 +205,10 @@ // Run() was called. Checking elements might or might not have finished yet. bool started_ = false; - // Whether to wait until one of the conditions becomes true. - bool use_observers_ = false; - base::TimeDelta observer_max_wait_time_; - base::TimeDelta observer_periodic_check_interval_; - base::TimeDelta observer_extra_timeout_; + // Whether to wait until one of the conditions becomes true. If it's a nullopt + // it will check only once, if it has a value it will observe the DOM until + // one of the conditions becomes true or the observation times out. + absl::optional<const SelectorObserver::Settings> observer_settings_; std::vector<base::OnceCallback<void()>> all_done_;
diff --git a/components/autofill_assistant/browser/client_settings.cc b/components/autofill_assistant/browser/client_settings.cc index 436c24c4..2d2f5e20 100644 --- a/components/autofill_assistant/browser/client_settings.cc +++ b/components/autofill_assistant/browser/client_settings.cc
@@ -176,6 +176,10 @@ selector_observer_extra_timeout = base::Milliseconds(proto.selector_observer_extra_timeout_ms()); } + if (proto.has_selector_observer_debounce_interval_ms()) { + selector_observer_debounce_interval = + base::Milliseconds(proto.selector_observer_debounce_interval_ms()); + } } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/client_settings.h b/components/autofill_assistant/browser/client_settings.h index 096e20dd..b3a4029 100644 --- a/components/autofill_assistant/browser/client_settings.h +++ b/components/autofill_assistant/browser/client_settings.h
@@ -147,6 +147,10 @@ // time spent waiting so a extra delay of 1 to 10 seconds for javascript // execution and checking selectors is conceivable. base::TimeDelta selector_observer_extra_timeout = base::Seconds(15); + + // Wait until no DOM changes are received for this amount of time to check + // the selectors. An interval of 0 effectively disables debouncing. + base::TimeDelta selector_observer_debounce_interval = base::Milliseconds(100); }; } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/controller.cc b/components/autofill_assistant/browser/controller.cc index 11ef56c3..a91efdfe 100644 --- a/components/autofill_assistant/browser/controller.cc +++ b/components/autofill_assistant/browser/controller.cc
@@ -510,6 +510,14 @@ Metrics::DropOutReason::GET_SCRIPTS_UNPARSABLE); return; } + + if (response_proto.has_semantic_selector_policy()) { + // TODO(b/228987849): A semantic policy is set unconditionally. It may be + // more appropriate to only set one if there are actual eligible scripts for + // the given domain. + SetSemanticSelectorPolicy( + std::move(response_proto.semantic_selector_policy())); + } if (response_proto.has_client_settings()) { SetClientSettings(response_proto.client_settings()); } @@ -1000,6 +1008,13 @@ } } +void Controller::SetSemanticSelectorPolicy(SemanticSelectorPolicy policy) { + DCHECK(annotate_dom_model_service_); + if (!annotate_dom_model_service_->SetOverridesPolicy(std::move(policy))) { + NOTREACHED() << "Setting overrides policy failed!"; + } +} + void Controller::OnRunnableScriptsChanged( const std::vector<ScriptHandle>& runnable_scripts) { base::ScopedClosureRunner report_first_check;
diff --git a/components/autofill_assistant/browser/controller.h b/components/autofill_assistant/browser/controller.h index 243d05bb..64d141d9f 100644 --- a/components/autofill_assistant/browser/controller.h +++ b/components/autofill_assistant/browser/controller.h
@@ -296,6 +296,9 @@ void SetDirectActionScripts( const std::vector<ScriptHandle>& direct_action_scripts); + // Sets the semantic selector in the DOM annotation service. + void SetSemanticSelectorPolicy(SemanticSelectorPolicy policy); + ClientSettings settings_; const raw_ptr<Client> client_; const raw_ptr<const base::TickClock> tick_clock_;
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index efde8c2..2ddc770 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -74,6 +74,14 @@ using ::testing::UnorderedElementsAre; using ::testing::WithArgs; +class MockAnnotateDomModelService : public AnnotateDomModelService { + public: + MockAnnotateDomModelService() : AnnotateDomModelService(nullptr, nullptr) {} + ~MockAnnotateDomModelService() override = default; + + MOCK_METHOD1(SetOverridesPolicy, bool(SemanticSelectorPolicy)); +}; + class ControllerTest : public testing::Test { public: ControllerTest() { @@ -99,7 +107,7 @@ controller_ = std::make_unique<Controller>( web_contents(), &mock_client_, task_environment()->GetMockTickClock(), mock_runtime_manager_->GetWeakPtr(), std::move(service), &ukm_recorder_, - /* annotate_dom_model_service= */ nullptr); + &mock_annotate_dom_model_service_); controller_->SetWebControllerForTest(std::move(web_controller)); @@ -261,6 +269,7 @@ mock_password_change_success_tracker_; ukm::TestAutoSetUkmRecorder ukm_recorder_; std::unique_ptr<Controller> controller_; + NiceMock<MockAnnotateDomModelService> mock_annotate_dom_model_service_; }; struct NavigationState { @@ -2303,4 +2312,20 @@ EXPECT_THAT(listener.events, IsEmpty()); } +TEST_F(ControllerTest, SemanticOverridesSetInService) { + EXPECT_CALL(mock_annotate_dom_model_service_, SetOverridesPolicy) + .WillOnce(Return(true)); + + SupportsScriptResponseProto script_response; + script_response.mutable_semantic_selector_policy() + ->mutable_bag_of_words() + ->add_data_point_map(); + AddRunnableScript(&script_response, "runnable"); + SetNextScriptResponse(script_response); + + EXPECT_CALL(mock_client_, AttachUI()); + Start("http://a.example.com/path"); + EXPECT_EQ(AutofillAssistantState::STARTING, controller_->GetState()); +} + } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/mock_script_executor_delegate.cc b/components/autofill_assistant/browser/mock_script_executor_delegate.cc index 2bc56bb7..c9450bf9 100644 --- a/components/autofill_assistant/browser/mock_script_executor_delegate.cc +++ b/components/autofill_assistant/browser/mock_script_executor_delegate.cc
@@ -11,6 +11,7 @@ MockScriptExecutorDelegate::MockScriptExecutorDelegate() { ON_CALL(*this, GetSettings).WillByDefault(ReturnRef(client_settings_)); ON_CALL(*this, GetLogInfo).WillByDefault(ReturnRef(log_info_)); + ON_CALL(*this, GetCurrentURL).WillByDefault(ReturnRef(default_url_)); } MockScriptExecutorDelegate::~MockScriptExecutorDelegate() = default;
diff --git a/components/autofill_assistant/browser/mock_script_executor_delegate.h b/components/autofill_assistant/browser/mock_script_executor_delegate.h index 6abd6834..9bff2c2d2 100644 --- a/components/autofill_assistant/browser/mock_script_executor_delegate.h +++ b/components/autofill_assistant/browser/mock_script_executor_delegate.h
@@ -100,6 +100,7 @@ private: ClientSettings client_settings_; ProcessedActionStatusDetailsProto log_info_; + const GURL default_url_ = GURL("https://example.com/"); }; } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index e53827c..e6b8cbf 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -324,7 +324,7 @@ optional ClientDimensionProto text_size = 7; } -// Next ID: 25 +// Next ID: 26 message ClientSettingsProto { message IntegrationTestSettings { // Disables animations for the poodle and the progress bar. @@ -505,6 +505,10 @@ // wrong and fails with a |TIMED_OUT| error. optional int32 selector_observer_extra_timeout_ms = 24; + // SelectorObserver will wait until no DOM mutation notifications are received + // for this amount of time to check the selectors. + optional int32 selector_observer_debounce_interval_ms = 25; + reserved 8 to 11; }
diff --git a/components/autofill_assistant/browser/wait_for_dom_operation.cc b/components/autofill_assistant/browser/wait_for_dom_operation.cc index fc859a11..c4f6434 100644 --- a/components/autofill_assistant/browser/wait_for_dom_operation.cc +++ b/components/autofill_assistant/browser/wait_for_dom_operation.cc
@@ -165,12 +165,14 @@ base::Unretained(this), std::move(report_attempt_result))); if (use_observers_) { batch_element_checker_->EnableObserver( - /* max_wait_time= */ max_wait_time_ - - wait_time_stopwatch_.TotalElapsed(), - /* periodic_check_interval= */ - delegate_->GetSettings().periodic_element_check_interval, - /* extra_timeout= */ - delegate_->GetSettings().selector_observer_extra_timeout); + {/* max_wait_time= */ max_wait_time_ - + wait_time_stopwatch_.TotalElapsed(), + /* min_check_interval= */ + delegate_->GetSettings().periodic_element_check_interval, + /* extra_timeout= */ + delegate_->GetSettings().selector_observer_extra_timeout, + /* debounce_interval */ + delegate_->GetSettings().selector_observer_debounce_interval}); } batch_element_checker_->Run(delegate_->GetWebController()); }
diff --git a/components/autofill_assistant/browser/web/batch_element_checker_browsertest.cc b/components/autofill_assistant/browser/web/batch_element_checker_browsertest.cc index b304148a..38a800b1 100644 --- a/components/autofill_assistant/browser/web/batch_element_checker_browsertest.cc +++ b/components/autofill_assistant/browser/web/batch_element_checker_browsertest.cc
@@ -101,6 +101,12 @@ return proto; } + static SelectorObserver::Settings SelectorObserverDefaultSettings( + base::TimeDelta max_wait_time) { + return {max_wait_time, base::Seconds(1), base::Seconds(15), + base::Milliseconds(100)}; + } + // Run Observer BatchElementChecker on the provided conditions. The second // value in the pairs (bool) is the match expectation. void RunObserverBatchElementChecker( @@ -123,8 +129,7 @@ ObserverBatchElementCheckerAllDoneCallback, run_loop.QuitClosure(), &expected_results, &actual_results)); - checker.EnableObserver(base::Seconds(30), base::Seconds(1), - base::Seconds(15)); + checker.EnableObserver(SelectorObserverDefaultSettings(base::Seconds(30))); checker.Run(web_controller_.get()); run_loop.Run(); EXPECT_EQ(web_controller_->pending_workers_.size(), 0u); @@ -335,7 +340,7 @@ /* proto = */ Selector({"#iframeExternal", ".dynamic.about-2-seconds"}).proto, /* strict = */ true}}, - base::Seconds(30), base::Seconds(1), base::Seconds(15), update_callback); + SelectorObserverDefaultSettings(base::Seconds(30)), update_callback); run_loop.Run(); ASSERT_TRUE(expected_updates.empty()); @@ -375,7 +380,7 @@ {{/* selector_id = */ button_id, /* proto = */ Selector({"#iframeRedirecting", "#button"}).proto, /* strict = */ true}}, - base::Seconds(30), base::Seconds(1), base::Seconds(15), update_callback); + SelectorObserverDefaultSettings(base::Seconds(30)), update_callback); run_loop.Run(); } @@ -411,7 +416,7 @@ {{/* selector_id = */ SelectorObserver::SelectorId(1), /* proto = */ Selector({"#does_not_exist"}).proto, /* strict = */ true}}, - base::Milliseconds(300), base::Seconds(1), base::Seconds(15), + SelectorObserverDefaultSettings(base::Milliseconds(300)), mock_callback.Get()); run_loop.Run(); @@ -454,7 +459,7 @@ {{/* selector_id = */ button_id, /* proto = */ Selector({"#iframe", "#button"}).proto, /* strict = */ true}}, - base::Milliseconds(1), base::Seconds(1), base::Seconds(15), + SelectorObserverDefaultSettings(base::Milliseconds(1)), update_callback.Get()); run_loop.Run();
diff --git a/components/autofill_assistant/browser/web/selector_observer.cc b/components/autofill_assistant/browser/web/selector_observer.cc index a6a38e6..1b12eaf 100644 --- a/components/autofill_assistant/browser/web/selector_observer.cc +++ b/components/autofill_assistant/browser/web/selector_observer.cc
@@ -61,23 +61,31 @@ SelectorObserver::RequestedElement::RequestedElement(const RequestedElement&) = default; +SelectorObserver::Settings::Settings(const base::TimeDelta& max_wait_time, + const base::TimeDelta& min_check_interval, + const base::TimeDelta& extra_timeout, + const base::TimeDelta& debounce_interval) + : max_wait_time(max_wait_time), + min_check_interval(min_check_interval), + extra_timeout(extra_timeout), + debounce_interval(debounce_interval) {} +SelectorObserver::Settings::~Settings() = default; +SelectorObserver::Settings::Settings(const Settings&) = default; + SelectorObserver::SelectorObserver( const std::vector<ObservableSelector>& selectors, - base::TimeDelta max_wait_time, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout, + const Settings& settings, content::WebContents* web_contents, DevtoolsClient* devtools_client, const UserData* user_data, Callback update_callback) - : periodic_check_interval_(periodic_check_interval), - extra_timeout_(extra_timeout), + : settings_(settings), devtools_client_(devtools_client), web_contents_(web_contents), user_data_(user_data), update_callback_(update_callback) { const DomRoot root(/* frame_id = */ "", DomRoot::kUseMainDoc); - wait_time_remaining_ms_[root] = max_wait_time.InMilliseconds(); + wait_time_remaining_ms_[root] = settings.max_wait_time.InMilliseconds(); for (auto& selector : selectors) { selectors_.emplace(std::make_pair(selector.selector_id, selector)); // Every selector starts in the root frame @@ -106,7 +114,7 @@ ResolveObjectIdAndInjectFrame(root, 0); timeout_timer_ = std::make_unique<base::OneShotTimer>(); - timeout_timer_->Start(FROM_HERE, MaxTimeRemaining() + extra_timeout_, + timeout_timer_->Start(FROM_HERE, MaxTimeRemaining() + settings_.extra_timeout, base::BindOnce(&SelectorObserver::OnHardTimeout, weak_ptr_factory_.GetWeakPtr())); @@ -814,15 +822,21 @@ snippet.AddLine("(function selectorObserver() {"); snippet.AddLine( {"const pollInterval = ", - base::NumberToString(periodic_check_interval_.InMilliseconds()), ";"}); + base::NumberToString(settings_.min_check_interval.InMilliseconds()), + ";"}); int max_wait_time = wait_time_remaining_ms_.at(dom_root); - snippet.AddLine({"const maxRuntime = ", - base::NumberToString(base::saturated_cast<int>( - (base::Milliseconds(max_wait_time) + extra_timeout_) - .InMilliseconds())), - ";"}); + snippet.AddLine( + {"const maxRuntime = ", + base::NumberToString(base::saturated_cast<int>( + (base::Milliseconds(max_wait_time) + settings_.extra_timeout) + .InMilliseconds())), + ";"}); snippet.AddLine( {"const maxWaitTime = ", base::NumberToString(max_wait_time), ";"}); + snippet.AddLine( + {"const debounceInterval = ", + base::NumberToString(settings_.debounce_interval.InMilliseconds()), + ";"}); snippet.AddLine("const selectors = ["); size_t depth = frame_depth_.at(dom_root);
diff --git a/components/autofill_assistant/browser/web/selector_observer.h b/components/autofill_assistant/browser/web/selector_observer.h index e89f7b9d..73f28f5 100644 --- a/components/autofill_assistant/browser/web/selector_observer.h +++ b/components/autofill_assistant/browser/web/selector_observer.h
@@ -60,6 +60,7 @@ // If true, match will fail if more that one element matches the selector. bool strict; }; + // An update to the match status of a selector. struct Update { Update(); @@ -73,6 +74,7 @@ // fetch the element later. int element_id; }; + struct RequestedElement { RequestedElement(const SelectorId& selector_id, int element_id); ~RequestedElement(); @@ -85,18 +87,37 @@ // end. int element_id; }; + + // Settings to configure the selector observer. + struct Settings { + Settings(const base::TimeDelta& max_wait_time, + const base::TimeDelta& min_check_interval, + const base::TimeDelta& extra_timeout, + const base::TimeDelta& debounce_interval); + ~Settings(); + Settings(const Settings&); + // Maximum amount of time it will wait for an element. + const base::TimeDelta max_wait_time; + // Selector checks will run at least this often, even if no DOM changes are + // detected. + const base::TimeDelta min_check_interval; + // Extra wait time before assuming something has failed and giving up. + const base::TimeDelta extra_timeout; + // Wait until no DOM changes are received for this amount of time to check + // the selectors. An interval of 0 effectively disables debouncing. + const base::TimeDelta debounce_interval; + }; + using Callback = base::RepeatingCallback< void(const ClientStatus&, const std::vector<Update>&, SelectorObserver*)>; // |content::WebContents| and |DevtoolsClient| need to outlive this instance. // |UserData| needs to exist until Start() is called. explicit SelectorObserver(const std::vector<ObservableSelector>& selectors, - base::TimeDelta max_wait_time, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout, - content::WebContents*, - DevtoolsClient*, - const UserData*, + const Settings& settings, + content::WebContents* web_contents, + DevtoolsClient* devtools_client, + const UserData* user_data, Callback update_callback); ~SelectorObserver() override; @@ -143,9 +164,7 @@ ERROR_STATE = 4, }; State state_ = State::INITIALIZED; - const base::TimeDelta periodic_check_interval_; - const base::TimeDelta extra_timeout_; - base::TimeDelta max_wait_time_; + const Settings settings_; base::TimeTicks started_; std::unique_ptr<base::OneShotTimer> timeout_timer_;
diff --git a/components/autofill_assistant/browser/web/selector_observer_script.h b/components/autofill_assistant/browser/web/selector_observer_script.h index f4207e52..05e4e97f 100644 --- a/components/autofill_assistant/browser/web/selector_observer_script.h +++ b/components/autofill_assistant/browser/web/selector_observer_script.h
@@ -13,7 +13,7 @@ // (1) selector_id -> element // (2) selector_id -> element // (3) element_id -> element -// (4) uses setTimeout so that initialization isn't blocked checking the +// (4) uses queueMicrotask so that initialization isn't blocked checking the // selectors. // (5) In case c++ doesn't call terminate() // (7) A result is serializable by value. Unserializable elements are saved in @@ -75,14 +75,15 @@ return runTime - count * avgCheckTime; }; - const onChange = () => { + const checkSelectors = () => { if (startTime == null) { startTime = now(); } checkCount += 1; const start = now(); - if (pollingTid) clearTimeout(pollingTid); - pollingTid = setTimeout(onChange, pollInterval); + clearTimeout(pollingTid); + clearTimeout(debounceTid); + pollingTid = setTimeout(checkSelectors, pollInterval); for (const selector of selectors) { const node = runSelector(selector); @@ -108,6 +109,15 @@ } }; + let debounceTid = 0; + const onChange = () => { + clearTimeout(debounceTid); + debounceTid = setTimeout(checkSelectors, debounceInterval); + }; + + // (4) + queueMicrotask(checkSelectors); + const config = { attributes: true, childList: true, @@ -121,8 +131,6 @@ if (pollingTid) clearTimeout(pollingTid); clearTimeout(disconnectTid); }; - // (4) - setTimeout(onChange, 0); // (5) const disconnectTid = setTimeout(terminate, maxRuntime); @@ -176,7 +184,7 @@ selectors.push(selector); } }); - onChange(); + checkSelectors(); }, getElements(elementIds) { const result = {};
diff --git a/components/autofill_assistant/browser/web/web_controller.cc b/components/autofill_assistant/browser/web/web_controller.cc index d8d16df..953d9bc1 100644 --- a/components/autofill_assistant/browser/web/web_controller.cc +++ b/components/autofill_assistant/browser/web/web_controller.cc
@@ -917,13 +917,11 @@ ClientStatus WebController::ObserveSelectors( const std::vector<SelectorObserver::ObservableSelector>& selectors, - base::TimeDelta timeout_ms, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout, + const SelectorObserver::Settings& settings, SelectorObserver::Callback callback) { auto observer = std::make_unique<SelectorObserver>( - selectors, timeout_ms, periodic_check_interval, extra_timeout, - web_contents_, devtools_client_.get(), user_data_, std::move(callback)); + selectors, settings, web_contents_, devtools_client_.get(), user_data_, + std::move(callback)); auto* ptr = observer.get(); pending_workers_.emplace_back(std::move(observer)); return ptr->Start(base::BindOnce(&WebController::OnSelectorObserverFinished,
diff --git a/components/autofill_assistant/browser/web/web_controller.h b/components/autofill_assistant/browser/web/web_controller.h index 3936a01..921cd8b1 100644 --- a/components/autofill_assistant/browser/web/web_controller.h +++ b/components/autofill_assistant/browser/web/web_controller.h
@@ -118,9 +118,7 @@ virtual ClientStatus ObserveSelectors( const std::vector<SelectorObserver::ObservableSelector>& selectors, - base::TimeDelta timeout_ms, - base::TimeDelta periodic_check_interval, - base::TimeDelta extra_timeout, + const SelectorObserver::Settings& settings, SelectorObserver::Callback callback); // Scroll the |element| into view. |animation| defines the transition
diff --git a/components/autofill_assistant/content/browser/annotate_dom_model_service.cc b/components/autofill_assistant/content/browser/annotate_dom_model_service.cc index cc501a400..bdaf61ad 100644 --- a/components/autofill_assistant/content/browser/annotate_dom_model_service.cc +++ b/components/autofill_assistant/content/browser/annotate_dom_model_service.cc
@@ -120,6 +120,15 @@ return annotate_dom_model_file_->Duplicate(); } +std::string AnnotateDomModelService::GetOverridesPolicy() const { + return overrides_policy_binary_proto_; +} + +bool AnnotateDomModelService::SetOverridesPolicy( + SemanticSelectorPolicy policy) { + return policy.SerializeToString(&overrides_policy_binary_proto_); +} + void AnnotateDomModelService::NotifyOnModelFileAvailable( NotifyModelAvailableCallback callback) { DCHECK(!annotate_dom_model_file_);
diff --git a/components/autofill_assistant/content/browser/annotate_dom_model_service.h b/components/autofill_assistant/content/browser/annotate_dom_model_service.h index ba4d0b0a..fbb0b81 100644 --- a/components/autofill_assistant/content/browser/annotate_dom_model_service.h +++ b/components/autofill_assistant/content/browser/annotate_dom_model_service.h
@@ -13,6 +13,7 @@ #include "base/files/file_path.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" +#include "components/autofill_assistant/content/common/proto/semantic_feature_overrides.pb.h" #include "components/keyed_service/core/keyed_service.h" #include "components/optimization_guide/core/optimization_target_model_observer.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -50,6 +51,11 @@ // asynchronous notification of the model being available. absl::optional<base::File> GetModelFile(); + // Returns the overrides policy as a serialized binary proto representation + // that will be passed to renderer processes. + std::string GetOverridesPolicy() const; + virtual bool SetOverridesPolicy(SemanticSelectorPolicy policy); + // If the model file is not available, requestors can ask to be notified, via // |callback|. This enables a two-step approach to relabily get the model file // when it becomes available if the requestor needs the file right when it @@ -72,6 +78,9 @@ // successfully loaded. absl::optional<base::File> annotate_dom_model_file_; + // A serialized binary representation of a SemanticSelectorPolicy proto. + std::string overrides_policy_binary_proto_; + // The set of callbacks associated with requests for the language detection // model. std::vector<NotifyModelAvailableCallback> pending_model_requests_;
diff --git a/components/autofill_assistant/content/browser/content_autofill_assistant_driver.cc b/components/autofill_assistant/content/browser/content_autofill_assistant_driver.cc index 8118c59..86fed0b 100644 --- a/components/autofill_assistant/content/browser/content_autofill_assistant_driver.cc +++ b/components/autofill_assistant/content/browser/content_autofill_assistant_driver.cc
@@ -144,14 +144,8 @@ } std::string ContentAutofillAssistantDriver::GetOverridesPolicy() const { - // TODO(b/228987849): Finish the plumbing by fetching the overrides data from - // the service. - std::string policy; - SemanticSelectorPolicy policy_proto; - if (!policy_proto.SerializeToString(&policy)) { - return std::string(); - } - return policy; + DCHECK(annotate_dom_model_service_); + return annotate_dom_model_service_->GetOverridesPolicy(); } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc b/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc index e8391303..91adc27d 100644 --- a/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc +++ b/components/autofill_assistant/content/renderer/autofill_assistant_agent.cc
@@ -78,7 +78,7 @@ std::string(overrides_policy.begin(), overrides_policy.end()))) { return absl::nullopt; } - if (!policy.has_bag_of_words()) { + if (policy.bag_of_words().data_point_map().empty()) { return absl::nullopt; } OverridesMap overrides_map;
diff --git a/components/autofill_assistant/content/renderer/autofill_assistant_model_executor.cc b/components/autofill_assistant/content/renderer/autofill_assistant_model_executor.cc index 8b7de51..9c84e87 100644 --- a/components/autofill_assistant/content/renderer/autofill_assistant_model_executor.cc +++ b/components/autofill_assistant/content/renderer/autofill_assistant_model_executor.cc
@@ -4,9 +4,13 @@ #include "components/autofill_assistant/content/renderer/autofill_assistant_model_executor.h" +#include <ostream> + +#include "base/command_line.h" #include "base/i18n/case_conversion.h" #include "base/no_destructor.h" #include "base/strings/utf_string_conversions.h" +#include "components/autofill_assistant/content/common/switches.h" #include "components/optimization_guide/core/execution_status.h" #include "components/optimization_guide/core/tflite_op_resolver.h" #include "third_party/abseil-cpp/absl/status/status.h" @@ -19,6 +23,17 @@ namespace autofill_assistant { namespace { +std::string SparseVectorToDebugString( + AutofillAssistantModelExecutor::SparseVector sparse_vector) { + std::ostringstream out; + out << "Sparse vector representation:\n"; + for (const auto& entry : sparse_vector) { + out << " [idx: [" << entry.first.first << ", " << entry.first.second + << "], count: " << entry.second << "]"; + } + return out.str(); +} + void DenseEncode( const AutofillAssistantModelExecutor::SparseVector& sparse_vector, std::vector<std::vector<float>>& inputs) { @@ -147,6 +162,10 @@ } SparseVector sparse_vector = TokenizeSignalsToSparseVector(node_signals); + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAutofillAssistantDebugAnnotateDom)) { + VLOG(3) << SparseVectorToDebugString(sparse_vector); + } if (overrides_ && overrides_->contains(sparse_vector)) { overrides_result_ = (*overrides_)[sparse_vector]; @@ -237,7 +256,15 @@ const std::vector<const TfLiteTensor*>& output_tensors) { // Check if we have an override for this execution and return that instead. if (overrides_result_) { - return overrides_result_; + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kAutofillAssistantDebugAnnotateDom)) { + VLOG(3) << "Found override, using (role: " << overrides_result_->first + << ", objective: " << overrides_result_->second << ")"; + } + // Cleanup the result in case this executor is reused. + std::pair<int, int> result = *overrides_result_; + overrides_result_.reset(); + return result; } if (output_tensors.size() < 2u) { NOTREACHED() << "Output Tensors mismatch.";
diff --git a/components/autofill_assistant/content/renderer/autofill_assistant_model_executor_unittest.cc b/components/autofill_assistant/content/renderer/autofill_assistant_model_executor_unittest.cc index 5998429..71a5c26 100644 --- a/components/autofill_assistant/content/renderer/autofill_assistant_model_executor_unittest.cc +++ b/components/autofill_assistant/content/renderer/autofill_assistant_model_executor_unittest.cc
@@ -140,5 +140,37 @@ EXPECT_NE(result->second, 1111); } +TEST_F(AutofillAssistantModelExecutorTest, OverridesResultNotReused) { + AutofillAssistantModelExecutor model_executor = + AutofillAssistantModelExecutor(CreateOverrides()); + + ASSERT_TRUE(model_executor.InitializeModelFromFile(model_file_.Duplicate())); + { + blink::AutofillAssistantNodeSignals node_signals; + node_signals.node_features.invisible_attributes = + blink::WebString::FromUTF8("street"); + node_signals.node_features.text.push_back( + blink::WebString::FromUTF8("street")); + + auto result = model_executor.ExecuteModelWithInput(node_signals); + ASSERT_TRUE(result.has_value()); + EXPECT_EQ(result->first, 9999); + EXPECT_EQ(result->second, 1111); + } + + // We expect the internal overrides result from the previous execution to have + // been cleared. + { + blink::AutofillAssistantNodeSignals node_signals; + node_signals.node_features.text.push_back( + blink::WebString::FromUTF8("unknown")); + + auto result = model_executor.ExecuteModelWithInput(node_signals); + ASSERT_TRUE(result.has_value()); + EXPECT_NE(result->first, 9999); + EXPECT_NE(result->second, 1111); + } +} + } // namespace } // namespace autofill_assistant
diff --git a/components/components_strings.grd b/components/components_strings.grd index 9665c68..1a7e174 100644 --- a/components/components_strings.grd +++ b/components/components_strings.grd
@@ -333,6 +333,7 @@ <part file="translate_strings.grdp" /> <part file="tab_groups_strings.grdp" /> <part file="undo_strings.grdp" /> + <part file="user_education_strings.grdp" /> <part file="version_ui_strings.grdp" /> <part file="webapps_strings.grdp" />
diff --git a/components/crash/core/app/crashpad.cc b/components/crash/core/app/crashpad.cc index 1ff1011..9058d56 100644 --- a/components/crash/core/app/crashpad.cc +++ b/components/crash/core/app/crashpad.cc
@@ -222,26 +222,28 @@ bool InitializeCrashpad(bool initial_client, const std::string& process_type) { return InitializeCrashpadImpl(initial_client, process_type, std::string(), base::FilePath(), std::vector<std::string>(), - false); + /*embedded_handler=*/false); } #if BUILDFLAG(IS_WIN) -void InitializeCrashpadWithEmbeddedHandler(bool initial_client, +bool InitializeCrashpadWithEmbeddedHandler(bool initial_client, const std::string& process_type, const std::string& user_data_dir, const base::FilePath& exe_path) { - InitializeCrashpadImpl(initial_client, process_type, user_data_dir, exe_path, - std::vector<std::string>(), true); + return InitializeCrashpadImpl(initial_client, process_type, user_data_dir, + exe_path, std::vector<std::string>(), + /*embedded_handler=*/true); } -void InitializeCrashpadWithDllEmbeddedHandler( +bool InitializeCrashpadWithDllEmbeddedHandler( bool initial_client, const std::string& process_type, const std::string& user_data_dir, const base::FilePath& exe_path, const std::vector<std::string>& initial_arguments) { - InitializeCrashpadImpl(initial_client, process_type, user_data_dir, exe_path, - initial_arguments, true); + return InitializeCrashpadImpl(initial_client, process_type, user_data_dir, + exe_path, initial_arguments, + /*embedded_handler=*/true); } #endif // BUILDFLAG(IS_WIN)
diff --git a/components/crash/core/app/crashpad.h b/components/crash/core/app/crashpad.h index 55322a1d..35668b44 100644 --- a/components/crash/core/app/crashpad.h +++ b/components/crash/core/app/crashpad.h
@@ -85,7 +85,7 @@ // current executable if |exe_path| is empty with a command line argument of // --type=crashpad-handler. If |user_data_dir| is non-empty, it is added to the // handler's command line for use by Chrome Crashpad extensions. -void InitializeCrashpadWithEmbeddedHandler(bool initial_client, +bool InitializeCrashpadWithEmbeddedHandler(bool initial_client, const std::string& process_type, const std::string& user_data_dir, const base::FilePath& exe_path); @@ -97,7 +97,7 @@ // In this situation the exe_path is not sufficient to allow spawning a crash // handler through the DLL so |initial_arguments| needs to be passed to // specify the DLL entry point. -void InitializeCrashpadWithDllEmbeddedHandler( +bool InitializeCrashpadWithDllEmbeddedHandler( bool initial_client, const std::string& process_type, const std::string& user_data_dir,
diff --git a/components/crash/core/app/crashpad_win.cc b/components/crash/core/app/crashpad_win.cc index d2354b8..80f33dc 100644 --- a/components/crash/core/app/crashpad_win.cc +++ b/components/crash/core/app/crashpad_win.cc
@@ -75,6 +75,8 @@ CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); + bool initialized = false; + if (initial_client) { std::wstring database_path_str; if (crash_reporter_client->GetCrashDumpLocation(&database_path_str)) @@ -140,22 +142,28 @@ arguments.push_back(std::string("--monitor-self-annotation=ptype=") + switches::kCrashpadHandler); - GetCrashpadClient().StartHandler(exe_file, *database_path, metrics_path, - url, process_annotations, arguments, false, - false); + initialized = GetCrashpadClient().StartHandler( + exe_file, *database_path, metrics_path, url, process_annotations, + arguments, /*restartable=*/false, /*asynchronous_start=*/false); - // If we're the browser, push the pipe name into the environment so child - // processes can connect to it. If we inherited another crashpad_handler's - // pipe name, we'll overwrite it here. - env->SetVar(kPipeNameVar, - base::WideToUTF8(GetCrashpadClient().GetHandlerIPCPipe())); + if (initialized) { + // If we're the browser, push the pipe name into the environment so child + // processes can connect to it. If we inherited another crashpad_handler's + // pipe name, we'll overwrite it here. + env->SetVar(kPipeNameVar, + base::WideToUTF8(GetCrashpadClient().GetHandlerIPCPipe())); + } } else { std::string pipe_name_utf8; if (env->GetVar(kPipeNameVar, &pipe_name_utf8)) { - GetCrashpadClient().SetHandlerIPCPipe(base::UTF8ToWide(pipe_name_utf8)); + initialized = GetCrashpadClient().SetHandlerIPCPipe( + base::UTF8ToWide(pipe_name_utf8)); } } + if (!initialized) + return false; + if (crash_reporter_client->GetShouldDumpLargerDumps()) { const uint32_t kIndirectMemoryLimit = 4 * 1024 * 1024; crashpad::CrashpadInfo::GetCrashpadInfo()
diff --git a/components/enterprise/BUILD.gn b/components/enterprise/BUILD.gn index 984e93b..9e5fbe7 100644 --- a/components/enterprise/BUILD.gn +++ b/components/enterprise/BUILD.gn
@@ -70,6 +70,13 @@ "//services/network/public/cpp", ] + # Include certain intermediate targets as public deps so consumers + # can start using them as needed. + public_deps = [ + "//components/reporting/client:report_queue_configuration", + "//components/reporting/util:status", + ] + if (!is_chromeos_ash) { sources += [ "browser/controller/chrome_browser_cloud_management_controller.cc",
diff --git a/components/history_clusters_strings.grdp b/components/history_clusters_strings.grdp index a47c655..2d86278 100644 --- a/components/history_clusters_strings.grdp +++ b/components/history_clusters_strings.grdp
@@ -12,15 +12,6 @@ <message name="IDS_HISTORY_CLUSTERS_JOURNEYS_TAB_LABEL" desc="A label for the section in Chrome History (chrome://history) where Journeys are collected and shown to the user. See glossary entry for meaning of 'Journeys'." formatter_data="android_java"> Journeys </message> - <message name="IDS_HISTORY_CLUSTERS_JOURNEYS_HALF_HEIGHT" desc="Accessibility string read when the Journeys bottom sheet (showing a cluster of related visits) is opened at half height." formatter_data="android_java" is_accessibility_with_no_ui="true"> - Journeys opened at half height - </message> - <message name="IDS_HISTORY_CLUSTERS_JOURNEYS_FULL_HEIGHT" desc="Accessibility string read when the Journeys bottom sheet (showing a cluster of related visits) is opened at full height." formatter_data="android_java" is_accessibility_with_no_ui="true"> - Journeys opened at full height - </message> - <message name="IDS_HISTORY_CLUSTERS_JOURNEYS_CLOSED" desc="Accessibility string read when the Journeys bottom sheet (showing a cluster of related visits) is closed." formatter_data="android_java" is_accessibility_with_no_ui="true"> - Journeys closed - </message> <message name="IDS_HISTORY_CLUSTERS_LIST_TAB_LABEL" desc="A label for the section in Chrome History (chrome://history) where a list of history items are shown to the user."> List </message>
diff --git a/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc b/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc index daf9921f..4e0db552 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc +++ b/components/optimization_guide/content/browser/page_content_annotations_model_manager.cc
@@ -26,97 +26,27 @@ namespace { -const char kPageTopicsModelMetadataTypeUrl[] = - "type.googleapis.com/" - "google.internal.chrome.optimizationguide.v1.PageTopicsModelMetadata"; - -// The ID of the NONE category in the taxonomy. This node always exists. -// Semantically, the none category is attached to data for which we can say -// with certainty that no single label in the taxonomy is appropriate. -const char kNoneCategoryId[] = "-2"; - -// The max number of page entities that should be output. -// TODO(crbug/1234578): Make the number of entities Finch-able once we -// know how much the model is expected to output. -constexpr size_t kMaxPageEntities = 5; - -std::unique_ptr<history::VisitContentModelAnnotations> -GetOrCreateCurrentContentModelAnnotations( - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations) { - if (current_annotations) - return current_annotations; - return std::make_unique<history::VisitContentModelAnnotations>(); +base::TaskTraits GetTaskTraits() { + base::TaskTraits task_traits = {base::MayBlock(), + base::TaskPriority::BEST_EFFORT}; + if (base::FeatureList::IsEnabled( + features:: + kOptimizationGuideUseContinueOnShutdownForPageContentAnnotations)) { + task_traits = {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}; + } + return task_traits; } } // namespace PageContentAnnotationsModelManager::PageContentAnnotationsModelManager( - const std::string& application_locale, OptimizationGuideModelProvider* optimization_guide_model_provider) - : optimization_guide_model_provider_(optimization_guide_model_provider) { - if (features::ShouldExecutePageVisibilityModelOnPageContent( - application_locale)) { - SetUpPageTopicsModel(optimization_guide_model_provider); - ordered_models_to_execute_.push_back( - proto::OPTIMIZATION_TARGET_PAGE_TOPICS); - } - if (features::ShouldExecutePageEntitiesModelOnPageContent( - application_locale)) { - SetUpPageEntitiesModel(optimization_guide_model_provider); - ordered_models_to_execute_.push_back( - proto::OPTIMIZATION_TARGET_PAGE_ENTITIES); - } -} + : optimization_guide_model_provider_(optimization_guide_model_provider) {} PageContentAnnotationsModelManager::~PageContentAnnotationsModelManager() = default; -void PageContentAnnotationsModelManager::Annotate( - const std::string& text, - PageContentAnnotatedCallback callback) { - ExecuteNextModelOrInvokeCallback(text, /*current_annotations=*/nullptr, - std::move(callback), - /*current_model_index=*/absl::nullopt); -} - -void PageContentAnnotationsModelManager::ExecuteNextModelOrInvokeCallback( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> current_annotations, - PageContentAnnotatedCallback callback, - absl::optional<size_t> current_model_index) { - size_t next_model_index_to_execute = current_model_index.value_or(-1) + 1; - if (next_model_index_to_execute >= ordered_models_to_execute_.size()) { - // We have run all the models, so run the callback. - DCHECK(callback); - std::move(callback).Run(current_annotations - ? absl::make_optional(*current_annotations) - : absl::nullopt); - return; - } - - // Execute the next model. - proto::OptimizationTarget optimization_target = - ordered_models_to_execute_.at(next_model_index_to_execute); - switch (optimization_target) { - case proto::OPTIMIZATION_TARGET_PAGE_TOPICS: - ExecutePageTopicsModel(text, std::move(current_annotations), - std::move(callback), next_model_index_to_execute); - break; - case proto::OPTIMIZATION_TARGET_PAGE_ENTITIES: - ExecutePageEntitiesModel(text, std::move(current_annotations), - std::move(callback), - next_model_index_to_execute); - break; - default: - NOTREACHED(); - // NOTREACHED is a no-op in release builds, so just run next model. - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), - next_model_index_to_execute); - } -} - void PageContentAnnotationsModelManager::SetUpPageEntitiesModel( OptimizationGuideModelProvider* optimization_guide_model_provider, base::OnceCallback<void(bool)> callback) { @@ -126,17 +56,8 @@ true); #if BUILDFLAG(BUILD_WITH_INTERNAL_OPTIMIZATION_GUIDE) - base::TaskTraits task_traits = {base::MayBlock(), - base::TaskPriority::BEST_EFFORT}; - if (base::FeatureList::IsEnabled( - features:: - kOptimizationGuideUseContinueOnShutdownForPageContentAnnotations)) { - task_traits = {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}; - } - scoped_refptr<base::SequencedTaskRunner> background_task_runner = - base::ThreadPool::CreateSequencedTaskRunner(task_traits); + base::ThreadPool::CreateSequencedTaskRunner(GetTaskTraits()); page_entities_model_executor_ = std::make_unique<PageEntitiesModelExecutorImpl>( @@ -149,11 +70,6 @@ #endif } -void PageContentAnnotationsModelManager::SetUpPageEntitiesModel( - OptimizationGuideModelProvider* optimization_guide_model_provider) { - SetUpPageEntitiesModel(optimization_guide_model_provider, base::DoNothing()); -} - void PageContentAnnotationsModelManager:: OverridePageEntitiesModelExecutorForTesting( std::unique_ptr<PageEntitiesModelExecutor> @@ -161,104 +77,18 @@ page_entities_model_executor_ = std::move(page_entities_model_executor); } -void PageContentAnnotationsModelManager::ExecutePageEntitiesModel( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index) { - LOCAL_HISTOGRAM_BOOLEAN( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageEntitiesModelExecutionRequested", - true); - if (page_entities_model_executor_) { - page_entities_model_executor_->ExecuteModelWithInput( - text, - base::BindOnce(&PageContentAnnotationsModelManager:: - OnPageEntitiesModelExecutionCompleted, - weak_ptr_factory_.GetWeakPtr(), text, - std::move(current_annotations), base::TimeTicks::Now(), - std::move(callback), current_model_index)); - return; - } - OnPageEntitiesModelExecutionCompleted( - text, std::move(current_annotations), base::TimeTicks::Now(), - std::move(callback), current_model_index, - /*output=*/absl::nullopt); -} - -void PageContentAnnotationsModelManager::OnPageEntitiesModelExecutionCompleted( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> current_annotations, - base::TimeTicks execution_start, - PageContentAnnotatedCallback callback, - size_t current_model_index, - const absl::optional<std::vector<ScoredEntityMetadata>>& output) { - if (output) { - current_annotations = GetOrCreateCurrentContentModelAnnotations( - std::move(current_annotations)); - - // Add the top entities to the working current annotations. - for (const auto& entity : *output) { - if (current_annotations->entities.size() >= kMaxPageEntities) { - break; - } - - // We expect the weight to be between 0 and 1, so that the normalization - // from 0 to 100 makes sense. - DCHECK(entity.score >= 0.0 && entity.score <= 1.0); - current_annotations->entities.emplace_back( - history::VisitContentModelAnnotations::Category( - entity.metadata.entity_id, static_cast<int>(100 * entity.score))); - } - base::UmaHistogramTimes( - "OptimizationGuide.PageContentAnnotationsService." - "PageEntitiesExecutionLatency", - base::TimeTicks::Now() - execution_start); - } - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), current_model_index); -} - -void PageContentAnnotationsModelManager::SetUpPageTopicsModel( - OptimizationGuideModelProvider* optimization_guide_model_provider) { - proto::Any model_metadata; - model_metadata.set_type_url(kPageTopicsModelMetadataTypeUrl); - proto::PageTopicsModelMetadata page_topics_model_metadata; - page_topics_model_metadata.add_supported_output( - proto::PAGE_TOPICS_SUPPORTED_OUTPUT_VISIBILITY); - page_topics_model_metadata.add_supported_output( - proto::PAGE_TOPICS_SUPPORTED_OUTPUT_CATEGORIES); - page_topics_model_metadata.SerializeToString(model_metadata.mutable_value()); - - base::TaskTraits task_traits = {base::MayBlock(), - base::TaskPriority::BEST_EFFORT}; - if (base::FeatureList::IsEnabled( - features:: - kOptimizationGuideUseContinueOnShutdownForPageContentAnnotations)) { - task_traits = {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}; - } - - page_topics_model_handler_ = std::make_unique<BertModelHandler>( - optimization_guide_model_provider, - base::ThreadPool::CreateSequencedTaskRunner(task_traits), - proto::OPTIMIZATION_TARGET_PAGE_TOPICS, model_metadata); -} - void PageContentAnnotationsModelManager::SetUpPageTopicsV2Model( OptimizationGuideModelProvider* optimization_guide_model_provider) { if (!features::PageTopicsBatchAnnotationsEnabled()) return; - if (on_demand_page_topics_model_executor_) + if (page_topics_model_executor_) return; - on_demand_page_topics_model_executor_ = - std::make_unique<PageTopicsModelExecutor>( - optimization_guide_model_provider, - base::ThreadPool::CreateSequencedTaskRunner( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT}), - absl::nullopt); + page_topics_model_executor_ = std::make_unique<PageTopicsModelExecutor>( + optimization_guide_model_provider, + base::ThreadPool::CreateSequencedTaskRunner(GetTaskTraits()), + absl::nullopt); } void PageContentAnnotationsModelManager::SetUpPageVisibilityModel( @@ -272,99 +102,10 @@ page_visibility_model_executor_ = std::make_unique<PageVisibilityModelExecutor>( optimization_guide_model_provider, - base::ThreadPool::CreateSequencedTaskRunner( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT}), + base::ThreadPool::CreateSequencedTaskRunner(GetTaskTraits()), absl::nullopt); } -void PageContentAnnotationsModelManager::ExecutePageTopicsModel( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index) { - LOCAL_HISTOGRAM_BOOLEAN( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageTopicsModelExecutionRequested", - true); - - bool model_available = page_topics_model_handler_->ModelAvailable(); - - base::UmaHistogramBoolean( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", - model_available); - - if (!model_available) { - // TODO(crbug/1177102): Figure out if we want to enqueue it for later if - // model isn't ready, but if we call this when the model isn't ready, it - // will just return absl::nullopt for now. - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), current_model_index); - return; - } - - absl::optional<proto::PageTopicsModelMetadata> model_metadata = - page_topics_model_handler_->ParsedSupportedFeaturesForLoadedModel< - proto::PageTopicsModelMetadata>(); - if (!model_metadata) { - NOTREACHED(); - // Continue to run the callback since NOTREACHED is a no-op in prod. - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), current_model_index); - return; - } - - bool has_supported_output = false; - for (const auto supported_output : model_metadata->supported_output()) { - if (supported_output == proto::PAGE_TOPICS_SUPPORTED_OUTPUT_CATEGORIES || - supported_output == proto::PAGE_TOPICS_SUPPORTED_OUTPUT_VISIBILITY) { - has_supported_output = true; - break; - } - } - if (!has_supported_output) { - // TODO(crbug/1177102): Add histogram. - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), current_model_index); - return; - } - - page_topics_model_handler_->ExecuteModelWithInput( - base::BindOnce(&PageContentAnnotationsModelManager:: - OnPageTopicsModelExecutionCompleted, - weak_ptr_factory_.GetWeakPtr(), text, - std::move(current_annotations), std::move(callback), - current_model_index, *model_metadata), - text); -} - -void PageContentAnnotationsModelManager::OnPageTopicsModelExecutionCompleted( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index, - const proto::PageTopicsModelMetadata& model_metadata, - const absl::optional<std::vector<tflite::task::core::Category>>& output) { - if (output) { - current_annotations = GetOrCreateCurrentContentModelAnnotations( - std::move(current_annotations)); - PopulateContentModelAnnotationsFromPageTopicsModelOutput( - model_metadata, *output, current_annotations.get()); - } - - ExecuteNextModelOrInvokeCallback(text, std::move(current_annotations), - std::move(callback), current_model_index); -} - -absl::optional<int64_t> -PageContentAnnotationsModelManager::GetPageTopicsModelVersion() const { - absl::optional<proto::PageTopicsModelMetadata> model_metadata = - page_topics_model_handler_->ParsedSupportedFeaturesForLoadedModel< - proto::PageTopicsModelMetadata>(); - if (model_metadata) - return model_metadata->version(); - return absl::nullopt; -} - void PageContentAnnotationsModelManager::GetMetadataForEntityId( const std::string& entity_id, EntityMetadataRetrievedCallback callback) { @@ -377,134 +118,6 @@ std::move(callback).Run(absl::nullopt); } -void PageContentAnnotationsModelManager:: - PopulateContentModelAnnotationsFromPageTopicsModelOutput( - const proto::PageTopicsModelMetadata& model_metadata, - const std::vector<tflite::task::core::Category>& model_output, - history::VisitContentModelAnnotations* out_content_annotations) const { - out_content_annotations->page_topics_model_version = model_metadata.version(); - - absl::optional<std::string> visibility_category_name; - if (model_metadata.output_postprocessing_params().has_visibility_params()) { - visibility_category_name = model_metadata.output_postprocessing_params() - .visibility_params() - .category_name(); - } - // -1 is a sentinel value that means the visibility of the page was not - // evaluated. - out_content_annotations->visibility_score = -1.0; - std::vector<std::pair<std::string, float>> category_candidates; - for (const auto& category : model_output) { - if (visibility_category_name && - category.class_name == *visibility_category_name) { - out_content_annotations->visibility_score = - static_cast<float>(1 - category.score); - if (!model_metadata.output_postprocessing_params() - .has_category_params()) { - break; - } - continue; - } - - // Assume everything else is for categories. - int category_id; - if (base::StringToInt(category.class_name, &category_id)) { - category_candidates.emplace_back(std::make_pair( - category.class_name, static_cast<float>(category.score))); - } - } - - // Postprocess categories. - if (!model_metadata.output_postprocessing_params().has_category_params()) { - // No parameters for postprocessing, so just return. - return; - } - const proto::PageTopicsCategoryPostprocessingParams category_params = - model_metadata.output_postprocessing_params().category_params(); - - // Determine the categories with the highest weights. - std::sort(category_candidates.begin(), category_candidates.end(), - [](const std::pair<std::string, float>& a, - const std::pair<std::string, float>& b) { - return a.second > b.second; - }); - size_t max_categories = static_cast<size_t>(category_params.max_categories()); - float total_weight = 0.0; - float sum_positive_scores = 0.0; - absl::optional<std::pair<size_t, float>> none_idx_and_weight; - std::vector<std::pair<std::string, float>> categories; - categories.reserve(max_categories); - for (size_t i = 0; i < category_candidates.size() && i < max_categories; - i++) { - std::pair<std::string, float> candidate = category_candidates[i]; - categories.push_back(candidate); - total_weight += candidate.second; - - if (candidate.second > 0) - sum_positive_scores += candidate.second; - - if (candidate.first == kNoneCategoryId) { - none_idx_and_weight = std::make_pair(i, candidate.second); - } - } - - // Prune out categories that do not meet the minimum threshold. - if (category_params.min_category_weight() > 0) { - categories.erase( - std::remove_if(categories.begin(), categories.end(), - [&](const std::pair<std::string, float>& category) { - return category.second < - category_params.min_category_weight(); - }), - categories.end()); - } - - // Prune out none weights. - if (total_weight == 0) { - return; - } - if (none_idx_and_weight) { - if ((none_idx_and_weight->second / total_weight) > - category_params.min_none_weight()) { - // None weight is too strong. - return; - } - // None weight doesn't matter, so prune it out. Note that it may have - // already been removed above if its weight was below the category min. - categories.erase( - std::remove_if(categories.begin(), categories.end(), - [&](const std::pair<std::string, float>& category) { - return category.first == kNoneCategoryId; - }), - categories.end()); - } - - // Normalize category weights. - float normalization_factor = - sum_positive_scores > 0 ? sum_positive_scores : 1.0; - categories.erase( - std::remove_if( - categories.begin(), categories.end(), - [&](const std::pair<std::string, float>& category) { - return (category.second / normalization_factor) < - category_params.min_normalized_weight_within_top_n(); - }), - categories.end()); - - std::vector<history::VisitContentModelAnnotations::Category> final_categories; - final_categories.reserve(categories.size()); - for (const auto& category : categories) { - // We expect the weight to be between 0 and 1, so that the normalization - // from 0 to 100 makes sense. - DCHECK(category.second >= 0.0 && category.second <= 1.0); - final_categories.emplace_back( - history::VisitContentModelAnnotations::Category( - category.first, static_cast<int>(100 * category.second))); - } - DCHECK_LE(final_categories.size(), max_categories); - out_content_annotations->categories = final_categories; -} - void PageContentAnnotationsModelManager::RequestAndNotifyWhenModelAvailable( AnnotationType type, base::OnceCallback<void(bool)> callback) { @@ -512,8 +125,8 @@ // No-op if the executor is already setup. SetUpPageTopicsV2Model(optimization_guide_model_provider_); - if (on_demand_page_topics_model_executor_) { - on_demand_page_topics_model_executor_->AddOnModelUpdatedCallback( + if (page_topics_model_executor_) { + page_topics_model_executor_->AddOnModelUpdatedCallback( base::BindOnce(std::move(callback), true)); return; } @@ -547,9 +160,8 @@ absl::optional<ModelInfo> PageContentAnnotationsModelManager::GetModelInfoForType( AnnotationType type) const { - if (type == AnnotationType::kPageTopics && - on_demand_page_topics_model_executor_) { - return on_demand_page_topics_model_executor_->GetModelInfo(); + if (type == AnnotationType::kPageTopics && page_topics_model_executor_) { + return page_topics_model_executor_->GetModelInfo(); } if (type == AnnotationType::kContentVisibility && page_visibility_model_executor_) { @@ -593,8 +205,8 @@ JobQueue::Pointer job_ptr = job_queue_.FirstMax(); if (job_ptr.is_null()) { // There are no more jobs to run, so unload all models. - if (on_demand_page_topics_model_executor_) { - on_demand_page_topics_model_executor_->UnloadModel(); + if (page_topics_model_executor_) { + page_topics_model_executor_->UnloadModel(); } if (page_visibility_model_executor_) { page_visibility_model_executor_->UnloadModel(); @@ -615,8 +227,8 @@ // Reset every other model from memory so that there aren't a bunch of models // all loaded at the same time. if (job->type() != AnnotationType::kPageTopics && - on_demand_page_topics_model_executor_) { - on_demand_page_topics_model_executor_->UnloadModel(); + page_topics_model_executor_) { + page_topics_model_executor_->UnloadModel(); } if (job->type() != AnnotationType::kContentVisibility && page_visibility_model_executor_) { @@ -624,15 +236,15 @@ } if (job->type() == AnnotationType::kPageTopics) { - if (!on_demand_page_topics_model_executor_) { + if (!page_topics_model_executor_) { job->FillWithNullOutputs(); job->OnComplete(); job.reset(); std::move(on_job_complete_callback).Run(); return; } - on_demand_page_topics_model_executor_->ExecuteJob( - std::move(on_job_complete_callback), std::move(job)); + page_topics_model_executor_->ExecuteJob(std::move(on_job_complete_callback), + std::move(job)); return; }
diff --git a/components/optimization_guide/content/browser/page_content_annotations_model_manager.h b/components/optimization_guide/content/browser/page_content_annotations_model_manager.h index fb05111..7e6337c 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_model_manager.h +++ b/components/optimization_guide/content/browser/page_content_annotations_model_manager.h
@@ -6,16 +6,13 @@ #define COMPONENTS_OPTIMIZATION_GUIDE_CONTENT_BROWSER_PAGE_CONTENT_ANNOTATIONS_MODEL_MANAGER_H_ #include "base/memory/raw_ptr.h" -#include "components/history/core/browser/url_row.h" #include "components/optimization_guide/content/browser/page_content_annotator.h" -#include "components/optimization_guide/core/bert_model_handler.h" #include "components/optimization_guide/core/entity_metadata.h" #include "components/optimization_guide/core/model_info.h" #include "components/optimization_guide/core/page_content_annotation_job.h" #include "components/optimization_guide/core/page_content_annotations_common.h" #include "components/optimization_guide/core/page_topics_model_executor.h" #include "components/optimization_guide/core/page_visibility_model_executor.h" -#include "components/optimization_guide/proto/page_topics_model_metadata.pb.h" #include "net/base/priority_queue.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -24,10 +21,6 @@ class OptimizationGuideModelProvider; class PageEntitiesModelExecutor; -// Callback to inform the caller that the page content has been annotated. -using PageContentAnnotatedCallback = base::OnceCallback<void( - const absl::optional<history::VisitContentModelAnnotations>&)>; - // Callback to inform the caller that the metadata for an entity ID has been // retrieved. using EntityMetadataRetrievedCallback = @@ -36,8 +29,7 @@ // Manages the loading and execution of models used to annotate page content. class PageContentAnnotationsModelManager : public PageContentAnnotator { public: - PageContentAnnotationsModelManager( - const std::string& application_locale, + explicit PageContentAnnotationsModelManager( OptimizationGuideModelProvider* optimization_guide_model_provider); ~PageContentAnnotationsModelManager() override; PageContentAnnotationsModelManager( @@ -45,14 +37,11 @@ PageContentAnnotationsModelManager& operator=( const PageContentAnnotationsModelManager&) = delete; - // Requests to annotate |text|, will invoke |callback| when completed. + // Each call to |Annotate| starts one job which are are run one at a time + // based on their original order and priority. Each job runs to completion + // before the next one will start. Thus, it's ok to call |Annotate| multiple + // times in a row, like in a loop, and only one job will run at a time. // - // This will execute all supported models of the PageContentAnnotationsService - // feature and is only used by the History service code path. See the below - // |Annotate| for the publicly available Annotation code path. - // TODO(crbug/1278833): Remove this. - void Annotate(const std::string& text, PageContentAnnotatedCallback callback); - // PageContentAnnotator: void Annotate(BatchAnnotationCallback callback, const std::vector<std::string>& inputs, @@ -63,11 +52,6 @@ AnnotationType type, base::OnceCallback<void(bool)> callback) override; - // Returns the version of the page topics model that is currently being used - // to annotate page content. Will return |absl::nullopt| if no model is being - // used to annotate page topics for received page content. - absl::optional<int64_t> GetPageTopicsModelVersion() const; - // Retrieves the metadata associated with |entity_id|. Invokes |callback| // when done. void GetMetadataForEntityId(const std::string& entity_id, @@ -87,8 +71,6 @@ // All publicly posted jobs will have this priority level. kNormal = 1, - // TODO(crbug/1278833): Add a kHigh value for internal jobs. - // Always keep this last and as the highest priority + 1. This value is // passed to the priority queue ctor as "how many level of priorities are // supported" by the queue. @@ -103,111 +85,23 @@ kComplete = 3, }; - // Runs the next model on |text| based on |current_model_index|. If the - // last model in |ordered_models_to_execute_| has executed, it will invoke - // |callback| with the contents of |current_annotations|. - // - // |current_annotations|, |callback|, and |current_model_index| will be passed - // through a series of callbacks and will be invoked after the last model - // executes. - void ExecuteNextModelOrInvokeCallback( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations, - PageContentAnnotatedCallback callback, - absl::optional<size_t> current_model_index); - // Set up the machinery for execution of the page entities model. This should - // only be run at construction. - void SetUpPageEntitiesModel(OptimizationGuideModelProvider* model_provider); - - // Same as above but runs |callback(true)| when the model executor has a model - // file or |callback(false)| if the model executor is not available. + // only be run at construction. Runs |callback(true)| when the model executor + // has a model file or |callback(false)| if the model executor is not + // available. void SetUpPageEntitiesModel(OptimizationGuideModelProvider* model_provider, base::OnceCallback<void(bool)> callback); - // Requests to execute the page entities model with |text|, populate - // |current_annotations| with detected entities on success, and proceed to - // execute any subsequent models. - // - // |current_annotations|, |callback|, and |current_model_index| will be passed - // through a series of callbacks and will be invoked after the last model - // executes. - void ExecutePageEntitiesModel( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index); - - // Invoked when the page entities model has finished executing. If |output| is - // populated, |current_annotations| will be populated with the detected - // entities. Regardless of success, this will proceed to execute any - // subsequent models. If it is the last model to execute, it will invoke - // |callback| with the contents of |current_annotations| after it has - // populated it based on |output|. - void OnPageEntitiesModelExecutionCompleted( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations, - base::TimeTicks execution_start, - PageContentAnnotatedCallback callback, - size_t current_model_index, - const absl::optional<std::vector<ScoredEntityMetadata>>& output); - - // Set up the machinery for execution of the page topics model. This should - // only be run at construction. - void SetUpPageTopicsModel( - OptimizationGuideModelProvider* optimization_guide_model_provider); - // Set up the machinery for execution of the page topics v2 model. This should // only be run at construction. - // TODO(crbug/1266504): Actually call this based on a separate feature flag. void SetUpPageTopicsV2Model( OptimizationGuideModelProvider* optimization_guide_model_provider); // Set up the machinery for execution of the page visibility model. This // should only be run at construction. - // TODO(crbug/1266504): Actually call this based on a separate feature flag. void SetUpPageVisibilityModel( OptimizationGuideModelProvider* optimization_guide_model_provider); - // Requests to execute the page topics model with |text|, populate - // |current_annotations| with detected topics on success, and proceed to - // execute any subsequent models. - // - // |current_annotations|, |callback|, and |current_model_index| will be passed - // through a series of callbacks and will be invoked after the last model - // executes. - void ExecutePageTopicsModel( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index); - - // Invoked when the page topics model has finished executing. If |output| is - // populated, |current_annotations| will be populated based on that. - // Regardless of success, this will proceed to execute any subsequent models. - // If it is the last model to execute, it will invoke |callback| with the - // contents of |current_annotations| after it has populated it based on - // |output|. - void OnPageTopicsModelExecutionCompleted( - const std::string& text, - std::unique_ptr<history::VisitContentModelAnnotations> - current_annotations, - PageContentAnnotatedCallback callback, - size_t current_model_index, - const proto::PageTopicsModelMetadata& model_metadata, - const absl::optional<std::vector<tflite::task::core::Category>>& output); - - // Populates |out_content_annotations| based on |model_output| and - // |model_metadata|. - void PopulateContentModelAnnotationsFromPageTopicsModelOutput( - const proto::PageTopicsModelMetadata& model_metadata, - const std::vector<tflite::task::core::Category>& model_output, - history::VisitContentModelAnnotations* out_content_annotations) const; - // Overrides |page_entities_model_executor_| for testing purposes. void OverridePageEntitiesModelExecutorForTesting( std::unique_ptr<PageEntitiesModelExecutor> page_entities_model_executor); @@ -218,20 +112,9 @@ // Called when a |job| finishes executing, just before it is deleted. void OnJobExecutionComplete(); - // The model executor responsible for executing the page topics model. - // - // Can be nullptr if the page topics model will not be running for the - // session. - // TODO(crbug/1266504): Deprecate this in favor of - // |on_demand_page_topics_model_executor_|. - std::unique_ptr<BertModelHandler> page_topics_model_handler_; - // The model executor responsible for executing the on demand page topics // model. - // TODO(crbug/1266504): Replace |page_topics_model_handler_| with - // this. - std::unique_ptr<PageTopicsModelExecutor> - on_demand_page_topics_model_executor_; + std::unique_ptr<PageTopicsModelExecutor> page_topics_model_executor_; // The model executor responsible for executing the page visibility model. std::unique_ptr<PageVisibilityModelExecutor> page_visibility_model_executor_; @@ -242,9 +125,6 @@ // session. std::unique_ptr<PageEntitiesModelExecutor> page_entities_model_executor_; - // The ordering of models to execute on the page content of each page load. - std::vector<proto::OptimizationTarget> ordered_models_to_execute_; - // The queue of all jobs to be executed. This data structure supports FIFO // ordering for elements of the same priority. using JobQueue =
diff --git a/components/optimization_guide/content/browser/page_content_annotations_model_manager_unittest.cc b/components/optimization_guide/content/browser/page_content_annotations_model_manager_unittest.cc index 5530939..610cd9f2 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_model_manager_unittest.cc +++ b/components/optimization_guide/content/browser/page_content_annotations_model_manager_unittest.cc
@@ -139,7 +139,7 @@ model_observer_tracker_ = std::make_unique<ModelObserverTracker>(); model_manager_ = std::make_unique<PageContentAnnotationsModelManager>( - "en-US", model_observer_tracker_.get()); + model_observer_tracker_.get()); } void TearDown() override { @@ -147,26 +147,6 @@ model_observer_tracker_.reset(); } - void SendPageTopicsModelToExecutor( - const absl::optional<proto::Any>& model_metadata) { - base::FilePath source_root_dir; - base::PathService::Get(base::DIR_SOURCE_ROOT, &source_root_dir); - base::FilePath model_file_path = - source_root_dir.AppendASCII("components") - .AppendASCII("test") - .AppendASCII("data") - .AppendASCII("optimization_guide") - .AppendASCII("bert_page_topics_model.tflite"); - std::unique_ptr<ModelInfo> model_info = - TestModelInfoBuilder() - .SetModelFilePath(model_file_path) - .SetModelMetadata(model_metadata) - .Build(); - model_manager()->page_topics_model_handler_->OnModelUpdated( - proto::OPTIMIZATION_TARGET_PAGE_TOPICS, *model_info); - RunUntilIdle(); - } - proto::PageTopicsModelMetadata MakeValidPageTopicsModelMetadata() const { proto::PageTopicsModelMetadata page_topics_model_metadata; page_topics_model_metadata.set_version(123); @@ -187,7 +167,7 @@ AnnotationType::kPageTopics, base::DoNothing()); // If the feature flag is disabled, the executor won't have been created so // skip everything else. - if (!model_manager()->on_demand_page_topics_model_executor_) + if (!model_manager()->page_topics_model_executor_) return; proto::Any any_metadata; @@ -209,7 +189,7 @@ .SetModelFilePath(model_file_path) .SetModelMetadata(any_metadata) .Build(); - model_manager()->on_demand_page_topics_model_executor_->OnModelUpdated( + model_manager()->page_topics_model_executor_->OnModelUpdated( proto::OPTIMIZATION_TARGET_PAGE_TOPICS_V2, *model_info); RunUntilIdle(); } @@ -250,27 +230,6 @@ entity_metadata)); } - absl::optional<history::VisitContentModelAnnotations> Annotate( - const std::string& text) { - absl::optional<history::VisitContentModelAnnotations> content_annotations; - base::RunLoop run_loop; - model_manager()->Annotate( - "sometext", - base::BindOnce( - [](base::RunLoop* run_loop, - absl::optional<history::VisitContentModelAnnotations>* - out_content_annotations, - const absl::optional<history::VisitContentModelAnnotations>& - content_annotations) { - *out_content_annotations = content_annotations; - run_loop->Quit(); - }, - &run_loop, &content_annotations)); - run_loop.Run(); - - return content_annotations; - } - absl::optional<EntityMetadata> GetMetadataForEntityId( const std::string& entity_id) { absl::optional<EntityMetadata> entities_metadata; @@ -298,15 +257,6 @@ return model_manager_.get(); } - history::VisitContentModelAnnotations GetContentModelAnnotationsFromOutput( - const proto::PageTopicsModelMetadata& metadata, - const std::vector<tflite::task::core::Category>& model_output) const { - history::VisitContentModelAnnotations annotations; - model_manager()->PopulateContentModelAnnotationsFromPageTopicsModelOutput( - metadata, model_output, &annotations); - return annotations; - } - base::HistogramTester* histogram_tester() const { return histogram_tester_.get(); } @@ -324,290 +274,17 @@ }; TEST_F(PageContentAnnotationsModelManagerTest, - SetsUpModelsCorrectlyBasedOnFeatureParams) { - absl::optional<proto::Any> registered_model_metadata; - EXPECT_TRUE(model_observer_tracker()->DidRegisterForTarget( - proto::OPTIMIZATION_TARGET_PAGE_TOPICS, ®istered_model_metadata)); - EXPECT_TRUE(registered_model_metadata.has_value()); - absl::optional<proto::PageTopicsModelMetadata> page_topics_model_metadata = - ParsedAnyMetadata<proto::PageTopicsModelMetadata>( - *registered_model_metadata); - EXPECT_TRUE(page_topics_model_metadata.has_value()); - EXPECT_EQ(page_topics_model_metadata->supported_output_size(), 2); - EXPECT_THAT( - page_topics_model_metadata->supported_output(), - UnorderedElementsAre(proto::PAGE_TOPICS_SUPPORTED_OUTPUT_VISIBILITY, - proto::PAGE_TOPICS_SUPPORTED_OUTPUT_CATEGORIES)); - - // The feature param did not specify page entities, so we expect for it to not - // be requested. - histogram_tester()->ExpectTotalCount( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageEntitiesModelRequested", - 0); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetPageTopicsModelVersionNoPushedModel) { - EXPECT_FALSE(model_manager()->GetPageTopicsModelVersion().has_value()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetPageTopicsModelVersionFromExecutor) { - proto::Any any_metadata; - any_metadata.set_type_url( - "type.googleapis.com/com.foo.PageTopicsModelMetadata"); - proto::PageTopicsModelMetadata page_topics_model_metadata; - page_topics_model_metadata.set_version(123); - page_topics_model_metadata.SerializeToString(any_metadata.mutable_value()); - SendPageTopicsModelToExecutor(any_metadata); - - absl::optional<int64_t> model_version = - model_manager()->GetPageTopicsModelVersion(); - EXPECT_TRUE(model_version.has_value()); - EXPECT_EQ(model_version.value(), 123); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetPageTopicsModelVersionFromExecutorBadMetadata) { - proto::Any any_metadata; - any_metadata.set_type_url( - "type.googleapis.com/com.foo.whatevernotpagetopics"); - any_metadata.set_value("123"); - SendPageTopicsModelToExecutor(any_metadata); - - absl::optional<int64_t> model_version = - model_manager()->GetPageTopicsModelVersion(); - EXPECT_FALSE(model_version.has_value()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputVisibilityOnly) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - model_metadata.mutable_output_postprocessing_params() - ->mutable_visibility_params() - ->set_category_name("SOMECATEGORY"); - - std::vector<tflite::task::core::Category> model_output = { - {"SOMECATEGORY", 0.4}, - {"-2", 0.3}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_TRUE(annotations.categories.empty()); - EXPECT_THAT(annotations.visibility_score, FloatEq(0.6)); - EXPECT_EQ(annotations.page_topics_model_version, 123); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputVisibilityOnlyCategoryNotInOutput) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - model_metadata.mutable_output_postprocessing_params() - ->mutable_visibility_params() - ->set_category_name("SOMECATEGORY"); - - std::vector<tflite::task::core::Category> model_output = { - {"-2", 0.3}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_TRUE(annotations.categories.empty()); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F( - PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputNonNumericAndLowWeightCategoriesPruned) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.8); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.1); - - std::vector<tflite::task::core::Category> model_output = { - {"0", 0.0001}, {"1", 0.1}, {"SOMECATEGORY", 0.9}, {"2", 0.2}, {"3", 0.3}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_THAT(annotations.categories, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("1", 10), - history::VisitContentModelAnnotations::Category("2", 20), - history::VisitContentModelAnnotations::Category("3", 30))); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputNoneWeightTooStrong) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.1); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.1); - - std::vector<tflite::task::core::Category> model_output = { - {"-2", 0.9999}, - {"0", 0.3}, - {"1", 0.2}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_TRUE(annotations.categories.empty()); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputNoneInTopButNotStrongSoPruned) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.8); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.1); - - std::vector<tflite::task::core::Category> model_output = { - {"-2", 0.1}, {"0", 0.3}, {"1", 0.2}, {"2", 0.4}, {"3", 0.05}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_THAT(annotations.categories, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("0", 30), - history::VisitContentModelAnnotations::Category("1", 20), - history::VisitContentModelAnnotations::Category("2", 40))); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputPrunedAfterNormalization) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.8); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.25); - - std::vector<tflite::task::core::Category> model_output = { - {"0", 0.3}, - {"1", 0.25}, - {"2", 0.4}, - {"3", 0.05}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_THAT(annotations.categories, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("0", 30), - history::VisitContentModelAnnotations::Category("1", 25), - history::VisitContentModelAnnotations::Category("2", 40))); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputNoneCategoryBelowMin) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.8); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.25); - - std::vector<tflite::task::core::Category> model_output = { - {"-2", 0.001}, {"0", 0.3}, {"1", 0.25}, {"2", 0.4}, {"3", 0.05}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_THAT(annotations.categories, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("0", 30), - history::VisitContentModelAnnotations::Category("1", 25), - history::VisitContentModelAnnotations::Category("2", 40))); - EXPECT_EQ(annotations.visibility_score, -1.0); - EXPECT_EQ(annotations.page_topics_model_version, 123); - EXPECT_TRUE(annotations.entities.empty()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - GetContentModelAnnotationsFromOutputCategoriesAndVisibility) { - proto::PageTopicsModelMetadata model_metadata; - model_metadata.set_version(123); - auto* category_params = model_metadata.mutable_output_postprocessing_params() - ->mutable_category_params(); - category_params->set_max_categories(4); - category_params->set_min_none_weight(0.8); - category_params->set_min_category_weight(0.01); - category_params->set_min_normalized_weight_within_top_n(0.25); - model_metadata.mutable_output_postprocessing_params() - ->mutable_visibility_params() - ->set_category_name("SOMECATEGORY"); - - std::vector<tflite::task::core::Category> model_output = { - {"0", 0.3}, {"1", 0.25}, {"2", 0.4}, {"3", 0.05}, {"SOMECATEGORY", 0.4}, - }; - history::VisitContentModelAnnotations annotations = - GetContentModelAnnotationsFromOutput(model_metadata, model_output); - EXPECT_THAT(annotations.categories, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("0", 30), - history::VisitContentModelAnnotations::Category("1", 25), - history::VisitContentModelAnnotations::Category("2", 40))); - EXPECT_THAT(annotations.visibility_score, FloatEq(0.6)); - EXPECT_EQ(annotations.page_topics_model_version, 123); -} - -TEST_F(PageContentAnnotationsModelManagerTest, - AnnotateNoModelsFinishedExecuting) { - proto::Any any_metadata; - any_metadata.set_type_url( - "type.googleapis.com/com.foo.PageTopicsModelMetadata"); - proto::PageTopicsModelMetadata page_topics_model_metadata; - page_topics_model_metadata.set_version(123); - page_topics_model_metadata.SerializeToString(any_metadata.mutable_value()); - SendPageTopicsModelToExecutor(any_metadata); - - EXPECT_FALSE(Annotate("sometext").has_value()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, AnnotateModelNotAvailable) { - EXPECT_FALSE(Annotate("sometext").has_value()); -} - -TEST_F(PageContentAnnotationsModelManagerTest, GetMetadataForEntityIdEntitiesAnnotatorNotInitialized) { EXPECT_FALSE(GetMetadataForEntityId("someid").has_value()); } // TODO(crbug.com/1286473): Flaky on Chrome OS. #if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_BatchAnnotate_PageTopics DISABLED_BatchAnnotate_PageTopics +#define MAYBE_PageTopics DISABLED_PageTopics #else -#define MAYBE_BatchAnnotate_PageTopics BatchAnnotate_PageTopics +#define MAYBE_PageTopics PageTopics #endif -TEST_F(PageContentAnnotationsModelManagerTest, MAYBE_BatchAnnotate_PageTopics) { +TEST_F(PageContentAnnotationsModelManagerTest, MAYBE_PageTopics) { SetupPageTopicsV2ModelExecutor(); // Running the actual model can take a while. @@ -659,8 +336,7 @@ EXPECT_EQ(result[0].visibility_score(), absl::nullopt); } -TEST_F(PageContentAnnotationsModelManagerTest, - BatchAnnotate_PageTopicsDisabled) { +TEST_F(PageContentAnnotationsModelManagerTest, PageTopicsDisabled) { base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndDisableFeature( features::kPageTopicsBatchAnnotations); @@ -708,7 +384,7 @@ EXPECT_EQ(result[0].visibility_score(), absl::nullopt); } -TEST_F(PageContentAnnotationsModelManagerTest, BatchAnnotate_PageEntities) { +TEST_F(PageContentAnnotationsModelManagerTest, PageEntities) { std::vector<ScoredEntityMetadata> input1_entities = { ScoredEntityMetadata(0.5, EntityMetadata("cat", "cat", {})), ScoredEntityMetadata(0.6, EntityMetadata("dog", "dog", {})), @@ -774,12 +450,11 @@ // TODO(crbug.com/1286473): Flaky on Chrome OS. #if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_BatchAnnotate_PageVisibility DISABLED_BatchAnnotate_PageVisibility +#define MAYBE_PageVisibility DISABLED_PageVisibility #else -#define MAYBE_BatchAnnotate_PageVisibility BatchAnnotate_PageVisibility +#define MAYBE_PageVisibility PageVisibility #endif -TEST_F(PageContentAnnotationsModelManagerTest, - MAYBE_BatchAnnotate_PageVisibility) { +TEST_F(PageContentAnnotationsModelManagerTest, MAYBE_PageVisibility) { base::HistogramTester histogram_tester; proto::Any any_metadata; any_metadata.set_type_url( @@ -835,8 +510,7 @@ EXPECT_EQ(result[0].visibility_score(), absl::make_optional(-1.0)); } -TEST_F(PageContentAnnotationsModelManagerTest, - BatchAnnotate_PageVisibilityDisabled) { +TEST_F(PageContentAnnotationsModelManagerTest, PageVisibilityDisabled) { base::HistogramTester histogram_tester; base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndDisableFeature( @@ -895,12 +569,11 @@ // TODO(crbug.com/1286473): Flaky on Chrome OS. #if BUILDFLAG(IS_CHROMEOS) -#define MAYBE_BatchAnnotate_CalledTwice DISABLED_BatchAnnotate_CalledTwice +#define MAYBE_CalledTwice DISABLED_CalledTwice #else -#define MAYBE_BatchAnnotate_CalledTwice BatchAnnotate_CalledTwice +#define MAYBE_CalledTwice CalledTwice #endif -TEST_F(PageContentAnnotationsModelManagerTest, - MAYBE_BatchAnnotate_CalledTwice) { +TEST_F(PageContentAnnotationsModelManagerTest, MAYBE_CalledTwice) { SetupPageTopicsV2ModelExecutor(); base::HistogramTester histogram_tester; @@ -1114,76 +787,7 @@ EXPECT_TRUE(visibility_callback_success); } -class PageContentAnnotationsModelManagerEntitiesOnlyTest - : public PageContentAnnotationsModelManagerTest { - public: - PageContentAnnotationsModelManagerEntitiesOnlyTest() { - scoped_feature_list_.InitWithFeatures( - {features::kPageEntitiesPageContentAnnotations}, - {features::kPageVisibilityPageContentAnnotations}); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -TEST_F(PageContentAnnotationsModelManagerEntitiesOnlyTest, - SetsUpModelsCorrectlyBasedOnFeatureParams) { - // The feature param did not specify page topics, so we expect for it to not - // be requested. - absl::optional<proto::Any> registered_model_metadata; - EXPECT_FALSE(model_observer_tracker()->DidRegisterForTarget( - proto::OPTIMIZATION_TARGET_PAGE_TOPICS, ®istered_model_metadata)); - - // But it did specify page entities. - histogram_tester()->ExpectUniqueSample( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageEntitiesModelRequested", - true, 1); -} - -TEST_F(PageContentAnnotationsModelManagerEntitiesOnlyTest, - AnnotateNoModelsFinishedExecuting) { - SetPageEntitiesModelExecutor( - {{"sometext", - { - ScoredEntityMetadata(0.6, EntityMetadata("entity6", "entity6", {})), - ScoredEntityMetadata(0.5, EntityMetadata("entity5", "entity5", {})), - ScoredEntityMetadata(0.4, EntityMetadata("entity4", "entity4", {})), - ScoredEntityMetadata(0.3, EntityMetadata("entity3", "entity3", {})), - ScoredEntityMetadata(0.2, EntityMetadata("entity2", "entity2", {})), - }}}, - /*entity_metadata=*/{}); - - absl::optional<history::VisitContentModelAnnotations> annotations = - Annotate("sometext"); - - histogram_tester()->ExpectUniqueSample( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageEntitiesModelExecutionRequested", - true, 1); - - // We expect that the page topics model will not be requested for execution. - histogram_tester()->ExpectTotalCount( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageTopicsModelExecutionRequested", - 0); - - // Make sure annotations object is populated correctly. - ASSERT_TRUE(annotations.has_value()); - EXPECT_TRUE(annotations->categories.empty()); - EXPECT_EQ(annotations->visibility_score, -1.0); - EXPECT_THAT( - annotations->entities, - UnorderedElementsAre( - history::VisitContentModelAnnotations::Category("entity6", 60), - history::VisitContentModelAnnotations::Category("entity5", 50), - history::VisitContentModelAnnotations::Category("entity4", 40), - history::VisitContentModelAnnotations::Category("entity3", 30), - history::VisitContentModelAnnotations::Category("entity2", 20))); -} - -TEST_F(PageContentAnnotationsModelManagerEntitiesOnlyTest, +TEST_F(PageContentAnnotationsModelManagerTest, GetMetadataForEntityIdEntitiesAnnotatorInitialized) { EntityMetadata entity_metadata; entity_metadata.human_readable_name = "entity1"; @@ -1196,43 +800,4 @@ EXPECT_TRUE(GetMetadataForEntityId("entity1").has_value()); } -class PageContentAnnotationsModelManagerMultipleModelsTest - : public PageContentAnnotationsModelManagerTest { - public: - PageContentAnnotationsModelManagerMultipleModelsTest() { - scoped_feature_list_.InitWithFeatures( - {features::kPageEntitiesPageContentAnnotations, - features::kPageVisibilityPageContentAnnotations}, - {}); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -TEST_F(PageContentAnnotationsModelManagerMultipleModelsTest, - AnnotateRequestBothModels) { - SetPageEntitiesModelExecutor( - {{"sometext", - { - ScoredEntityMetadata(0.6, EntityMetadata("entity6", "entity6", {})), - ScoredEntityMetadata(0.5, EntityMetadata("entity5", "entity5", {})), - ScoredEntityMetadata(0.4, EntityMetadata("entity4", "entity4", {})), - ScoredEntityMetadata(0.3, EntityMetadata("entity3", "entity3", {})), - ScoredEntityMetadata(0.2, EntityMetadata("entity2", "entity2", {})), - }}}, - /*entity_metadata=*/{}); - - Annotate("sometext"); - - histogram_tester()->ExpectUniqueSample( - "OptimizationGuide.PageContentAnnotationsModelManager." - "PageEntitiesModelExecutionRequested", - true, 1); - - // We expect that the page topics model will also be requested for execution. - histogram_tester()->ExpectTotalCount( - "OptimizationGuide.PageContentAnnotationsService.ModelAvailable", 1); -} - } // namespace optimization_guide
diff --git a/components/optimization_guide/content/browser/page_content_annotations_service.cc b/components/optimization_guide/content/browser/page_content_annotations_service.cc index 699313c..517a488 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_service.cc +++ b/components/optimization_guide/content/browser/page_content_annotations_service.cc
@@ -4,6 +4,7 @@ #include "components/optimization_guide/content/browser/page_content_annotations_service.h" +#include "base/barrier_closure.h" #include "base/callback_helpers.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros_local.h" @@ -129,8 +130,21 @@ history_service_ = history_service; #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) model_manager_ = std::make_unique<PageContentAnnotationsModelManager>( - application_locale, optimization_guide_model_provider); + optimization_guide_model_provider); annotator_ = model_manager_.get(); + + if (features::ShouldExecutePageVisibilityModelOnPageContent( + application_locale)) { + model_manager_->RequestAndNotifyWhenModelAvailable( + AnnotationType::kContentVisibility, base::DoNothing()); + annotation_types_to_execute_.push_back(AnnotationType::kContentVisibility); + } + if (features::ShouldExecutePageEntitiesModelOnPageContent( + application_locale)) { + model_manager_->RequestAndNotifyWhenModelAvailable( + AnnotationType::kPageEntities, base::DoNothing()); + annotation_types_to_execute_.push_back(AnnotationType::kPageEntities); + } #endif if (features::UseLocalPageEntitiesMetadataProvider()) { @@ -195,18 +209,19 @@ << "Text: " << visit.text_to_annotate.value_or(std::string()); } visits_to_annotate_.emplace_back(visit); + base::UmaHistogramBoolean( "OptimizationGuide.PageContentAnnotations.AnnotateVisitResultCached", false); - if (visits_to_annotate_.size() >= features::AnnotateVisitBatchSize()) { - if (current_visit_annotation_batch_.empty()) { - // Used for testing. - LOCAL_HISTOGRAM_BOOLEAN( - "PageContentAnnotations.AnnotateVisit.BatchAnnotationStarted", true); - current_visit_annotation_batch_ = std::move(visits_to_annotate_); - AnnotateVisitBatch(); - return; - } + + if (MaybeStartAnnotateVisitBatch()) + return; + + // Used for testing. + LOCAL_HISTOGRAM_BOOLEAN( + "PageContentAnnotations.AnnotateVisit.AnnotationRequestQueued", true); + + if (visits_to_annotate_.size() > features::AnnotateVisitBatchSize()) { // The queue is full and an batch annotation is actively being done so // we will remove the "oldest" visit. visits_to_annotate_.erase(visits_to_annotate_.begin()); @@ -214,46 +229,123 @@ LOCAL_HISTOGRAM_BOOLEAN( "PageContentAnnotations.AnnotateVisit.QueueFullVisitDropped", true); } - // Used for testing. - LOCAL_HISTOGRAM_BOOLEAN( - "PageContentAnnotations.AnnotateVisit.AnnotationRequestQueued", true); #endif } #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) +bool PageContentAnnotationsService::MaybeStartAnnotateVisitBatch() { + bool is_full_batch_available = + visits_to_annotate_.size() >= features::AnnotateVisitBatchSize(); + bool batch_already_running = !current_visit_annotation_batch_.empty(); + + if (is_full_batch_available && !batch_already_running) { + // Used for testing. + LOCAL_HISTOGRAM_BOOLEAN( + "PageContentAnnotations.AnnotateVisit.BatchAnnotationStarted", true); + current_visit_annotation_batch_ = std::move(visits_to_annotate_); + AnnotateVisitBatch(); + + return true; + } + return false; +} + void PageContentAnnotationsService::AnnotateVisitBatch() { DCHECK(!current_visit_annotation_batch_.empty()); - if (switches::StopHistoryVisitBatchAnnotateForTesting()) { - // Code beyond this is tested in multiple places. This just ensures the - // calls up to this point can be more easily configured. - return; + std::vector<std::string> inputs; + for (const HistoryVisit& visit : current_visit_annotation_batch_) { + DCHECK(visit.text_to_annotate); + inputs.push_back(*visit.text_to_annotate); } - if (current_visit_annotation_batch_.empty()) { - return; + std::unique_ptr< + std::vector<absl::optional<history::VisitContentModelAnnotations>>> + merged_annotation_outputs = std::make_unique< + std::vector<absl::optional<history::VisitContentModelAnnotations>>>(); + merged_annotation_outputs->reserve(inputs.size()); + for (size_t i = 0; i < inputs.size(); i++) { + merged_annotation_outputs->push_back(absl::nullopt); } - auto visit = current_visit_annotation_batch_.back(); - DCHECK(visit.text_to_annotate); - if (visit.text_to_annotate) { - model_manager_->Annotate( - *(visit.text_to_annotate), - base::BindOnce(&PageContentAnnotationsService::OnBatchVisitAnnotated, - weak_ptr_factory_.GetWeakPtr(), visit)); + + std::vector<absl::optional<history::VisitContentModelAnnotations>>* + merged_annotation_outputs_ptr = merged_annotation_outputs.get(); + + base::RepeatingClosure barrier_closure = base::BarrierClosure( + annotation_types_to_execute_.size(), + base::BindOnce(&PageContentAnnotationsService::OnBatchVisitsAnnotated, + weak_ptr_factory_.GetWeakPtr(), + std::move(merged_annotation_outputs))); + + for (AnnotationType type : annotation_types_to_execute_) { + annotator_->Annotate( + base::BindOnce( + &PageContentAnnotationsService::OnAnnotationBatchComplete, type, + merged_annotation_outputs_ptr, barrier_closure), + inputs, type); } } -void PageContentAnnotationsService::OnBatchVisitAnnotated( - const HistoryVisit& visit, - const absl::optional<history::VisitContentModelAnnotations>& - content_annotations) { - OnPageContentAnnotated(visit, content_annotations); - DCHECK_EQ(visit.navigation_id, - current_visit_annotation_batch_.back().navigation_id); - current_visit_annotation_batch_.pop_back(); - if (!current_visit_annotation_batch_.empty()) { - AnnotateVisitBatch(); +// static +void PageContentAnnotationsService::OnAnnotationBatchComplete( + AnnotationType type, + std::vector<absl::optional<history::VisitContentModelAnnotations>>* + merge_to_output, + base::OnceClosure signal_merge_complete_callback, + const std::vector<BatchAnnotationResult>& batch_result) { + DCHECK_EQ(merge_to_output->size(), batch_result.size()); + for (size_t i = 0; i < batch_result.size(); i++) { + const BatchAnnotationResult result = batch_result[i]; + DCHECK_EQ(type, result.type()); + + if (!result.HasOutputForType()) + continue; + + history::VisitContentModelAnnotations current_annotations; + + if (type == AnnotationType::kContentVisibility) { + DCHECK(result.visibility_score()); + current_annotations.visibility_score = *result.visibility_score(); + } + + if (type == AnnotationType::kPageEntities) { + DCHECK(result.entities()); + for (const ScoredEntityMetadata& scored_md : *result.entities()) { + DCHECK(scored_md.score >= 0.0 && scored_md.score <= 1.0); + history::VisitContentModelAnnotations::Category category( + scored_md.metadata.entity_id, + static_cast<int>(100 * scored_md.score)); + history::VisitContentModelAnnotations::MergeCategoryIntoVector( + category, ¤t_annotations.entities); + } + } + + history::VisitContentModelAnnotations previous_annotations = + merge_to_output->at(i).value_or( + history::VisitContentModelAnnotations()); + current_annotations.MergeFrom(previous_annotations); + + merge_to_output->at(i) = current_annotations; } + + // This needs to be ran last because |merge_to_output| may be deleted when + // run. + std::move(signal_merge_complete_callback).Run(); +} + +void PageContentAnnotationsService::OnBatchVisitsAnnotated( + std::unique_ptr< + std::vector<absl::optional<history::VisitContentModelAnnotations>>> + merged_annotation_outputs) { + DCHECK_EQ(merged_annotation_outputs->size(), + current_visit_annotation_batch_.size()); + for (size_t i = 0; i < merged_annotation_outputs->size(); i++) { + OnPageContentAnnotated(current_visit_annotation_batch_[i], + merged_annotation_outputs->at(i)); + } + + current_visit_annotation_batch_.clear(); + MaybeStartAnnotateVisitBatch(); } #endif @@ -508,8 +600,8 @@ base::BindOnce( &history::HistoryService::AddContentModelAnnotationsForVisit, history_service_->AsWeakPtr(), annotations), - // Even though we are persisting remote page entities, we store these - // as an override to the model annotations. + // Even though we are persisting remote page entities, we store + // these as an override to the model annotations. PageContentAnnotationsType::kModelAnnotations); }
diff --git a/components/optimization_guide/content/browser/page_content_annotations_service.h b/components/optimization_guide/content/browser/page_content_annotations_service.h index a4c911d..ac34887 100644 --- a/components/optimization_guide/content/browser/page_content_annotations_service.h +++ b/components/optimization_guide/content/browser/page_content_annotations_service.h
@@ -6,6 +6,7 @@ #define COMPONENTS_OPTIMIZATION_GUIDE_CONTENT_BROWSER_PAGE_CONTENT_ANNOTATIONS_SERVICE_H_ #include <string> +#include <vector> #include "base/callback_forward.h" #include "base/containers/lru_cache.h" @@ -151,31 +152,46 @@ static std::string StringInputForPageTopicsHost(const std::string& host); #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) - // Callback invoked when |visit| has been annotated. + // Callback invoked when a single |visit| has been annotated. void OnPageContentAnnotated( const HistoryVisit& visit, const absl::optional<history::VisitContentModelAnnotations>& content_annotations); + // Maybe calls |AnnotateVisitBatch| to start a new batch of content + // annotations. Returns true if a new batch is started. Returns false if a + // batch is already running, or if there batch queue is not full. + bool MaybeStartAnnotateVisitBatch(); + // Runs the page annotation models available to |model_manager_| on all the // visits within |current_visit_annotation_batch_|. void AnnotateVisitBatch(); - // Callback run after the annotations for a |visit| of a batch has been - // determined. |current_visit_annotation_batch_| is updated to remove - // the annotated visit and will trigger the next visit to be annotated. - void OnBatchVisitAnnotated( - const HistoryVisit& visit, - const absl::optional<history::VisitContentModelAnnotations>& - content_annotations); + // Runs when a single annotation job of |type| is completed and |batch_result| + // can be merged into |merge_to_output|. |signal_merge_complete_callback| + // should be run last as it is a |base::BarrierClosure| that may trigger + // |OnBatchVisitsAnnotated| to run. + static void OnAnnotationBatchComplete( + AnnotationType type, + std::vector<absl::optional<history::VisitContentModelAnnotations>>* + merge_to_output, + base::OnceClosure signal_merge_complete_callback, + const std::vector<BatchAnnotationResult>& batch_result); + + // Callback run after all annotation types in |annotation_types_to_execute_| + // for all of |current_visit_annotation_batch_| has been completed. + void OnBatchVisitsAnnotated( + std::unique_ptr< + std::vector<absl::optional<history::VisitContentModelAnnotations>>> + merged_annotation_outputs); std::unique_ptr<PageContentAnnotationsModelManager> model_manager_; #endif - // The annotator to use for requests to |BatchAnnotate|. In prod, this is - // simply |model_manager_.get()| but is set as a separate pointer here in - // order to be override-able for testing. + // The annotator to use for requests to |BatchAnnotate| and |Annotate|. In + // prod, this is simply |model_manager_.get()| but is set as a separate + // pointer here in order to be override-able for testing. raw_ptr<PageContentAnnotator> annotator_; // Requests to annotate |text|, which is associated with |web_contents|. @@ -275,6 +291,9 @@ // and annotations can be scheduled with minimal impact to browsing. std::vector<HistoryVisit> visits_to_annotate_; + // The set of |AnnotationType|'s to run on each of |visits_to_annotate_|. + std::vector<AnnotationType> annotation_types_to_execute_; + // The batch of visits being annotated. If this is empty, it is assumed that // no visits are actively be annotated and a new batch can be started. std::vector<HistoryVisit> current_visit_annotation_batch_;
diff --git a/components/optimization_guide/core/insertion_ordered_set.h b/components/optimization_guide/core/insertion_ordered_set.h index 061d4a3..56b67f60 100644 --- a/components/optimization_guide/core/insertion_ordered_set.h +++ b/components/optimization_guide/core/insertion_ordered_set.h
@@ -33,6 +33,8 @@ bool empty() const { return vector_.empty(); } + size_t size() const { return vector_.size(); } + const std::vector<T>& vector() { return vector_; } const base::flat_set<T>& set() { return set_; }
diff --git a/components/optimization_guide/core/optimization_guide_switches.cc b/components/optimization_guide/core/optimization_guide_switches.cc index 0cbbc85..f8f4c4a 100644 --- a/components/optimization_guide/core/optimization_guide_switches.cc +++ b/components/optimization_guide/core/optimization_guide_switches.cc
@@ -81,11 +81,6 @@ // Triggers validation of the model. Used for manual testing. const char kModelValidate[] = "optimization-guide-model-validate"; -// Prevents any models from being executing when in annotating a batch -// of visits. This is used for testing only. -const char kStopHistoryVisitBatchAnnotateForTesting[] = - "stop-history-visit-batch-annotate"; - const char kPageContentAnnotationsLoggingEnabled[] = "enable-page-content-annotations-logging"; @@ -194,13 +189,6 @@ return command_line->GetSwitchValueASCII(kModelOverride); } -bool StopHistoryVisitBatchAnnotateForTesting() { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(kStopHistoryVisitBatchAnnotateForTesting)) - return true; - return false; -} - bool ShouldLogPageContentAnnotationsInput() { return base::CommandLine::ForCurrentProcess()->HasSwitch( kPageContentAnnotationsLoggingEnabled);
diff --git a/components/optimization_guide/core/optimization_guide_switches.h b/components/optimization_guide/core/optimization_guide_switches.h index c7e80ce..ea0f552 100644 --- a/components/optimization_guide/core/optimization_guide_switches.h +++ b/components/optimization_guide/core/optimization_guide_switches.h
@@ -33,7 +33,6 @@ extern const char kModelOverride[]; extern const char kDebugLoggingEnabled[]; extern const char kModelValidate[]; -extern const char kStopHistoryVisitBatchAnnotateForTesting[]; extern const char kPageContentAnnotationsLoggingEnabled[]; // Returns whether the hint component should be processed. @@ -89,10 +88,6 @@ // Returns true if debug logs are enabled for the optimization guide. bool IsDebugLogsEnabled(); -// Whether to prevent annotations from happening when in a batch. For testing -// purposes only. -bool StopHistoryVisitBatchAnnotateForTesting(); - // Returns true if page content annotations input should be logged. bool ShouldLogPageContentAnnotationsInput();
diff --git a/components/optimization_guide/core/page_content_annotations_common.cc b/components/optimization_guide/core/page_content_annotations_common.cc index 6f66791..be995c4d 100644 --- a/components/optimization_guide/core/page_content_annotations_common.cc +++ b/components/optimization_guide/core/page_content_annotations_common.cc
@@ -58,6 +58,19 @@ default; BatchAnnotationResult::~BatchAnnotationResult() = default; +bool BatchAnnotationResult::HasOutputForType() const { + switch (type()) { + case AnnotationType::kUnknown: + return false; + case AnnotationType::kPageTopics: + return !!topics(); + case AnnotationType::kContentVisibility: + return !!visibility_score(); + case AnnotationType::kPageEntities: + return !!entities(); + } +} + std::string BatchAnnotationResult::ToString() const { std::string output = "nullopt"; if (topics_) {
diff --git a/components/optimization_guide/core/page_content_annotations_common.h b/components/optimization_guide/core/page_content_annotations_common.h index f2aa257..937992e 100644 --- a/components/optimization_guide/core/page_content_annotations_common.h +++ b/components/optimization_guide/core/page_content_annotations_common.h
@@ -86,6 +86,9 @@ BatchAnnotationResult(const BatchAnnotationResult&); ~BatchAnnotationResult(); + // Returns true if the output corresponding to |type| is not nullopt; + bool HasOutputForType() const; + const std::string& input() const { return input_; } AnnotationType type() const { return type_; } const absl::optional<std::vector<WeightedIdentifier>>& topics() const {
diff --git a/components/optimization_guide/core/page_entities_model_executor_impl.cc b/components/optimization_guide/core/page_entities_model_executor_impl.cc index 71251a49..7c07835 100644 --- a/components/optimization_guide/core/page_entities_model_executor_impl.cc +++ b/components/optimization_guide/core/page_entities_model_executor_impl.cc
@@ -23,6 +23,11 @@ "type.googleapis.com/" "google.internal.chrome.optimizationguide.v1.PageEntitiesModelMetadata"; +// The max number of page entities that should be output. +// TODO(crbug/1234578): Make the number of entities Finch-able once we +// know how much the model is expected to output. +constexpr size_t kMaxPageEntities = 5; + PageEntitiesModelExecutorConfig& GetPageEntitiesModelExecutorConfigInternal() { static base::NoDestructor<PageEntitiesModelExecutorConfig> s_config; return *s_config; @@ -161,6 +166,11 @@ [](const ScoredEntityMetadata& a, const ScoredEntityMetadata& b) { return a.score > b.score; }); + + // Limit the output to the top |kMaxPageEntities| items. + if (scored_md->size() > kMaxPageEntities) { + scored_md->resize(kMaxPageEntities); + } } reply_task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), scored_md));
diff --git a/components/password_manager/content/browser/password_change_success_tracker_factory.cc b/components/password_manager/content/browser/password_change_success_tracker_factory.cc index 695dc8e2..63d83a2 100644 --- a/components/password_manager/content/browser/password_change_success_tracker_factory.cc +++ b/components/password_manager/content/browser/password_change_success_tracker_factory.cc
@@ -41,6 +41,8 @@ user_prefs::UserPrefs::Get(browser_context)); tracker->AddMetricsRecorder( std::make_unique<PasswordChangeMetricsRecorderUma>()); + tracker->AddMetricsRecorder( + std::make_unique<PasswordChangeMetricsRecorderUkm>()); return tracker; }
diff --git a/components/password_manager/core/browser/password_change_success_tracker.h b/components/password_manager/core/browser/password_change_success_tracker.h index e2d12a858..0effab96 100644 --- a/components/password_manager/core/browser/password_change_success_tracker.h +++ b/components/password_manager/core/browser/password_change_success_tracker.h
@@ -39,7 +39,8 @@ // Start and end events for automated (i.e. Autofill Assistant-driven) and // manual flows (i.e. Chrome opens a CCT and a user updates a password on // their own). - // These values are persisted to prefs; do not reorder or renumber entries! + // These values are persisted to prefs and used in enums.xml; do not reorder + // or renumber entries! enum class StartEvent { // An automated password change flow. kAutomatedFlow = 0, @@ -67,7 +68,8 @@ kMaxValue = kManualResetLinkFlow }; - // These values are persisted to prefs; do not reorder or renumber entries! + // These values are persisted to prefs and used in enums.xml; do not reorder + // or renumber entries! enum class EndEvent { // Automated password change flow completed with a generated password. kAutomatedFlowGeneratedPasswordChosen = 0, @@ -94,7 +96,8 @@ }; // The place in Chrome where the password change flow originated. - // These values are persisted to prefs; do not reorder or renumber entries! + // These values are persisted to prefs and used in enums.xml; do not reorder + // or renumber entries! enum class EntryPoint { // Started after performing a password check in settings / the password // manager.
diff --git a/components/password_manager/core/browser/password_change_success_tracker_impl.cc b/components/password_manager/core/browser/password_change_success_tracker_impl.cc index e351066..fe0d85b 100644 --- a/components/password_manager/core/browser/password_change_success_tracker_impl.cc +++ b/components/password_manager/core/browser/password_change_success_tracker_impl.cc
@@ -15,6 +15,9 @@ #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h" +#include "services/metrics/public/cpp/metrics_utils.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "services/metrics/public/cpp/ukm_source_id.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" #include "url/origin.h" @@ -123,6 +126,25 @@ UmaHistogramLongTimes100(entry_key, duration); } +PasswordChangeMetricsRecorderUkm::~PasswordChangeMetricsRecorderUkm() = default; + +void PasswordChangeMetricsRecorderUkm::OnFlowRecorded( + const std::string& etld_plus_1, + PasswordChangeSuccessTracker::StartEvent start_event, + PasswordChangeSuccessTracker::EndEvent end_event, + PasswordChangeSuccessTracker::EntryPoint entry_point, + base::TimeDelta duration) { + int64_t bucketed_duration = + ukm::GetExponentialBucketMin(duration.InSeconds(), kBucketSpacing); + ukm::builders::PasswordManager_PasswordChangeFlowDuration( + ukm::NoURLSourceId()) + .SetStartEvent(static_cast<int64_t>(start_event)) + .SetEndEvent(static_cast<int64_t>(end_event)) + .SetEntryPoint(static_cast<int64_t>(entry_point)) + .SetDuration(bucketed_duration) + .Record(ukm::UkmRecorder::Get()); +} + PasswordChangeSuccessTrackerImpl::IncompleteFlow::IncompleteFlow( const std::string& etld_plus_1, const std::string& username,
diff --git a/components/password_manager/core/browser/password_change_success_tracker_impl.h b/components/password_manager/core/browser/password_change_success_tracker_impl.h index bb27141..3ef8cdbf 100644 --- a/components/password_manager/core/browser/password_change_success_tracker_impl.h +++ b/components/password_manager/core/browser/password_change_success_tracker_impl.h
@@ -56,6 +56,33 @@ base::TimeDelta duration) override; }; +// Implementation of the |PasswordChangeMetricsRecorder| for UKM metrics. +// It currently does not associate the record with the current navigation; +// instead, it writes everything to the id |ukm::NoUrlSourceId()|. +class PasswordChangeMetricsRecorderUkm : public PasswordChangeMetricsRecorder { + public: + // The exponential factor used for bucket spacing for the UKM recorder. + // Choosing a factor of 1.1 gives 70 unique buckets between 1 and 3600. + // A sufficient good resolution is important, since we expect the majority of + // flows to have durations much shorter than 3600 seconds. + static constexpr double kBucketSpacing = 1.1; + + PasswordChangeMetricsRecorderUkm() = default; + ~PasswordChangeMetricsRecorderUkm() override; + + PasswordChangeMetricsRecorderUkm(const PasswordChangeMetricsRecorderUkm&) = + delete; + PasswordChangeMetricsRecorderUkm& operator=( + const PasswordChangeMetricsRecorderUkm&) = delete; + + // PasswordChangeMetricsRecorder: + void OnFlowRecorded(const std::string& etld_plus_1, + PasswordChangeSuccessTracker::StartEvent start_event, + PasswordChangeSuccessTracker::EndEvent end_event, + PasswordChangeSuccessTracker::EntryPoint entry_point, + base::TimeDelta duration) override; +}; + // Implementation of the |PasswordChangeSuccessTracker| interface. class PasswordChangeSuccessTrackerImpl : public password_manager::PasswordChangeSuccessTracker {
diff --git a/components/password_manager/core/browser/password_change_success_tracker_impl_unittest.cc b/components/password_manager/core/browser/password_change_success_tracker_impl_unittest.cc index ce65bb31..3fb2db22 100644 --- a/components/password_manager/core/browser/password_change_success_tracker_impl_unittest.cc +++ b/components/password_manager/core/browser/password_change_success_tracker_impl_unittest.cc
@@ -11,17 +11,22 @@ #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" +#include "components/ukm/test_ukm_recorder.h" +#include "services/metrics/public/cpp/ukm_builders.h" +#include "services/metrics/public/cpp/ukm_source_id.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" using password_manager::PasswordChangeMetricsRecorder; +using password_manager::PasswordChangeMetricsRecorderUkm; using password_manager::PasswordChangeMetricsRecorderUma; using password_manager::PasswordChangeSuccessTracker; using password_manager::PasswordChangeSuccessTrackerImpl; using testing::_; using testing::StrictMock; +using UkmEntry = ukm::builders::PasswordManager_PasswordChangeFlowDuration; constexpr char kUrl1[] = "https://www.example.com"; constexpr char kEtldPlus1[] = "example.com"; @@ -174,6 +179,81 @@ 2); } +// Tests of |PasswordChangeMetricsRecorderUkm|. +class PasswordChangeMetricsRecorderUkmTest : public ::testing::Test { + public: + PasswordChangeMetricsRecorderUkmTest() = default; + ~PasswordChangeMetricsRecorderUkmTest() override = default; + + protected: + const ukm::TestAutoSetUkmRecorder& ukm_tester() { return test_ukm_recorder_; } + PasswordChangeMetricsRecorderUkm& recorder() { return recorder_; } + + private: + base::test::TaskEnvironment task_environment_; + ukm::TestAutoSetUkmRecorder test_ukm_recorder_; + + // The object to test. + PasswordChangeMetricsRecorderUkm recorder_; +}; + +TEST_F(PasswordChangeMetricsRecorderUkmTest, RecordSingleMetricsEvent) { + constexpr PasswordChangeSuccessTracker::StartEvent start_event = + PasswordChangeSuccessTracker::StartEvent::kAutomatedFlow; + constexpr PasswordChangeSuccessTracker::EndEvent end_event = + PasswordChangeSuccessTracker::EndEvent:: + kAutomatedFlowGeneratedPasswordChosen; + constexpr PasswordChangeSuccessTracker::EntryPoint entry_point = + PasswordChangeSuccessTracker::EntryPoint::kLeakWarningDialog; + + recorder().OnFlowRecorded(kEtldPlus1, start_event, end_event, entry_point, + base::Seconds(30)); + + // Check that UKM logging is correct. + const auto& entries = ukm_tester().GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + EXPECT_EQ(entry->source_id, ukm::NoURLSourceId()); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kStartEventName, + static_cast<int64_t>(start_event)); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kEndEventName, + static_cast<int64_t>(end_event)); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kEntryPointName, + static_cast<int64_t>(entry_point)); + // Exponential bucketing maps 30 seconds to the 29 second bucket. + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kDurationName, 29); + } +} + +TEST_F(PasswordChangeMetricsRecorderUkmTest, + RecordSingleMetricsEventWithTimeout) { + constexpr PasswordChangeSuccessTracker::StartEvent start_event = + PasswordChangeSuccessTracker::StartEvent::kManualChangePasswordUrlFlow; + constexpr PasswordChangeSuccessTracker::EndEvent end_event = + PasswordChangeSuccessTracker::EndEvent::kTimeout; + constexpr PasswordChangeSuccessTracker::EntryPoint entry_point = + PasswordChangeSuccessTracker::EntryPoint::kLeakCheckInSettings; + + recorder().OnFlowRecorded(kEtldPlus1, start_event, end_event, entry_point, + PasswordChangeSuccessTracker::kFlowTimeout); + + // Check that UKM logging is correct. + const auto& entries = ukm_tester().GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + EXPECT_EQ(entry->source_id, ukm::NoURLSourceId()); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kStartEventName, + static_cast<int64_t>(start_event)); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kEndEventName, + static_cast<int64_t>(end_event)); + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kEntryPointName, + static_cast<int64_t>(entry_point)); + // With a bucket spacing of 1.1, 3600 seconds are mapped to the bucket + // with 3299 seconds. + ukm_tester().ExpectEntryMetric(entry, UkmEntry::kDurationName, 3299); + } +} + // Tests of |PasswordChangeSuccessTrackerImpl|. class PasswordChangeSuccessTrackerImplTest : public ::testing::Test { public: @@ -562,3 +642,55 @@ "AutomatedFlow.AutomatedFlowPasswordChosen", 1); } + +TEST_F(PasswordChangeSuccessTrackerImplTest, + IntegrationTestWithMetricsRecorderUkm) { + ukm::TestAutoSetUkmRecorder ukm_tester; + + // Manually add the Ukm recorder. + AddMetricsRecorder(std::make_unique<PasswordChangeMetricsRecorderUkm>()); + + tracker()->OnChangePasswordFlowStarted( + GURL(kUrl2WithPath), kUsername2, + PasswordChangeSuccessTracker::StartEvent::kAutomatedFlow, + PasswordChangeSuccessTracker::EntryPoint::kLeakWarningDialog); + + // This flow completion cannot be matched due to a different url, + // so there is no call to the recorder. + tracker()->OnChangePasswordFlowCompleted( + GURL(kUrl1), kUsername2, + PasswordChangeSuccessTracker::EndEvent:: + kAutomatedFlowGeneratedPasswordChosen); + + EXPECT_CALL( + *metrics_recorder(), + OnFlowRecorded( + PasswordChangeSuccessTrackerImpl::ExtractEtldPlus1(GURL(kUrl2)), + PasswordChangeSuccessTracker::StartEvent::kAutomatedFlow, + PasswordChangeSuccessTracker::EndEvent:: + kAutomatedFlowOwnPasswordChosen, + PasswordChangeSuccessTracker::EntryPoint::kLeakWarningDialog, _)); + + tracker()->OnChangePasswordFlowCompleted( + GURL(kUrl2), kUsername2, + PasswordChangeSuccessTracker::EndEvent::kAutomatedFlowOwnPasswordChosen); + + // Check that UKM logging is correct. + const auto& entries = ukm_tester.GetEntriesByName(UkmEntry::kEntryName); + EXPECT_EQ(1u, entries.size()); + for (const auto* entry : entries) { + EXPECT_EQ(entry->source_id, ukm::NoURLSourceId()); + ukm_tester.ExpectEntryMetric( + entry, UkmEntry::kStartEventName, + static_cast<int64_t>( + PasswordChangeSuccessTracker::StartEvent::kAutomatedFlow)); + ukm_tester.ExpectEntryMetric( + entry, UkmEntry::kEndEventName, + static_cast<int64_t>(PasswordChangeSuccessTracker::EndEvent:: + kAutomatedFlowOwnPasswordChosen)); + ukm_tester.ExpectEntryMetric( + entry, UkmEntry::kEntryPointName, + static_cast<int64_t>( + PasswordChangeSuccessTracker::EntryPoint::kLeakWarningDialog)); + } +}
diff --git a/components/user_education/DEPS b/components/user_education/DEPS new file mode 100644 index 0000000..a74f63f36 --- /dev/null +++ b/components/user_education/DEPS
@@ -0,0 +1,10 @@ +include_rules = [ + "+base", + "+components/feature_engagement/public", + "+components/strings", + "+components/vector_icons", + "+ui/accessibility", + "+ui/base", + "+ui/color", + "+ui/gfx", +]
diff --git a/components/user_education/DIR_METADATA b/components/user_education/DIR_METADATA new file mode 100644 index 0000000..52757302 --- /dev/null +++ b/components/user_education/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "UI>Browser>UserEducation" +}
diff --git a/components/user_education/OWNERS b/components/user_education/OWNERS new file mode 100644 index 0000000..a93db645 --- /dev/null +++ b/components/user_education/OWNERS
@@ -0,0 +1,6 @@ +dfried@chromium.org +dpenning@chromium.org + +# Backup +bsep@chromium.org +pbos@chromium.org
diff --git a/components/user_education/README.md b/components/user_education/README.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/components/user_education/README.md
diff --git a/components/user_education/common/BUILD.gn b/components/user_education/common/BUILD.gn new file mode 100644 index 0000000..a90db5a --- /dev/null +++ b/components/user_education/common/BUILD.gn
@@ -0,0 +1,78 @@ +# 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. + +import("//build/buildflag_header.gni") +import("//build/config/ui.gni") + +source_set("common") { + sources = [ + "feature_promo_controller.cc", + "feature_promo_controller.h", + "feature_promo_registry.cc", + "feature_promo_registry.h", + "feature_promo_snooze_service.cc", + "feature_promo_snooze_service.h", + "feature_promo_specification.cc", + "feature_promo_specification.h", + "help_bubble.cc", + "help_bubble.h", + "help_bubble_factory.h", + "help_bubble_factory_registry.cc", + "help_bubble_factory_registry.h", + "help_bubble_params.cc", + "help_bubble_params.h", + "scoped_new_badge_tracker_base.cc", + "scoped_new_badge_tracker_base.h", + "tutorial.cc", + "tutorial.h", + "tutorial_description.cc", + "tutorial_description.h", + "tutorial_identifier.h", + "tutorial_registry.cc", + "tutorial_registry.h", + "tutorial_service.cc", + "tutorial_service.h", + "user_education_class_properties.cc", + "user_education_class_properties.h", + ] + + deps = [ + "//base", + "//components/feature_engagement/public", + "//components/strings", + "//components/variations", + "//components/vector_icons", + "//skia", + "//third_party/abseil-cpp:absl", + "//ui/accessibility", + "//ui/base", + ] +} + +source_set("unit_tests") { + testonly = true + + sources = [ + "feature_promo_snooze_service_unittest.cc", + "help_bubble_factory_registry_unittest.cc", + "tutorial_unittest.cc", + ] + + deps = [ + ":common", + "//base", + "//base/test:test_support", + "//components/feature_engagement/public", + "//components/strings", + "//components/user_education/test", + "//components/variations", + "//skia", + "//testing/gmock", + "//testing/gtest", + "//third_party/abseil-cpp:absl", + "//ui/accessibility", + "//ui/base", + "//ui/base:test_support", + ] +}
diff --git a/chrome/browser/ui/user_education/feature_promo_controller.cc b/components/user_education/common/feature_promo_controller.cc similarity index 93% rename from chrome/browser/ui/user_education/feature_promo_controller.cc rename to components/user_education/common/feature_promo_controller.cc index d9f7bbc..43a10be4 100644 --- a/chrome/browser/ui/user_education/feature_promo_controller.cc +++ b/components/user_education/common/feature_promo_controller.cc
@@ -2,27 +2,29 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_controller.h" + #include "base/auto_reset.h" #include "base/bind.h" #include "base/callback_list.h" #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/notreached.h" -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/feature_promo_snooze_service.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" -#include "chrome/grit/generated_resources.h" #include "components/feature_engagement/public/event_constants.h" #include "components/feature_engagement/public/feature_constants.h" +#include "components/strings/grit/components_strings.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/feature_promo_snooze_service.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_service.h" #include "ui/accessibility/ax_mode.h" #include "ui/accessibility/platform/ax_platform_node.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/views/style/platform_style.h" + +namespace user_education { FeaturePromoController::PromoHandle::PromoHandle() = default; @@ -290,16 +292,16 @@ iph_feature_bypassing_tracker_) return true; - if (!feature_engagement_tracker_->ShouldTriggerHelpUI( - feature_engagement::kIPHFocusHelpBubbleScreenReaderPromoFeature)) { + const base::Feature* const prompt_feature = + GetScreenReaderPromptPromoFeature(); + if (!prompt_feature || + !feature_engagement_tracker_->ShouldTriggerHelpUI(*prompt_feature)) return false; - } // TODO(crbug.com/1258216): Once we have our answer, immediately dismiss // so that this doesn't interfere with actually showing the bubble. This // dismiss can be moved elsewhere once we support concurrency. - feature_engagement_tracker_->Dismissed( - feature_engagement::kIPHFocusHelpBubbleScreenReaderPromoFeature); + feature_engagement_tracker_->Dismissed(*prompt_feature); return true; } @@ -325,6 +327,8 @@ : l10n_util::GetStringUTF16(spec.screen_reader_string_id()); } create_params.body_icon = spec.bubble_icon(); + if (spec.bubble_body_string_id()) + create_params.body_icon_alt_text = GetBodyIconAltText(); create_params.arrow = spec.bubble_arrow(); // Critical promos don't time out. @@ -341,6 +345,8 @@ CreateTutorialButtons(*spec.feature(), spec.tutorial_id()); create_params.force_close_button = true; } + create_params.close_button_alt_text = + l10n_util::GetStringUTF16(IDS_CLOSE_PROMO); // Feature isn't present for some critical promos. if (spec.feature()) { @@ -367,7 +373,7 @@ // promos to ignore other active promos. if (had_screen_reader_promo) { feature_engagement_tracker_->NotifyEvent( - feature_engagement::events::kFocusHelpBubbleAcceleratorPromoRead); + GetScreenReaderPromptPromoEventName()); } // Listen for the bubble being closed. @@ -468,7 +474,7 @@ std::vector<HelpBubbleButtonParams> buttons; HelpBubbleButtonParams snooze_button; - snooze_button.text = GetSnoozeButtonText(); + snooze_button.text = l10n_util::GetStringUTF16(IDS_PROMO_SNOOZE_BUTTON); snooze_button.is_default = false; snooze_button.callback = base::BindOnce( &FeaturePromoControllerCommon::OnHelpBubbleSnoozed, @@ -476,7 +482,7 @@ buttons.push_back(std::move(snooze_button)); HelpBubbleButtonParams dismiss_button; - dismiss_button.text = GetDismissButtonText(); + dismiss_button.text = l10n_util::GetStringUTF16(IDS_PROMO_DISMISS_BUTTON); dismiss_button.is_default = true; dismiss_button.callback = base::BindOnce( &FeaturePromoControllerCommon::OnHelpBubbleDismissed, @@ -509,9 +515,6 @@ weak_ptr_factory_.GetWeakPtr(), base::Unretained(&feature), tutorial_id); buttons.push_back(std::move(tutorial_button)); - if (views::PlatformStyle::kIsOkButtonLeading) - std::swap(buttons[0], buttons[1]); - return buttons; } @@ -524,3 +527,5 @@ return std::make_unique<base::AutoReset<bool>>(&active_window_check_blocked_, true); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/feature_promo_controller.h b/components/user_education/common/feature_promo_controller.h similarity index 90% rename from chrome/browser/ui/user_education/feature_promo_controller.h rename to components/user_education/common/feature_promo_controller.h index 1ea03096..81a473e 100644 --- a/chrome/browser/ui/user_education/feature_promo_controller.h +++ b/components/user_education/common/feature_promo_controller.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_CONTROLLER_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_CONTROLLER_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_CONTROLLER_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_CONTROLLER_H_ #include <memory> #include <string> @@ -14,12 +14,12 @@ #include "base/callback_list.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/ui/user_education/feature_promo_registry.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" #include "components/feature_engagement/public/tracker.h" +#include "components/user_education/common/feature_promo_registry.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_identifier.h" namespace base { struct Feature; @@ -30,6 +30,12 @@ class TrackedElement; } // namespace ui +// Declaring these in the global namespace for testing purposes. +class BrowserFeaturePromoControllerTest; +class FeaturePromoSnoozeInteractiveTest; + +namespace user_education { + class FeaturePromoSnoozeService; class HelpBubbleFactoryRegistry; class TutorialService; @@ -213,8 +219,8 @@ [[nodiscard]] static TestLock BlockActiveWindowCheckForTesting(); protected: - friend class BrowserFeaturePromoControllerTest; - friend class FeaturePromoSnoozeInteractiveTest; + friend BrowserFeaturePromoControllerTest; + friend FeaturePromoSnoozeInteractiveTest; // For IPH not registered with |FeaturePromoRegistry|. Only use this // if it is infeasible to pre-register your IPH. @@ -246,9 +252,19 @@ // Get the accelerator provider to use to look up accelerators. virtual const ui::AcceleratorProvider* GetAcceleratorProvider() const = 0; - // These methods control how snooze buttons appear and function. - virtual std::u16string GetSnoozeButtonText() const = 0; - virtual std::u16string GetDismissButtonText() const = 0; + // Gets the alt text to use for body icons. + virtual std::u16string GetBodyIconAltText() const = 0; + + // Gets the feature associated with prompting the user how to navigate to help + // bubbles via the keyboard. It is its own promo, and will stop playing in + // most cases when the user has made use of it enough times. + // + // If null is returned, no attempt will be made to play a prompt. + virtual const base::Feature* GetScreenReaderPromptPromoFeature() const = 0; + + // This is the associated event with the promo feature above. The event is + // recorded only if and when the promo is actually played to the user. + virtual const char* GetScreenReaderPromptPromoEventName() const = 0; // Returns the special prompt to play with the initial bubble of a tutorial; // instead of the general navigation help prompt returned by @@ -366,4 +382,6 @@ static bool active_window_check_blocked_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_CONTROLLER_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_CONTROLLER_H_
diff --git a/chrome/browser/ui/user_education/feature_promo_registry.cc b/components/user_education/common/feature_promo_registry.cc similarity index 86% rename from chrome/browser/ui/user_education/feature_promo_registry.cc rename to components/user_education/common/feature_promo_registry.cc index ea3ddd3..b578d35 100644 --- a/chrome/browser/ui/user_education/feature_promo_registry.cc +++ b/components/user_education/common/feature_promo_registry.cc
@@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/feature_promo_registry.h" +#include "components/user_education/common/feature_promo_registry.h" #include "base/containers/contains.h" #include "base/feature_list.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" +#include "components/user_education/common/feature_promo_specification.h" + +namespace user_education { FeaturePromoRegistry::FeaturePromoRegistry() = default; FeaturePromoRegistry::~FeaturePromoRegistry() = default; @@ -34,3 +36,5 @@ void FeaturePromoRegistry::ClearFeaturesForTesting() { feature_promo_data_.clear(); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/feature_promo_registry.h b/components/user_education/common/feature_promo_registry.h similarity index 83% rename from chrome/browser/ui/user_education/feature_promo_registry.h rename to components/user_education/common/feature_promo_registry.h index 5899335..3e784d3 100644 --- a/chrome/browser/ui/user_education/feature_promo_registry.h +++ b/components/user_education/common/feature_promo_registry.h
@@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_REGISTRY_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_REGISTRY_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_REGISTRY_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_REGISTRY_H_ #include <map> -#include "chrome/browser/ui/user_education/feature_promo_specification.h" +#include "components/user_education/common/feature_promo_specification.h" namespace base { struct Feature; } +namespace user_education { + // Stores parameters for in-product help promos. For each registered // IPH, has the bubble parameters and a method for getting an anchor // view for a given BrowserView. Promos should be registered here when @@ -52,4 +54,6 @@ std::map<const base::Feature*, FeaturePromoSpecification> feature_promo_data_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_REGISTRY_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_REGISTRY_H_
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service.cc b/components/user_education/common/feature_promo_snooze_service.cc similarity index 96% rename from chrome/browser/ui/user_education/feature_promo_snooze_service.cc rename to components/user_education/common/feature_promo_snooze_service.cc index 735f25f3..de4632e 100644 --- a/chrome/browser/ui/user_education/feature_promo_snooze_service.cc +++ b/components/user_education/common/feature_promo_snooze_service.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/feature_promo_snooze_service.h" +#include "components/user_education/common/feature_promo_snooze_service.h" #include <ostream> @@ -15,6 +15,8 @@ #include "components/feature_engagement/public/feature_constants.h" #include "third_party/abseil-cpp/absl/types/optional.h" +namespace user_education { + namespace { constexpr base::FeatureParam<FeaturePromoSnoozeService::NonClickerPolicy>:: @@ -137,3 +139,5 @@ absl::optional<SnoozeData> snooze_data = ReadSnoozeData(iph_feature); return snooze_data ? snooze_data->snooze_count : 0; } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service.h b/components/user_education/common/feature_promo_snooze_service.h similarity index 89% rename from chrome/browser/ui/user_education/feature_promo_snooze_service.h rename to components/user_education/common/feature_promo_snooze_service.h index 3185c26b..20aa8bd 100644 --- a/chrome/browser/ui/user_education/feature_promo_snooze_service.h +++ b/components/user_education/common/feature_promo_snooze_service.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SNOOZE_SERVICE_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SNOOZE_SERVICE_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SNOOZE_SERVICE_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SNOOZE_SERVICE_H_ #include "base/time/time.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -12,6 +12,11 @@ struct Feature; } // namespace base +// Declare in the global namespace for test purposes. +class FeaturePromoSnoozeInteractiveTest; + +namespace user_education { + // This service manages snooze and dismiss of snoozable in-product help promo. // It is an abstract base class in order to support multiple frameworks/ // platforms and potentially to migrate the backing to the new snooze feature @@ -87,7 +92,9 @@ const SnoozeData& snooze_data) = 0; private: - friend class FeaturePromoSnoozeInteractiveTest; + friend FeaturePromoSnoozeInteractiveTest; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SNOOZE_SERVICE_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SNOOZE_SERVICE_H_
diff --git a/chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc b/components/user_education/common/feature_promo_snooze_service_unittest.cc similarity index 70% copy from chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc copy to components/user_education/common/feature_promo_snooze_service_unittest.cc index 8ca1f34..6e71d5aa 100644 --- a/chrome/browser/ui/user_education/feature_promo_snooze_service_unittest.cc +++ b/components/user_education/common/feature_promo_snooze_service_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/browser_feature_promo_snooze_service.h" +#include "components/user_education/common/feature_promo_snooze_service.h" #include <memory> @@ -11,41 +11,54 @@ #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/time/time.h" -#include "chrome/test/base/testing_profile.h" #include "components/feature_engagement/public/feature_constants.h" -#include "content/public/test/browser_task_environment.h" +#include "components/user_education/common/feature_promo_snooze_service.h" #include "testing/gtest/include/gtest/gtest.h" +namespace user_education { + namespace { base::Feature kTestIPHFeature{"TestIPHFeature", base::FEATURE_ENABLED_BY_DEFAULT}; base::Feature kTestIPHFeature2{"TestIPHFeature2", base::FEATURE_ENABLED_BY_DEFAULT}; +class TestFeaturePromoSnoozeService : public FeaturePromoSnoozeService { + public: + TestFeaturePromoSnoozeService() = default; + ~TestFeaturePromoSnoozeService() override = default; + + void Reset(const base::Feature& iph_feature) override { + snooze_data_.erase(&iph_feature); + } + + absl::optional<FeaturePromoSnoozeService::SnoozeData> ReadSnoozeData( + const base::Feature& iph_feature) override { + const auto it = snooze_data_.find(&iph_feature); + return it == snooze_data_.end() ? absl::nullopt + : absl::make_optional(it->second); + } + + void SaveSnoozeData(const base::Feature& iph_feature, + const SnoozeData& snooze_data) override { + snooze_data_[&iph_feature] = snooze_data; + } + + private: + std::map<const base::Feature*, SnoozeData> snooze_data_; +}; + } // namespace class FeaturePromoSnoozeServiceTest : public testing::Test { public: FeaturePromoSnoozeServiceTest() - : task_environment_{base::test::SingleThreadTaskEnvironment::TimeSource:: - MOCK_TIME}, - service_{&profile_} {} - - void SetNonClickerPolicy(base::test::ScopedFeatureList& feature_list, - FeaturePromoSnoozeService::NonClickerPolicy policy) { - std::map<std::string, std::string> parameters = { - {"x_iph_snooze_non_clicker_policy", - policy == FeaturePromoSnoozeService::NonClickerPolicy::kDismiss - ? "dismiss" - : "long_snooze"}}; - feature_list.InitAndEnableFeatureWithParameters(kTestIPHFeature, - parameters); - } + : task_environment_{ + base::test::SingleThreadTaskEnvironment::TimeSource::MOCK_TIME} {} protected: - content::BrowserTaskEnvironment task_environment_; - TestingProfile profile_; - BrowserFeaturePromoSnoozeService service_; + base::test::TaskEnvironment task_environment_; + TestFeaturePromoSnoozeService service_; }; TEST_F(FeaturePromoSnoozeServiceTest, AllowFirstTimeIPH) { @@ -103,3 +116,5 @@ task_environment_.FastForwardBy(base::Days(15)); EXPECT_FALSE(service_.IsBlocked(kTestIPHFeature)); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/feature_promo_specification.cc b/components/user_education/common/feature_promo_specification.cc similarity index 75% rename from chrome/browser/ui/user_education/feature_promo_specification.cc rename to components/user_education/common/feature_promo_specification.cc index da11825..a6bb186 100644 --- a/chrome/browser/ui/user_education/feature_promo_specification.cc +++ b/components/user_education/common/feature_promo_specification.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/feature_promo_specification.h" +#include "components/user_education/common/feature_promo_specification.h" #include <string> @@ -12,6 +12,8 @@ #include "ui/base/interaction/element_tracker.h" #include "ui/base/l10n/l10n_util.h" +namespace user_education { + FeaturePromoSpecification::AcceleratorInfo::AcceleratorInfo() = default; FeaturePromoSpecification::AcceleratorInfo::AcceleratorInfo( const AcceleratorInfo& other) = default; @@ -59,28 +61,17 @@ FeaturePromoSpecification::DemoPageInfo::~DemoPageInfo() = default; +FeaturePromoSpecification::DemoPageInfo& +FeaturePromoSpecification::DemoPageInfo::operator=(const DemoPageInfo& other) = + default; + // static constexpr HelpBubbleArrow FeaturePromoSpecification::kDefaultBubbleArrow; FeaturePromoSpecification::FeaturePromoSpecification() = default; FeaturePromoSpecification::FeaturePromoSpecification( - FeaturePromoSpecification&& other) - : feature_(std::exchange(other.feature_, nullptr)), - promo_type_(std::exchange(other.promo_type_, PromoType::kUnspecifiied)), - anchor_element_id_( - std::exchange(other.anchor_element_id_, ui::ElementIdentifier())), - anchor_element_filter_(std::move(other.anchor_element_filter_)), - bubble_body_string_id_(std::exchange(other.bubble_body_string_id_, 0)), - bubble_title_text_(std::move(other.bubble_title_text_)), - bubble_icon_(std::exchange(other.bubble_icon_, nullptr)), - bubble_arrow_(std::exchange(other.bubble_arrow_, kDefaultBubbleArrow)), - screen_reader_string_id_( - std::exchange(other.screen_reader_string_id_, 0)), - screen_reader_accelerator_( - std::exchange(other.screen_reader_accelerator_, AcceleratorInfo())), - demo_page_info_(std::exchange(other.demo_page_info_, DemoPageInfo())), - tutorial_id_(std::move(other.tutorial_id_)) {} + FeaturePromoSpecification&& other) = default; FeaturePromoSpecification::FeaturePromoSpecification( const base::Feature* feature, @@ -99,25 +90,7 @@ FeaturePromoSpecification::~FeaturePromoSpecification() = default; FeaturePromoSpecification& FeaturePromoSpecification::operator=( - FeaturePromoSpecification&& other) { - if (this != &other) { - feature_ = std::exchange(other.feature_, nullptr); - promo_type_ = std::exchange(other.promo_type_, PromoType::kUnspecifiied); - anchor_element_id_ = - std::exchange(other.anchor_element_id_, ui::ElementIdentifier()); - anchor_element_filter_ = std::move(other.anchor_element_filter_); - bubble_body_string_id_ = std::exchange(other.bubble_body_string_id_, 0); - bubble_title_text_ = std::move(other.bubble_title_text_); - bubble_icon_ = std::exchange(other.bubble_icon_, nullptr); - bubble_arrow_ = std::exchange(other.bubble_arrow_, kDefaultBubbleArrow); - screen_reader_string_id_ = std::exchange(other.screen_reader_string_id_, 0); - screen_reader_accelerator_ = - std::exchange(other.screen_reader_accelerator_, AcceleratorInfo()); - demo_page_info_ = std::exchange(other.demo_page_info_, DemoPageInfo()); - tutorial_id_ = std::move(other.tutorial_id_); - } - return *this; -} + FeaturePromoSpecification&& other) = default; // static FeaturePromoSpecification FeaturePromoSpecification::CreateForToastPromo( @@ -205,3 +178,5 @@ : element_tracker->GetFirstMatchingElement( anchor_element_id_, context); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/feature_promo_specification.h b/components/user_education/common/feature_promo_specification.h similarity index 94% rename from chrome/browser/ui/user_education/feature_promo_specification.h rename to components/user_education/common/feature_promo_specification.h index 1dc2a15..69792ce 100644 --- a/chrome/browser/ui/user_education/feature_promo_specification.h +++ b/components/user_education/common/feature_promo_specification.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SPECIFICATION_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SPECIFICATION_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SPECIFICATION_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SPECIFICATION_H_ #include <string> #include <vector> #include "base/callback_forward.h" #include "base/memory/raw_ptr.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_identifier.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/abseil-cpp/absl/types/variant.h" #include "ui/base/accelerators/accelerator.h" @@ -26,6 +26,8 @@ struct VectorIcon; } +namespace user_education { + // Specifies the parameters for a feature promo and its associated bubble. class FeaturePromoSpecification { public: @@ -95,6 +97,7 @@ base::DoNothing()); ~DemoPageInfo(); DemoPageInfo(const DemoPageInfo& other); + DemoPageInfo& operator=(const DemoPageInfo& other); }; FeaturePromoSpecification(); @@ -223,4 +226,6 @@ TutorialIdentifier tutorial_id_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_FEATURE_PROMO_SPECIFICATION_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_FEATURE_PROMO_SPECIFICATION_H_
diff --git a/chrome/browser/ui/user_education/help_bubble.cc b/components/user_education/common/help_bubble.cc similarity index 93% rename from chrome/browser/ui/user_education/help_bubble.cc rename to components/user_education/common/help_bubble.cc index a536425a..27a1fc0 100644 --- a/chrome/browser/ui/user_education/help_bubble.cc +++ b/components/user_education/common/help_bubble.cc
@@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/help_bubble.h" +#include "components/user_education/common/help_bubble.h" #include "base/auto_reset.h" #include "base/notreached.h" +namespace user_education { + HelpBubble::HelpBubble() : on_close_callbacks_(std::make_unique<CallbackList>()) {} @@ -62,3 +64,5 @@ if (temp) temp->Notify(this); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/help_bubble.h b/components/user_education/common/help_bubble.h similarity index 91% rename from chrome/browser/ui/user_education/help_bubble.h rename to components/user_education/common/help_bubble.h index 41c1bb7..d63e8d2c 100644 --- a/chrome/browser/ui/user_education/help_bubble.h +++ b/components/user_education/common/help_bubble.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_H_ #include "base/callback.h" #include "base/callback_list.h" @@ -12,6 +12,8 @@ #include "ui/base/interaction/framework_specific_implementation.h" #include "ui/gfx/geometry/rect.h" +namespace user_education { + // HelpBubble is an interface for the lifecycle of an IPH or tutorial bubble. // it is implemented by a framework's bubble. It is returned as the result of // HelpBubbleFactory's CreateBubble...() method. @@ -69,4 +71,6 @@ bool closing_ = false; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_H_
diff --git a/chrome/browser/ui/user_education/help_bubble_factory.h b/components/user_education/common/help_bubble_factory.h similarity index 83% rename from chrome/browser/ui/user_education/help_bubble_factory.h rename to components/user_education/common/help_bubble_factory.h index 60dcca1..430525a 100644 --- a/chrome/browser/ui/user_education/help_bubble_factory.h +++ b/components/user_education/common/help_bubble_factory.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_H_ #include <memory> @@ -14,6 +14,8 @@ class TrackedElement; } +namespace user_education { + class HelpBubble; struct HelpBubbleParams; @@ -36,4 +38,6 @@ HelpBubbleParams params) = 0; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_H_
diff --git a/chrome/browser/ui/user_education/help_bubble_factory_registry.cc b/components/user_education/common/help_bubble_factory_registry.cc similarity index 88% rename from chrome/browser/ui/user_education/help_bubble_factory_registry.cc rename to components/user_education/common/help_bubble_factory_registry.cc index cb2c52c..e3bc9ec 100644 --- a/chrome/browser/ui/user_education/help_bubble_factory_registry.cc +++ b/components/user_education/common/help_bubble_factory_registry.cc
@@ -2,19 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_factory_registry.h" #include <memory> #include "base/bind.h" #include "base/callback_list.h" #include "base/no_destructor.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_params.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" +namespace user_education { + HelpBubbleFactoryRegistry::HelpBubbleFactoryRegistry() = default; HelpBubbleFactoryRegistry::~HelpBubbleFactoryRegistry() { @@ -84,3 +86,5 @@ const auto result = help_bubbles_.erase(bubble); DCHECK(result); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/help_bubble_factory_registry.h b/components/user_education/common/help_bubble_factory_registry.h similarity index 88% rename from chrome/browser/ui/user_education/help_bubble_factory_registry.h rename to components/user_education/common/help_bubble_factory_registry.h index e8330d4..430411e 100644 --- a/chrome/browser/ui/user_education/help_bubble_factory_registry.h +++ b/components/user_education/common/help_bubble_factory_registry.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_REGISTRY_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_REGISTRY_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_REGISTRY_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_REGISTRY_H_ #include <map> #include <utility> @@ -11,13 +11,15 @@ #include "base/callback_forward.h" #include "base/callback_list.h" -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_params.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/framework_specific_implementation.h" +namespace user_education { + // HelpBubbleFactoryRegistry provides access to framework specific bubble // factory implementations. HelpBubbleFactoryRegistry is not a strict singleton // that instances can be created multiple times in a test environment. @@ -78,4 +80,6 @@ toggle_focus_callbacks_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_FACTORY_REGISTRY_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_FACTORY_REGISTRY_H_
diff --git a/chrome/browser/ui/user_education/help_bubble_factory_registry_unittest.cc b/components/user_education/common/help_bubble_factory_registry_unittest.cc similarity index 91% rename from chrome/browser/ui/user_education/help_bubble_factory_registry_unittest.cc rename to components/user_education/common/help_bubble_factory_registry_unittest.cc index 1efaa81e..275636d2 100644 --- a/chrome/browser/ui/user_education/help_bubble_factory_registry_unittest.cc +++ b/components/user_education/common/help_bubble_factory_registry_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_factory_registry.h" #include <memory> @@ -10,14 +10,16 @@ #include "base/callback_helpers.h" #include "base/memory/raw_ptr.h" #include "base/test/mock_callback.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/test_help_bubble.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/test/test_help_bubble.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_test_util.h" #include "ui/base/interaction/expect_call_in_scope.h" +namespace user_education { + namespace { // Placeholder ID and context for test elements. @@ -31,7 +33,7 @@ public: HelpBubbleFactoryRegistryTest() : test_element_(kTestElementIdentifier, kTestElementContext) { - help_bubble_factory_registry_.MaybeRegister<TestHelpBubbleFactory>(); + help_bubble_factory_registry_.MaybeRegister<test::TestHelpBubbleFactory>(); } ~HelpBubbleFactoryRegistryTest() override = default; @@ -121,7 +123,7 @@ params.timeout_callback = timeout_callback.Get(); auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, std::move(params)); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_CALL_IN_SCOPE(close_callback, Run, test_bubble->SimulateDismiss()); EXPECT_FALSE(bubble->is_open()); @@ -136,7 +138,7 @@ params.timeout_callback = timeout_callback.Get(); auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, std::move(params)); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_CALL_IN_SCOPE(timeout_callback, Run, test_bubble->SimulateTimeout()); EXPECT_FALSE(bubble->is_open()); @@ -163,7 +165,7 @@ params.buttons.push_back(std::move(button2_params)); auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, std::move(params)); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_CALL_IN_SCOPE(button_callback, Run, test_bubble->SimulateButtonPress(0)); @@ -189,7 +191,7 @@ params.buttons.push_back(std::move(button2_params)); auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, std::move(params)); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_CALL_IN_SCOPE(button2_callback, Run, test_bubble->SimulateButtonPress(1)); @@ -199,7 +201,7 @@ auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, GetBubbleParams()); ASSERT_TRUE(bubble); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_EQ(0, test_bubble->focus_count()); const bool result = help_bubble_factory_registry_.ToggleFocusForAccessibility( kTestElementContext); @@ -212,7 +214,7 @@ auto bubble = help_bubble_factory_registry_.CreateHelpBubble( &test_element_, GetBubbleParams()); ASSERT_TRUE(bubble); - auto* const test_bubble = static_cast<TestHelpBubble*>(bubble.get()); + auto* const test_bubble = static_cast<test::TestHelpBubble*>(bubble.get()); EXPECT_EQ(0, test_bubble->focus_count()); const bool result = help_bubble_factory_registry_.ToggleFocusForAccessibility( kTestElementContext2); @@ -243,3 +245,5 @@ bubble2->Close(); EXPECT_FALSE(help_bubble_factory_registry_.is_any_bubble_showing()); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/help_bubble_params.cc b/components/user_education/common/help_bubble_params.cc similarity index 84% rename from chrome/browser/ui/user_education/help_bubble_params.cc rename to components/user_education/common/help_bubble_params.cc index 798c384..833b9a5 100644 --- a/chrome/browser/ui/user_education/help_bubble_params.cc +++ b/components/user_education/common/help_bubble_params.cc
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble_params.h" + +namespace user_education { HelpBubbleButtonParams::HelpBubbleButtonParams() = default; HelpBubbleButtonParams::HelpBubbleButtonParams(HelpBubbleButtonParams&&) = @@ -15,3 +17,5 @@ HelpBubbleParams::HelpBubbleParams(HelpBubbleParams&&) = default; HelpBubbleParams::~HelpBubbleParams() = default; HelpBubbleParams& HelpBubbleParams::operator=(HelpBubbleParams&&) = default; + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/help_bubble_params.h b/components/user_education/common/help_bubble_params.h similarity index 86% rename from chrome/browser/ui/user_education/help_bubble_params.h rename to components/user_education/common/help_bubble_params.h index 6da1043..f7e03a9c 100644 --- a/chrome/browser/ui/user_education/help_bubble_params.h +++ b/components/user_education/common/help_bubble_params.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_PARAMS_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_PARAMS_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_PARAMS_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_PARAMS_H_ #include <string> #include <utility> @@ -16,6 +16,8 @@ #include "ui/base/interaction/element_tracker.h" #include "ui/gfx/vector_icon_types.h" +namespace user_education { + // Mirrors most values of views::BubbleBorder::Arrow. // All values except kNone show a visible arrow between the bubble and the // anchor element. @@ -56,6 +58,7 @@ std::u16string title_text; raw_ptr<const gfx::VectorIcon> body_icon = nullptr; + std::u16string body_icon_alt_text; std::u16string body_text; std::u16string screenreader_text; @@ -72,9 +75,12 @@ // If set to true, a close button will always be shown. bool force_close_button = false; + // Alt text to use for the close button. + std::u16string close_button_alt_text; + // Determines whether a progress indicator will be displayed; if set the // first value is current progress and the second is max progress. - absl::optional<std::pair<int, int>> tutorial_progress; + absl::optional<std::pair<int, int>> progress; // Sets the bubble timeout. If a timeout is not provided a default will // be used. If the timeout is 0, the bubble never times out. @@ -88,4 +94,6 @@ base::OnceClosure timeout_callback = base::DoNothing(); }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_HELP_BUBBLE_PARAMS_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_HELP_BUBBLE_PARAMS_H_
diff --git a/components/user_education/common/scoped_new_badge_tracker_base.cc b/components/user_education/common/scoped_new_badge_tracker_base.cc new file mode 100644 index 0000000..dc71054f --- /dev/null +++ b/components/user_education/common/scoped_new_badge_tracker_base.cc
@@ -0,0 +1,58 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/user_education/common/scoped_new_badge_tracker_base.h" + +#include "base/containers/contains.h" +#include "base/feature_list.h" +#include "components/feature_engagement/public/tracker.h" + +namespace user_education { + +ScopedNewBadgeTrackerBase::ScopedNewBadgeTrackerBase( + feature_engagement::Tracker* tracker) + : tracker_(tracker) {} + +// TODO(crbug.com/1258216): When we have the ability to do concurrent FE promos, +// dismiss all of the badge promos here instead of in TryShowNewBadge(). +ScopedNewBadgeTrackerBase::~ScopedNewBadgeTrackerBase() = default; + +bool ScopedNewBadgeTrackerBase::TryShowNewBadge( + const base::Feature& badge_feature, + const base::Feature* promoted_feature) { + // In the event of a submenu that the user could open multiple times while + // navigating the same top-level menu, and we don't want to count those as + // separate times the user sees the New Badge: + if (base::Contains(active_badge_features_, &badge_feature)) + return true; + + // If there is no tracker available or the feature being promoted is disabled, + // do not show the New Badge. + if (!tracker_) + return false; + if (promoted_feature && !base::FeatureList::IsEnabled(*promoted_feature)) + return false; + + const bool result = tracker_->ShouldTriggerHelpUI(badge_feature); + if (result) { + active_badge_features_.insert(&badge_feature); + // TODO(crbug.com/1258216): Immediately dismiss to work around an issue + // where the FE backend disallows concurrent promos; move the call to + // Dismiss() to the destructor when concurrency is added. + // + // Note that "Dismiss" in this case does not dismiss the UI. It's telling + // the FE backend that the promo is done so that other promos can run. A + // badge showing in a menu should not block e.g. other badges from + // displaying (never mind help bubbles). + tracker_->Dismissed(badge_feature); + } + return result; +} + +void ScopedNewBadgeTrackerBase::ActionPerformed(const char* event_name) { + if (tracker_) + tracker_->NotifyEvent(event_name); +} + +} // namespace user_education
diff --git a/components/user_education/common/scoped_new_badge_tracker_base.h b/components/user_education/common/scoped_new_badge_tracker_base.h new file mode 100644 index 0000000..16efd24 --- /dev/null +++ b/components/user_education/common/scoped_new_badge_tracker_base.h
@@ -0,0 +1,134 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_USER_EDUCATION_COMMON_SCOPED_NEW_BADGE_TRACKER_BASE_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_SCOPED_NEW_BADGE_TRACKER_BASE_H_ + +#include <set> + +#include "base/memory/raw_ptr.h" + +namespace base { +struct Feature; +} + +namespace feature_engagement { +class Tracker; +} + +namespace user_education { + +// Works with the Feature Engagement system to determine when/how many times a +// New Badge is displayed to the user. Wraps a feature_engagement::Tracker so +// the correct calls are made to the Feature Engagement backend. +// +// Derive a subclass for a more convenient constructor (e.g. one that takes a +// Browser or Profile rather than a raw feature_engagement::Tracker). +// +// The lifespan of a ScopedNewBadgeTracker should match the time the dialog or +// menu containing the New Badge is visible to the user. +// +// You may use a single tracker for New Badges on multiple features in the same +// menu or dialog, but make sure the feature flags and event names are distinct. +// +// Usage: +// +// * Menus +// +// Below is an example of using a ScopedNewBadgeTracker to add a New Badge to a +// menu where the object implementing ui::SimpleMenuModel::Delegate is created +// each time the menu is shown (e.g. AppMenuModel, TabContextMenuContents, +// etc.) The case where the delegate object is persistent will be discussed +// later. +// +// // In OnMenuWillShow(menu): +// menu->SetIsNewFeatureAt( +// menu->GetIndexOfCommandId(IDC_MY_FEATURE), +// new_badge_tracker_.TryShowNewBadge( +// feature_engagement::kIPHMyFeatureNewBadge, +// &ui_features::kMyFeature)); +// +// // In ExecuteCommand(): +// case IDC_MY_FEATURE: +// new_badge_tracker_.EventPerformed("my_feature_activated"); +// ... +// break; +// +// If the New Badge is in the top-level menu, you can move the call to +// SetIsNewFeatureAt() to immediately after the menu model is initialized +// (typically in the constructor or "Init" method) and you will not have to +// override OnMenuWillBeShown(). +// +// If you are handling multiple New Badges for different features, you will +// want to check the result of GetIndexOfCommand() to make sure the menu being +// shown is the one that contains the item receiving the new badge. +// +// If the ui::SimpleMenuModel::Delegate is a persistent object and is not +// created each time the menu is displayed, you will need to move the tracker +// down into the ui::SimpleMenuModel for your menu, and move your code from +// OnMenuWillShow() to MenuWillShow() and from ExecuteCommand() to +// ActivatedAt(int, int). Be sure to invoke base class behavior when overriding +// these methods! +// +// * Dialogs +// +// Add a ScopedNewBadgeTracker member variable to your DialogDelegateView. +// Dialogs are typically not re-usable; we create a new DialogDelegateView for +// each time we show them. If you are following this pattern, include this in +// your constructor or "Init" function after creating the NewBadgeLabel (but +// before showing the dialog): +// +// new_badge_label_->SetDisplayNewBadge( +// new_badge_tracker_.TryShowNewBadge( +// feature_engagement::kIPHMyFeatureNewBadge, +// &ui_features::kMyFeature)); +// +// Then in the callback for the button that activates the feature being +// promoted, call: +// +// new_badge_tracker_.EventPerformed("my_feature_activated"); +// +// If for some reason you are re-using a dialog delegate, you must dynamically +// create and destroy the tracker when the dialog is shown and hidden. +class ScopedNewBadgeTrackerBase { + public: + // Constructs a scoped tracker for browser with |profile|. + explicit ScopedNewBadgeTrackerBase(feature_engagement::Tracker* tracker); + + // This object should be destructed when the New Badge is going away, such as + // when a menu with a New Badge or a dialog with a NewBadgeLabel is closing. + // If TryShowNewBadge() returned true, the tracker will be informed that the + // promo has ended. + ~ScopedNewBadgeTrackerBase(); + + ScopedNewBadgeTrackerBase(const ScopedNewBadgeTrackerBase& other) = delete; + void operator=(const ScopedNewBadgeTrackerBase& other) = delete; + + // Returns whether the New Badge should be shown. + // + // |badge_feature| is the feature flag for the New Badge itself. + // + // |promoted_feature|, if specified, is the flag for the feature the New Badge + // is promoting. You generally want to specify this feature even if the two + // flags are controlled by the same Finch study, because the user could + // override one but not the other. This parameter is optional because a New + // Badge promo could be shown for a feature without a flag, or for a feature + // that has already rolled to 100% and whose flag has been removed. + bool TryShowNewBadge(const base::Feature& badge_feature, + const base::Feature* promoted_feature = nullptr); + + // Indicates that the user performed a promoted action. |action_event_name| + // should be the value referenced in the "event_used" parameter of your field + // trial configuration. + // Note: this is a wrapper around feature_engagement::Tracker::NotifyEvent(). + void ActionPerformed(const char* action_event_name); + + private: + const raw_ptr<feature_engagement::Tracker> tracker_; + std::set<const base::Feature*> active_badge_features_; +}; + +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_SCOPED_NEW_BADGE_TRACKER_BASE_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial.cc b/components/user_education/common/tutorial.cc similarity index 93% rename from chrome/browser/ui/user_education/tutorial/tutorial.cc rename to components/user_education/common/tutorial.cc index f78557e..4d36956 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial.cc +++ b/components/user_education/common/tutorial.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" +#include "components/user_education/common/tutorial.h" #include "base/bind.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" -#include "chrome/grit/generated_resources.h" +#include "components/strings/grit/components_strings.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_service.h" #include "components/vector_icons/vector_icons.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" @@ -21,6 +21,8 @@ #include "ui/base/interaction/interaction_sequence.h" #include "ui/base/l10n/l10n_util.h" +namespace user_education { + Tutorial::StepBuilder::StepBuilder() = default; Tutorial::StepBuilder::StepBuilder(const TutorialDescription::Step& step) : step_(step) {} @@ -197,7 +199,7 @@ HelpBubbleParams params; params.title_text = title_text_; params.body_text = body_text_; - params.tutorial_progress = progress_; + params.progress = progress_; params.arrow = arrow_; params.timeout = base::TimeDelta(); params.dismiss_callback = base::BindOnce( @@ -211,6 +213,8 @@ if (is_last_step_) { params.body_icon = &vector_icons::kCelebrationIcon; + params.body_icon_alt_text = + tutorial_service->GetBodyIconAltText(true); params.dismiss_callback = base::BindOnce( [](TutorialService* tutorial_service) { tutorial_service->CompleteTutorial(); @@ -241,6 +245,8 @@ base::Unretained(tutorial_service)); params.buttons.emplace_back(std::move(close_button)); } + params.close_button_alt_text = + l10n_util::GetStringUTF16(IDS_CLOSE_TUTORIAL); std::unique_ptr<HelpBubble> bubble = tutorial_service->bubble_factory_registry()->CreateHelpBubble( @@ -351,3 +357,5 @@ if (interaction_sequence_) interaction_sequence_.reset(); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial.h b/components/user_education/common/tutorial.h similarity index 92% rename from chrome/browser/ui/user_education/tutorial/tutorial.h rename to components/user_education/common/tutorial.h index 8402d3b..1cedf37e 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial.h +++ b/components/user_education/common/tutorial.h
@@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_H_ -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_description.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/interaction_sequence.h" +namespace user_education { + class TutorialService; // Tutorials are a user initiated IPH which spans 1 or more Interactions. @@ -147,4 +149,6 @@ std::unique_ptr<ui::InteractionSequence> interaction_sequence_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_description.cc b/components/user_education/common/tutorial_description.cc similarity index 93% rename from chrome/browser/ui/user_education/tutorial/tutorial_description.cc rename to components/user_education/common/tutorial_description.cc index 59e9c65e..62dd864 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_description.cc +++ b/components/user_education/common/tutorial_description.cc
@@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" +#include "components/user_education/common/tutorial_description.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/interaction_sequence.h" +namespace user_education { + TutorialDescription::TutorialDescription() = default; TutorialDescription::~TutorialDescription() = default; TutorialDescription::TutorialDescription(TutorialDescription&&) = default; @@ -54,3 +56,5 @@ return body_text_id && step_type != ui::InteractionSequence::StepType::kHidden; } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_description.h b/components/user_education/common/tutorial_description.h similarity index 95% rename from chrome/browser/ui/user_education/tutorial/tutorial_description.h rename to components/user_education/common/tutorial_description.h index 416ea2a..bbecc1aa 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_description.h +++ b/components/user_education/common/tutorial_description.h
@@ -2,19 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_DESCRIPTION_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_DESCRIPTION_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_DESCRIPTION_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_DESCRIPTION_H_ #include <string> #include <vector> #include "base/metrics/histogram_macros.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble_params.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/interaction_sequence.h" +namespace user_education { + // Holds the data required to properly store histograms for a given tutorial. // Abstract base class because best practice is to statically declare // histograms and so we need some compile-time polymorphism to actually @@ -190,4 +192,6 @@ bool can_be_restarted = false; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_DESCRIPTION_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_DESCRIPTION_H_
diff --git a/components/user_education/common/tutorial_identifier.h b/components/user_education/common/tutorial_identifier.h new file mode 100644 index 0000000..240baa46 --- /dev/null +++ b/components/user_education/common/tutorial_identifier.h
@@ -0,0 +1,15 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_IDENTIFIER_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_IDENTIFIER_H_ + +namespace user_education { + +// TutorialIdentifier is used as a handle for Tutorials. +using TutorialIdentifier = std::string; + +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_IDENTIFIER_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc b/components/user_education/common/tutorial_registry.cc similarity index 81% rename from chrome/browser/ui/user_education/tutorial/tutorial_registry.cc rename to components/user_education/common/tutorial_registry.cc index 26275ede7..dd38f13 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_registry.cc +++ b/components/user_education/common/tutorial_registry.cc
@@ -2,15 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" +#include "components/user_education/common/tutorial_registry.h" #include <memory> #include <vector> #include "base/containers/contains.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_identifier.h" + +namespace user_education { TutorialRegistry::TutorialRegistry() = default; TutorialRegistry::~TutorialRegistry() = default; @@ -46,3 +48,5 @@ void TutorialRegistry::RemoveTutorialForTesting(TutorialIdentifier id) { tutorial_registry_.erase(id); } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_registry.h b/components/user_education/common/tutorial_registry.h similarity index 78% rename from chrome/browser/ui/user_education/tutorial/tutorial_registry.h rename to components/user_education/common/tutorial_registry.h index d36c9d2..0e357a5 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_registry.h +++ b/components/user_education/common/tutorial_registry.h
@@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_REGISTRY_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_REGISTRY_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_REGISTRY_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_REGISTRY_H_ -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_identifier.h" + +namespace user_education { class Tutorial; @@ -44,4 +46,6 @@ std::map<TutorialIdentifier, TutorialDescription> tutorial_registry_; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_REGISTRY_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_REGISTRY_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_service.cc b/components/user_education/common/tutorial_service.cc similarity index 93% rename from chrome/browser/ui/user_education/tutorial/tutorial_service.cc rename to components/user_education/common/tutorial_service.cc index 3ecf527..4e82530 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_service.cc +++ b/components/user_education/common/tutorial_service.cc
@@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" +#include "components/user_education/common/tutorial_service.h" #include <memory> #include <vector> #include "base/auto_reset.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_identifier.h" +#include "components/user_education/common/tutorial_registry.h" + +namespace user_education { TutorialService::TutorialCreationParams::TutorialCreationParams( TutorialDescription* description, @@ -177,3 +179,5 @@ if (bubble == currently_displayed_bubble_.get()) ++toggle_focus_count_; } + +} // namespace user_education
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_service.h b/components/user_education/common/tutorial_service.h similarity index 86% rename from chrome/browser/ui/user_education/tutorial/tutorial_service.h rename to components/user_education/common/tutorial_service.h index 78c38dd..c5e6234b 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_service.h +++ b/components/user_education/common/tutorial_service.h
@@ -2,20 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_SERVICE_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_SERVICE_H_ +#ifndef COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_SERVICE_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_SERVICE_H_ #include <memory> +#include <string> #include "base/callback_forward.h" #include "base/callback_helpers.h" #include "base/callback_list.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" -#include "components/keyed_service/core/keyed_service.h" +#include "components/user_education/common/tutorial.h" +#include "components/user_education/common/tutorial_identifier.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_tracker.h" +// Declare in the global scope for testing purposes. +class TutorialInteractiveUitest; + +namespace user_education { + class HelpBubble; class HelpBubbleFactoryRegistry; class TutorialRegistry; @@ -23,11 +28,11 @@ // A profile based service which provides the current running tutorial. A // TutorialService should be constructed by a factory which fills in the correct // tutorials based on the platform the tutorial targets. -class TutorialService : public KeyedService { +class TutorialService { public: TutorialService(TutorialRegistry* tutorial_registry, HelpBubbleFactoryRegistry* help_bubble_factory_registry); - ~TutorialService() override; + virtual ~TutorialService(); using CompletedCallback = base::OnceClosure; using AbortedCallback = base::OnceClosure; @@ -65,9 +70,12 @@ // Calls the abort code for the running tutorial. void AbortTutorial(absl::optional<int> abort_step); + // Returns application-specific strings. + virtual std::u16string GetBodyIconAltText(bool is_last_step) const = 0; + private: friend class Tutorial; - friend class TutorialInteractiveUitest; + friend TutorialInteractiveUitest; // Struct used to reconstruct a tutorial from the params initially used to // create it. @@ -127,4 +135,6 @@ bool is_restarting_ = false; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TUTORIAL_TUTORIAL_SERVICE_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_TUTORIAL_SERVICE_H_
diff --git a/chrome/browser/ui/user_education/tutorial/tutorial_unittest.cc b/components/user_education/common/tutorial_unittest.cc similarity index 66% rename from chrome/browser/ui/user_education/tutorial/tutorial_unittest.cc rename to components/user_education/common/tutorial_unittest.cc index 65eca8f..9099c57a 100644 --- a/chrome/browser/ui/user_education/tutorial/tutorial_unittest.cc +++ b/components/user_education/common/tutorial_unittest.cc
@@ -2,19 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/tutorial/tutorial.h" +#include "components/user_education/common/tutorial.h" -#include "base/logging.h" +#include <string> + #include "base/test/bind.h" #include "base/test/mock_callback.h" -#include "chrome/browser/ui/user_education/help_bubble_factory_registry.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/user_education/test_help_bubble.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_description.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_identifier.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_registry.h" -#include "chrome/browser/ui/user_education/tutorial/tutorial_service.h" -#include "chrome/grit/generated_resources.h" +#include "components/strings/grit/components_strings.h" +#include "components/user_education/common/help_bubble_factory_registry.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/tutorial_description.h" +#include "components/user_education/common/tutorial_identifier.h" +#include "components/user_education/common/tutorial_registry.h" +#include "components/user_education/common/tutorial_service.h" +#include "components/user_education/test/test_help_bubble.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/base/interaction/element_identifier.h" @@ -24,7 +25,10 @@ #include "ui/base/interaction/interaction_sequence.h" #include "ui/base/l10n/l10n_util.h" +namespace user_education { + namespace { + DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kTestIdentifier1); DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kTestIdentifier2); DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kTestIdentifier3); @@ -34,36 +38,44 @@ const ui::ElementContext kTestContext1(1); +class TestTutorialService : public TutorialService { + public: + TestTutorialService(TutorialRegistry* tutorial_registry, + HelpBubbleFactoryRegistry* help_bubble_factory_registry) + : TutorialService(tutorial_registry, help_bubble_factory_registry) {} + ~TestTutorialService() override = default; + + std::u16string GetBodyIconAltText(bool is_last_step) const override { + return std::u16string(); + } +}; + std::unique_ptr<HelpBubbleFactoryRegistry> CreateTestTutorialBubbleFactoryRegistry() { - std::unique_ptr<HelpBubbleFactoryRegistry> bubble_factory_registry = - std::make_unique<HelpBubbleFactoryRegistry>(); - bubble_factory_registry->MaybeRegister<TestHelpBubbleFactory>(); + auto bubble_factory_registry = std::make_unique<HelpBubbleFactoryRegistry>(); + bubble_factory_registry->MaybeRegister<test::TestHelpBubbleFactory>(); return bubble_factory_registry; } void ClickDismissButton(HelpBubble* bubble) { - TestHelpBubble* help_bubble = static_cast<TestHelpBubble*>(bubble); + auto* const help_bubble = static_cast<test::TestHelpBubble*>(bubble); help_bubble->SimulateDismiss(); } void ClickCloseButton(HelpBubble* bubble) { - LOG(INFO) << "BUBBLE: " << bubble; - TestHelpBubble* help_bubble = static_cast<TestHelpBubble*>(bubble); + auto* const help_bubble = static_cast<test::TestHelpBubble*>(bubble); int button_index = help_bubble->GetIndexOfButtonWithText( l10n_util::GetStringUTF16(IDS_TUTORIAL_CLOSE_TUTORIAL)); - LOG(INFO) << "BUBBLE: " << button_index; - - EXPECT_TRUE(button_index != TestHelpBubble::kNoButtonWithTextIndex); + EXPECT_TRUE(button_index != test::TestHelpBubble::kNoButtonWithTextIndex); help_bubble->SimulateButtonPress(button_index); } void ClickRestartButton(HelpBubble* bubble) { - TestHelpBubble* help_bubble = static_cast<TestHelpBubble*>(bubble); + auto* const help_bubble = static_cast<test::TestHelpBubble*>(bubble); int button_index = help_bubble->GetIndexOfButtonWithText( l10n_util::GetStringUTF16(IDS_TUTORIAL_RESTART_TUTORIAL)); - EXPECT_TRUE(button_index != TestHelpBubble::kNoButtonWithTextIndex); + EXPECT_TRUE(button_index != test::TestHelpBubble::kNoButtonWithTextIndex); help_bubble->SimulateButtonPress(button_index); } @@ -76,7 +88,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); Tutorial::Builder builder; @@ -126,8 +138,7 @@ { TutorialDescription description; description.steps.emplace_back(TutorialDescription::Step( - 0, IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, kTestIdentifier1, + 0, IDS_OK, ui::InteractionSequence::StepType::kShown, kTestIdentifier1, std::string(), HelpBubbleArrow::kNone)); description.can_be_restarted = true; registry->AddTutorial(kTestTutorial1, std::move(description)); @@ -145,7 +156,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -153,11 +164,9 @@ // Build the tutorial Description TutorialDescription description; - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier1, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier1, "", HelpBubbleArrow::kNone)); registry.AddTutorial(kTestTutorial1, std::move(description)); service.StartTutorial(kTestTutorial1, element_1.context(), completed.Get()); @@ -173,7 +182,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -182,10 +191,8 @@ // Build the tutorial Description TutorialDescription description; description.steps.emplace_back(TutorialDescription::Step( - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kCustomEvent, kTestIdentifier1, "", - HelpBubbleArrow::kNone, kCustomEventType1)); + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kCustomEvent, + kTestIdentifier1, "", HelpBubbleArrow::kNone, kCustomEventType1)); registry.AddTutorial(kTestTutorial1, std::move(description)); service.StartTutorial(kTestTutorial1, element_1.context(), completed.Get()); @@ -203,7 +210,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -212,10 +219,9 @@ // Build the tutorial Description TutorialDescription description; description.steps.emplace_back(TutorialDescription::Step( - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, kTestIdentifier1, - std::string(), HelpBubbleArrow::kNone, ui::CustomElementEventType(), + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier1, std::string(), HelpBubbleArrow::kNone, + ui::CustomElementEventType(), /* must_remain_visible =*/true, /* transition_only_on_event =*/false, base::BindLambdaForTesting( @@ -224,10 +230,8 @@ return true; }))); description.steps.emplace_back(TutorialDescription::Step( - IDS_TUTORIAL_TAB_GROUP_SUCCESS_TITLE, - IDS_TUTORIAL_TAB_GROUP_SUCCESS_DESCRIPTION, - ui::InteractionSequence::StepType::kShown, ui::ElementIdentifier(), - kElementName, HelpBubbleArrow::kNone)); + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + ui::ElementIdentifier(), kElementName, HelpBubbleArrow::kNone)); registry.AddTutorial(kTestTutorial1, std::move(description)); service.StartTutorial(kTestTutorial1, element_1.context(), completed.Get()); @@ -242,7 +246,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -250,11 +254,9 @@ // Build the tutorial Description TutorialDescription description; - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier1, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier1, "", HelpBubbleArrow::kNone)); description.can_be_restarted = true; registry.AddTutorial(kTestTutorial1, std::move(description)); @@ -275,7 +277,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -286,21 +288,15 @@ // Build the tutorial Description TutorialDescription description; - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier1, "", HelpBubbleArrow::kNone)); - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier2, "", HelpBubbleArrow::kNone)); - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier3, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier1, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier2, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier3, "", HelpBubbleArrow::kNone)); description.can_be_restarted = true; registry.AddTutorial(kTestTutorial1, std::move(description)); @@ -328,7 +324,7 @@ const auto bubble_factory_registry = CreateTestTutorialBubbleFactoryRegistry(); TutorialRegistry registry; - TutorialService service(®istry, bubble_factory_registry.get()); + TestTutorialService service(®istry, bubble_factory_registry.get()); // build elements and keep them for triggering show/hide ui::test::TestElement element_1(kTestIdentifier1, kTestContext1); @@ -339,21 +335,15 @@ // Build the tutorial Description TutorialDescription description; - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier1, "", HelpBubbleArrow::kNone)); - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier2, "", HelpBubbleArrow::kNone)); - description.steps.emplace_back( - TutorialDescription::Step(IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - IDS_TUTORIAL_TAB_GROUP_ADD_TAB_TO_GROUP, - ui::InteractionSequence::StepType::kShown, - kTestIdentifier3, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier1, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier2, "", HelpBubbleArrow::kNone)); + description.steps.emplace_back(TutorialDescription::Step( + IDS_OK, IDS_OK, ui::InteractionSequence::StepType::kShown, + kTestIdentifier3, "", HelpBubbleArrow::kNone)); description.can_be_restarted = true; registry.AddTutorial(kTestTutorial1, std::move(description)); @@ -371,3 +361,5 @@ EXPECT_CALL_IN_SCOPE( completed, Run, ClickDismissButton(service.currently_displayed_bubble())); } + +} // namespace user_education
diff --git a/chrome/browser/ui/views/chrome_view_class_properties.cc b/components/user_education/common/user_education_class_properties.cc similarity index 62% rename from chrome/browser/ui/views/chrome_view_class_properties.cc rename to components/user_education/common/user_education_class_properties.cc index 3099bc14..3874871c 100644 --- a/chrome/browser/ui/views/chrome_view_class_properties.cc +++ b/components/user_education/common/user_education_class_properties.cc
@@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/chrome_view_class_properties.h" +#include "components/user_education/common/user_education_class_properties.h" + +namespace user_education { DEFINE_UI_CLASS_PROPERTY_KEY(bool, kHasInProductHelpPromoKey, false) + +} // namespace user_education
diff --git a/components/user_education/common/user_education_class_properties.h b/components/user_education/common/user_education_class_properties.h new file mode 100644 index 0000000..e02f99b --- /dev/null +++ b/components/user_education/common/user_education_class_properties.h
@@ -0,0 +1,22 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_USER_EDUCATION_COMMON_USER_EDUCATION_CLASS_PROPERTIES_H_ +#define COMPONENTS_USER_EDUCATION_COMMON_USER_EDUCATION_CLASS_PROPERTIES_H_ + +#include "ui/base/class_property.h" + +namespace user_education { + +// Set to true for a UI elements that support ui::PropertyHandler if a help +// bubble is showing for that element. The element can respond however is +// appropriate, e.g. with a highlight or a color change. +// +// Individual help bubble [factory] implementations should set this value, as +// not all UI elements implement ui::PropertyHandler. +extern const ui::ClassProperty<bool>* const kHasInProductHelpPromoKey; + +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_COMMON_USER_EDUCATION_CLASS_PROPERTIES_H_
diff --git a/components/user_education/test/BUILD.gn b/components/user_education/test/BUILD.gn new file mode 100644 index 0000000..c41a9476 --- /dev/null +++ b/components/user_education/test/BUILD.gn
@@ -0,0 +1,28 @@ +# 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. + +import("//build/buildflag_header.gni") +import("//build/config/ui.gni") + +source_set("test") { + testonly = true + + sources = [ + "mock_feature_promo_controller.cc", + "mock_feature_promo_controller.h", + "test_help_bubble.cc", + "test_help_bubble.h", + ] + + deps = [ + "//base", + "//components/feature_engagement/public", + "//components/user_education/common", + "//skia", + "//testing/gmock", + "//third_party/abseil-cpp:absl", + "//ui/base", + "//ui/base:test_support", + ] +}
diff --git a/chrome/browser/ui/user_education/mock_feature_promo_controller.cc b/components/user_education/test/mock_feature_promo_controller.cc similarity index 74% rename from chrome/browser/ui/user_education/mock_feature_promo_controller.cc rename to components/user_education/test/mock_feature_promo_controller.cc index 373748b..e13707f 100644 --- a/chrome/browser/ui/user_education/mock_feature_promo_controller.cc +++ b/components/user_education/test/mock_feature_promo_controller.cc
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/mock_feature_promo_controller.h" +#include "components/user_education/test/mock_feature_promo_controller.h" + +namespace user_education::test { MockFeaturePromoController::MockFeaturePromoController() = default; MockFeaturePromoController::~MockFeaturePromoController() = default; @@ -11,3 +13,5 @@ MockFeaturePromoController::GetAsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } + +} // namespace user_education::test
diff --git a/chrome/browser/ui/user_education/mock_feature_promo_controller.h b/components/user_education/test/mock_feature_promo_controller.h similarity index 78% rename from chrome/browser/ui/user_education/mock_feature_promo_controller.h rename to components/user_education/test/mock_feature_promo_controller.h index c4a44b07..e21915f55 100644 --- a/chrome/browser/ui/user_education/mock_feature_promo_controller.h +++ b/components/user_education/test/mock_feature_promo_controller.h
@@ -2,15 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_MOCK_FEATURE_PROMO_CONTROLLER_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_MOCK_FEATURE_PROMO_CONTROLLER_H_ +#ifndef COMPONENTS_USER_EDUCATION_TEST_MOCK_FEATURE_PROMO_CONTROLLER_H_ +#define COMPONENTS_USER_EDUCATION_TEST_MOCK_FEATURE_PROMO_CONTROLLER_H_ #include "base/feature_list.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/ui/user_education/feature_promo_controller.h" -#include "chrome/browser/ui/user_education/feature_promo_specification.h" +#include "components/user_education/common/feature_promo_controller.h" +#include "components/user_education/common/feature_promo_specification.h" #include "testing/gmock/include/gmock/gmock.h" +namespace user_education::test { + class MockFeaturePromoController : public FeaturePromoController { public: MockFeaturePromoController(); @@ -49,4 +51,6 @@ base::WeakPtrFactory<MockFeaturePromoController> weak_ptr_factory_{this}; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_MOCK_FEATURE_PROMO_CONTROLLER_H_ +} // namespace user_education::test + +#endif // COMPONENTS_USER_EDUCATION_TEST_MOCK_FEATURE_PROMO_CONTROLLER_H_
diff --git a/chrome/browser/ui/user_education/test_help_bubble.cc b/components/user_education/test/test_help_bubble.cc similarity index 94% rename from chrome/browser/ui/user_education/test_help_bubble.cc rename to components/user_education/test/test_help_bubble.cc index 53d6c1f..53d94a0 100644 --- a/chrome/browser/ui/user_education/test_help_bubble.cc +++ b/components/user_education/test/test_help_bubble.cc
@@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/user_education/test_help_bubble.h" +#include "components/user_education/test/test_help_bubble.h" #include "base/memory/weak_ptr.h" #include "ui/base/interaction/element_test_util.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/framework_specific_implementation.h" +namespace user_education::test { + DEFINE_FRAMEWORK_SPECIFIC_METADATA(TestHelpBubble) DEFINE_FRAMEWORK_SPECIFIC_METADATA(TestHelpBubbleFactory) @@ -85,3 +87,5 @@ const ui::TrackedElement* element) const { return element->IsA<ui::test::TestElement>(); } + +} // namespace user_education::test
diff --git a/chrome/browser/ui/user_education/test_help_bubble.h b/components/user_education/test/test_help_bubble.h similarity index 80% rename from chrome/browser/ui/user_education/test_help_bubble.h rename to components/user_education/test/test_help_bubble.h index 190ecf4a..a65e089 100644 --- a/chrome/browser/ui/user_education/test_help_bubble.h +++ b/components/user_education/test/test_help_bubble.h
@@ -2,21 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_USER_EDUCATION_TEST_HELP_BUBBLE_H_ -#define CHROME_BROWSER_UI_USER_EDUCATION_TEST_HELP_BUBBLE_H_ +#ifndef COMPONENTS_USER_EDUCATION_TEST_TEST_HELP_BUBBLE_H_ +#define COMPONENTS_USER_EDUCATION_TEST_TEST_HELP_BUBBLE_H_ #include <memory> #include "base/auto_reset.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_params.h" #include "ui/base/interaction/element_identifier.h" namespace ui { class TrackedElement; } +namespace user_education::test { + class TestHelpBubble : public HelpBubble { public: static constexpr int kNoButtonWithTextIndex = -1; @@ -70,4 +72,6 @@ HelpBubbleParams params) override; }; -#endif // CHROME_BROWSER_UI_USER_EDUCATION_TEST_HELP_BUBBLE_H_ +} // namespace user_education::test + +#endif // COMPONENTS_USER_EDUCATION_TEST_TEST_HELP_BUBBLE_H_
diff --git a/components/user_education/views/BUILD.gn b/components/user_education/views/BUILD.gn new file mode 100644 index 0000000..74532a2e --- /dev/null +++ b/components/user_education/views/BUILD.gn
@@ -0,0 +1,72 @@ +# 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. + +import("//build/buildflag_header.gni") +import("//build/config/ui.gni") + +source_set("views") { + sources = [ + "help_bubble_delegate.h", + "help_bubble_factory_views.cc", + "help_bubble_factory_views.h", + "help_bubble_view.cc", + "help_bubble_view.h", + "new_badge_label.cc", + "new_badge_label.h", + ] + + if (is_mac) { + sources += [ + "help_bubble_factory_mac.h", + "help_bubble_factory_mac.mm", + ] + } + + public_deps = [ "//components/user_education/common" ] + + deps = [ + "//base", + "//components/strings", + "//components/variations", + "//components/vector_icons", + "//skia", + "//third_party/abseil-cpp:absl", + "//ui/accessibility", + "//ui/base", + "//ui/color", + "//ui/gfx", + "//ui/views", + ] +} + +source_set("unit_tests") { + testonly = true + + sources = [ + "help_bubble_view_unittest.cc", + "new_badge_label_unittest.cc", + ] + + deps = [ + ":views", + "//base", + "//base/test:test_support", + "//components/feature_engagement/public", + "//components/strings", + "//components/user_education/common", + "//components/user_education/test", + "//components/variations", + "//skia", + "//testing/gmock", + "//testing/gtest", + "//third_party/abseil-cpp:absl", + "//ui/accessibility", + "//ui/base", + "//ui/base:test_support", + "//ui/color", + "//ui/gfx", + "//ui/views", + "//ui/views:test_support", + ] +}
diff --git a/components/user_education/views/DEPS b/components/user_education/views/DEPS new file mode 100644 index 0000000..53a99db --- /dev/null +++ b/components/user_education/views/DEPS
@@ -0,0 +1,4 @@ +include_rules = [ + "+ui/views", + "+components/variations", +]
diff --git a/components/user_education/views/help_bubble_delegate.h b/components/user_education/views/help_bubble_delegate.h new file mode 100644 index 0000000..abe4dd7 --- /dev/null +++ b/components/user_education/views/help_bubble_delegate.h
@@ -0,0 +1,54 @@ +// 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. + +#ifndef COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_DELEGATE_H_ +#define COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_DELEGATE_H_ + +#include <vector> + +#include "ui/base/accelerators/accelerator.h" +#include "ui/color/color_id.h" + +namespace ui { +class TrackedElement; +} + +namespace user_education { + +// Provides access to app-specific strings, styles, and navigation accelerators +// so we can properly handle them. +class HelpBubbleDelegate { + public: + HelpBubbleDelegate() = default; + HelpBubbleDelegate(const HelpBubbleDelegate&) = delete; + void operator=(const HelpBubbleDelegate&) = delete; + virtual ~HelpBubbleDelegate() = default; + + // Gets a list of accelerators that can be used to navigate panes, which + // should trigger HelpBubble::ToggleFocusForAccessibility(). We need this + // because we do not by default have access to the current app's + // accelerator provider nor to the specific command IDs. + virtual std::vector<ui::Accelerator> GetPaneNavigationAccelerators( + ui::TrackedElement* anchor_element) const = 0; + + // These methods return text contexts that will be handled by the app's + // typography system. + virtual int GetTitleTextContext() const = 0; + virtual int GetBodyTextContext() const = 0; + virtual int GetButtonTextContext() const = 0; + + // These methods return color codes that will be handled by the app's theming + // system. + virtual int GetHelpBubbleBackgroundColor() const = 0; + virtual int GetHelpBubbleForegroundColor() const = 0; + virtual int GetHelpBubbleDefaultButtonBackgroundColor() const = 0; + virtual int GetHelpBubbleDefaultButtonForegroundColor() const = 0; + virtual int GetHelpBubbleButtonBorderColor() const = 0; + virtual int GetHelpBubbleCloseButtonInkDropColor() const = 0; + virtual ui::ColorId GetHelpBubbleBackgroundColorId() const = 0; +}; + +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_DELEGATE_H_ \ No newline at end of file
diff --git a/components/user_education/views/help_bubble_factory_mac.h b/components/user_education/views/help_bubble_factory_mac.h new file mode 100644 index 0000000..8213549e --- /dev/null +++ b/components/user_education/views/help_bubble_factory_mac.h
@@ -0,0 +1,35 @@ +// 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. + +#ifndef COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_MAC_H_ +#define COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_MAC_H_ + +#include "base/memory/raw_ptr.h" +#include "components/user_education/common/help_bubble_factory.h" + +namespace user_education { + +class HelpBubbleDelegate; + +// Factory implementation for HelpBubbleViews. +class HelpBubbleFactoryMac : public HelpBubbleFactory { + public: + explicit HelpBubbleFactoryMac(const HelpBubbleDelegate* delegate); + ~HelpBubbleFactoryMac() override; + + DECLARE_FRAMEWORK_SPECIFIC_METADATA() + + // HelpBubbleFactory: + std::unique_ptr<HelpBubble> CreateBubble(ui::TrackedElement* element, + HelpBubbleParams params) override; + bool CanBuildBubbleForTrackedElement( + const ui::TrackedElement* element) const override; + + private: + base::raw_ptr<const HelpBubbleDelegate> delegate_; +}; + +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_MAC_H_
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_mac.mm b/components/user_education/views/help_bubble_factory_mac.mm similarity index 68% rename from chrome/browser/ui/views/user_education/help_bubble_factory_mac.mm rename to components/user_education/views/help_bubble_factory_mac.mm index 22964b9..fd1e4f8 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_mac.mm +++ b/components/user_education/views/help_bubble_factory_mac.mm
@@ -2,20 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/user_education/help_bubble_factory_mac.h" +#include "components/user_education/views/help_bubble_factory_mac.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_delegate.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_view.h" #include "ui/base/interaction/element_tracker_mac.h" #include "ui/base/interaction/framework_specific_implementation.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/interaction/element_tracker_views.h" #include "ui/views/widget/widget.h" +namespace user_education { + DEFINE_FRAMEWORK_SPECIFIC_METADATA(HelpBubbleFactoryMac) -HelpBubbleFactoryMac::HelpBubbleFactoryMac() = default; +HelpBubbleFactoryMac::HelpBubbleFactoryMac(const HelpBubbleDelegate* delegate) + : delegate_(delegate) {} HelpBubbleFactoryMac::~HelpBubbleFactoryMac() = default; std::unique_ptr<HelpBubble> HelpBubbleFactoryMac::CreateBubble( @@ -33,11 +37,13 @@ constexpr auto kMacMenuInsets = gfx::Insets::VH(10, -5); anchor_rect.Inset(kMacMenuInsets); - return base::WrapUnique(new HelpBubbleViews( - new HelpBubbleView(anchor_view, std::move(params), anchor_rect))); + return base::WrapUnique(new HelpBubbleViews(new HelpBubbleView( + delegate_, anchor_view, std::move(params), anchor_rect))); } bool HelpBubbleFactoryMac::CanBuildBubbleForTrackedElement( const ui::TrackedElement* element) const { return element->IsA<ui::TrackedElementMac>(); } + +} // namespace user_education
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_views.cc b/components/user_education/views/help_bubble_factory_views.cc similarity index 87% rename from chrome/browser/ui/views/user_education/help_bubble_factory_views.cc rename to components/user_education/views/help_bubble_factory_views.cc index 1650fef..3adbe55e 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_views.cc +++ b/components/user_education/views/help_bubble_factory_views.cc
@@ -2,18 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/user_education/help_bubble_factory_views.h" +#include "components/user_education/views/help_bubble_factory_views.h" #include <memory> #include "base/logging.h" #include "base/memory/ptr_util.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser_finder.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/views/chrome_view_class_properties.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/common/user_education_class_properties.h" +#include "components/user_education/views/help_bubble_delegate.h" +#include "components/user_education/views/help_bubble_view.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" @@ -22,6 +20,8 @@ #include "ui/views/interaction/element_tracker_views.h" #include "ui/views/view_utils.h" +namespace user_education { + DEFINE_FRAMEWORK_SPECIFIC_METADATA(HelpBubbleViews) DEFINE_FRAMEWORK_SPECIFIC_METADATA(HelpBubbleFactoryViews) @@ -148,9 +148,9 @@ } HelpBubbleFactoryViews::HelpBubbleFactoryViews( - HelpBubbleAcceleratorDelegate* accelerator_delegate) - : accelerator_delegate_(accelerator_delegate) { - DCHECK(accelerator_delegate_); + const HelpBubbleDelegate* delegate) + : delegate_(delegate) { + DCHECK(delegate_); } HelpBubbleFactoryViews::~HelpBubbleFactoryViews() = default; @@ -161,10 +161,10 @@ views::View* const anchor_view = element->AsA<views::TrackedElementViews>()->view(); anchor_view->SetProperty(kHasInProductHelpPromoKey, true); - auto result = base::WrapUnique( - new HelpBubbleViews(new HelpBubbleView(anchor_view, std::move(params)))); + auto result = base::WrapUnique(new HelpBubbleViews( + new HelpBubbleView(delegate_, anchor_view, std::move(params)))); for (const auto& accelerator : - accelerator_delegate_->GetPaneNavigationAccelerators(element)) { + delegate_->GetPaneNavigationAccelerators(element)) { result->bubble_view()->GetFocusManager()->RegisterAccelerator( accelerator, ui::AcceleratorManager::HandlerPriority::kNormalPriority, result.get()); @@ -176,3 +176,5 @@ const ui::TrackedElement* element) const { return element->IsA<views::TrackedElementViews>(); } + +} // namespace user_education
diff --git a/chrome/browser/ui/views/user_education/help_bubble_factory_views.h b/components/user_education/views/help_bubble_factory_views.h similarity index 66% rename from chrome/browser/ui/views/user_education/help_bubble_factory_views.h rename to components/user_education/views/help_bubble_factory_views.h index 46485fe..bcc11be9 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_factory_views.h +++ b/components/user_education/views/help_bubble_factory_views.h
@@ -2,41 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_VIEWS_H_ -#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_VIEWS_H_ +#ifndef COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_VIEWS_H_ +#define COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_VIEWS_H_ #include "base/memory/raw_ptr.h" #include "base/scoped_observation.h" -#include "chrome/browser/ui/user_education/help_bubble.h" -#include "chrome/browser/ui/user_education/help_bubble_factory.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble.h" +#include "components/user_education/common/help_bubble_factory.h" +#include "components/user_education/common/help_bubble_params.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/interaction/element_tracker.h" #include "ui/base/interaction/framework_specific_implementation.h" +#include "ui/color/color_id.h" #include "ui/gfx/geometry/rect.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_observer.h" +namespace user_education { + class HelpBubbleView; - -// Provides access to pane navigation accelerators so we can properly handle -// them. -class HelpBubbleAcceleratorDelegate { - public: - HelpBubbleAcceleratorDelegate() = default; - HelpBubbleAcceleratorDelegate(const HelpBubbleAcceleratorDelegate&) = delete; - void operator=(const HelpBubbleAcceleratorDelegate&) = delete; - virtual ~HelpBubbleAcceleratorDelegate() = default; - - // Gets a list of accelerators that can be used to navigate panes, which - // should trigger HelpBubble::ToggleFocusForAccessibility(). We need this - // because we do not by default have access to the current app's - // accelerator provider nor to the specific command IDs. - virtual std::vector<ui::Accelerator> GetPaneNavigationAccelerators( - ui::TrackedElement* anchor_element) const = 0; -}; +class HelpBubbleDelegate; // Views-specific implementation of the help bubble. // @@ -89,8 +76,7 @@ // Factory implementation for HelpBubbleViews. class HelpBubbleFactoryViews : public HelpBubbleFactory { public: - explicit HelpBubbleFactoryViews( - HelpBubbleAcceleratorDelegate* accelerator_delegate); + explicit HelpBubbleFactoryViews(const HelpBubbleDelegate* delegate); ~HelpBubbleFactoryViews() override; DECLARE_FRAMEWORK_SPECIFIC_METADATA() @@ -102,7 +88,9 @@ const ui::TrackedElement* element) const override; private: - base::raw_ptr<HelpBubbleAcceleratorDelegate> accelerator_delegate_; + base::raw_ptr<const HelpBubbleDelegate> delegate_; }; -#endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_FACTORY_VIEWS_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_FACTORY_VIEWS_H_
diff --git a/chrome/browser/ui/views/user_education/help_bubble_view.cc b/components/user_education/views/help_bubble_view.cc similarity index 85% rename from chrome/browser/ui/views/user_education/help_bubble_view.cc rename to components/user_education/views/help_bubble_view.cc index 8970f56..ce457631 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_view.cc +++ b/components/user_education/views/help_bubble_view.cc
@@ -2,24 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/user_education/help_bubble_view.h" +#include "components/user_education/views/help_bubble_view.h" #include <initializer_list> #include <memory> #include <numeric> +#include <string> #include <utility> #include "base/bind.h" +#include "base/memory/raw_ptr.h" #include "base/metrics/user_metrics.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" -#include "chrome/browser/themes/theme_properties.h" -#include "chrome/browser/ui/color/chrome_color_id.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" -#include "chrome/browser/ui/views/chrome_layout_provider.h" -#include "chrome/browser/ui/views/chrome_typography.h" -#include "chrome/grit/generated_resources.h" #include "components/strings/grit/components_strings.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_delegate.h" +#include "components/user_education/views/help_bubble_factory_views.h" #include "components/variations/variations_associated_data.h" #include "components/vector_icons/vector_icons.h" #include "ui/base/interaction/element_identifier.h" @@ -65,6 +64,8 @@ #include "ui/views/view_tracker.h" #include "ui/views/view_utils.h" +namespace user_education { + namespace { // The amount of time the promo should stay onscreen. @@ -116,12 +117,12 @@ public: METADATA_HEADER(MdIPHBubbleButton); - MdIPHBubbleButton(PressedCallback callback, + MdIPHBubbleButton(const HelpBubbleDelegate* delegate, + PressedCallback callback, const std::u16string& text, bool is_default_button) - : MdTextButton(callback, - text, - ChromeTextContext::CONTEXT_IPH_BUBBLE_BUTTON), + : MdTextButton(callback, text, delegate->GetButtonTextContext()), + delegate_(delegate), is_default_button_(is_default_button) { // Prominent style gives a button hover highlight. SetProminent(true); @@ -139,21 +140,17 @@ if (!theme_provider) return; SkColor background_color = theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BACKGROUND); - if (is_default_button_) { - background_color = theme_provider->GetColor( - ThemeProperties:: - COLOR_FEATURE_PROMO_BUBBLE_DEFAULT_BUTTON_BACKGROUND); - } + is_default_button_ + ? delegate_->GetHelpBubbleDefaultButtonBackgroundColor() + : delegate_->GetHelpBubbleBackgroundColor()); if (GetState() == STATE_PRESSED) { background_color = GetNativeTheme()->GetSystemButtonPressedColor(background_color); } const SkColor stroke_color = theme_provider->GetColor( is_default_button_ - ? ThemeProperties:: - COLOR_FEATURE_PROMO_BUBBLE_DEFAULT_BUTTON_BACKGROUND - : ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BUTTON_BORDER); + ? delegate_->GetHelpBubbleDefaultButtonBackgroundColor() + : delegate_->GetHelpBubbleButtonBorderColor()); SetBackground(CreateBackgroundFromPainter( views::Painter::CreateRoundRectWith1PxBorderPainter( background_color, stroke_color, GetCornerRadius()))); @@ -163,15 +160,14 @@ views::MdTextButton::OnThemeChanged(); const auto* theme_provider = GetThemeProvider(); - const SkColor background_color = theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BACKGROUND); + const SkColor background_color = + theme_provider->GetColor(delegate_->GetHelpBubbleBackgroundColor()); views::FocusRing::Get(this)->SetColor(background_color); const SkColor foreground_color = theme_provider->GetColor( is_default_button_ - ? ThemeProperties:: - COLOR_FEATURE_PROMO_BUBBLE_DEFAULT_BUTTON_FOREGROUND - : ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND); + ? delegate_->GetHelpBubbleDefaultButtonForegroundColor() + : delegate_->GetHelpBubbleForegroundColor()); SetEnabledTextColors(foreground_color); // TODO(crbug/1112244): Temporary fix for Mac. Bubble shouldn't be in @@ -180,6 +176,7 @@ } private: + const base::raw_ptr<const HelpBubbleDelegate> delegate_; bool is_default_button_; }; @@ -192,13 +189,16 @@ class ClosePromoButton : public views::ImageButton { public: METADATA_HEADER(ClosePromoButton); - ClosePromoButton(int accessible_name_id, PressedCallback callback) { + ClosePromoButton(const HelpBubbleDelegate* delegate, + const std::u16string accessible_name, + PressedCallback callback) + : delegate_(delegate) { SetCallback(callback); views::ConfigureVectorImageButton(this); views::HighlightPathGenerator::Install( this, std::make_unique<views::CircleHighlightPathGenerator>(gfx::Insets())); - SetAccessibleName(l10n_util::GetStringUTF16(accessible_name_id)); + SetAccessibleName(accessible_name); } void OnThemeChanged() override { @@ -207,18 +207,21 @@ constexpr float kCloseButtonFocusRingHaloThickness = 1.25f; const auto* theme_provider = GetThemeProvider(); - SetImage(views::ImageButton::STATE_NORMAL, - gfx::CreateVectorIcon( - views::kIcCloseIcon, 16, - theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND))); + SetImage( + views::ImageButton::STATE_NORMAL, + gfx::CreateVectorIcon(views::kIcCloseIcon, 16, + theme_provider->GetColor( + delegate_->GetHelpBubbleForegroundColor()))); views::InkDrop::Get(this)->SetBaseColor(theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_CLOSE_BUTTON_INK_DROP)); - views::FocusRing::Get(this)->SetColor(theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND)); + delegate_->GetHelpBubbleCloseButtonInkDropColor())); + views::FocusRing::Get(this)->SetColor( + theme_provider->GetColor(delegate_->GetHelpBubbleForegroundColor())); views::FocusRing::Get(this)->SetHaloThickness( kCloseButtonFocusRingHaloThickness); } + + private: + const base::raw_ptr<const HelpBubbleDelegate> delegate_; }; BEGIN_METADATA(ClosePromoButton, views::ImageButton) @@ -227,8 +230,8 @@ class DotView : public views::View { public: METADATA_HEADER(DotView); - DotView(gfx::Size size, bool should_fill) - : size_(size), should_fill_(should_fill) { + DotView(const HelpBubbleDelegate* delegate, gfx::Size size, bool should_fill) + : delegate_(delegate), size_(size), should_fill_(should_fill) { // In order to anti-alias properly, we'll grow by the stroke width and then // have the excess space be subtracted from the margins by the layout. SetProperty(views::kInternalPaddingKey, gfx::Insets(kStrokeWidth)); @@ -250,8 +253,8 @@ const gfx::PointF center_point = local_bounds.CenterPoint(); const float radius = (size_.width() - kStrokeWidth) / 2.0f; - const SkColor color = GetThemeProvider()->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND); + const SkColor color = + GetThemeProvider()->GetColor(delegate_->GetHelpBubbleForegroundColor()); if (should_fill_) { cc::PaintFlags fill_flags; fill_flags.setStyle(cc::PaintFlags::kFill_Style); @@ -271,6 +274,7 @@ private: static constexpr int kStrokeWidth = 1; + base::raw_ptr<const HelpBubbleDelegate> delegate_; const gfx::Size size_; const bool should_fill_; }; @@ -288,12 +292,14 @@ // Explicitly don't use the default DIALOG_SHADOW as it will show a black // outline in dark mode on Mac. Use our own shadow instead. The shadow type is // the same for all other platforms. -HelpBubbleView::HelpBubbleView(views::View* anchor_view, +HelpBubbleView::HelpBubbleView(const HelpBubbleDelegate* delegate, + views::View* anchor_view, HelpBubbleParams params, absl::optional<gfx::Rect> anchor_rect) : BubbleDialogDelegateView(anchor_view, TranslateArrow(params.arrow), views::BubbleBorder::STANDARD_SHADOW), + delegate_(delegate), force_anchor_rect_(anchor_rect) { DCHECK(anchor_view) << "A bubble that closes on blur must be initially focused."; @@ -342,13 +348,13 @@ AddChildView(std::make_unique<views::View>()); // Add progress indicator (optional) and its container. - if (params.tutorial_progress) { - DCHECK(params.tutorial_progress->second); + if (params.progress) { + DCHECK(params.progress->second); // TODO(crbug.com/1197208): surface progress information in a11y tree - for (int i = 0; i < params.tutorial_progress->second; ++i) { + for (int i = 0; i < params.progress->second; ++i) { // TODO(crbug.com/1197208): formalize dot size progress_container->AddChildView(std::make_unique<DotView>( - gfx::Size(8, 8), i < params.tutorial_progress->first)); + delegate, gfx::Size(8, 8), i < params.progress->first)); } } else { progress_container->SetVisible(false); @@ -360,27 +366,27 @@ if (params.body_icon) { icon_view_ = top_text_container->AddChildViewAt( std::make_unique<views::ImageView>(ui::ImageModel::FromVectorIcon( - *params.body_icon, kColorFeaturePromoBubbleBackground, + *params.body_icon, delegate->GetHelpBubbleBackgroundColorId(), kBodyIconSize)), 0); icon_view_->SetPreferredSize( gfx::Size(kBodyIconBackgroundSize, kBodyIconBackgroundSize)); - icon_view_->SetAccessibleName(l10n_util::GetStringUTF16(IDS_CHROME_TIP)); + icon_view_->SetAccessibleName(params.body_icon_alt_text); } // Add title (optional) and body label. if (!params.title_text.empty()) { labels_.push_back( top_text_container->AddChildView(std::make_unique<views::Label>( - params.title_text, ChromeTextContext::CONTEXT_IPH_BUBBLE_TITLE))); + params.title_text, delegate->GetTitleTextContext()))); labels_.push_back( - AddChildViewAt(std::make_unique<views::Label>(params.body_text, - CONTEXT_IPH_BUBBLE_BODY), + AddChildViewAt(std::make_unique<views::Label>( + params.body_text, delegate->GetBodyTextContext()), GetIndexOf(button_container))); } else { labels_.push_back( top_text_container->AddChildView(std::make_unique<views::Label>( - params.body_text, CONTEXT_IPH_BUBBLE_BODY))); + params.body_text, delegate->GetBodyTextContext()))); } // Set common label properties. @@ -392,15 +398,20 @@ // Add close button (optional). if (params.buttons.empty() || params.force_close_button) { - int close_string_id = - params.tutorial_progress ? IDS_CLOSE_TUTORIAL : IDS_CLOSE_PROMO; + std::u16string alt_text = params.close_button_alt_text; + + // This can be empty if a test doesn't set it. Set a reasonable default to + // avoid an assertion (generated when a button with no text has no + // accessible name). + if (alt_text.empty()) + alt_text = l10n_util::GetStringUTF16(IDS_CLOSE); + // Since we set the cancel callback, we will use CancelDialog() to dismiss. - close_button_ = - (params.tutorial_progress ? progress_container : top_text_container) - ->AddChildView(std::make_unique<ClosePromoButton>( - close_string_id, - base::BindRepeating(&DialogDelegate::CancelDialog, - base::Unretained(this)))); + close_button_ = (params.progress ? progress_container : top_text_container) + ->AddChildView(std::make_unique<ClosePromoButton>( + delegate, alt_text, + base::BindRepeating(&DialogDelegate::CancelDialog, + base::Unretained(this)))); } // Add other buttons. @@ -423,6 +434,7 @@ std::unique_ptr<MdIPHBubbleButton> default_button; for (HelpBubbleButtonParams& button_params : params.buttons) { auto button = std::make_unique<MdIPHBubbleButton>( + delegate, base::BindRepeating(run_callback_and_close, base::Unretained(this), base::Passed(std::move(button_params.callback))), button_params.text, button_params.is_default); @@ -583,7 +595,7 @@ set_adjust_if_offscreen(true); auto* const frame_view = GetBubbleFrameView(); frame_view->SetCornerRadius( - ChromeLayoutProvider::Get()->GetCornerRadiusMetric( + views::LayoutProvider::Get()->GetCornerRadiusMetric( views::Emphasis::kHigh)); frame_view->SetDisplayVisibleArrow(!force_anchor_rect_.has_value() && params.arrow != HelpBubbleArrow::kNone); @@ -644,12 +656,12 @@ views::BubbleDialogDelegateView::OnThemeChanged(); const auto* theme_provider = GetThemeProvider(); - const SkColor background_color = theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_BACKGROUND); + const SkColor background_color = + theme_provider->GetColor(delegate_->GetHelpBubbleBackgroundColor()); set_color(background_color); - const SkColor foreground_color = theme_provider->GetColor( - ThemeProperties::COLOR_FEATURE_PROMO_BUBBLE_FOREGROUND); + const SkColor foreground_color = + theme_provider->GetColor(delegate_->GetHelpBubbleForegroundColor()); if (icon_view_) { icon_view_->SetBackground(views::CreateRoundedRectBackground( foreground_color, icon_view_->GetPreferredSize().height() / 2)); @@ -710,3 +722,5 @@ BEGIN_METADATA(HelpBubbleView, views::BubbleDialogDelegateView) END_METADATA + +} // namespace user_education
diff --git a/chrome/browser/ui/views/user_education/help_bubble_view.h b/components/user_education/views/help_bubble_view.h similarity index 86% rename from chrome/browser/ui/views/user_education/help_bubble_view.h rename to components/user_education/views/help_bubble_view.h index ee88e2ce..8199397 100644 --- a/chrome/browser/ui/views/user_education/help_bubble_view.h +++ b/components/user_education/views/help_bubble_view.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_VIEW_H_ -#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_VIEW_H_ +#ifndef COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_VIEW_H_ +#define COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_VIEW_H_ #include <cstddef> #include <memory> @@ -12,7 +12,7 @@ #include "base/memory/raw_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "chrome/browser/ui/user_education/help_bubble_params.h" +#include "components/user_education/common/help_bubble_params.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/interaction/element_identifier.h" #include "ui/base/metadata/metadata_header_macros.h" @@ -31,6 +31,10 @@ class MdTextButton; } // namespace views +namespace user_education { + +class HelpBubbleDelegate; + // The HelpBubbleView is a special BubbleDialogDelegateView for // in-product help which educates users about certain Chrome features in // a deferred context. @@ -39,7 +43,8 @@ METADATA_HEADER(HelpBubbleView); DECLARE_CLASS_ELEMENT_IDENTIFIER_VALUE(kHelpBubbleElementIdForTesting); - HelpBubbleView(views::View* anchor_view, + HelpBubbleView(const HelpBubbleDelegate* delegate, + views::View* anchor_view, HelpBubbleParams params, absl::optional<gfx::Rect> anchor_rect = absl::nullopt); HelpBubbleView(const HelpBubbleView&) = delete; @@ -54,14 +59,7 @@ views::LabelButton* GetDefaultButtonForTesting() const; views::LabelButton* GetNonDefaultButtonForTesting(int index) const; - private: - FRIEND_TEST_ALL_PREFIXES(HelpBubbleViewTest, - RespectsProvidedTimeoutAfterActivate); - - void MaybeStartAutoCloseTimer(); - - void OnTimeout(); - + protected: // BubbleDialogDelegateView: bool OnMousePressed(const ui::MouseEvent& event) override; std::u16string GetAccessibleWindowTitle() const override; @@ -73,6 +71,16 @@ gfx::Size CalculatePreferredSize() const override; gfx::Rect GetAnchorRect() const override; + private: + FRIEND_TEST_ALL_PREFIXES(HelpBubbleViewTimeoutTest, + RespectsProvidedTimeoutAfterActivate); + + void MaybeStartAutoCloseTimer(); + + void OnTimeout(); + + const base::raw_ptr<const HelpBubbleDelegate> delegate_; + // Forces the anchor rect to the specified rectangle (in screen coordinates). // If an artificial anchor rect is used, we assume the exact target cannot be // localized, and a visible arrow is not shown. @@ -108,4 +116,6 @@ base::OnceClosure timeout_callback_; }; -#endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_HELP_BUBBLE_VIEW_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_VIEWS_HELP_BUBBLE_VIEW_H_
diff --git a/components/user_education/views/help_bubble_view_unittest.cc b/components/user_education/views/help_bubble_view_unittest.cc new file mode 100644 index 0000000..12df66c --- /dev/null +++ b/components/user_education/views/help_bubble_view_unittest.cc
@@ -0,0 +1,206 @@ +// Copyright 2020 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/user_education/views/help_bubble_view.h" + +#include <memory> +#include <vector> + +#include "base/bind.h" +#include "base/callback_forward.h" +#include "base/callback_helpers.h" +#include "base/memory/raw_ptr.h" +#include "base/test/mock_callback.h" +#include "components/user_education/common/feature_promo_specification.h" +#include "components/user_education/common/help_bubble_params.h" +#include "components/user_education/views/help_bubble_delegate.h" +#include "components/user_education/views/help_bubble_factory_views.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "ui/base/accelerators/accelerator.h" +#include "ui/base/interaction/element_tracker.h" +#include "ui/base/interaction/expect_call_in_scope.h" +#include "ui/base/interaction/interaction_test_util.h" +#include "ui/base/theme_provider.h" +#include "ui/views/interaction/interaction_test_util_views.h" +#include "ui/views/test/views_test_base.h" +#include "ui/views/widget/widget.h" +#include "ui/views/widget/widget_observer.h" + +namespace user_education { + +namespace { + +// Fake delegate implementation that does not depend on the browser. +class TestDelegate : public HelpBubbleDelegate { + public: + TestDelegate() = default; + ~TestDelegate() override = default; + + std::vector<ui::Accelerator> GetPaneNavigationAccelerators( + ui::TrackedElement* anchor_element) const override { + return std::vector<ui::Accelerator>(); + } + + // These methods return text contexts that will be handled by the app's + // typography system. + int GetTitleTextContext() const override { return 0; } + int GetBodyTextContext() const override { return 0; } + int GetButtonTextContext() const override { return 0; } + + // These methods return color codes that will be handled by the app's theming + // system. + int GetHelpBubbleBackgroundColor() const override { return 0; } + int GetHelpBubbleForegroundColor() const override { return 0; } + int GetHelpBubbleDefaultButtonBackgroundColor() const override { return 0; } + int GetHelpBubbleDefaultButtonForegroundColor() const override { return 0; } + int GetHelpBubbleButtonBorderColor() const override { return 0; } + int GetHelpBubbleCloseButtonInkDropColor() const override { return 0; } + ui::ColorId GetHelpBubbleBackgroundColorId() const override { return 0; } +}; + +// Fake theme provider. There's a similar TestThemeProvider in chrome/test but +// we're avoiding using chrome-specific code here. +class TestThemeProvider : public ui::ThemeProvider { + public: + TestThemeProvider() = default; + ~TestThemeProvider() override = default; + + gfx::ImageSkia* GetImageSkiaNamed(int id) const override { return nullptr; } + SkColor GetColor(int id) const override { return SK_ColorRED; } + color_utils::HSL GetTint(int id) const override { return color_utils::HSL(); } + int GetDisplayProperty(int id) const override { return 0; } + bool ShouldUseNativeFrame() const override { return false; } + bool HasCustomImage(int id) const override { return false; } + base::RefCountedMemory* GetRawData( + int id, + ui::ResourceScaleFactor scale_factor) const override { + return nullptr; + } +}; + +// A top-level widget that reports a dummy theme provider. +class TestThemedWidget : public views::Widget { + public: + const ui::ThemeProvider* GetThemeProvider() const override { + return &test_theme_provider_; + } + + private: + TestThemeProvider test_theme_provider_; +}; + +} // namespace + +// Unit tests for HelpBubbleView. Timeout functionality isn't tested here due to +// the vagaries of trying to get simulated timed events to run without a full +// execution environment (specifically, Mac tests were extremely flaky without +// the browser). +// +// Timeouts are tested in: +// chrome/browser/ui/views/user_education/help_bubble_view_timeout_unittest.cc +class HelpBubbleViewTest : public views::ViewsTestBase { + public: + HelpBubbleViewTest() = default; + ~HelpBubbleViewTest() override = default; + + void SetUp() override { + ViewsTestBase::SetUp(); + widget_ = std::make_unique<TestThemedWidget>(); + widget_->Init(CreateParamsForTestWidget()); + view_ = widget_->SetContentsView(std::make_unique<views::View>()); + widget_->Show(); + } + + void TearDown() override { + widget_.reset(); + ViewsTestBase::TearDown(); + } + + protected: + HelpBubbleView* CreateHelpBubbleView(HelpBubbleParams params) { + return new HelpBubbleView(&test_delegate_, view_, std::move(params)); + } + + HelpBubbleView* CreateHelpBubbleView(base::RepeatingClosure button_callback) { + HelpBubbleParams params; + params.body_text = u"To X, do Y"; + params.arrow = HelpBubbleArrow::kTopRight; + + if (button_callback) { + HelpBubbleButtonParams button_params; + button_params.text = u"Go away"; + button_params.is_default = true; + button_params.callback = std::move(button_callback); + params.buttons.push_back(std::move(button_params)); + } + + return CreateHelpBubbleView(std::move(params)); + } + + TestDelegate test_delegate_; + base::raw_ptr<views::View> view_; + std::unique_ptr<views::Widget> widget_; +}; + +TEST_F(HelpBubbleViewTest, CallButtonCallback_Mouse) { + UNCALLED_MOCK_CALLBACK(base::RepeatingClosure, mock_callback); + + HelpBubbleView* const bubble = CreateHelpBubbleView(mock_callback.Get()); + + // Simulate clicks on dismiss button. + EXPECT_CALL_IN_SCOPE( + mock_callback, Run, + views::test::InteractionTestUtilSimulatorViews::PressButton( + bubble->GetDefaultButtonForTesting(), + ui::test::InteractionTestUtil::InputType::kMouse)); + + bubble->GetWidget()->Close(); +} + +TEST_F(HelpBubbleViewTest, CallButtonCallback_Keyboard) { + UNCALLED_MOCK_CALLBACK(base::RepeatingClosure, mock_callback); + + HelpBubbleView* const bubble = CreateHelpBubbleView(mock_callback.Get()); + + // Simulate clicks on dismiss button. + EXPECT_CALL_IN_SCOPE( + mock_callback, Run, + views::test::InteractionTestUtilSimulatorViews::PressButton( + bubble->GetDefaultButtonForTesting(), + ui::test::InteractionTestUtil::InputType::kKeyboard)); + + bubble->GetWidget()->Close(); +} + +TEST_F(HelpBubbleViewTest, StableButtonOrder) { + HelpBubbleParams params; + params.body_text = u"To X, do Y"; + params.arrow = HelpBubbleArrow::kTopRight; + + constexpr char16_t kButton1Text[] = u"button 1"; + constexpr char16_t kButton2Text[] = u"button 2"; + constexpr char16_t kButton3Text[] = u"button 3"; + + HelpBubbleButtonParams button1; + button1.text = kButton1Text; + button1.is_default = false; + params.buttons.push_back(std::move(button1)); + + HelpBubbleButtonParams button2; + button2.text = kButton2Text; + button2.is_default = true; + params.buttons.push_back(std::move(button2)); + + HelpBubbleButtonParams button3; + button3.text = kButton3Text; + button3.is_default = false; + params.buttons.push_back(std::move(button3)); + + auto* bubble = new HelpBubbleView(&test_delegate_, view_, std::move(params)); + EXPECT_EQ(kButton1Text, bubble->GetNonDefaultButtonForTesting(0)->GetText()); + EXPECT_EQ(kButton2Text, bubble->GetDefaultButtonForTesting()->GetText()); + EXPECT_EQ(kButton3Text, bubble->GetNonDefaultButtonForTesting(1)->GetText()); +} + +} // namespace user_education
diff --git a/chrome/browser/ui/views/user_education/new_badge_label.cc b/components/user_education/views/new_badge_label.cc similarity index 93% rename from chrome/browser/ui/views/user_education/new_badge_label.cc rename to components/user_education/views/new_badge_label.cc index 2935c0d..8b840a8 100644 --- a/chrome/browser/ui/views/user_education/new_badge_label.cc +++ b/components/user_education/views/new_badge_label.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/user_education/new_badge_label.h" +#include "components/user_education/views/new_badge_label.h" #include "ui/accessibility/ax_node_data.h" #include "ui/base/metadata/metadata_impl_macros.h" @@ -14,6 +14,8 @@ #include "ui/views/view_class_properties.h" #include "ui/views/widget/widget.h" +namespace user_education { + NewBadgeLabel::NewBadgeLabel(const std::u16string& text, int text_context, int text_style, @@ -162,14 +164,17 @@ NOTREACHED() << "Calling SetBorder() externally is currently not allowed."; } -DEFINE_ENUM_CONVERTERS(NewBadgeLabel::BadgePlacement, - {NewBadgeLabel::BadgePlacement::kImmediatelyAfterText, - u"kImmediatelyAfterText"}, - {NewBadgeLabel::BadgePlacement::kTrailingEdge, - u"kTrailingEdge"}) - BEGIN_METADATA(NewBadgeLabel, views::Label) ADD_PROPERTY_METADATA(bool, DisplayNewBadge) ADD_PROPERTY_METADATA(NewBadgeLabel::BadgePlacement, BadgePlacement) ADD_PROPERTY_METADATA(bool, PadAfterNewBadge) END_METADATA + +} // namespace user_education + +DEFINE_ENUM_CONVERTERS( + user_education::NewBadgeLabel::BadgePlacement, + {user_education::NewBadgeLabel::BadgePlacement::kImmediatelyAfterText, + u"kImmediatelyAfterText"}, + {user_education::NewBadgeLabel::BadgePlacement::kTrailingEdge, + u"kTrailingEdge"})
diff --git a/chrome/browser/ui/views/user_education/new_badge_label.h b/components/user_education/views/new_badge_label.h similarity index 93% rename from chrome/browser/ui/views/user_education/new_badge_label.h rename to components/user_education/views/new_badge_label.h index 6441eef1..98241c7 100644 --- a/chrome/browser/ui/views/user_education/new_badge_label.h +++ b/components/user_education/views/new_badge_label.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_NEW_BADGE_LABEL_H_ -#define CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_NEW_BADGE_LABEL_H_ +#ifndef COMPONENTS_USER_EDUCATION_VIEWS_NEW_BADGE_LABEL_H_ +#define COMPONENTS_USER_EDUCATION_VIEWS_NEW_BADGE_LABEL_H_ #include <memory> @@ -15,6 +15,8 @@ class Border; } +namespace user_education { + // Extends views::Label to optionally display a "New" badge next to the text, // drawing attention to a new feature in Chrome. // @@ -91,4 +93,6 @@ bool pad_after_new_badge_ = true; }; -#endif // CHROME_BROWSER_UI_VIEWS_USER_EDUCATION_NEW_BADGE_LABEL_H_ +} // namespace user_education + +#endif // COMPONENTS_USER_EDUCATION_VIEWS_NEW_BADGE_LABEL_H_
diff --git a/chrome/browser/ui/views/user_education/new_badge_label_unittest.cc b/components/user_education/views/new_badge_label_unittest.cc similarity index 97% rename from chrome/browser/ui/views/user_education/new_badge_label_unittest.cc rename to components/user_education/views/new_badge_label_unittest.cc index a2cda87..90e37992 100644 --- a/chrome/browser/ui/views/user_education/new_badge_label_unittest.cc +++ b/components/user_education/views/new_badge_label_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/views/user_education/new_badge_label.h" +#include "components/user_education/views/new_badge_label.h" #include "base/memory/raw_ptr.h" #include "base/strings/utf_string_conversions.h" @@ -14,6 +14,8 @@ #include "ui/views/test/views_test_base.h" #include "ui/views/view_class_properties.h" +namespace user_education { + class NewBadgeLabelTest : public views::ViewsTestBase { public: NewBadgeLabelTest() = default; @@ -137,3 +139,5 @@ EXPECT_LT(control_label()->GetPreferredSize().width(), new_badge_label()->GetPreferredSize().width()); } + +} // namespace user_education
diff --git a/components/user_education_strings.grdp b/components/user_education_strings.grdp new file mode 100644 index 0000000..99e0ba1 --- /dev/null +++ b/components/user_education_strings.grdp
@@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="utf-8"?> +<grit-part> + <message name="IDS_CLOSE_TUTORIAL" desc="Accessible name used by a screen reader for the tutorial bubble close button." is_accessibility_with_no_ui="true"> + Close tutorial + </message> + <message name="IDS_CLOSE_PROMO" desc="Accessible name used by a screen reader for the in-product-help bubble close button." is_accessibility_with_no_ui="true"> + Close help bubble + </message> + <if expr="use_titlecase"> + <message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message"> + Got It + </message> + <message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time"> + Remind Me Later + </message> + <message name="IDS_PROMO_SHOW_TUTORIAL_BUTTON" desc="Text shown on a promo bubble button for the user to initiate a tutorial after being asked if they want to learn more."> + Show Me How + </message> + </if> + <if expr="not use_titlecase"> + <message name="IDS_PROMO_DISMISS_BUTTON" desc="Text shown on the button for the user to acknowledge that they understand the message"> + Got it + </message> + <message name="IDS_PROMO_SNOOZE_BUTTON" desc="Text shown on the button to snooze a promotional UI, which indicates that users want to see this promotion at a later time"> + Remind me later + </message> + <message name="IDS_PROMO_SHOW_TUTORIAL_BUTTON" desc="Text shown on a promo bubble button for the user to initiate a tutorial after being asked if they want to learn more."> + Show me how + </message> + </if> + <!-- Strings associated with help bubbles, IPH, and other promos. --> + <message name="IDS_TUTORIAL_RESTART_TUTORIAL" desc="The text shown on the button for restarting a tutorial"> + Restart tutorial + </message> + <message name="IDS_TUTORIAL_CLOSE_TUTORIAL" desc="The text shown on the button for closing a tutorial"> + Close + </message> + +</grit-part>
diff --git a/chrome/app/generated_resources_grd/IDS_PROMO_DISMISS_BUTTON.png.sha1 b/components/user_education_strings_grdp/IDS_PROMO_DISMISS_BUTTON.png.sha1 similarity index 100% rename from chrome/app/generated_resources_grd/IDS_PROMO_DISMISS_BUTTON.png.sha1 rename to components/user_education_strings_grdp/IDS_PROMO_DISMISS_BUTTON.png.sha1
diff --git a/chrome/app/generated_resources_grd/IDS_PROMO_SHOW_TUTORIAL_BUTTON.png.sha1 b/components/user_education_strings_grdp/IDS_PROMO_SHOW_TUTORIAL_BUTTON.png.sha1 similarity index 100% rename from chrome/app/generated_resources_grd/IDS_PROMO_SHOW_TUTORIAL_BUTTON.png.sha1 rename to components/user_education_strings_grdp/IDS_PROMO_SHOW_TUTORIAL_BUTTON.png.sha1
diff --git a/chrome/app/generated_resources_grd/IDS_PROMO_SNOOZE_BUTTON.png.sha1 b/components/user_education_strings_grdp/IDS_PROMO_SNOOZE_BUTTON.png.sha1 similarity index 100% rename from chrome/app/generated_resources_grd/IDS_PROMO_SNOOZE_BUTTON.png.sha1 rename to components/user_education_strings_grdp/IDS_PROMO_SNOOZE_BUTTON.png.sha1
diff --git a/chrome/app/generated_resources_grd/IDS_TUTORIAL_CLOSE_TUTORIAL.png.sha1 b/components/user_education_strings_grdp/IDS_TUTORIAL_CLOSE_TUTORIAL.png.sha1 similarity index 100% rename from chrome/app/generated_resources_grd/IDS_TUTORIAL_CLOSE_TUTORIAL.png.sha1 rename to components/user_education_strings_grdp/IDS_TUTORIAL_CLOSE_TUTORIAL.png.sha1
diff --git a/chrome/app/generated_resources_grd/IDS_TUTORIAL_RESTART_TUTORIAL.png.sha1 b/components/user_education_strings_grdp/IDS_TUTORIAL_RESTART_TUTORIAL.png.sha1 similarity index 100% rename from chrome/app/generated_resources_grd/IDS_TUTORIAL_RESTART_TUTORIAL.png.sha1 rename to components/user_education_strings_grdp/IDS_TUTORIAL_RESTART_TUTORIAL.png.sha1
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn index 5a7778c..d27eadd 100644 --- a/content/browser/BUILD.gn +++ b/content/browser/BUILD.gn
@@ -2613,6 +2613,8 @@ deps += [ "//chromeos/crosapi/mojom", "//chromeos/lacros", + "//chromeos/startup", + "//chromeos/startup:constants", ] }
diff --git a/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc b/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc index f1e5a563c..a4c56ce 100644 --- a/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc +++ b/content/browser/bluetooth/web_bluetooth_service_impl_browsertest.cc
@@ -567,7 +567,7 @@ prerender_helper()->GetPrerenderedMainFrameHost(host_id); // Runs JS asynchronously since Mojo calls are deferred during prerendering. - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(prerendered_frame_host); content::ExecuteScriptAsync(prerendered_frame_host, R"( navigator.bluetooth.getAvailability() .then(isBluetoothAvailable => {
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index 41e226f..f38123d 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -217,19 +217,9 @@ std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, std::unique_ptr<base::CommandLine> cmd_line, bool terminate_on_shutdown) { - LaunchWithPreloadedFiles(std::move(delegate), std::move(cmd_line), - /*files_to_preload=*/{}, terminate_on_shutdown); -} - -void BrowserChildProcessHostImpl::LaunchWithPreloadedFiles( - std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, - std::unique_ptr<base::CommandLine> cmd_line, - std::map<std::string, base::FilePath> files_to_preload, - bool terminate_on_shutdown) { - GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line.get(), - data_.id); - LaunchWithoutExtraCommandLineSwitches( - std::move(delegate), std::move(cmd_line), std::move(files_to_preload), + LaunchWithFileData( + std::move(delegate), std::move(cmd_line), + /*file_data=*/std::make_unique<ChildProcessLauncherFileData>(), terminate_on_shutdown); } @@ -279,10 +269,22 @@ child_process_host_->AddFilter(filter->GetFilter()); } +void BrowserChildProcessHostImpl::LaunchWithFileData( + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, + std::unique_ptr<ChildProcessLauncherFileData> file_data, + bool terminate_on_shutdown) { + GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line.get(), + data_.id); + LaunchWithoutExtraCommandLineSwitches( + std::move(delegate), std::move(cmd_line), std::move(file_data), + terminate_on_shutdown); +} + void BrowserChildProcessHostImpl::LaunchWithoutExtraCommandLineSwitches( std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, std::unique_ptr<base::CommandLine> cmd_line, - std::map<std::string, base::FilePath> files_to_preload, + std::unique_ptr<ChildProcessLauncherFileData> file_data, bool terminate_on_shutdown) { DCHECK_CURRENTLY_ON(BrowserThread::UI); const base::CommandLine& browser_command_line = @@ -331,7 +333,7 @@ base::BindRepeating(&BrowserChildProcessHostImpl::OnMojoError, weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()), - std::move(files_to_preload), terminate_on_shutdown); + std::move(file_data), terminate_on_shutdown); ShareMetricsAllocatorToProcess(); if (!has_legacy_ipc_channel_)
diff --git a/content/browser/browser_child_process_host_impl.h b/content/browser/browser_child_process_host_impl.h index e505ea12..a95454c 100644 --- a/content/browser/browser_child_process_host_impl.h +++ b/content/browser/browser_child_process_host_impl.h
@@ -79,11 +79,6 @@ void Launch(std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, std::unique_ptr<base::CommandLine> cmd_line, bool terminate_on_shutdown) override; - void LaunchWithPreloadedFiles( - std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, - std::unique_ptr<base::CommandLine> cmd_line, - std::map<std::string, base::FilePath> files_to_preload, - bool terminate_on_shutdown) override; const ChildProcessData& GetData() override; ChildProcessHost* GetHost() override; ChildProcessTerminationInfo GetTerminationInfo(bool known_dead) override; @@ -113,6 +108,14 @@ // Adds an IPC message filter. void AddFilter(BrowserMessageFilter* filter); + // Same as Launch(), but the process is launched with preloaded files and file + // descriptors containing in `file_data`. + void LaunchWithFileData( + std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, + std::unique_ptr<base::CommandLine> cmd_line, + std::unique_ptr<ChildProcessLauncherFileData> file_data, + bool terminate_on_shutdown); + // Unlike Launch(), AppendExtraCommandLineSwitches will not be called // in this function. If AppendExtraCommandLineSwitches has been called before // reaching launch, call this function instead so the command line switches @@ -120,7 +123,7 @@ void LaunchWithoutExtraCommandLineSwitches( std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, std::unique_ptr<base::CommandLine> cmd_line, - std::map<std::string, base::FilePath> files_to_preload, + std::unique_ptr<ChildProcessLauncherFileData> file_data, bool terminate_on_shutdown); static void HistogramBadMessageTerminated(ProcessType process_type);
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc index c470160..6b09929 100644 --- a/content/browser/child_process_launcher.cc +++ b/content/browser/child_process_launcher.cc
@@ -52,6 +52,10 @@ #endif } +ChildProcessLauncherFileData::ChildProcessLauncherFileData() = default; + +ChildProcessLauncherFileData::~ChildProcessLauncherFileData() = default; + #if BUILDFLAG(IS_ANDROID) bool ChildProcessLauncher::Client::CanUseWarmUpConnection() { return true; @@ -65,7 +69,7 @@ Client* client, mojo::OutgoingInvitation mojo_invitation, const mojo::ProcessErrorCallback& process_error_callback, - std::map<std::string, base::FilePath> files_to_preload, + std::unique_ptr<ChildProcessLauncherFileData> file_data, bool terminate_on_shutdown) : client_(client), starting_(true), @@ -85,8 +89,7 @@ #if BUILDFLAG(IS_ANDROID) client_->CanUseWarmUpConnection(), #endif - std::move(mojo_invitation), process_error_callback, - std::move(files_to_preload)); + std::move(mojo_invitation), process_error_callback, std::move(file_data)); helper_->StartLaunchOnClientThread(); }
diff --git a/content/browser/child_process_launcher.h b/content/browser/child_process_launcher.h index 48270c3..9e3400a 100644 --- a/content/browser/child_process_launcher.h +++ b/content/browser/child_process_launcher.h
@@ -19,6 +19,7 @@ #include "build/build_config.h" #include "content/browser/child_process_launcher_helper.h" #include "content/common/content_export.h" +#include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_termination_info.h" #include "content/public/common/result_codes.h" @@ -33,6 +34,10 @@ #include "base/win/windows_types.h" #endif +#if BUILDFLAG(IS_POSIX) +#include "base/files/scoped_file.h" +#endif + namespace base { class CommandLine; } @@ -145,6 +150,29 @@ #endif }; +// Data to pass as file descriptors. +struct ChildProcessLauncherFileData { + ChildProcessLauncherFileData(); + ChildProcessLauncherFileData(const ChildProcessLauncherFileData& others) = + delete; + ChildProcessLauncherFileData& operator=(const ChildProcessLauncherFileData&) = + delete; + ~ChildProcessLauncherFileData(); + +#if BUILDFLAG(IS_POSIX) + // Files opened by the browser and passed as corresponding file descriptors + // in the child process. + // Currently only supported on Linux, ChromeOS and Android platforms. + std::map<std::string, base::FilePath> files_to_preload; + + // Map of file descriptors to pass. This is used instead of + // `files_to_preload` when the data is already contained as a file + // descriptor. + // Currently only supported on POSIX platforms. + std::map<int, base::ScopedFD> additional_remapped_fds; +#endif +}; + // Launches a process asynchronously and notifies the client of the process // handle when it's available. It's used to avoid blocking the calling thread // on the OS since often it can take > 100 ms to create the process. @@ -172,15 +200,19 @@ // this object destructs, it will be terminated. // Takes ownership of cmd_line. // - // If |process_error_callback| is provided, it will be called if a Mojo error + // If `process_error_callback` is provided, it will be called if a Mojo error // is encountered when processing messages from the child process. This // callback must be safe to call from any thread. // - // |files_to_preload| is a map of key names to file paths. These files will be + // `file_data` consists of 2 members: + // files_to_preload: a map of key names to file paths. These files will be // opened by the browser process and corresponding file descriptors inherited // by the new child process, accessible using the corresponding key via some // platform-specific mechanism (such as base::FileDescriptorStore on POSIX). - // Currently only supported on POSIX platforms. + // Currently only supported on Linux, ChromeOS and Android platforms. + // additional_remapped_fds: is a map of file descriptors to pass. This is + // used instead of files_to_preload when the data is already contained as a + // file descriptor. Currently only supported on POSIX platforms. ChildProcessLauncher( std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, std::unique_ptr<base::CommandLine> cmd_line, @@ -188,7 +220,7 @@ Client* client, mojo::OutgoingInvitation mojo_invitation, const mojo::ProcessErrorCallback& process_error_callback, - std::map<std::string, base::FilePath> files_to_preload, + std::unique_ptr<ChildProcessLauncherFileData> file_data, bool terminate_on_shutdown = true); ChildProcessLauncher(const ChildProcessLauncher&) = delete;
diff --git a/content/browser/child_process_launcher_helper.cc b/content/browser/child_process_launcher_helper.cc index bf0ff19..a942cc6 100644 --- a/content/browser/child_process_launcher_helper.cc +++ b/content/browser/child_process_launcher_helper.cc
@@ -78,7 +78,7 @@ #endif mojo::OutgoingInvitation mojo_invitation, const mojo::ProcessErrorCallback& process_error_callback, - std::map<std::string, base::FilePath> files_to_preload) + std::unique_ptr<ChildProcessLauncherFileData> file_data) : child_process_id_(child_process_id), client_task_runner_(base::SequencedTaskRunnerHandle::Get()), command_line_(std::move(command_line)), @@ -87,7 +87,7 @@ terminate_on_shutdown_(terminate_on_shutdown), mojo_invitation_(std::move(mojo_invitation)), process_error_callback_(process_error_callback), - files_to_preload_(std::move(files_to_preload)) + file_data_(std::move(file_data)) #if BUILDFLAG(IS_ANDROID) , can_use_warm_up_connection_(can_use_warm_up_connection)
diff --git a/content/browser/child_process_launcher_helper.h b/content/browser/child_process_launcher_helper.h index 8934a7b..5337642 100644 --- a/content/browser/child_process_launcher_helper.h +++ b/content/browser/child_process_launcher_helper.h
@@ -15,6 +15,7 @@ #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "build/build_config.h" +#include "content/public/browser/browser_child_process_host.h" #include "content/public/common/result_codes.h" #include "content/public/common/zygote/zygote_buildflags.h" #include "mojo/public/cpp/platform/platform_channel.h" @@ -56,6 +57,7 @@ class ChildProcessLauncher; class SandboxedProcessLauncherDelegate; +struct ChildProcessLauncherFileData; struct ChildProcessLauncherPriority; struct ChildProcessTerminationInfo; @@ -104,7 +106,7 @@ #endif mojo::OutgoingInvitation mojo_invitation, const mojo::ProcessErrorCallback& process_error_callback, - std::map<std::string, base::FilePath> files_to_preload); + std::unique_ptr<ChildProcessLauncherFileData> file_data); // The methods below are defined in the order they are called. @@ -240,7 +242,7 @@ bool terminate_on_shutdown_; mojo::OutgoingInvitation mojo_invitation_; const mojo::ProcessErrorCallback process_error_callback_; - const std::map<std::string, base::FilePath> files_to_preload_; + std::unique_ptr<ChildProcessLauncherFileData> file_data_; #if BUILDFLAG(IS_MAC) std::unique_ptr<sandbox::SeatbeltExecClient> seatbelt_exec_client_;
diff --git a/content/browser/child_process_launcher_helper_android.cc b/content/browser/child_process_launcher_helper_android.cc index 8fe864a..ec12d8d 100644 --- a/content/browser/child_process_launcher_helper_android.cc +++ b/content/browser/child_process_launcher_helper_android.cc
@@ -78,7 +78,7 @@ std::unique_ptr<PosixFileDescriptorInfo> files_to_register = CreateDefaultPosixFilesToMap( child_process_id(), mojo_channel_->remote_endpoint(), - files_to_preload_, GetProcessType(), command_line()); + file_data_->files_to_preload, GetProcessType(), command_line()); #if ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE base::MemoryMappedFile::Region icu_region; @@ -92,6 +92,11 @@ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( PosixFileDescriptorInfo& files_to_register, base::LaunchOptions* options) { + for (const auto& remapped_fd : file_data_->additional_remapped_fds) { + options->fds_to_remap.emplace_back(remapped_fd.second.get(), + remapped_fd.first); + } + return true; }
diff --git a/content/browser/child_process_launcher_helper_linux.cc b/content/browser/child_process_launcher_helper_linux.cc index 80db4cb..b2b29e7 100644 --- a/content/browser/child_process_launcher_helper_linux.cc +++ b/content/browser/child_process_launcher_helper_linux.cc
@@ -40,8 +40,8 @@ ChildProcessLauncherHelper::GetFilesToMap() { DCHECK(CurrentlyOnProcessLauncherTaskRunner()); return CreateDefaultPosixFilesToMap( - child_process_id(), mojo_channel_->remote_endpoint(), files_to_preload_, - GetProcessType(), command_line()); + child_process_id(), mojo_channel_->remote_endpoint(), + file_data_->files_to_preload, GetProcessType(), command_line()); } bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( @@ -56,6 +56,11 @@ options->fds_to_remap.push_back(std::make_pair(sandbox_fd, GetSandboxFD())); } + for (const auto& remapped_fd : file_data_->additional_remapped_fds) { + options->fds_to_remap.emplace_back(remapped_fd.second.get(), + remapped_fd.first); + } + options->environment = delegate_->GetEnvironment(); return true;
diff --git a/content/browser/child_process_launcher_helper_mac.cc b/content/browser/child_process_launcher_helper_mac.cc index 4795ed4..5917a41e 100644 --- a/content/browser/child_process_launcher_helper_mac.cc +++ b/content/browser/child_process_launcher_helper_mac.cc
@@ -99,6 +99,11 @@ base::StringPrintf("%s%d", sandbox::switches::kSeatbeltClient, pipe)); } + for (const auto& remapped_fd : file_data_->additional_remapped_fds) { + options->fds_to_remap.emplace_back(remapped_fd.second.get(), + remapped_fd.first); + } + return true; }
diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc index ab17927b..b8ed639b 100644 --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -243,7 +243,7 @@ "document.body.addEventListener('keydown', handleKeyEvent);" "document.body.addEventListener('keyup', handleKeyEvent);")); - DOMMessageQueue dom_message_queue; + DOMMessageQueue dom_message_queue(shell()->web_contents()); // Send enter (keycode 13). SendKeyEvent("rawKeyDown", 0, 13, 13, "Enter", true);
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 043aa08d..6483a33 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc
@@ -162,6 +162,10 @@ return base::EmptyString16(); } +bool IsSavableFrame(RenderFrameHost* rfh) { + return rfh->IsRenderFrameLive() && !rfh->IsNestedWithinFencedFrame(); +} + } // namespace const base::FilePath::CharType SavePackage::kDefaultHtmlExtension[] = @@ -1022,7 +1026,7 @@ FrameTreeNode* frame_tree_node = frame_tree->FindByID(frame_tree_node_id); if (frame_tree_node && - frame_tree_node->current_frame_host()->IsRenderFrameLive()) { + IsSavableFrame(frame_tree_node->current_frame_host())) { // Ask the frame for HTML to be written to the associated SaveItem. GetSerializedHtmlWithLocalLinksForFrame(frame_tree_node); number_of_frames_pending_response_++; @@ -1200,7 +1204,7 @@ void SavePackage::GetSavableResourceLinksForRenderFrameHost( RenderFrameHost* rfh) { - if (!rfh->IsRenderFrameLive()) + if (!IsSavableFrame(rfh)) return; ++number_of_frames_pending_response_; static_cast<RenderFrameHostImpl*>(rfh)->GetSavableResourceLinksFromRenderer();
diff --git a/content/browser/download/save_package.h b/content/browser/download/save_package.h index de634f5..4b98c0fe 100644 --- a/content/browser/download/save_package.h +++ b/content/browser/download/save_package.h
@@ -147,6 +147,8 @@ friend class WebContentsImpl; FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestSuggestedSaveNames); FRIEND_TEST_ALL_PREFIXES(SavePackageTest, TestLongSafePureFilename); + FRIEND_TEST_ALL_PREFIXES(SavePackageFencedFrameTest, + DontRequestSavableResourcesFromFencedFrames); FRIEND_TEST_ALL_PREFIXES(SavePackageBrowserTest, ImplicitCancel); FRIEND_TEST_ALL_PREFIXES(SavePackageBrowserTest, ExplicitCancel); FRIEND_TEST_ALL_PREFIXES(SavePackageBrowserTest, Reload);
diff --git a/content/browser/download/save_package_unittest.cc b/content/browser/download/save_package_unittest.cc index 060fd0e..68a5937 100644 --- a/content/browser/download/save_package_unittest.cc +++ b/content/browser/download/save_package_unittest.cc
@@ -14,14 +14,17 @@ #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "content/browser/download/save_file_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/common/url_constants.h" +#include "content/public/test/fake_local_frame.h" #include "content/test/test_render_view_host.h" #include "content/test/test_web_contents.h" #include "net/test/url_request/url_request_mock_http_job.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" #include "url/gurl.h" namespace content { @@ -132,7 +135,6 @@ scoped_refptr<SavePackage> save_package_success_; // SavePackage for failed generating file name. scoped_refptr<SavePackage> save_package_fail_; - base::ScopedTempDir temp_dir_; scoped_refptr<SaveFileManager> save_file_manager_; @@ -285,4 +287,84 @@ EXPECT_EQ(view_source_url, contents()->GetLastCommittedURL()); } +class SavePackageFencedFrameTest : public SavePackageTest { + public: + SavePackageFencedFrameTest() { + scoped_feature_list_.InitAndEnableFeatureWithParameters( + blink::features::kFencedFrames, {{"implementation_type", "mparch"}}); + } + ~SavePackageFencedFrameTest() override = default; + + RenderFrameHost* CreateFencedFrame(RenderFrameHost* parent) { + RenderFrameHost* fenced_frame = + RenderFrameHostTester::For(parent)->AppendFencedFrame(); + return fenced_frame; + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// FakeLocalFrame implementation that records calls to +// GetSavableResourceLinks(). +class FakeLocalFrameWithSavableResourceLinks : public FakeLocalFrame { + public: + explicit FakeLocalFrameWithSavableResourceLinks(RenderFrameHost* rfh) { + Init(static_cast<TestRenderFrameHost*>(rfh) + ->GetRemoteAssociatedInterfaces()); + } + + bool is_called() const { return is_called_; } + + // FakeLocalFrame: + void GetSavableResourceLinks( + GetSavableResourceLinksCallback callback) override { + is_called_ = true; + std::move(callback).Run(nullptr); + } + + private: + bool is_called_ = false; +}; + +// Tests that SavePackage does not create an unnecessary task that gets the +// resources links from fenced frames. +// If fenced frames become savable, this test will need to be updated. +// See https://crbug.com/1321102 +TEST_F(SavePackageFencedFrameTest, + DontRequestSavableResourcesFromFencedFrames) { + NavigateAndCommit(GURL("https://www.example.com")); + + // Create a fenced frame. + RenderFrameHostTester::For(contents()->GetMainFrame()) + ->InitializeRenderFrameIfNeeded(); + RenderFrameHost* fenced_frame_rfh = + CreateFencedFrame(contents()->GetMainFrame()); + + base::ScopedTempDir temp_dir; + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + + scoped_refptr<SavePackage> save_package(new SavePackage( + contents()->GetPrimaryPage(), SAVE_PAGE_TYPE_AS_COMPLETE_HTML, + temp_dir.GetPath().AppendASCII("testfile" HTML_EXTENSION), + temp_dir.GetPath().AppendASCII("testfile_files"))); + + FakeLocalFrameWithSavableResourceLinks local_frame_for_primary( + contents()->GetMainFrame()); + local_frame_for_primary.Init( + contents()->GetMainFrame()->GetRemoteAssociatedInterfaces()); + + FakeLocalFrameWithSavableResourceLinks local_frame_for_fenced_frame( + fenced_frame_rfh); + local_frame_for_fenced_frame.Init( + fenced_frame_rfh->GetRemoteAssociatedInterfaces()); + + EXPECT_TRUE(save_package->Init(base::DoNothing())); + + base::RunLoop().RunUntilIdle(); + + EXPECT_TRUE(local_frame_for_primary.is_called()); + EXPECT_FALSE(local_frame_for_fenced_frame.is_called()); +} + } // namespace content
diff --git a/content/browser/file_system_access/file_system_access_file_delegate_host_impl.cc b/content/browser/file_system_access/file_system_access_file_delegate_host_impl.cc index 5b2e76b..bea0e0f 100644 --- a/content/browser/file_system_access/file_system_access_file_delegate_host_impl.cc +++ b/content/browser/file_system_access/file_system_access_file_delegate_host_impl.cc
@@ -95,7 +95,7 @@ // Chrome will be allowed to contiguously allocate at once. int max_bytes_to_read = std::min(base::saturated_cast<int>(bytes_to_read), - base::saturated_cast<int>(base::MaxDirectMapped())); + base::saturated_cast<int>(partition_alloc::MaxDirectMapped())); auto buffer = base::MakeRefCounted<storage::BigIOBuffer>(max_bytes_to_read);
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index fe955e5..e0df775 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -35,6 +35,7 @@ #include "components/viz/common/features.h" #include "components/viz/common/switches.h" #include "content/browser/browser_child_process_host_impl.h" +#include "content/browser/child_process_launcher.h" #include "content/browser/compositor/image_transport_factory.h" #include "content/browser/gpu/compositor_util.h" #include "content/browser/gpu/gpu_data_manager_impl.h" @@ -44,6 +45,7 @@ #include "content/common/child_process.mojom.h" #include "content/common/child_process_host_impl.h" #include "content/common/in_process_child_thread_params.h" +#include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -1232,7 +1234,9 @@ // Call LaunchWithoutExtraCommandLineSwitches() so the command line switches // will not be appended twice. process_->LaunchWithoutExtraCommandLineSwitches( - std::move(delegate), std::move(cmd_line), /*files_to_preload=*/{}, true); + std::move(delegate), std::move(cmd_line), + /*file_data=*/ + std::make_unique<ChildProcessLauncherFileData>(), true); process_launched_ = true; if (kind_ == GPU_PROCESS_KIND_SANDBOXED) {
diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc index b64829d..b1a600de 100644 --- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc +++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
@@ -28,6 +28,7 @@ #include "base/task/sequenced_task_runner.h" #include "base/task/thread_pool.h" #include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/default_clock.h" @@ -51,6 +52,7 @@ #include "storage/browser/test/mock_quota_manager_proxy.h" #include "storage/browser/test/mock_special_storage_policy.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/indexeddb/web_idb_types.h" #include "third_party/blink/public/common/storage_key/storage_key.h" #include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom.h" @@ -473,6 +475,27 @@ IndexedDBValue value2_; }; +class IndexedDBBackingStoreTestForThirdPartyStoragePartitioning + : public testing::WithParamInterface<bool>, + public IndexedDBBackingStoreTest { + public: + IndexedDBBackingStoreTestForThirdPartyStoragePartitioning() { + scoped_feature_list_.InitWithFeatureState( + blink::features::kThirdPartyStoragePartitioning, + IsThirdPartyStoragePartitioningEnabled()); + } + + bool IsThirdPartyStoragePartitioningEnabled() { return GetParam(); } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +INSTANTIATE_TEST_SUITE_P( + /* no prefix */, + IndexedDBBackingStoreTestForThirdPartyStoragePartitioning, + testing::Bool()); + enum class ExternalObjectTestType { kOnlyBlobs, kOnlyFileSystemAccessHandles, @@ -1631,7 +1654,8 @@ EXPECT_EQ(db1_name, names[0]); } -TEST_F(IndexedDBBackingStoreTest, ReadCorruptionInfo) { +TEST_P(IndexedDBBackingStoreTestForThirdPartyStoragePartitioning, + ReadCorruptionInfoForOpaqueStorageKey) { auto filesystem_proxy = std::make_unique<storage::FilesystemProxy>( storage::FilesystemProxy::UNRESTRICTED, base::FilePath()); storage::BucketLocator bucket_locator; @@ -1641,10 +1665,17 @@ EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), base::FilePath(), bucket_locator) .empty()); +} +TEST_P(IndexedDBBackingStoreTestForThirdPartyStoragePartitioning, + ReadCorruptionInfoForFirstPartyStorageKey) { + auto filesystem_proxy = std::make_unique<storage::FilesystemProxy>( + storage::FilesystemProxy::UNRESTRICTED, base::FilePath()); + storage::BucketLocator bucket_locator; const base::FilePath path_base = temp_dir_.GetPath(); bucket_locator.storage_key = blink::StorageKey::CreateFromStringForTesting("http://www.google.com/"); + bucket_locator.id = storage::BucketId::FromUnsafeValue(1); ASSERT_FALSE(path_base.empty()); ASSERT_TRUE(PathIsWritable(path_base)); @@ -1719,6 +1750,96 @@ EXPECT_EQ("foo", message); } +TEST_P(IndexedDBBackingStoreTestForThirdPartyStoragePartitioning, + ReadCorruptionInfoForThirdPartyStorageKey) { + auto filesystem_proxy = std::make_unique<storage::FilesystemProxy>( + storage::FilesystemProxy::UNRESTRICTED, base::FilePath()); + storage::BucketLocator bucket_locator; + const base::FilePath path_base = temp_dir_.GetPath(); + bucket_locator.storage_key = + blink::StorageKey(url::Origin::Create(GURL("http://www.google.com/")), + url::Origin::Create(GURL("http://www.youtube.com/"))); + bucket_locator.id = storage::BucketId::FromUnsafeValue(1); + ASSERT_FALSE(path_base.empty()); + ASSERT_TRUE(PathIsWritable(path_base)); + + // File not found. + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + + base::FilePath info_path = + path_base.AppendASCII("http_www.google.com_0.indexeddb.leveldb") + .AppendASCII("corruption_info.json"); + if (IsThirdPartyStoragePartitioningEnabled()) { + info_path = path_base.AppendASCII("1") + .AppendASCII("IndexedDB") + .AppendASCII("indexeddb.leveldb") + .AppendASCII("corruption_info.json"); + } + ASSERT_TRUE(CreateDirectory(info_path.DirName())); + + // Empty file. + std::string dummy_data; + ASSERT_TRUE(base::WriteFile(info_path, dummy_data)); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // File size > 4 KB. + dummy_data.resize(5000, 'c'); + ASSERT_TRUE(base::WriteFile(info_path, dummy_data)); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // Random string. + ASSERT_TRUE(base::WriteFile(info_path, "foo bar")); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // Not a dictionary. + ASSERT_TRUE(base::WriteFile(info_path, "[]")); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // Empty dictionary. + ASSERT_TRUE(base::WriteFile(info_path, "{}")); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // Dictionary, no message key. + ASSERT_TRUE(base::WriteFile(info_path, "{\"foo\":\"bar\"}")); + EXPECT_TRUE(indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator) + .empty()); + EXPECT_FALSE(PathExists(info_path)); + + // Dictionary, message key. + ASSERT_TRUE(base::WriteFile(info_path, "{\"message\":\"bar\"}")); + std::string message = indexed_db::ReadCorruptionInfo( + filesystem_proxy.get(), path_base, bucket_locator); + EXPECT_FALSE(message.empty()); + EXPECT_FALSE(PathExists(info_path)); + EXPECT_EQ("bar", message); + + // Dictionary, message key and more. + ASSERT_TRUE(base::WriteFile(info_path, "{\"message\":\"foo\",\"bar\":5}")); + message = indexed_db::ReadCorruptionInfo(filesystem_proxy.get(), path_base, + bucket_locator); + EXPECT_FALSE(message.empty()); + EXPECT_FALSE(PathExists(info_path)); + EXPECT_EQ("foo", message); +} + // There was a wrong migration from schema 2 to 3, which always delete IDB // blobs and doesn't actually write the new schema version. This tests the // upgrade path where the database doesn't have blob entries, so it' safe to
diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 74aee377..37fc638 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc
@@ -73,8 +73,7 @@ // This browser test is aimed towards exercising the IndexedDB bindings and // the actual implementation that lives in the browser side. -class IndexedDBBrowserTest : public ContentBrowserTest, - public ::testing::WithParamInterface<const char*> { +class IndexedDBBrowserTest : public ContentBrowserTest { public: IndexedDBBrowserTest() = default; @@ -1026,7 +1025,21 @@ // See TODO in CorruptDBRequestHandler. Windows does not support nested // message loops on the IO thread, so run this test on other platforms. #if !BUILDFLAG(IS_WIN) -IN_PROC_BROWSER_TEST_P(IndexedDBBrowserTest, OperationOnCorruptedOpenDatabase) { +class IndexedDBBrowserTestWithCorruption + : public IndexedDBBrowserTest, + public ::testing::WithParamInterface<const char*> {}; + +INSTANTIATE_TEST_SUITE_P(/* no prefix */, + IndexedDBBrowserTestWithCorruption, + ::testing::Values("failGetBlobJournal", + "get", + "getAll", + "iterate", + "failTransactionCommit", + "clearObjectStore")); + +IN_PROC_BROWSER_TEST_P(IndexedDBBrowserTestWithCorruption, + OperationOnCorruptedOpenDatabase) { ASSERT_TRUE(embedded_test_server()->Started() || embedded_test_server()->InitializeAndListen()); const blink::StorageKey storage_key = blink::StorageKey( @@ -1062,16 +1075,6 @@ std::string(s_corrupt_db_test_prefix) + "corrupted_open_db_recovery.html"; SimpleTest(embedded_test_server()->GetURL(test_file)); } - -// Only instantiate on platforms that run the parameterized test. -INSTANTIATE_TEST_SUITE_P(IndexedDBBrowserTestInstantiation, - IndexedDBBrowserTest, - ::testing::Values("failGetBlobJournal", - "get", - "getAll", - "iterate", - "failTransactionCommit", - "clearObjectStore")); #endif // !BUILDFLAG(IS_WIN) // TODO: http://crbug.com/510520, flaky on all platforms
diff --git a/content/browser/indexed_db/indexed_db_context_impl.cc b/content/browser/indexed_db/indexed_db_context_impl.cc index 1b64342..aac5a9eb 100644 --- a/content/browser/indexed_db/indexed_db_context_impl.cc +++ b/content/browser/indexed_db/indexed_db_context_impl.cc
@@ -32,6 +32,7 @@ #include "components/services/storage/public/cpp/buckets/bucket_info.h" #include "components/services/storage/public/cpp/buckets/bucket_locator.h" #include "components/services/storage/public/cpp/buckets/constants.h" +#include "components/services/storage/public/cpp/constants.h" #include "components/services/storage/public/cpp/quota_client_callback_wrapper.h" #include "components/services/storage/public/cpp/quota_error_or.h" #include "components/services/storage/public/mojom/quota_client.mojom.h" @@ -63,8 +64,6 @@ using storage::DatabaseUtil; namespace content { -const base::FilePath::CharType IndexedDBContextImpl::kIndexedDBDirectory[] = - FILE_PATH_LITERAL("IndexedDB"); namespace { @@ -89,13 +88,14 @@ // This may be called after the IndexedDBContext is destroyed. const std::map<blink::StorageKey, base::FilePath> -DefaultBucketFilePerFirstPartyStorageKey(const base::FilePath& indexeddb_path) { +DefaultBucketFilePerFirstPartyStorageKey( + const base::FilePath& first_party_path) { // TODO(jsbell): DCHECK that this is running on an IndexedDB sequence, // if a global handle to it is ever available. std::map<blink::StorageKey, base::FilePath> storage_key_to_file_path; - if (indexeddb_path.empty()) + if (first_party_path.empty()) return storage_key_to_file_path; - base::FileEnumerator file_enumerator(indexeddb_path, false, + base::FileEnumerator file_enumerator(first_party_path, /*recursive=*/false, base::FileEnumerator::DIRECTORIES); for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); file_path = file_enumerator.Next()) { @@ -113,6 +113,35 @@ return storage_key_to_file_path; } +// This may be called after the IndexedDBContext is destroyed. +const std::map<storage::BucketId, base::FilePath> +DefaultBucketFilePerThirdPartyBucketId(const base::FilePath& third_party_path) { + // TODO(jsbell): DCHECK that this is running on an IndexedDB sequence, + // if a global handle to it is ever available. + std::map<storage::BucketId, base::FilePath> bucket_id_to_file_path; + if (third_party_path.empty()) + return bucket_id_to_file_path; + base::FileEnumerator file_enumerator(third_party_path, /*recursive=*/true, + base::FileEnumerator::DIRECTORIES); + for (base::FilePath file_path = file_enumerator.Next(); !file_path.empty(); + file_path = file_enumerator.Next()) { + if (file_path.BaseName().Extension() == indexed_db::kLevelDBExtension && + file_path.BaseName().RemoveExtension().value() == + indexed_db::kIndexedDBFile && + file_path.DirName().BaseName().value() == + storage::kIndexedDbDirectory) { + int64_t raw_bucket_id = 0; + bool success = base::StringToInt64( + file_path.DirName().DirName().BaseName().value(), &raw_bucket_id); + if (success && raw_bucket_id > 0) { + bucket_id_to_file_path[storage::BucketId::FromUnsafeValue( + raw_bucket_id)] = file_path; + } + } + } + return bucket_id_to_file_path; +} + } // namespace // static @@ -256,6 +285,7 @@ DeleteForBucketCallback callback) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; DeleteForBucketImpl(std::move(callback), bucket_locator); } @@ -273,9 +303,13 @@ // if there's a file in the directory and not exit early if so. const auto& storage_key_to_file_path = DefaultBucketFilePerFirstPartyStorageKey(GetFirstPartyDataPath()); + const auto& bucket_id_to_file_path = + DefaultBucketFilePerThirdPartyBucketId(GetThirdPartyDataPath()); if (!HasBucket(*bucket_locator) && storage_key_to_file_path.find(bucket_locator->storage_key) == - storage_key_to_file_path.end()) { + storage_key_to_file_path.end() && + bucket_id_to_file_path.find(bucket_locator->id) == + bucket_id_to_file_path.end()) { std::move(callback).Run(true); return; } @@ -283,6 +317,8 @@ if (is_incognito()) { bucket_set_.erase(*bucket_locator); bucket_size_map_.erase(*bucket_locator); + storage_key_to_bucket_locator_.erase(bucket_locator->storage_key); + bucket_id_to_bucket_locator_.erase(bucket_locator->id); std::move(callback).Run(true); return; } @@ -301,6 +337,8 @@ if (success) { bucket_set_.erase(*bucket_locator); bucket_size_map_.erase(*bucket_locator); + storage_key_to_bucket_locator_.erase(bucket_locator->storage_key); + bucket_id_to_bucket_locator_.erase(bucket_locator->id); } std::move(callback).Run(success); } @@ -320,6 +358,7 @@ base::OnceClosure closure) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; ForceCloseImpl(reason, std::move(closure), bucket_locator); } @@ -362,6 +401,7 @@ GetConnectionCountCallback callback) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; GetConnectionCountImpl(std::move(callback), bucket_locator); } @@ -398,6 +438,7 @@ DownloadBucketDataCallback callback) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; return DownloadBucketDataImpl(std::move(callback), bucket_locator); } @@ -874,18 +915,20 @@ if (bucket_locator.storage_key.IsFirstPartyContext()) { // First-party idb files, for legacy reasons, are stored at: // {{storage_partition_path}}/IndexedDB/ + // TODO(crbug.com/1315371): Migrate all first party buckets to the new path. return GetFirstPartyDataPath(); } else { // Third-party idb files are stored at: - // {{storage_partition_path}}/WebStorage/{{bucket_id}}/IndexedDB/ - // TODO(crbug.com/1218100): Support the correct third-party data path. - return GetFirstPartyDataPath(); + // {{storage_partition_path}}/WebStorage/ + // TODO(crbug.com/1315371): Use QuotaManagerProxy::GetBucketPath. + return GetThirdPartyDataPath(); } } const base::FilePath IndexedDBContextImpl::GetFirstPartyDataPath() const { - return base_data_path_.empty() ? base_data_path_ - : base_data_path_.Append(kIndexedDBDirectory); + return base_data_path_.empty() + ? base_data_path_ + : base_data_path_.Append(storage::kIndexedDbDirectory); } const base::FilePath IndexedDBContextImpl::GetFirstPartyDataPathForTesting() @@ -893,6 +936,12 @@ return GetFirstPartyDataPath(); } +const base::FilePath IndexedDBContextImpl::GetThirdPartyDataPath() const { + return base_data_path_.empty() + ? base_data_path_ + : base_data_path_.Append(storage::kWebStorageDirectory); +} + void IndexedDBContextImpl::FactoryOpened( const storage::BucketLocator& bucket_locator) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); @@ -900,6 +949,7 @@ storage_key_to_bucket_locator_.find(bucket_locator.storage_key); if (it == storage_key_to_bucket_locator_.end()) { storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; } if (bucket_set_.insert(bucket_locator).second) { // A newly created db, notify the quota system. @@ -919,6 +969,7 @@ storage_key_to_bucket_locator_.find(bucket_locator.storage_key); if (it == storage_key_to_bucket_locator_.end()) { storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; } if (bucket_set_.insert(bucket_locator).second) { // A newly created db, notify the quota system. @@ -952,6 +1003,7 @@ storage_key_to_bucket_locator_.find(bucket_locator.storage_key); if (it == storage_key_to_bucket_locator_.end()) { storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; } bucket_set_.insert(bucket_locator); QueryDiskAndUpdateQuotaUsage(bucket_locator); @@ -998,17 +1050,28 @@ IndexedDBFactoryImpl* factory = GetIDBFactory(); const auto& storage_key_to_file_path = DefaultBucketFilePerFirstPartyStorageKey(GetFirstPartyDataPath()); - for (const auto& pair : storage_key_to_file_path) { - const auto& bucket_locator_it = - storage_key_to_bucket_locator_.find(pair.first); - if (bucket_locator_it == storage_key_to_bucket_locator_.end()) - continue; - if (buckets_to_purge_on_shutdown_.find(bucket_locator_it->second) == - buckets_to_purge_on_shutdown_.end()) { - continue; + const auto& bucket_id_to_file_path = + DefaultBucketFilePerThirdPartyBucketId(GetThirdPartyDataPath()); + for (const auto& bucket_locator : buckets_to_purge_on_shutdown_) { + base::FilePath path; + const auto& first_party_it = + storage_key_to_file_path.find(bucket_locator.storage_key); + const auto& third_party_it = bucket_id_to_file_path.find(bucket_locator.id); + // If the bucket exists on the file system, it is in only one of the two + // possible locations depending on if the key is first or third party. + if (first_party_it != storage_key_to_file_path.end()) { + DCHECK(third_party_it == bucket_id_to_file_path.end()); + DCHECK(bucket_locator.storage_key.IsFirstPartyContext()); + path = first_party_it->second; + } else if (third_party_it != bucket_id_to_file_path.end()) { + DCHECK(first_party_it == storage_key_to_file_path.end()); + DCHECK(bucket_locator.storage_key.IsThirdPartyContext()); + path = third_party_it->second; } - factory->ForceClose(bucket_locator_it->second, false); - filesystem_proxy_->DeletePathRecursively(pair.second); + if (!path.empty()) { + factory->ForceClose(bucket_locator, false); + filesystem_proxy_->DeletePathRecursively(path); + } } } @@ -1081,16 +1144,20 @@ } const auto& storage_key_to_file_path = DefaultBucketFilePerFirstPartyStorageKey(GetFirstPartyDataPath()); - if (storage_key_to_file_path.empty()) { + const auto& bucket_id_to_file_path = + DefaultBucketFilePerThirdPartyBucketId(GetThirdPartyDataPath()); + if (storage_key_to_file_path.empty() && bucket_id_to_file_path.empty()) { did_initialize_from_files_ = true; std::move(callback).Run(); return; } for (auto iter = storage_key_to_file_path.begin(); iter != storage_key_to_file_path.end(); ++iter) { - if (std::next(iter) == storage_key_to_file_path.end()) { - // `callback` is only passed to the last task scheduled so that it won't - // be triggered until the update is complete. + if (std::next(iter) == storage_key_to_file_path.end() && + bucket_id_to_file_path.empty()) { + // `callback` is only passed to the last task scheduled (if the second + // loop is empty)so that it won't be triggered until the update is + // complete. GetOrCreateDefaultBucket( iter->first, base::BindOnce( @@ -1121,6 +1188,41 @@ base::Unretained(this))); } } + for (auto iter = bucket_id_to_file_path.begin(); + iter != bucket_id_to_file_path.end(); ++iter) { + if (std::next(iter) == bucket_id_to_file_path.end()) { + // `callback` is only passed to the last task scheduled so that it won't + // be triggered until the update is complete. + GetBucketById( + iter->first, + base::BindOnce( + [](IndexedDBContextImpl* context, + base::OnceClosure inner_callback, + const absl::optional<storage::BucketLocator>& bucket_locator) { + if (bucket_locator) + context->bucket_set_.insert(*bucket_locator); + std::move(inner_callback).Run(); + context->did_initialize_from_files_ = true; + }, + // `this` is destroyed on idb_task_runner_ so it's safe to post + // raw. + base::Unretained(this), std::move(callback))); + // This path is only invoked once but the analyzer doesn't know that. + callback = base::DoNothing(); + } else { + GetBucketById( + iter->first, + base::BindOnce( + [](IndexedDBContextImpl* context, + const absl::optional<storage::BucketLocator>& bucket_locator) { + if (bucket_locator) + context->bucket_set_.insert(*bucket_locator); + }, + // `this` is destroyed on idb_task_runner_ so it's safe to post + // raw. + base::Unretained(this))); + } + } } void IndexedDBContextImpl::ForceInitializeFromFilesForTesting( @@ -1132,11 +1234,12 @@ void IndexedDBContextImpl::RegisterBucketLocatorToSkipQuotaLookupForTesting( const storage::BucketLocator& bucket_locator) { storage_key_to_bucket_locator_[bucket_locator.storage_key] = bucket_locator; + bucket_id_to_bucket_locator_[bucket_locator.id] = bucket_locator; } void IndexedDBContextImpl::GetOrCreateDefaultBucket( const blink::StorageKey& storage_key, - GetOrCreateDefaultBucketCallback callback) { + DidGetBucketLocatorCallback callback) { DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); const auto& bucket_locator = storage_key_to_bucket_locator_.find(storage_key); if (bucket_locator == storage_key_to_bucket_locator_.end()) { @@ -1144,13 +1247,45 @@ storage::BucketInitParams(storage_key), idb_task_runner_, base::BindOnce( [](IndexedDBContextImpl* context, - GetOrCreateDefaultBucketCallback inner_callback, + DidGetBucketLocatorCallback inner_callback, storage::QuotaErrorOr<storage::BucketInfo> result) { if (result.ok()) { const auto& bucket_locator = result->ToBucketLocator(); context->storage_key_to_bucket_locator_[bucket_locator .storage_key] = bucket_locator; + context->bucket_id_to_bucket_locator_[bucket_locator.id] = + bucket_locator; + std::move(inner_callback).Run(bucket_locator); + } else { + std::move(inner_callback).Run(absl::nullopt); + } + }, + // `this` is destroyed on idb_task_runner_ so it's safe to post raw. + base::Unretained(this), std::move(callback))); + } else { + std::move(callback).Run(bucket_locator->second); + } +} + +void IndexedDBContextImpl::GetBucketById(const storage::BucketId& bucket_id, + DidGetBucketLocatorCallback callback) { + DCHECK(IDBTaskRunner()->RunsTasksInCurrentSequence()); + const auto& bucket_locator = bucket_id_to_bucket_locator_.find(bucket_id); + if (bucket_locator == bucket_id_to_bucket_locator_.end()) { + quota_manager_proxy_->GetBucketById( + bucket_id, idb_task_runner_, + base::BindOnce( + [](IndexedDBContextImpl* context, + DidGetBucketLocatorCallback inner_callback, + storage::QuotaErrorOr<storage::BucketInfo> result) { + if (result.ok()) { + const auto& bucket_locator = result->ToBucketLocator(); + context->storage_key_to_bucket_locator_[bucket_locator + .storage_key] = + bucket_locator; + context->bucket_id_to_bucket_locator_[bucket_locator.id] = + bucket_locator; std::move(inner_callback).Run(bucket_locator); } else { std::move(inner_callback).Run(absl::nullopt);
diff --git a/content/browser/indexed_db/indexed_db_context_impl.h b/content/browser/indexed_db/indexed_db_context_impl.h index 702ef9b5a..67326788 100644 --- a/content/browser/indexed_db/indexed_db_context_impl.h +++ b/content/browser/indexed_db/indexed_db_context_impl.h
@@ -57,9 +57,6 @@ public storage::mojom::IndexedDBControl, public storage::mojom::IndexedDBControlTest { public: - // The indexed db directory. - static const base::FilePath::CharType kIndexedDBDirectory[]; - // Release `context` on the IDBTaskRunner. static void ReleaseOnIDBSequence( scoped_refptr<IndexedDBContextImpl>&& context); @@ -256,6 +253,7 @@ void ShutdownOnIDBSequence(); const base::FilePath GetFirstPartyDataPath() const; + const base::FilePath GetThirdPartyDataPath() const; base::FilePath GetBlobStorePath( const storage::BucketLocator& bucket_locator) const; base::FilePath GetLevelDBPath( @@ -277,13 +275,20 @@ void InitializeFromFilesIfNeeded(base::OnceClosure callback); bool did_initialize_from_files_{false}; - using GetOrCreateDefaultBucketCallback = base::OnceCallback<void( + using DidGetBucketLocatorCallback = base::OnceCallback<void( const absl::optional<storage::BucketLocator>& bucket_locator)>; + // This function provides an easy way to wrap the common operation: find // bucket in `storage_key_to_bucket_locator_` if it exists, otherwise look // it up in the `quota_manager_proxy_`, cache it, and then run the callback. void GetOrCreateDefaultBucket(const blink::StorageKey& storage_key, - GetOrCreateDefaultBucketCallback callback); + DidGetBucketLocatorCallback callback); + + // This function provides an easy way to wrap the common operation: find + // bucket in `bucket_id_to_bucket_locator_` if it exists, otherwise look + // it up in the `quota_manager_proxy_`, cache it, and then run the callback. + void GetBucketById(const storage::BucketId& bucket_id, + DidGetBucketLocatorCallback callback); // TODO(crbug.com/1315371): We need a way to map the StorageKey to a single // valid BucketLocator for legacy API purposes. This member should be removed @@ -291,6 +296,9 @@ std::map<blink::StorageKey, storage::BucketLocator> storage_key_to_bucket_locator_; + std::map<storage::BucketId, storage::BucketLocator> + bucket_id_to_bucket_locator_; + const scoped_refptr<base::SequencedTaskRunner> idb_task_runner_; IndexedDBDispatcherHost dispatcher_host_;
diff --git a/content/browser/indexed_db/indexed_db_factory_impl.h b/content/browser/indexed_db/indexed_db_factory_impl.h index 1d34d48..7fa7e6a 100644 --- a/content/browser/indexed_db/indexed_db_factory_impl.h +++ b/content/browser/indexed_db/indexed_db_factory_impl.h
@@ -170,26 +170,16 @@ scoped_refptr<base::SequencedTaskRunner> idb_task_runner); private: - friend class IndexedDBBrowserTest; - friend class IndexedDBBucketState; - - FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, - BackingStoreReleasedOnForcedClose); - FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, - BackingStoreReleaseDelayedOnClose); - FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, BackingStoreRunPreCloseTasks); - FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, - BackingStoreCloseImmediatelySwitch); FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, BackingStoreNoSweeping); FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, DatabaseFailedOpen); FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, DeleteDatabaseClosesBackingStore); FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, ForceCloseReleasesBackingStore); - FRIEND_TEST_ALL_PREFIXES(IndexedDBFactoryTest, - GetDatabaseNamesClosesBackingStore); FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, - ForceCloseOpenDatabasesOnCommitFailure); + ForceCloseOpenDatabasesOnCommitFailureFirstParty); + FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, + ForceCloseOpenDatabasesOnCommitFailureThirdParty); // `path_base` is the directory that will contain the database directory, the // blob directory, and any data loss info. `database_path` is the directory
diff --git a/content/browser/indexed_db/indexed_db_leveldb_operations.cc b/content/browser/indexed_db/indexed_db_leveldb_operations.cc index a4adb26..45b83a8 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_operations.cc +++ b/content/browser/indexed_db/indexed_db_leveldb_operations.cc
@@ -16,6 +16,7 @@ #include "components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_iterator.h" #include "components/services/storage/indexed_db/transactional_leveldb/transactional_leveldb_transaction.h" #include "components/services/storage/public/cpp/buckets/bucket_locator.h" +#include "components/services/storage/public/cpp/constants.h" #include "content/browser/indexed_db/indexed_db_data_format_version.h" #include "content/browser/indexed_db/indexed_db_data_loss_info.h" #include "content/browser/indexed_db/indexed_db_leveldb_env.h" @@ -50,6 +51,8 @@ const base::FilePath::CharType kBlobExtension[] = FILE_PATH_LITERAL(".blob"); const base::FilePath::CharType kIndexedDBExtension[] = FILE_PATH_LITERAL(".indexeddb"); +const base::FilePath::CharType kIndexedDBFile[] = + FILE_PATH_LITERAL("indexeddb"); const base::FilePath::CharType kLevelDBExtension[] = FILE_PATH_LITERAL(".leveldb"); @@ -67,11 +70,11 @@ .AddExtension(kBlobExtension); } else { // Third-party blob files are stored at: - // {{third_party_data_path}}/indexeddb.blob - // TODO(crbug.com/1218100): Support the correct third-party blob path. + // {{third_party_data_path}}/{{bucket_id}}/IndexedDB/indexeddb.blob return base::FilePath() - .AppendASCII(storage::GetIdentifierFromOrigin(url::Origin())) - .AddExtension(kIndexedDBExtension) + .AppendASCII(base::NumberToString(bucket_locator.id.GetUnsafeValue())) + .Append(storage::kIndexedDbDirectory) + .Append(kIndexedDBFile) .AddExtension(kBlobExtension); } } @@ -83,6 +86,7 @@ if (bucket_locator.storage_key.IsFirstPartyContext()) { // First-party leveldb files, for legacy reasons, are stored at: // {{first_party_data_path}}/{{serialized_origin}}.indexeddb.leveldb + // TODO(crbug.com/1315371): Migrate all first party buckets to the new path. return base::FilePath() .AppendASCII(storage::GetIdentifierFromOrigin( bucket_locator.storage_key.origin())) @@ -90,11 +94,12 @@ .AddExtension(kLevelDBExtension); } else { // Third-party leveldb files are stored at: - // {{unique_bucket_path}}/indexeddb.leveldb - // TODO(crbug.com/1218100): Support the correct third-party leveldb path. + // {{third_party_data_path}}/{{bucket_id}}/IndexedDB/indexeddb.leveldb + // TODO(crbug.com/1315371): Use QuotaManagerProxy::GetClientBucketPath. return base::FilePath() - .AppendASCII(storage::GetIdentifierFromOrigin(url::Origin())) - .AddExtension(kIndexedDBExtension) + .AppendASCII(base::NumberToString(bucket_locator.id.GetUnsafeValue())) + .Append(storage::kIndexedDbDirectory) + .Append(kIndexedDBFile) .AddExtension(kLevelDBExtension); } }
diff --git a/content/browser/indexed_db/indexed_db_leveldb_operations.h b/content/browser/indexed_db/indexed_db_leveldb_operations.h index c6c9f40..26c0f3c4 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_operations.h +++ b/content/browser/indexed_db/indexed_db_leveldb_operations.h
@@ -39,6 +39,7 @@ extern const base::FilePath::CharType kBlobExtension[]; extern const base::FilePath::CharType kIndexedDBExtension[]; +extern const base::FilePath::CharType kIndexedDBFile[]; extern const base::FilePath::CharType kLevelDBExtension[]; base::FilePath GetBlobStoreFileName(
diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc index e592c92..7d1b8da 100644 --- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc +++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
@@ -16,6 +16,7 @@ #include "base/memory/scoped_refptr.h" #include "base/run_loop.h" #include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/test/test_future.h" #include "base/threading/sequenced_task_runner_handle.h" @@ -30,6 +31,7 @@ #include "storage/browser/test/mock_special_storage_policy.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/storage_key/storage_key.h" #include "third_party/blink/public/mojom/quota/quota_types.mojom.h" #include "url/origin.h" @@ -43,17 +45,32 @@ namespace content { // Base class for our test fixtures. -class IndexedDBQuotaClientTest : public testing::Test { +class IndexedDBQuotaClientTest : public testing::Test, + public testing::WithParamInterface<bool> { public: - const StorageKey kStorageKeyA; - const StorageKey kStorageKeyB; + const StorageKey kStorageKeyFirstPartyA; + const StorageKey kStorageKeyFirstPartyB; + StorageKey kStorageKeyThirdPartyA; + StorageKey kStorageKeyThirdPartyB; IndexedDBQuotaClientTest() - : kStorageKeyA(StorageKey::CreateFromStringForTesting("http://host")), - kStorageKeyB( + : kStorageKeyFirstPartyA( + StorageKey::CreateFromStringForTesting("http://host")), + kStorageKeyFirstPartyB( StorageKey::CreateFromStringForTesting("http://host:8000")), special_storage_policy_( base::MakeRefCounted<storage::MockSpecialStoragePolicy>()) { + scoped_feature_list_.InitWithFeatureState( + blink::features::kThirdPartyStoragePartitioning, + IsThirdPartyStoragePartitioningEnabled()); + // This cannot be created above as the kThirdPartyStoragePartitioning must + // be set. + kStorageKeyThirdPartyA = + StorageKey(url::Origin::Create(GURL("http://host")), + url::Origin::Create(GURL("http://other"))); + kStorageKeyThirdPartyB = + StorageKey(url::Origin::Create(GURL("http://host:8000")), + url::Origin::Create(GURL("http://other"))); CreateTempDir(); quota_manager_ = base::MakeRefCounted<storage::MockQuotaManager>( /*in_memory=*/false, temp_dir_.GetPath(), @@ -177,8 +194,11 @@ return bucket->ToBucketLocator(); } + bool IsThirdPartyStoragePartitioningEnabled() { return GetParam(); } + protected: scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_; + base::test::ScopedFeatureList scoped_feature_list_; base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; @@ -188,39 +208,106 @@ base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_{this}; }; -TEST_F(IndexedDBQuotaClientTest, GetBucketUsage) { +INSTANTIATE_TEST_SUITE_P( + /* no prefix */, + IndexedDBQuotaClientTest, + testing::Bool()); + +TEST_P(IndexedDBQuotaClientTest, GetBucketUsageFirstParty) { IndexedDBQuotaClient client(*idb_context()); - AddFakeIndexedDB(kStorageKeyA, 6); - AddFakeIndexedDB(kStorageKeyB, 3); - auto bucket_a = GetBucket(kStorageKeyA, storage::kDefaultBucketName); - auto bucket_b = GetBucket(kStorageKeyB, storage::kDefaultBucketName); + AddFakeIndexedDB(kStorageKeyFirstPartyA, 6); + AddFakeIndexedDB(kStorageKeyFirstPartyB, 3); + auto bucket_a = + GetBucket(kStorageKeyFirstPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyFirstPartyB, storage::kDefaultBucketName); EXPECT_EQ(6, GetBucketUsage(client, bucket_a)); EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); - AddFakeIndexedDB(kStorageKeyA, 1000); + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); } -TEST_F(IndexedDBQuotaClientTest, GetStorageKeysForType) { +TEST_P(IndexedDBQuotaClientTest, GetBucketUsageThirdParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyThirdPartyA, 6); + AddFakeIndexedDB(kStorageKeyThirdPartyB, 3); + auto bucket_a = + GetBucket(kStorageKeyThirdPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyThirdPartyB, storage::kDefaultBucketName); + EXPECT_EQ(6, GetBucketUsage(client, bucket_a)); + EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); + + AddFakeIndexedDB(kStorageKeyThirdPartyA, 1000); + EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); + EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); +} + +TEST_P(IndexedDBQuotaClientTest, GetBucketUsageMixedParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyFirstPartyA, 6); + AddFakeIndexedDB(kStorageKeyThirdPartyA, 3); + auto bucket_a = + GetBucket(kStorageKeyFirstPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyThirdPartyA, storage::kDefaultBucketName); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_NE(bucket_a, bucket_b); + } else { + EXPECT_EQ(bucket_a, bucket_b); + } + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_EQ(6, GetBucketUsage(client, bucket_a)); + } else { + EXPECT_EQ(3, GetBucketUsage(client, bucket_a)); + } + EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); + + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); + EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_EQ(3, GetBucketUsage(client, bucket_b)); + } else { + EXPECT_EQ(1000, GetBucketUsage(client, bucket_b)); + } +} + +TEST_P(IndexedDBQuotaClientTest, GetStorageKeysForTypeFirstParty) { IndexedDBQuotaClient client(*idb_context()); EXPECT_TRUE(GetStorageKeysForType(client, kTemp).empty()); - AddFakeIndexedDB(kStorageKeyA, 1000); + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); std::vector<StorageKey> storage_keys = GetStorageKeysForType(client, kTemp); EXPECT_EQ(storage_keys.size(), 1ul); - EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyA)); + EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyFirstPartyA)); } -TEST_F(IndexedDBQuotaClientTest, DeleteBucket) { +TEST_P(IndexedDBQuotaClientTest, GetStorageKeysForTypeThirdParty) { IndexedDBQuotaClient client(*idb_context()); - AddFakeIndexedDB(kStorageKeyA, 1000); - AddFakeIndexedDB(kStorageKeyB, 50); - auto bucket_a = GetBucket(kStorageKeyA, storage::kDefaultBucketName); - auto bucket_b = GetBucket(kStorageKeyB, storage::kDefaultBucketName); + EXPECT_TRUE(GetStorageKeysForType(client, kTemp).empty()); + + AddFakeIndexedDB(kStorageKeyThirdPartyA, 1000); + std::vector<StorageKey> storage_keys = GetStorageKeysForType(client, kTemp); + EXPECT_EQ(storage_keys.size(), 1ul); + EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyThirdPartyA)); +} + +TEST_P(IndexedDBQuotaClientTest, DeleteBucketFirstParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); + AddFakeIndexedDB(kStorageKeyFirstPartyB, 50); + auto bucket_a = + GetBucket(kStorageKeyFirstPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyFirstPartyB, storage::kDefaultBucketName); EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); @@ -231,9 +318,60 @@ EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); } -TEST_F(IndexedDBQuotaClientTest, NonDefaultBucket) { +TEST_P(IndexedDBQuotaClientTest, DeleteBucketThirdParty) { IndexedDBQuotaClient client(*idb_context()); - auto bucket = GetOrCreateBucket(kStorageKeyA, "logs_bucket"); + + AddFakeIndexedDB(kStorageKeyThirdPartyA, 1000); + AddFakeIndexedDB(kStorageKeyThirdPartyB, 50); + auto bucket_a = + GetBucket(kStorageKeyThirdPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyThirdPartyB, storage::kDefaultBucketName); + EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); + EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); + + blink::mojom::QuotaStatusCode delete_status = + DeleteBucketData(client, bucket_a); + EXPECT_EQ(blink::mojom::QuotaStatusCode::kOk, delete_status); + EXPECT_EQ(0, GetBucketUsage(client, bucket_a)); + EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); +} + +TEST_P(IndexedDBQuotaClientTest, DeleteBucketMixedParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); + AddFakeIndexedDB(kStorageKeyThirdPartyA, 50); + auto bucket_a = + GetBucket(kStorageKeyFirstPartyA, storage::kDefaultBucketName); + auto bucket_b = + GetBucket(kStorageKeyThirdPartyA, storage::kDefaultBucketName); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_NE(bucket_a, bucket_b); + } else { + EXPECT_EQ(bucket_a, bucket_b); + } + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_EQ(1000, GetBucketUsage(client, bucket_a)); + } else { + EXPECT_EQ(50, GetBucketUsage(client, bucket_a)); + } + EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); + + blink::mojom::QuotaStatusCode delete_status = + DeleteBucketData(client, bucket_a); + EXPECT_EQ(blink::mojom::QuotaStatusCode::kOk, delete_status); + EXPECT_EQ(0, GetBucketUsage(client, bucket_a)); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_EQ(50, GetBucketUsage(client, bucket_b)); + } else { + EXPECT_EQ(0, GetBucketUsage(client, bucket_b)); + } +} + +TEST_P(IndexedDBQuotaClientTest, NonDefaultBucketFirstParty) { + IndexedDBQuotaClient client(*idb_context()); + auto bucket = GetOrCreateBucket(kStorageKeyFirstPartyA, "logs_bucket"); ASSERT_FALSE(bucket.is_default); EXPECT_EQ(0, GetBucketUsage(client, bucket)); @@ -242,19 +380,64 @@ EXPECT_EQ(blink::mojom::QuotaStatusCode::kOk, delete_status); } -TEST_F(IndexedDBQuotaClientTest, GetStorageKeyUsageForNonexistentKey) { +TEST_P(IndexedDBQuotaClientTest, NonDefaultBucketThirdParty) { + IndexedDBQuotaClient client(*idb_context()); + auto bucket = GetOrCreateBucket(kStorageKeyThirdPartyA, "logs_bucket"); + ASSERT_FALSE(bucket.is_default); + + EXPECT_EQ(0, GetBucketUsage(client, bucket)); + blink::mojom::QuotaStatusCode delete_status = + DeleteBucketData(client, bucket); + EXPECT_EQ(blink::mojom::QuotaStatusCode::kOk, delete_status); +} + +TEST_P(IndexedDBQuotaClientTest, + GetStorageKeyUsageForNonexistentKeyFirstParty) { IndexedDBQuotaClient client(*idb_context()); - AddFakeIndexedDB(kStorageKeyA, 1000); + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); std::vector<StorageKey> storage_keys = GetStorageKeysForType(client, kTemp); EXPECT_EQ(storage_keys.size(), 1ul); - EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyA)); + EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyFirstPartyA)); - auto bucket_b = GetOrCreateBucket(kStorageKeyB, storage::kDefaultBucketName); + auto bucket_b = + GetOrCreateBucket(kStorageKeyFirstPartyB, storage::kDefaultBucketName); EXPECT_EQ(0, GetBucketUsage(client, bucket_b)); } -TEST_F(IndexedDBQuotaClientTest, IncognitoQuota) { +TEST_P(IndexedDBQuotaClientTest, + GetStorageKeyUsageForNonexistentKeyThirdParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyThirdPartyA, 1000); + std::vector<StorageKey> storage_keys = GetStorageKeysForType(client, kTemp); + EXPECT_EQ(storage_keys.size(), 1ul); + EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyThirdPartyA)); + + auto bucket_b = + GetOrCreateBucket(kStorageKeyThirdPartyB, storage::kDefaultBucketName); + EXPECT_EQ(0, GetBucketUsage(client, bucket_b)); +} + +TEST_P(IndexedDBQuotaClientTest, + GetStorageKeyUsageForNonexistentKeyMixedParty) { + IndexedDBQuotaClient client(*idb_context()); + + AddFakeIndexedDB(kStorageKeyFirstPartyA, 1000); + std::vector<StorageKey> storage_keys = GetStorageKeysForType(client, kTemp); + EXPECT_EQ(storage_keys.size(), 1ul); + EXPECT_THAT(storage_keys, testing::Contains(kStorageKeyFirstPartyA)); + + auto bucket_b = + GetOrCreateBucket(kStorageKeyThirdPartyA, storage::kDefaultBucketName); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_EQ(0, GetBucketUsage(client, bucket_b)); + } else { + EXPECT_EQ(1000, GetBucketUsage(client, bucket_b)); + } +} + +TEST_P(IndexedDBQuotaClientTest, IncognitoQuotaFirstParty) { auto quota_manager = base::MakeRefCounted<storage::MockQuotaManager>( /*in_memory=*/true, base::FilePath(), base::ThreadTaskRunnerHandle::Get(), special_storage_policy_); @@ -271,7 +454,35 @@ base::test::TestFuture<storage::QuotaErrorOr<storage::BucketInfo>> bucket_future; - quota_manager->CreateBucketForTesting(kStorageKeyA, + quota_manager->CreateBucketForTesting(kStorageKeyFirstPartyA, + storage::kDefaultBucketName, kTemp, + bucket_future.GetCallback()); + auto bucket_a = bucket_future.Take(); + EXPECT_TRUE(bucket_a.ok()); + + // No FakeIndexDB is added. + EXPECT_TRUE(GetStorageKeysForType(client, kTemp).empty()); + EXPECT_EQ(0, GetBucketUsage(client, bucket_a->ToBucketLocator())); +} + +TEST_P(IndexedDBQuotaClientTest, IncognitoQuotaThirdParty) { + auto quota_manager = base::MakeRefCounted<storage::MockQuotaManager>( + /*in_memory=*/true, base::FilePath(), base::ThreadTaskRunnerHandle::Get(), + special_storage_policy_); + auto incognito_idb_context = base::MakeRefCounted<IndexedDBContextImpl>( + base::FilePath(), quota_manager->proxy(), + base::DefaultClock::GetInstance(), + /*blob_storage_context=*/mojo::NullRemote(), + /*file_system_access_context=*/mojo::NullRemote(), + base::SequencedTaskRunnerHandle::Get(), + base::SequencedTaskRunnerHandle::Get()); + base::RunLoop().RunUntilIdle(); + + IndexedDBQuotaClient client(*incognito_idb_context.get()); + + base::test::TestFuture<storage::QuotaErrorOr<storage::BucketInfo>> + bucket_future; + quota_manager->CreateBucketForTesting(kStorageKeyThirdPartyA, storage::kDefaultBucketName, kTemp, bucket_future.GetCallback()); auto bucket_a = bucket_future.Take();
diff --git a/content/browser/indexed_db/indexed_db_unittest.cc b/content/browser/indexed_db/indexed_db_unittest.cc index eee1411..7c22062 100644 --- a/content/browser/indexed_db/indexed_db_unittest.cc +++ b/content/browser/indexed_db/indexed_db_unittest.cc
@@ -11,6 +11,7 @@ #include "base/memory/raw_ptr.h" #include "base/run_loop.h" #include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/default_clock.h" @@ -31,6 +32,7 @@ #include "storage/browser/test/mock_quota_manager_proxy.h" #include "storage/browser/test/mock_special_storage_policy.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/storage_key/storage_key.h" using blink::IndexedDBDatabaseMetadata; @@ -78,19 +80,20 @@ } // namespace -class IndexedDBTest : public testing::Test { +class IndexedDBTest : public testing::Test, + public testing::WithParamInterface<bool> { public: - const blink::StorageKey kNormalStorageKey; - mutable storage::BucketLocator kNormalBucketLocator; - const blink::StorageKey kSessionOnlyStorageKey; - mutable storage::BucketLocator kSessionOnlyBucketLocator; + blink::StorageKey kNormalFirstPartyStorageKey; + storage::BucketLocator kNormalFirstPartyBucketLocator; + blink::StorageKey kSessionOnlyFirstPartyStorageKey; + storage::BucketLocator kSessionOnlyFirstPartyBucketLocator; + blink::StorageKey kNormalThirdPartyStorageKey; + storage::BucketLocator kNormalThirdPartyBucketLocator; + blink::StorageKey kSessionOnlyThirdPartyStorageKey; + storage::BucketLocator kSessionOnlyThirdPartyBucketLocator; IndexedDBTest() - : kNormalStorageKey( - blink::StorageKey::CreateFromStringForTesting("http://normal/")), - kSessionOnlyStorageKey(blink::StorageKey::CreateFromStringForTesting( - "http://session-only/")), - quota_manager_proxy_( + : quota_manager_proxy_( base::MakeRefCounted<storage::MockQuotaManagerProxy>( nullptr, base::SequencedTaskRunnerHandle::Get())), @@ -102,17 +105,50 @@ /*file_system_access_context=*/mojo::NullRemote(), base::SequencedTaskRunnerHandle::Get(), base::SequencedTaskRunnerHandle::Get())) { - kNormalBucketLocator = storage::BucketLocator(); - kNormalBucketLocator.storage_key = kNormalStorageKey; + scoped_feature_list_.InitWithFeatureState( + blink::features::kThirdPartyStoragePartitioning, + IsThirdPartyStoragePartitioningEnabled()); + kNormalFirstPartyStorageKey = + blink::StorageKey::CreateFromStringForTesting("http://normal/"); + kNormalFirstPartyBucketLocator = storage::BucketLocator(); + kNormalFirstPartyBucketLocator.id = storage::BucketId::FromUnsafeValue(1); + kNormalFirstPartyBucketLocator.storage_key = kNormalFirstPartyStorageKey; context()->RegisterBucketLocatorToSkipQuotaLookupForTesting( - kNormalBucketLocator); - kSessionOnlyBucketLocator = storage::BucketLocator(); - kSessionOnlyBucketLocator.storage_key = kSessionOnlyStorageKey; + kNormalFirstPartyBucketLocator); + kSessionOnlyFirstPartyStorageKey = + blink::StorageKey::CreateFromStringForTesting("http://session-only/"); + kSessionOnlyFirstPartyBucketLocator = storage::BucketLocator(); + kSessionOnlyFirstPartyBucketLocator.id = + storage::BucketId::FromUnsafeValue(2); + kSessionOnlyFirstPartyBucketLocator.storage_key = + kSessionOnlyFirstPartyStorageKey; context()->RegisterBucketLocatorToSkipQuotaLookupForTesting( - kSessionOnlyBucketLocator); + kSessionOnlyFirstPartyBucketLocator); + kNormalThirdPartyStorageKey = + blink::StorageKey(url::Origin::Create(GURL("http://normal/")), + url::Origin::Create(GURL("http://rando/"))); + kNormalThirdPartyBucketLocator = storage::BucketLocator(); + kNormalThirdPartyBucketLocator.id = storage::BucketId::FromUnsafeValue(3); + kNormalThirdPartyBucketLocator.storage_key = kNormalThirdPartyStorageKey; + context()->RegisterBucketLocatorToSkipQuotaLookupForTesting( + kNormalThirdPartyBucketLocator); + kSessionOnlyThirdPartyStorageKey = + blink::StorageKey(url::Origin::Create(GURL("http://session-only/")), + url::Origin::Create(GURL("http://rando/"))); + kSessionOnlyThirdPartyBucketLocator = storage::BucketLocator(); + kSessionOnlyThirdPartyBucketLocator.id = + storage::BucketId::FromUnsafeValue(4); + kSessionOnlyThirdPartyBucketLocator.storage_key = + kSessionOnlyThirdPartyStorageKey; + context()->RegisterBucketLocatorToSkipQuotaLookupForTesting( + kSessionOnlyThirdPartyBucketLocator); std::vector<storage::mojom::StoragePolicyUpdatePtr> policy_updates; policy_updates.emplace_back(storage::mojom::StoragePolicyUpdate::New( - kSessionOnlyStorageKey.origin(), /*should_purge_on_shutdown=*/true)); + kSessionOnlyFirstPartyStorageKey.origin(), + /*should_purge_on_shutdown=*/true)); + policy_updates.emplace_back(storage::mojom::StoragePolicyUpdate::New( + kSessionOnlyThirdPartyStorageKey.origin(), + /*should_purge_on_shutdown=*/true)); context_->ApplyPolicyUpdates(std::move(policy_updates)); } @@ -168,8 +204,11 @@ return path; } + bool IsThirdPartyStoragePartitioningEnabled() { return GetParam(); } + protected: IndexedDBContextImpl* context() const { return context_.get(); } + base::test::ScopedFeatureList scoped_feature_list_; base::test::TaskEnvironment task_environment_; base::ScopedTempDir temp_dir_; @@ -177,35 +216,83 @@ scoped_refptr<IndexedDBContextImpl> context_; }; -TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { - base::FilePath normal_path; - base::FilePath session_only_path; +INSTANTIATE_TEST_SUITE_P( + /* no prefix */, + IndexedDBTest, + testing::Bool()); - normal_path = GetFilePathForTesting(kNormalBucketLocator); - session_only_path = GetFilePathForTesting(kSessionOnlyBucketLocator); - ASSERT_TRUE(base::CreateDirectory(normal_path)); - ASSERT_TRUE(base::CreateDirectory(session_only_path)); +TEST_P(IndexedDBTest, ClearSessionOnlyDatabases) { + base::FilePath normal_path_first_party; + base::FilePath session_only_path_first_party; + base::FilePath normal_path_third_party; + base::FilePath session_only_path_third_party; + + normal_path_first_party = + GetFilePathForTesting(kNormalFirstPartyBucketLocator); + session_only_path_first_party = + GetFilePathForTesting(kSessionOnlyFirstPartyBucketLocator); + normal_path_third_party = + GetFilePathForTesting(kNormalThirdPartyBucketLocator); + session_only_path_third_party = + GetFilePathForTesting(kSessionOnlyThirdPartyBucketLocator); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_NE(normal_path_first_party, normal_path_third_party); + EXPECT_NE(session_only_path_first_party, session_only_path_third_party); + } else { + EXPECT_EQ(normal_path_first_party, normal_path_third_party); + EXPECT_EQ(session_only_path_first_party, session_only_path_third_party); + } + + ASSERT_TRUE(base::CreateDirectory(normal_path_first_party)); + ASSERT_TRUE(base::CreateDirectory(session_only_path_first_party)); + ASSERT_TRUE(base::CreateDirectory(normal_path_third_party)); + ASSERT_TRUE(base::CreateDirectory(session_only_path_third_party)); base::RunLoop().RunUntilIdle(); context()->Shutdown(); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(base::DirectoryExists(normal_path)); - EXPECT_FALSE(base::DirectoryExists(session_only_path)); + EXPECT_TRUE(base::DirectoryExists(normal_path_first_party)); + EXPECT_FALSE(base::DirectoryExists(session_only_path_first_party)); + EXPECT_TRUE(base::DirectoryExists(normal_path_third_party)); + if (IsThirdPartyStoragePartitioningEnabled()) { + // TODO(https://crbug.com/1199077): Policy updates are per-origin. + EXPECT_TRUE(base::DirectoryExists(session_only_path_third_party)); + } else { + EXPECT_FALSE(base::DirectoryExists(session_only_path_third_party)); + } } -TEST_F(IndexedDBTest, SetForceKeepSessionState) { - base::FilePath normal_path; - base::FilePath session_only_path; +TEST_P(IndexedDBTest, SetForceKeepSessionState) { + base::FilePath normal_path_first_party; + base::FilePath session_only_path_first_party; + base::FilePath normal_path_third_party; + base::FilePath session_only_path_third_party; // Save session state. This should bypass the destruction-time deletion. context()->SetForceKeepSessionState(); - normal_path = GetFilePathForTesting(kNormalBucketLocator); - session_only_path = GetFilePathForTesting(kSessionOnlyBucketLocator); - ASSERT_TRUE(base::CreateDirectory(normal_path)); - ASSERT_TRUE(base::CreateDirectory(session_only_path)); + normal_path_first_party = + GetFilePathForTesting(kNormalFirstPartyBucketLocator); + session_only_path_first_party = + GetFilePathForTesting(kSessionOnlyFirstPartyBucketLocator); + normal_path_third_party = + GetFilePathForTesting(kNormalThirdPartyBucketLocator); + session_only_path_third_party = + GetFilePathForTesting(kSessionOnlyThirdPartyBucketLocator); + if (IsThirdPartyStoragePartitioningEnabled()) { + EXPECT_NE(normal_path_first_party, normal_path_third_party); + EXPECT_NE(session_only_path_first_party, session_only_path_third_party); + } else { + EXPECT_EQ(normal_path_first_party, normal_path_third_party); + EXPECT_EQ(session_only_path_first_party, session_only_path_third_party); + } + + ASSERT_TRUE(base::CreateDirectory(normal_path_first_party)); + ASSERT_TRUE(base::CreateDirectory(session_only_path_first_party)); + ASSERT_TRUE(base::CreateDirectory(normal_path_third_party)); + ASSERT_TRUE(base::CreateDirectory(session_only_path_third_party)); base::RunLoop().RunUntilIdle(); context()->Shutdown(); @@ -213,8 +300,10 @@ base::RunLoop().RunUntilIdle(); // No data was cleared because of SetForceKeepSessionState. - EXPECT_TRUE(base::DirectoryExists(normal_path)); - EXPECT_TRUE(base::DirectoryExists(session_only_path)); + EXPECT_TRUE(base::DirectoryExists(normal_path_first_party)); + EXPECT_TRUE(base::DirectoryExists(session_only_path_first_party)); + EXPECT_TRUE(base::DirectoryExists(normal_path_third_party)); + EXPECT_TRUE(base::DirectoryExists(session_only_path_third_party)); } class ForceCloseDBCallbacks : public IndexedDBCallbacks { @@ -249,10 +338,11 @@ std::unique_ptr<IndexedDBConnection> connection_; }; -TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { +TEST_P(IndexedDBTest, ForceCloseOpenDatabasesOnDeleteFirstParty) { const blink::StorageKey kTestStorageKey = blink::StorageKey::CreateFromStringForTesting("http://test/"); auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); bucket_locator.storage_key = kTestStorageKey; auto open_db_callbacks = @@ -309,10 +399,73 @@ EXPECT_FALSE(base::DirectoryExists(test_path)); } -TEST_F(IndexedDBTest, DeleteFailsIfDirectoryLocked) { +TEST_P(IndexedDBTest, ForceCloseOpenDatabasesOnDeleteThirdParty) { + const blink::StorageKey kTestStorageKey = + blink::StorageKey(url::Origin::Create(GURL("http://test/")), + url::Origin::Create(GURL("http://rando/"))); + auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); + bucket_locator.storage_key = kTestStorageKey; + + auto open_db_callbacks = + base::MakeRefCounted<MockIndexedDBDatabaseCallbacks>(); + auto closed_db_callbacks = + base::MakeRefCounted<MockIndexedDBDatabaseCallbacks>(); + auto open_callbacks = + base::MakeRefCounted<ForceCloseDBCallbacks>(context(), bucket_locator); + auto closed_callbacks = + base::MakeRefCounted<ForceCloseDBCallbacks>(context(), bucket_locator); + base::FilePath test_path = GetFilePathForTesting(bucket_locator); + + const int64_t host_transaction_id = 0; + const int64_t version = 0; + + IndexedDBFactory* factory = context()->GetIDBFactory(); + + auto create_transaction_callback1 = + base::BindOnce(&CreateAndBindTransactionPlaceholder); + factory->Open(u"opendb", + std::make_unique<IndexedDBPendingConnection>( + open_callbacks, open_db_callbacks, host_transaction_id, + version, std::move(create_transaction_callback1)), + bucket_locator, context()->GetDataPath(bucket_locator)); + EXPECT_TRUE(base::DirectoryExists(test_path)); + + auto create_transaction_callback2 = + base::BindOnce(&CreateAndBindTransactionPlaceholder); + factory->Open(u"closeddb", + std::make_unique<IndexedDBPendingConnection>( + closed_callbacks, closed_db_callbacks, host_transaction_id, + version, std::move(create_transaction_callback2)), + bucket_locator, context()->GetDataPath(bucket_locator)); + RunPostedTasks(); + ASSERT_TRUE(closed_callbacks->connection()); + closed_callbacks->connection()->AbortTransactionsAndClose( + IndexedDBConnection::CloseErrorHandling::kAbortAllReturnLastError); + RunPostedTasks(); + + context()->ForceClose( + bucket_locator, + storage::mojom::ForceCloseReason::FORCE_CLOSE_DELETE_ORIGIN, + base::DoNothing()); + EXPECT_TRUE(open_db_callbacks->forced_close_called()); + EXPECT_FALSE(closed_db_callbacks->forced_close_called()); + + RunPostedTasks(); + + bool success = false; + storage::mojom::IndexedDBControlAsyncWaiter waiter(context()); + waiter.DeleteForBucket(kTestStorageKey, &success); + EXPECT_TRUE(success); + + EXPECT_FALSE(base::DirectoryExists(test_path)); +} + +TEST_P(IndexedDBTest, DeleteFailsIfDirectoryLockedFirstParty) { const blink::StorageKey kTestStorageKey = blink::StorageKey::CreateFromStringForTesting("http://test/"); auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); bucket_locator.storage_key = kTestStorageKey; context()->RegisterBucketLocatorToSkipQuotaLookupForTesting(bucket_locator); @@ -336,10 +489,80 @@ EXPECT_TRUE(base::DirectoryExists(test_path)); } -TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailure) { +TEST_P(IndexedDBTest, DeleteFailsIfDirectoryLockedThirdParty) { + const blink::StorageKey kTestStorageKey = + blink::StorageKey(url::Origin::Create(GURL("http://test/")), + url::Origin::Create(GURL("http://rando/"))); + auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); + bucket_locator.storage_key = kTestStorageKey; + context()->RegisterBucketLocatorToSkipQuotaLookupForTesting(bucket_locator); + + base::FilePath test_path = GetFilePathForTesting(bucket_locator); + ASSERT_TRUE(base::CreateDirectory(test_path)); + + auto lock = LockForTesting(test_path); + ASSERT_TRUE(lock); + + bool success = false; + base::RunLoop loop; + context()->IDBTaskRunner()->PostTask( + FROM_HERE, base::BindLambdaForTesting([&]() { + storage::mojom::IndexedDBControlAsyncWaiter waiter(context()); + waiter.DeleteForBucket(kTestStorageKey, &success); + loop.Quit(); + })); + loop.Run(); + EXPECT_FALSE(success); + + EXPECT_TRUE(base::DirectoryExists(test_path)); +} + +TEST_P(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailureFirstParty) { const blink::StorageKey kTestStorageKey = blink::StorageKey::CreateFromStringForTesting("http://test/"); auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); + bucket_locator.storage_key = kTestStorageKey; + + auto* factory = + static_cast<IndexedDBFactoryImpl*>(context()->GetIDBFactory()); + + const int64_t transaction_id = 1; + + auto callbacks = base::MakeRefCounted<MockIndexedDBCallbacks>(); + auto db_callbacks = base::MakeRefCounted<MockIndexedDBDatabaseCallbacks>(); + auto create_transaction_callback1 = + base::BindOnce(&CreateAndBindTransactionPlaceholder); + auto connection = std::make_unique<IndexedDBPendingConnection>( + callbacks, db_callbacks, transaction_id, + IndexedDBDatabaseMetadata::DEFAULT_VERSION, + std::move(create_transaction_callback1)); + factory->Open(u"db", std::move(connection), bucket_locator, + context()->GetDataPath(bucket_locator)); + RunPostedTasks(); + + ASSERT_TRUE(callbacks->connection()); + + // ConnectionOpened() is usually called by the dispatcher. + context()->ConnectionOpened(bucket_locator, callbacks->connection()); + + EXPECT_TRUE(factory->IsBackingStoreOpen(bucket_locator)); + + // Simulate the write failure. + leveldb::Status status = leveldb::Status::IOError("Simulated failure"); + factory->HandleBackingStoreFailure(bucket_locator); + + EXPECT_TRUE(db_callbacks->forced_close_called()); + EXPECT_FALSE(factory->IsBackingStoreOpen(bucket_locator)); +} + +TEST_P(IndexedDBTest, ForceCloseOpenDatabasesOnCommitFailureThirdParty) { + const blink::StorageKey kTestStorageKey = + blink::StorageKey(url::Origin::Create(GURL("http://test/")), + url::Origin::Create(GURL("http://rando/"))); + auto bucket_locator = storage::BucketLocator(); + bucket_locator.id = storage::BucketId::FromUnsafeValue(5); bucket_locator.storage_key = kTestStorageKey; auto* factory =
diff --git a/content/browser/keyboard_lock_browsertest.cc b/content/browser/keyboard_lock_browsertest.cc index 03b239c..fe093ce8 100644 --- a/content/browser/keyboard_lock_browsertest.cc +++ b/content/browser/keyboard_lock_browsertest.cc
@@ -108,7 +108,7 @@ void SimulateKeyPress(WebContents* web_contents, const std::string& code_string, const std::string& expected_result) { - DOMMessageQueue msg_queue; + DOMMessageQueue msg_queue(web_contents); std::string reply; ui::DomKey dom_key = ui::KeycodeConverter::KeyStringToDomKey(code_string); ui::DomCode dom_code = ui::KeycodeConverter::CodeStringToDomCode(code_string);
diff --git a/content/browser/message_port_provider_browsertest.cc b/content/browser/message_port_provider_browsertest.cc index 535e7db7..6af93109 100644 --- a/content/browser/message_port_provider_browsertest.cc +++ b/content/browser/message_port_provider_browsertest.cc
@@ -36,7 +36,7 @@ const std::string target_origin(url.DeprecatedGetOriginAsURL().spec()); const std::string source_origin("https://source.origin.com"); const std::string message("success"); - DOMMessageQueue msg_queue; + DOMMessageQueue msg_queue(shell()->web_contents()); MessagePortProvider::PostMessageToFrame( shell()->web_contents()->GetPrimaryPage(), base::UTF8ToUTF16(source_origin), base::UTF8ToUTF16(target_origin),
diff --git a/content/browser/permissions/permission_controller_impl.cc b/content/browser/permissions/permission_controller_impl.cc index 10b8257..2285af3 100644 --- a/content/browser/permissions/permission_controller_impl.cc +++ b/content/browser/permissions/permission_controller_impl.cc
@@ -247,14 +247,14 @@ const auto old_statuses = GetSubscriptionsStatuses(); devtools_permission_overrides_ = DevToolsPermissionOverrides(); - // If any statuses changed because they lost their overrides, the subscribers - // must be notified manually. - NotifyChangedSubscriptions(old_statuses); - PermissionControllerDelegate* delegate = browser_context_->GetPermissionControllerDelegate(); if (delegate) delegate->ResetPermissionOverridesForDevTools(); + + // If any statuses changed because they lost their overrides, the subscribers + // must be notified manually. + NotifyChangedSubscriptions(old_statuses); } void PermissionControllerImpl::UpdateDelegateOverridesForDevTools(
diff --git a/content/browser/renderer_host/blocked_scheme_navigation_browsertest.cc b/content/browser/renderer_host/blocked_scheme_navigation_browsertest.cc index 3626444..8812d97 100644 --- a/content/browser/renderer_host/blocked_scheme_navigation_browsertest.cc +++ b/content/browser/renderer_host/blocked_scheme_navigation_browsertest.cc
@@ -198,7 +198,7 @@ } void Navigate(const GURL& url) { - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(shell()->web_contents()); EXPECT_TRUE(NavigateToURL(shell(), url)); std::string message; while (message_queue.WaitForMessage(&message)) { @@ -264,7 +264,7 @@ // Adds an iframe to |rfh| pointing to |url|. void AddIFrame(RenderFrameHost* rfh, const GURL& url) { - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(rfh); const std::string javascript = base::StringPrintf( "f = document.createElement('iframe'); f.src = '%s';" "document.body.appendChild(f);",
diff --git a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc index ff4a1d8f..2a3518b4 100644 --- a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc
@@ -15326,7 +15326,7 @@ }); )")); - DOMMessageQueue message_queue; + DOMMessageQueue message_queue(shell()->web_contents()); std::vector<std::string> messages; std::string message; EXPECT_TRUE(NavigateToURL(shell(), hash_url));
diff --git a/content/browser/renderer_host/render_process_host_browsertest.cc b/content/browser/renderer_host/render_process_host_browsertest.cc index 268db21b..a99f047 100644 --- a/content/browser/renderer_host/render_process_host_browsertest.cc +++ b/content/browser/renderer_host/render_process_host_browsertest.cc
@@ -65,9 +65,11 @@ #include "third_party/blink/public/common/chrome_debug_urls.h" #if BUILDFLAG(IS_WIN) +#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/win/windows_version.h" #include "sandbox/policy/features.h" +#include "sandbox/policy/switches.h" #endif namespace content { @@ -1935,4 +1937,33 @@ EXPECT_EQ(0, rfh_deletion_observer.render_frame_host_iterator_count()); } +#if BUILDFLAG(IS_WIN) +IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ZeroExecutionTimes) { + // This test only works if the renderer process is sandboxed. + if (base::CommandLine::ForCurrentProcess()->HasSwitch( + sandbox::policy::switches::kNoSandbox)) { + return; + } + base::HistogramTester histogram_tester; + RenderProcessHost* process = RenderProcessHostImpl::CreateRenderProcessHost( + ShellContentBrowserClient::Get()->browser_context(), nullptr); + RenderProcessHostWatcher process_watcher( + process, RenderProcessHostWatcher::WATCH_FOR_PROCESS_READY); + process->Init(); + process_watcher.Wait(); + EXPECT_TRUE(process->IsReady()); + histogram_tester.ExpectUniqueSample( + "BrowserRenderProcessHost.SuspendedChild.UserExecutionRecorded", false, + 1); + histogram_tester.ExpectUniqueSample( + "BrowserRenderProcessHost.SuspendedChild.KernelExecutionRecorded", false, + 1); + histogram_tester.ExpectTotalCount( + "BrowserRenderProcessHost.SuspendedChild.Win32Error", 0); + histogram_tester.ExpectTotalCount( + "BrowserRenderProcessHost.SuspendedChild.NtStatus", 0); + process->Cleanup(); +} +#endif // BUILDFLAG(IS_WIN) + } // namespace content
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 9bb8160b3..43f0560 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -135,6 +135,7 @@ #include "content/common/content_switches_internal.h" #include "content/common/in_process_child_thread_params.h" #include "content/common/pseudonymization_salt.h" +#include "content/public/browser/browser_child_process_host.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_or_resource_context.h" #include "content/public/browser/browser_thread.h" @@ -1753,6 +1754,12 @@ std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate = std::make_unique<RendererSandboxedProcessLauncherDelegate>(); #endif + + auto file_data = std::make_unique<ChildProcessLauncherFileData>(); +#if BUILDFLAG(IS_POSIX) + file_data->files_to_preload = GetV8SnapshotFilesToPreload(); +#endif + // Spawn the child process asynchronously to avoid blocking the UI thread. // As long as there's no renderer prefix, we can use the zygote process // at this stage. @@ -1760,7 +1767,7 @@ std::move(sandbox_delegate), std::move(cmd_line), GetID(), this, std::move(mojo_invitation_), base::BindRepeating(&RenderProcessHostImpl::OnMojoError, id_), - GetV8SnapshotFilesToPreload()); + std::move(file_data)); channel_->Pause(); // In single process mode, browser-side tracing and memory will cover the
diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 9206c717..3b230e9 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc
@@ -571,7 +571,7 @@ } bool SetUpSourceSurface(const char* wait_message) override { - content::DOMMessageQueue message_queue; + content::DOMMessageQueue message_queue(shell()->web_contents()); EXPECT_TRUE(NavigateToURL(shell(), TestUrl())); if (wait_message != nullptr) { std::string result(wait_message);
diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc index e8d6ef9..2c4bd947 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
@@ -10,6 +10,12 @@ #include "content/public/common/content_client.h" #if BUILDFLAG(IS_WIN) +#include <windows.h> + +#include "base/check.h" +#include "base/metrics/histogram_functions.h" +#include "base/time/time.h" +#include "base/win/nt_status.h" #include "sandbox/policy/win/sandbox_win.h" #include "sandbox/win/src/sandbox_policy_base.h" #include "sandbox/win/src/security_level.h" @@ -104,6 +110,34 @@ policy, sandbox::mojom::Sandbox::kRenderer, flags); } +void RendererSandboxedProcessLauncherDelegateWin::PostSpawnTarget( + base::ProcessHandle process) { + FILETIME creation_time, exit_time, kernel_time, user_time; + // Should never fail. If it does, then something really bad has happened, such + // as something external unsuspending the renderer process. + if (!::GetProcessTimes(process, &creation_time, &exit_time, &kernel_time, + &user_time)) { + // If this fails, then Win32 ::GetLastError might be ambiguous, so obtain + // the NT status from the TEB. + base::UmaHistogramSparse( + "BrowserRenderProcessHost.SuspendedChild.Win32Error", ::GetLastError()); + base::UmaHistogramSparse("BrowserRenderProcessHost.SuspendedChild.NtStatus", + base::win::GetLastNtStatus()); + return; + } + + // These should always be zero but if they are not, then something on the + // client has triggered execution in the child process putting it into a + // undefined state. Try and detect this here to diagnose this happening in the + // wild. + base::UmaHistogramBoolean( + "BrowserRenderProcessHost.SuspendedChild.UserExecutionRecorded", + base::TimeDelta::FromFileTime(user_time).InMicroseconds() > 0); + base::UmaHistogramBoolean( + "BrowserRenderProcessHost.SuspendedChild.KernelExecutionRecorded", + base::TimeDelta::FromFileTime(kernel_time).InMicroseconds() > 0); +} + bool RendererSandboxedProcessLauncherDelegateWin::CetCompatible() { // Disable CET for renderer because v8 deoptimization swaps stacks in a // non-compliant way. CET can be enabled where the renderer is known to
diff --git a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h index 463df70..576a2c0 100644 --- a/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h +++ b/content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h
@@ -40,6 +40,7 @@ bool is_jit_disabled); bool PreSpawnTarget(sandbox::TargetPolicy* policy) override; + void PostSpawnTarget(base::ProcessHandle process) override; bool CetCompatible() override;
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index db2efb2..0d1b448 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -206,7 +206,7 @@ const std::string& reply_status) { // Subtle: msg_queue needs to be declared before the ExecuteScript below, or // else it might miss the message of interest. See https://crbug.com/518729. - DOMMessageQueue msg_queue; + DOMMessageQueue msg_queue(sender_ftn->current_frame_host()); EXPECT_EQ(true, EvalJs(sender_ftn, "(" + post_message_script + ");")); @@ -4512,7 +4512,7 @@ // The main frame should be focused. EXPECT_EQ(root, root->frame_tree()->GetFocusedFrame()); - DOMMessageQueue msg_queue; + DOMMessageQueue msg_queue(web_contents()); // Click on the cross-process subframe. SimulateMouseClick(
diff --git a/content/browser/site_per_process_hit_test_browsertest.cc b/content/browser/site_per_process_hit_test_browsertest.cc index 17d0e9a..cee82b2 100644 --- a/content/browser/site_per_process_hit_test_browsertest.cc +++ b/content/browser/site_per_process_hit_test_browsertest.cc
@@ -4516,7 +4516,7 @@ "scroll_div.addEventListener('scroll', scroll_handler);" "document.body.style.background = 'black';"; - content::DOMMessageQueue msg_queue; + content::DOMMessageQueue msg_queue(rfh); std::string reply; EXPECT_TRUE(ExecJs(rfh, script)); @@ -4544,7 +4544,7 @@ } void RunTest(gfx::Point pos, RenderWidgetHostViewBase* expected_target) { - content::DOMMessageQueue msg_queue; + content::DOMMessageQueue msg_queue(web_contents()); std::string reply; auto* rwhv_root = static_cast<RenderWidgetHostViewAura*>(
diff --git a/content/browser/site_per_process_unload_browsertest.cc b/content/browser/site_per_process_unload_browsertest.cc index e0c78a7..5c162253 100644 --- a/content/browser/site_per_process_unload_browsertest.cc +++ b/content/browser/site_per_process_unload_browsertest.cc
@@ -252,7 +252,11 @@ // Open a popup on b.com. The b.com subframe on the main frame will use this // in its unload handler. GURL b_url(embedded_test_server()->GetURL("b.com", "/title1.html")); - EXPECT_TRUE(OpenPopup(shell()->web_contents(), b_url, "popup")); + + // Save the WebContents instance created via the popup to be able to listen + // for messages that occur in it. + auto* popup_shell = OpenPopup(shell()->web_contents(), b_url, "popup"); + WebContents* popup_web_contents = popup_shell->web_contents(); // Add an unload handler to b.com subframe, which will look up the top // frame's origin and send it via domAutomationController. Unfortunately, @@ -268,7 +272,9 @@ // Navigate the main frame to c.com and wait for the message from the // subframe's unload handler. GURL c_url(embedded_test_server()->GetURL("c.com", "/title1.html")); - DOMMessageQueue msg_queue; + + // NOTE: The message occurs in the WebContents for the popup. + DOMMessageQueue msg_queue(popup_web_contents); EXPECT_TRUE(NavigateToURL(shell(), c_url)); std::string message, top_origin; while (msg_queue.WaitForMessage(&message)) {
diff --git a/content/browser/text_fragment_browsertest.cc b/content/browser/text_fragment_browsertest.cc index 8cdd0664..5c99f3a4 100644 --- a/content/browser/text_fragment_browsertest.cc +++ b/content/browser/text_fragment_browsertest.cc
@@ -734,7 +734,7 @@ frame_observer.WaitForScrollOffsetAtTop( /*expected_scroll_offset_at_top=*/false); - DOMMessageQueue msg_queue; + DOMMessageQueue msg_queue(main_contents); SimulateKeyPress(main_contents, ui::DomKey::TAB, ui::DomCode::TAB, ui::VKEY_TAB, false, false, false, false);
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc index ed3778ac..76f4fe8 100644 --- a/content/browser/utility_process_host.cc +++ b/content/browser/utility_process_host.cc
@@ -56,6 +56,13 @@ #include "media/capture/capture_switches.h" #endif +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "base/posix/global_descriptors.h" +#include "chromeos/startup/browser_init_params.h" +#include "chromeos/startup/startup_switches.h" // nogncheck +#include "content/public/common/content_descriptors.h" +#endif + namespace content { UtilityMainThreadFactoryFunction g_utility_main_thread_factory = nullptr; @@ -325,12 +332,32 @@ } #endif + auto file_data = std::make_unique<ChildProcessLauncherFileData>(); +#if BUILDFLAG(IS_POSIX) + file_data->files_to_preload = GetV8SnapshotFilesToPreload(); +#endif // BUILDFLAG(IS_POSIX) + +#if BUILDFLAG(IS_CHROMEOS_LACROS) + // Create the file descriptor for Cros startup data and pass it. + // This FD will be used to obtain BrowserInitParams in Utility process. + base::ScopedFD cros_startup_fd = + chromeos::BrowserInitParams::CreateStartupData(); + if (cros_startup_fd.is_valid()) { + constexpr int kStartupDataFD = + kCrosStartupDataDescriptor + base::GlobalDescriptors::kBaseDescriptor; + cmd_line->AppendSwitchASCII(chromeos::switches::kCrosStartupDataFD, + base::NumberToString(kStartupDataFD)); + file_data->additional_remapped_fds.emplace(kStartupDataFD, + std::move(cros_startup_fd)); + } +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) + std::unique_ptr<UtilitySandboxedProcessLauncherDelegate> delegate = std::make_unique<UtilitySandboxedProcessLauncherDelegate>( sandbox_type_, env_, *cmd_line); - process_->LaunchWithPreloadedFiles(std::move(delegate), std::move(cmd_line), - GetV8SnapshotFilesToPreload(), true); + process_->LaunchWithFileData(std::move(delegate), std::move(cmd_line), + std::move(file_data), true); } return true;
diff --git a/content/public/browser/browser_child_process_host.h b/content/public/browser/browser_child_process_host.h index 479d19a..66dcc01 100644 --- a/content/public/browser/browser_child_process_host.h +++ b/content/public/browser/browser_child_process_host.h
@@ -5,7 +5,6 @@ #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ -#include <map> #include <memory> #include <string> @@ -61,16 +60,6 @@ std::unique_ptr<base::CommandLine> cmd_line, bool terminate_on_shutdown) = 0; - // Same as above, but the process is launched with preloaded files from - // |files_to_preload| opened by the browser and passed as corresponding file - // descriptors in the child process. |files_to_preload| is currently ignored - // on platforms other than Linux and Android. - virtual void LaunchWithPreloadedFiles( - std::unique_ptr<SandboxedProcessLauncherDelegate> delegate, - std::unique_ptr<base::CommandLine> cmd_line, - std::map<std::string, base::FilePath> files_to_preload, - bool terminate_on_shutdown) = 0; - virtual const ChildProcessData& GetData() = 0; // Returns the ChildProcessHost object used by this object.
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index 28407e1..c4aa4bc4 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc
@@ -1972,7 +1972,7 @@ script.append("\n"); ExecuteScriptAsync(web_contents, script); - DOMMessageQueue message_queue; + DOMMessageQueue message_queue(web_contents); bool should_wait_flag = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kWaitForDebuggerWebUI);
diff --git a/ios/chrome/browser/ui/icons/action_icon.h b/ios/chrome/browser/ui/icons/action_icon.h index 17d34639..6e5f3e3 100644 --- a/ios/chrome/browser/ui/icons/action_icon.h +++ b/ios/chrome/browser/ui/icons/action_icon.h
@@ -14,6 +14,7 @@ extern NSString* kLinkActionSymbol; extern NSString* kQRCodeFinderActionSymbol; extern NSString* kNewTabActionSymbol; +extern NSString* kNewTabCircleActionSymbol; extern NSString* kClipboardActionSymbol; extern NSString* kDeleteActionSymbol; extern NSString* kEditActionSymbol; @@ -23,5 +24,9 @@ extern NSString* kCopyActionSymbol; extern NSString* kNewWindowActionSymbol; extern NSString* kHideActionSymbol; +extern NSString* kRequestDesktopActionSymbol; +extern NSString* kRequestMobileActionSymbol; +extern NSString* kFindInPageActionSymbol; +extern NSString* kZoomTextActionSymbol; #endif // IOS_CHROME_BROWSER_UI_ICONS_ACTION_ICON_H_
diff --git a/ios/chrome/browser/ui/icons/action_icon.mm b/ios/chrome/browser/ui/icons/action_icon.mm index e1692576..bfa8a68a7 100644 --- a/ios/chrome/browser/ui/icons/action_icon.mm +++ b/ios/chrome/browser/ui/icons/action_icon.mm
@@ -13,6 +13,7 @@ NSString* kLinkActionSymbol = @"link"; NSString* kQRCodeFinderActionSymbol = @"qrcode.viewfinder"; NSString* kNewTabActionSymbol = @"plus.square"; +NSString* kNewTabCircleActionSymbol = @"plus.circle"; NSString* kClipboardActionSymbol = @"doc.on.clipboard"; NSString* kDeleteActionSymbol = @"trash"; NSString* kEditActionSymbol = @"pencil"; @@ -22,3 +23,7 @@ NSString* kCopyActionSymbol = @"doc.on.doc"; NSString* kNewWindowActionSymbol = @"square.split.2x1"; NSString* kHideActionSymbol = @"eye.slash"; +NSString* kRequestDesktopActionSymbol = @"desktopcomputer"; +NSString* kRequestMobileActionSymbol = @"iphone"; +NSString* kFindInPageActionSymbol = @"doc.text.magnifyingglass"; +NSString* kZoomTextActionSymbol = @"plus.magnifyingglass";
diff --git a/ios/chrome/browser/ui/icons/chrome_symbol.h b/ios/chrome/browser/ui/icons/chrome_symbol.h index 5fdec5f..1b453e2 100644 --- a/ios/chrome/browser/ui/icons/chrome_symbol.h +++ b/ios/chrome/browser/ui/icons/chrome_symbol.h
@@ -18,6 +18,7 @@ extern NSString* const kPlusCircleFillSymbol; extern NSString* const kArrowTriangleSlashCirclePathSymbol; extern NSString* const kPopupBadgeMinusSymbol; + // Default symbol names. extern NSString* const kCreditCardSymbol; extern NSString* const kMicrophoneFillSymbol; @@ -31,6 +32,8 @@ extern NSString* const kSearchSymbol; extern NSString* const kCheckmarkSymbol; extern NSString* const kArrowDownCircleFillSymbol; +extern NSString* const kWarningFillSymbol; +extern NSString* const kHelpFillSymbol; // Returns a SF symbol named |symbolName| configured with the given // |configuration|.
diff --git a/ios/chrome/browser/ui/icons/chrome_symbol.mm b/ios/chrome/browser/ui/icons/chrome_symbol.mm index 80845d6..53aef5f7 100644 --- a/ios/chrome/browser/ui/icons/chrome_symbol.mm +++ b/ios/chrome/browser/ui/icons/chrome_symbol.mm
@@ -70,6 +70,8 @@ NSString* const kSearchSymbol = @"magnifyingglass"; NSString* const kCheckmarkSymbol = @"checkmark"; NSString* const kArrowDownCircleFillSymbol = @"arrow.down.circle.fill"; +NSString* const kWarningFillSymbol = @"exclamationmark.triangle.fill"; +NSString* const kHelpFillSymbol = @"questionmark.circle"; UIImage* DefaultSymbolWithConfiguration(NSString* symbolName, UIImageConfiguration* configuration) {
diff --git a/ios/chrome/browser/ui/omnibox/BUILD.gn b/ios/chrome/browser/ui/omnibox/BUILD.gn index 3cb087b..38fb3e23 100644 --- a/ios/chrome/browser/ui/omnibox/BUILD.gn +++ b/ios/chrome/browser/ui/omnibox/BUILD.gn
@@ -103,7 +103,10 @@ "omnibox_icon_type.h", "omnibox_icon_type.mm", ] - deps = [ "//base" ] + deps = [ + "//base", + "//ios/chrome/browser/ui/icons:symbols", + ] } source_set("omnibox_internal") {
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_icon_type.mm b/ios/chrome/browser/ui/omnibox/omnibox_icon_type.mm index c810d89..0811d2b 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_icon_type.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_icon_type.mm
@@ -3,6 +3,7 @@ // found in the LICENSE file. #import "ios/chrome/browser/ui/omnibox/omnibox_icon_type.h" +#import "ios/chrome/browser/ui/icons/chrome_symbol.h" #include "base/notreached.h" @@ -15,7 +16,6 @@ // Specific symbol names for the location bar. NSString* kInfoLocationBarSymbol = @"info.circle.fill"; NSString* kSecureLocationBarSymbol = @"lock.fill"; -NSString* kNotSecureLocationBarSymbol = @"exclamationmark.triangle.fill"; } // namespace @@ -42,7 +42,7 @@ case SECURE: return kSecureLocationBarSymbol; case NOT_SECURE_WARNING: - return kNotSecureLocationBarSymbol; + return kWarningFillSymbol; case LOCATION_BAR_SECURITY_ICON_TYPE_COUNT: NOTREACHED(); return kInfoLocationBarSymbol;
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/BUILD.gn b/ios/chrome/browser/ui/popup_menu/overflow_menu/BUILD.gn index 4375fe4..fbe5c60 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/BUILD.gn +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/BUILD.gn
@@ -67,6 +67,8 @@ "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/default_promo:utils", "//ios/chrome/browser/ui/follow", + "//ios/chrome/browser/ui/icons:action_icons", + "//ios/chrome/browser/ui/icons:symbols", "//ios/chrome/browser/ui/popup_menu:constants", "//ios/chrome/browser/ui/popup_menu:metrics_protocols", "//ios/chrome/browser/ui/util",
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_footer.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_footer.swift index 5dae3b8..df7c225 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_footer.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_footer.swift
@@ -11,12 +11,12 @@ @Published public var link: String public init( - name: String, link: String, imageName: String, accessibilityIdentifier: String, + name: String, link: String, uiImage: UIImage, accessibilityIdentifier: String, handler: @escaping () -> Void ) { self.link = link super.init( - name: name, imageName: imageName, accessibilityIdentifier: accessibilityIdentifier, + name: name, uiImage: uiImage, accessibilityIdentifier: accessibilityIdentifier, enterpriseDisabled: false, handler: handler) }
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_item.swift b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_item.swift index ae202c3..f42dcda 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_item.swift +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_item.swift
@@ -9,12 +9,12 @@ /// The user-visible name of the item. @Published public var name: String - /// The name of the image used to load the image for SwiftUI. - @Published public var imageName: String + /// The UIImage used to load the image for SwiftUI. + @Published public var uiImage: UIImage /// The SwiftUI `Image` for the action icon. public var image: Image { - return Image(imageName) + return Image(uiImage: uiImage) } /// The accessibility identifier for this item. @@ -27,11 +27,11 @@ @Published public var handler: () -> Void public init( - name: String, imageName: String, accessibilityIdentifier: String, enterpriseDisabled: Bool, + name: String, uiImage: UIImage, accessibilityIdentifier: String, enterpriseDisabled: Bool, handler: @escaping () -> Void ) { self.name = name - self.imageName = imageName + self.uiImage = uiImage self.accessibilityIdentifier = accessibilityIdentifier self.enterpriseDisabled = enterpriseDisabled self.handler = handler
diff --git a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_mediator.mm b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_mediator.mm index 63968354..6bbf2bc 100644 --- a/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_mediator.mm +++ b/ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_mediator.mm
@@ -43,6 +43,8 @@ #import "ios/chrome/browser/ui/commands/text_zoom_commands.h" #import "ios/chrome/browser/ui/default_promo/default_browser_utils.h" #import "ios/chrome/browser/ui/follow/follow_web_page_urls.h" +#import "ios/chrome/browser/ui/icons/action_icon.h" +#import "ios/chrome/browser/ui/icons/chrome_symbol.h" #import "ios/chrome/browser/ui/popup_menu/overflow_menu/feature_flags.h" #import "ios/chrome/browser/ui/popup_menu/overflow_menu/overflow_menu_swift.h" #import "ios/chrome/browser/ui/popup_menu/popup_menu_constants.h" @@ -77,6 +79,9 @@ namespace { +// The size of overflow symbol images. +NSInteger kOverflowSymbolPointSize = 22; + enum class Destination { Bookmarks = 0, History = 1, @@ -96,7 +101,30 @@ Handler handler) { NSString* name = l10n_util::GetNSString(nameID); return [[OverflowMenuAction alloc] initWithName:name - imageName:imageName + uiImage:[UIImage imageNamed:imageName] + accessibilityIdentifier:accessibilityID + enterpriseDisabled:NO + handler:handler]; +} + +OverflowMenuAction* CreateOverflowMenuAction(int nameID, + NSString* symbolName, + bool systemSymbol, + NSString* accessibilityID, + Handler handler) { + DCHECK(UseSymbols()); + UIImageConfiguration* configuration = [UIImageSymbolConfiguration + configurationWithPointSize:kOverflowSymbolPointSize + weight:UIImageSymbolWeightLight + scale:UIImageSymbolScaleMedium]; + NSString* name = l10n_util::GetNSString(nameID); + UIImage* symbolImage = + [systemSymbol ? DefaultSymbolWithConfiguration(symbolName, configuration) + : CustomSymbolWithConfiguration(symbolName, configuration) + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + + return [[OverflowMenuAction alloc] initWithName:name + uiImage:symbolImage accessibilityIdentifier:accessibilityID enterpriseDisabled:NO handler:handler]; @@ -140,11 +168,12 @@ handler(); }; - return [[OverflowMenuDestination alloc] initWithName:name - imageName:imageName - accessibilityIdentifier:accessibilityID - enterpriseDisabled:NO - handler:handlerWithMetrics]; + return [[OverflowMenuDestination alloc] + initWithName:name + uiImage:[UIImage imageNamed:imageName] + accessibilityIdentifier:accessibilityID + enterpriseDisabled:NO + handler:handlerWithMetrics]; } OverflowMenuFooter* CreateOverflowMenuManagedFooter(int nameID, @@ -155,7 +184,7 @@ NSString* link = l10n_util::GetNSString(linkID); return [[OverflowMenuFooter alloc] initWithName:name link:link - imageName:imageName + uiImage:[UIImage imageNamed:imageName] accessibilityIdentifier:kTextMenuEnterpriseInfo handler:handler]; } @@ -442,11 +471,20 @@ [weakSelf openSiteInformation]; }); - self.reloadAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_RELOAD, - @"overflow_menu_action_reload", - kToolsMenuReload, ^{ - [weakSelf reload]; - }); + if (UseSymbols()) { + self.reloadAction = + CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_RELOAD, + kArrowClockWiseSymbol, NO, kToolsMenuReload, ^{ + [weakSelf reload]; + }); + } else { + self.reloadAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_RELOAD, + @"overflow_menu_action_reload", + kToolsMenuReload, ^{ + [weakSelf reload]; + }); + } + self.stopLoadAction = CreateOverflowMenuAction( IDS_IOS_TOOLS_MENU_STOP, @"overflow_menu_action_stop", kToolsMenuStop, ^{ [weakSelf stopLoading]; @@ -469,6 +507,223 @@ [weakSelf openNewWindow]; }); + [self logTranslateAvailability]; + + if (UseSymbols()) { + self.reloadAction = + CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_RELOAD, + kArrowClockWiseSymbol, NO, kToolsMenuReload, ^{ + [weakSelf reload]; + }); + + self.stopLoadAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_STOP, kXMarkSymbol, YES, kToolsMenuStop, ^{ + [weakSelf stopLoading]; + }); + + self.openTabAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_NEW_TAB, + kNewTabCircleActionSymbol, + YES, kToolsMenuNewTabId, ^{ + [weakSelf openTab]; + }); + + self.openIncognitoTabAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB, kIncognitoSymbol, NO, + kToolsMenuNewIncognitoTabId, ^{ + [weakSelf openIncognitoTab]; + }); + + self.openNewWindowAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_NEW_WINDOW, kNewWindowActionSymbol, YES, + kToolsMenuNewWindowId, ^{ + [weakSelf openNewWindow]; + }); + + self.followAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_FOLLOW, kPlusSymbol, YES, kToolsMenuFollow, ^{ + [weakSelf updateFollowStatus:YES]; + }); + + self.unfollowAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_UNFOLLOW, kXMarkSymbol, YES, kToolsMenuUnfollow, ^{ + [weakSelf updateFollowStatus:NO]; + }); + + self.addBookmarkAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_ADD_TO_BOOKMARKS, kAddBookmarkActionSymbol, YES, + kToolsMenuAddToBookmarks, ^{ + [weakSelf addOrEditBookmark]; + }); + + self.editBookmarkAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_EDIT_BOOKMARK, kEditActionSymbol, YES, + kToolsMenuEditBookmark, ^{ + [weakSelf addOrEditBookmark]; + }); + + self.readLaterAction = CreateOverflowMenuAction( + IDS_IOS_CONTENT_CONTEXT_ADDTOREADINGLIST, kReadLaterActionSymbol, YES, + kToolsMenuReadLater, ^{ + [weakSelf addToReadingList]; + }); + + self.translateAction = + CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_TRANSLATE, kTranslateSymbol, + NO, kToolsMenuTranslateId, ^{ + [weakSelf translatePage]; + }); + + self.requestDesktopAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE, kRequestDesktopActionSymbol, + YES, kToolsMenuRequestDesktopId, ^{ + [weakSelf requestDesktopSite]; + }); + + self.requestMobileAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE, kRequestMobileActionSymbol, YES, + kToolsMenuRequestMobileId, ^{ + [weakSelf requestMobileSite]; + }); + + self.findInPageAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, kFindInPageActionSymbol, YES, + kToolsMenuFindInPageId, ^{ + [weakSelf openFindInPage]; + }); + + self.textZoomAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_TEXT_ZOOM, + kZoomTextActionSymbol, YES, + kToolsMenuTextZoom, ^{ + [weakSelf openTextZoom]; + }); + self.settingsAction = + CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_SETTINGS, kGearShapeSymbol, + YES, kToolsMenuSettingsId, ^{ + [weakSelf openSettingsFromAction]; + }); + + self.reportIssueAction = CreateOverflowMenuAction( + IDS_IOS_OPTIONS_REPORT_AN_ISSUE, kWarningFillSymbol, YES, + kToolsMenuReportAnIssueId, ^{ + [weakSelf reportAnIssue]; + }); + + self.helpAction = + CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_HELP_MOBILE, + kHelpFillSymbol, YES, kToolsMenuHelpId, ^{ + [weakSelf openHelp]; + }); + + } else { + self.reloadAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_RELOAD, + @"overflow_menu_action_reload", + kToolsMenuReload, ^{ + [weakSelf reload]; + }); + + self.stopLoadAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_STOP, + @"overflow_menu_action_stop", + kToolsMenuStop, ^{ + [weakSelf stopLoading]; + }); + + self.openTabAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_NEW_TAB, @"overflow_menu_action_new_tab", + kToolsMenuNewTabId, ^{ + [weakSelf openTab]; + }); + + self.openIncognitoTabAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB, @"overflow_menu_action_incognito", + kToolsMenuNewIncognitoTabId, ^{ + [weakSelf openIncognitoTab]; + }); + + self.openNewWindowAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_NEW_WINDOW, @"overflow_menu_action_new_window", + kToolsMenuNewWindowId, ^{ + [weakSelf openNewWindow]; + }); + + self.followAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_FOLLOW, @"overflow_menu_action_follow", + kToolsMenuFollow, ^{ + [weakSelf updateFollowStatus:YES]; + }); + + self.unfollowAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_UNFOLLOW, @"overflow_menu_action_unfollow", + kToolsMenuUnfollow, ^{ + [weakSelf updateFollowStatus:NO]; + }); + + self.addBookmarkAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_ADD_TO_BOOKMARKS, @"overflow_menu_action_bookmark", + kToolsMenuAddToBookmarks, ^{ + [weakSelf addOrEditBookmark]; + }); + + self.editBookmarkAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_EDIT_BOOKMARK, @"overflow_menu_action_edit_bookmark", + kToolsMenuEditBookmark, ^{ + [weakSelf addOrEditBookmark]; + }); + + self.readLaterAction = CreateOverflowMenuAction( + IDS_IOS_CONTENT_CONTEXT_ADDTOREADINGLIST, + @"overflow_menu_action_read_later", kToolsMenuReadLater, ^{ + [weakSelf addToReadingList]; + }); + + self.translateAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_TRANSLATE, @"overflow_menu_action_translate", + kToolsMenuTranslateId, ^{ + [weakSelf translatePage]; + }); + + self.requestDesktopAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE, + @"overflow_menu_action_request_desktop", kToolsMenuRequestDesktopId, ^{ + [weakSelf requestDesktopSite]; + }); + + self.requestMobileAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE, + @"overflow_menu_action_request_mobile", kToolsMenuRequestMobileId, ^{ + [weakSelf requestMobileSite]; + }); + + self.findInPageAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, @"overflow_menu_action_find_in_page", + kToolsMenuFindInPageId, ^{ + [weakSelf openFindInPage]; + }); + + self.textZoomAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_TEXT_ZOOM, @"overflow_menu_action_text_zoom", + kToolsMenuTextZoom, ^{ + [weakSelf openTextZoom]; + }); + + self.settingsAction = CreateOverflowMenuAction( + IDS_IOS_TOOLS_MENU_SETTINGS, @"overflow_menu_action_settings", + kToolsMenuSettingsId, ^{ + [weakSelf openSettingsFromAction]; + }); + + self.reportIssueAction = CreateOverflowMenuAction( + IDS_IOS_OPTIONS_REPORT_AN_ISSUE, @"overflow_menu_action_report_issue", + kToolsMenuReportAnIssueId, ^{ + [weakSelf reportAnIssue]; + }); + + self.helpAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_HELP_MOBILE, + @"overflow_menu_action_help", + kToolsMenuHelpId, ^{ + [weakSelf openHelp]; + }); + } + // The app actions vary based on page state, so they are set in // |-updateModel|. self.appActionsGroup = @@ -476,64 +731,6 @@ actions:@[] footer:nil]; - self.clearBrowsingDataAction = - CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_CLEAR_BROWSING_DATA, - @"overflow_menu_action_clear_browsing_data", - kToolsMenuClearBrowsingData, ^{ - [weakSelf openClearBrowsingData]; - }); - self.followAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_FOLLOW, @"overflow_menu_action_follow", - kToolsMenuFollow, ^{ - [weakSelf updateFollowStatus:YES]; - }); - self.unfollowAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_UNFOLLOW, @"overflow_menu_action_unfollow", - kToolsMenuUnfollow, ^{ - [weakSelf updateFollowStatus:NO]; - }); - self.addBookmarkAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_ADD_TO_BOOKMARKS, @"overflow_menu_action_bookmark", - kToolsMenuAddToBookmarks, ^{ - [weakSelf addOrEditBookmark]; - }); - self.editBookmarkAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_EDIT_BOOKMARK, @"overflow_menu_action_edit_bookmark", - kToolsMenuEditBookmark, ^{ - [weakSelf addOrEditBookmark]; - }); - self.readLaterAction = CreateOverflowMenuAction( - IDS_IOS_CONTENT_CONTEXT_ADDTOREADINGLIST, - @"overflow_menu_action_read_later", kToolsMenuReadLater, ^{ - [weakSelf addToReadingList]; - }); - [self logTranslateAvailability]; - self.translateAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_TRANSLATE, @"overflow_menu_action_translate", - kToolsMenuTranslateId, ^{ - [weakSelf translatePage]; - }); - self.requestDesktopAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_REQUEST_DESKTOP_SITE, - @"overflow_menu_action_request_desktop", kToolsMenuRequestDesktopId, ^{ - [weakSelf requestDesktopSite]; - }); - self.requestMobileAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_REQUEST_MOBILE_SITE, - @"overflow_menu_action_request_mobile", kToolsMenuRequestMobileId, ^{ - [weakSelf requestMobileSite]; - }); - self.findInPageAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_FIND_IN_PAGE, @"overflow_menu_action_find_in_page", - kToolsMenuFindInPageId, ^{ - [weakSelf openFindInPage]; - }); - self.textZoomAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_TEXT_ZOOM, @"overflow_menu_action_text_zoom", - kToolsMenuTextZoom, ^{ - [weakSelf openTextZoom]; - }); - // The page actions vary based on page state, so they are set in // |-updateModel|. self.pageActionsGroup = @@ -541,22 +738,6 @@ actions:@[] footer:nil]; - self.settingsAction = CreateOverflowMenuAction( - IDS_IOS_TOOLS_MENU_SETTINGS, @"overflow_menu_action_settings", - kToolsMenuSettingsId, ^{ - [weakSelf openSettingsFromAction]; - }); - self.reportIssueAction = CreateOverflowMenuAction( - IDS_IOS_OPTIONS_REPORT_AN_ISSUE, @"overflow_menu_action_report_issue", - kToolsMenuReportAnIssueId, ^{ - [weakSelf reportAnIssue]; - }); - self.helpAction = CreateOverflowMenuAction(IDS_IOS_TOOLS_MENU_HELP_MOBILE, - @"overflow_menu_action_help", - kToolsMenuHelpId, ^{ - [weakSelf openHelp]; - }); - // Footer and actions vary based on state, so they're set in -updateModel. self.helpActionsGroup = [[OverflowMenuActionGroup alloc] initWithGroupName:@"help_actions"
diff --git a/ios/chrome/browser/ui/upgrade/BUILD.gn b/ios/chrome/browser/ui/upgrade/BUILD.gn new file mode 100644 index 0000000..ab2cac33 --- /dev/null +++ b/ios/chrome/browser/ui/upgrade/BUILD.gn
@@ -0,0 +1,24 @@ +# 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. + +import("//ios/public/provider/chrome/browser/build_config.gni") + +source_set("upgrade") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "upgrade_center_browser_agent.h", + "upgrade_center_browser_agent.mm", + ] + deps = [ + "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/infobars", + "//ios/chrome/browser/main:public", + "//ios/chrome/browser/ui/upgrade/utils:features", + "//ios/chrome/browser/ui/util", + "//ios/chrome/browser/upgrade", + "//ios/chrome/browser/web_state_list", + "//ui/base", + ] + frameworks = [ "UIKit.framework" ] +}
diff --git a/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.h b/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.h new file mode 100644 index 0000000..03adfaf --- /dev/null +++ b/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.h
@@ -0,0 +1,47 @@ +// 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. + +#ifndef IOS_CHROME_BROWSER_UI_UPGRADE_UPGRADE_CENTER_BROWSER_AGENT_H_ +#define IOS_CHROME_BROWSER_UI_UPGRADE_UPGRADE_CENTER_BROWSER_AGENT_H_ + +#import "ios/chrome/browser/main/browser_observer.h" +#import "ios/chrome/browser/main/browser_user_data.h" +#import "ios/chrome/browser/web_state_list/web_state_list_observer.h" + +class Browser; + +// Browser agent that handles informing the update center of new tabs. +class UpgradeCenterBrowserAgent + : public BrowserObserver, + public WebStateListObserver, + public BrowserUserData<UpgradeCenterBrowserAgent> { + public: + UpgradeCenterBrowserAgent(const UpgradeCenterBrowserAgent&) = delete; + UpgradeCenterBrowserAgent& operator=(const UpgradeCenterBrowserAgent&) = + delete; + + ~UpgradeCenterBrowserAgent() override; + + private: + explicit UpgradeCenterBrowserAgent(Browser* browser); + friend class BrowserUserData<UpgradeCenterBrowserAgent>; + BROWSER_USER_DATA_KEY_DECL(); + + // BrowserObserver methods + void BrowserDestroyed(Browser* browser) override; + + // WebStateListObserver methods + void WebStateInsertedAt(WebStateList* web_state_list, + web::WebState* web_state, + int index, + bool activating) override; + + void WillDetachWebStateAt(WebStateList* web_state_list, + web::WebState* web_state, + int index) override; + + Browser* browser_ = nullptr; +}; + +#endif // IOS_CHROME_BROWSER_UI_UPGRADE_UPGRADE_CENTER_BROWSER_AGENT_H_
diff --git a/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.mm b/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.mm new file mode 100644 index 0000000..938e4149 --- /dev/null +++ b/ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.mm
@@ -0,0 +1,66 @@ +// 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. + +#import "ios/chrome/browser/ui/upgrade/upgrade_center_browser_agent.h" + +#include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/chrome/browser/infobars/infobar_manager_impl.h" +#include "ios/chrome/browser/upgrade/upgrade_center.h" +#import "ios/chrome/browser/web_state_list/web_state_list.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +BROWSER_USER_DATA_KEY_IMPL(UpgradeCenterBrowserAgent) + +UpgradeCenterBrowserAgent::UpgradeCenterBrowserAgent(Browser* browser) { + DCHECK(browser); + browser->AddObserver(this); + browser->GetWebStateList()->AddObserver(this); +} + +UpgradeCenterBrowserAgent::~UpgradeCenterBrowserAgent() + + void UpgradeCenterBrowserAgent::BrowserDestroyed(Browser* browser) { + DCHECK(browser); + browser->GetWebStateList()->RemoveObserver(this); + browser->RemoveObserver(this); +} + +void UpgradeCenterBrowserAgent::WebStateInsertedAt(WebStateList* web_state_list, + web::WebState* web_state, + int index, + bool activating) { + DCHECK(web_state); + + // When adding new tabs, check what kind of reminder infobar should + // be added to the new tab. Try to add only one of them. + // This check is done when a new tab is added either through the Tools Menu + // "New Tab", through a long press on the Tab Switcher button "New Tab", and + // through creating a New Tab from the Tab Switcher. This logic needs to + // happen after a new WebState has added and finished initial navigation. If + // this happens earlier, the initial navigation may end up clearing the + // infobar(s) that are just added. + infobars::InfoBarManager* infoBarManager = + InfoBarManagerImpl::FromWebState(web_state); + NSString* tabID = web_state->GetStableIdentifier(); + + // TODO(crbug.com/1324514): Replace [UpgradeCenter sharedInstance] with a + // dependency + [[UpgradeCenter sharedInstance] addInfoBarToManager:infoBarManager + forTabId:tabID]; +} + +void UpgradeCenterBrowserAgent::WillDetachWebStateAt( + WebStateList* web_state_list, + web::WebState* web_state, + int index) { + DCHECK(web_state); + + // TODO(crbug.com/1324514): Replace [UpgradeCenter sharedInstance] with a + // dependency + [[UpgradeCenter sharedInstance] + tabWillClose:web_state->GetStableIdentifier()]; +}
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 456b192..76b919d 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 @@ -a56afb28a9858935e2d118e3fdee4d932d026631 \ No newline at end of file +c5eea122cf09f54421b8f030739cb396c7b51c07 \ 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 5386c9e..eb522e3 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 @@ -3ca26b9bee2642635bd47a11f06701a870253afa \ No newline at end of file +06e3f8e8f0b830eae831fb51bd3377339206e1fe \ 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 46ad031..60c70502 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 @@ -5de756b8b9d564750d5cc119f1e0a01a007ad4d1 \ No newline at end of file +5cc161ecb09ebe34d1e66469bb513b1d4eedb891 \ 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 ffbf010..b3e23b85 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 @@ -28873ff43fcfd8cb064afd0f47b2c5e23d63beda \ No newline at end of file +abeccfc9d9c64c755053165ff1f8967193b4c871 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index a93cd884..b861e585 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -e4c589ceac2ea0d1b31ea27d91dae11d389f4398 \ No newline at end of file +b05f5532fa0281d82fa476cd5dc70e1a070b5461 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index b76f360..c9637db 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -c769612298b263ff833e32c49241978db915b757 \ No newline at end of file +e901859f1ba20bcc781a114d3fdb4d8538344730 \ 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 eea7058..07c14e2 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 @@ -6fe60bb634fab81b616f3112b5a0506b17c5918a \ No newline at end of file +d22a9ac6754c3fc9185b359b3a3aa835da751305 \ 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 6bd2bcb4..7e74fd8 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 @@ -95d6862647724546a325fbf33be4eeac64b6bf33 \ No newline at end of file +86ba2ce57a9e44b4b4ecf834b5360996f0f51ecd \ 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 376b826..17aabd7a 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 @@ -9a0cfd9fcc944d5a95d0af742c367d23c2221f79 \ No newline at end of file +b15c93924637134c1cdee23e681303c6288f17bc \ 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 23968c7..a7f3aff 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 @@ -fc311b1882f9195aca0da85c622f9c979cc1694b \ No newline at end of file +f7af165ca8db4c7340d18988453d7f3c41a02880 \ No newline at end of file
diff --git a/ios/web/shell/test/BUILD.gn b/ios/web/shell/test/BUILD.gn index b272fdc..4031dba8 100644 --- a/ios/web/shell/test/BUILD.gn +++ b/ios/web/shell/test/BUILD.gn
@@ -91,7 +91,7 @@ ] } -source_set("eg_tests+eg2") { +source_set("eg2_tests") { configs += [ "//build/config/compiler:enable_arc", "//build/config/ios:xctest_config", @@ -132,8 +132,8 @@ xcode_test_application_name = "ios_web_shell_eg2tests" deps = [ - # Test support libraries. - ":eg_tests+eg2", + # Tests and test support libraries. + ":eg2_tests", ] data_deps = [ ":ios_web_shell_eg2tests" ]
diff --git a/ios/web_view/internal/cwv_preferences.mm b/ios/web_view/internal/cwv_preferences.mm index 637aabc..5cbce42 100644 --- a/ios/web_view/internal/cwv_preferences.mm +++ b/ios/web_view/internal/cwv_preferences.mm
@@ -8,6 +8,7 @@ #include "components/language/core/browser/pref_names.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "components/prefs/pref_service.h" +#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/translate/core/browser/translate_pref_names.h" #include "components/translate/core/browser/translate_prefs.h" @@ -42,8 +43,6 @@ translatePrefs.ResetToDefaults(); } -#pragma mark - Autofill - - (void)setProfileAutofillEnabled:(BOOL)enabled { autofill::prefs::SetAutofillProfileEnabled(_prefService, enabled); } @@ -80,4 +79,16 @@ password_manager::prefs::kPasswordLeakDetectionEnabled); } +- (void)setSafeBrowsingEnabled:(BOOL)enabled { + safe_browsing::SetSafeBrowsingState( + _prefService, + enabled ? safe_browsing::SafeBrowsingState::STANDARD_PROTECTION + : safe_browsing::SafeBrowsingState::NO_SAFE_BROWSING, + /*is_esb_enabled_in_sync=*/false); +} + +- (BOOL)isSafeBrowsingEnabled { + return safe_browsing::IsSafeBrowsingEnabled(*_prefService); +} + @end
diff --git a/ios/web_view/internal/cwv_preferences_unittest.mm b/ios/web_view/internal/cwv_preferences_unittest.mm index a902865..ba95822 100644 --- a/ios/web_view/internal/cwv_preferences_unittest.mm +++ b/ios/web_view/internal/cwv_preferences_unittest.mm
@@ -14,6 +14,7 @@ #include "components/prefs/in_memory_pref_store.h" #include "components/prefs/pref_service.h" #include "components/prefs/pref_service_factory.h" +#include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/translate/core/browser/translate_pref_names.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" @@ -41,6 +42,9 @@ pref_registry->RegisterBooleanPref( password_manager::prefs::kPasswordLeakDetectionEnabled, true); + pref_registry->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); + pref_registry->RegisterBooleanPref(prefs::kSafeBrowsingEnhanced, false); + scoped_refptr<PersistentPrefStore> pref_store = new InMemoryPrefStore(); PrefServiceFactory factory; factory.set_user_prefs(pref_store); @@ -89,4 +93,11 @@ EXPECT_FALSE(preferences_.passwordLeakCheckEnabled); } +// Tests safe browsing setting. +TEST_F(CWVPreferencesTest, SafeBrowsingEnabled) { + EXPECT_TRUE(preferences_.safeBrowsingEnabled); + preferences_.safeBrowsingEnabled = NO; + EXPECT_FALSE(preferences_.safeBrowsingEnabled); +} + } // namespace ios_web_view
diff --git a/ios/web_view/public/cwv_preferences.h b/ios/web_view/public/cwv_preferences.h index 90bd23d..dfab95d0 100644 --- a/ios/web_view/public/cwv_preferences.h +++ b/ios/web_view/public/cwv_preferences.h
@@ -48,6 +48,13 @@ @property(nonatomic, assign, getter=isPasswordLeakCheckEnabled) BOOL passwordLeakCheckEnabled; +// Whether or not safe browsing is enabled. +// Specifically this controls whether or not +// -[CWVNavigationDelegate handleUnsafeURLWithHandler:] is called. +// Defaults to |YES|. +@property(nonatomic, assign, getter=isSafeBrowsingEnabled) + BOOL safeBrowsingEnabled; + - (instancetype)init NS_UNAVAILABLE; // Resets all translation settings back to default. In particular, this will
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc index 7a47466..4e3918a 100644 --- a/media/ffmpeg/ffmpeg_common.cc +++ b/media/ffmpeg/ffmpeg_common.cc
@@ -526,14 +526,6 @@ // TODO(chcunningham): We need real profiles for all of the codecs below to // actually handle capabilities requests correctly. http://crbug.com/784610 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; - - // Prefer the color space found by libavcodec if available - VideoColorSpace color_space = - VideoColorSpace(codec_context->color_primaries, codec_context->color_trc, - codec_context->colorspace, - codec_context->color_range == AVCOL_RANGE_JPEG - ? gfx::ColorSpace::RangeID::FULL - : gfx::ColorSpace::RangeID::LIMITED); switch (codec) { #if BUILDFLAG(USE_PROPRIETARY_CODECS) case VideoCodec::kH264: { @@ -555,39 +547,32 @@ } #if BUILDFLAG(ENABLE_PLATFORM_HEVC) case VideoCodec::kHEVC: { - int hevc_profile = -1; - // We need to parse extradata each time, because we wont add ffmpeg - // hevc decoder & parser to chromium and codec_context->profile - // should always be FF_PROFILE_UNKNOWN (-99) here - if (codec_context->extradata && codec_context->extradata_size) { + int hevc_profile = FF_PROFILE_UNKNOWN; + if ((codec_context->profile < FF_PROFILE_HEVC_MAIN || + codec_context->profile > FF_PROFILE_HEVC_REXT) && + codec_context->extradata && codec_context->extradata_size) { mp4::HEVCDecoderConfigurationRecord hevc_config; if (hevc_config.Parse(codec_context->extradata, codec_context->extradata_size)) { hevc_profile = hevc_config.general_profile_idc; - if (!color_space.IsSpecified()) { - // We should try to parsed color space from SPS if the - // result from libavcodec is not specified in case - // that some encoder not write extra colorspace info to - // the container - color_space = hevc_config.GetColorSpace(); - } } + } else { + hevc_profile = codec_context->profile; } - // The values of general_profile_idc are taken from the HEVC standard, see - // the latest https://www.itu.int/rec/T-REC-H.265/en switch (hevc_profile) { - case 1: + case FF_PROFILE_HEVC_MAIN: profile = HEVCPROFILE_MAIN; break; - case 2: + case FF_PROFILE_HEVC_MAIN_10: profile = HEVCPROFILE_MAIN10; break; - case 3: + case FF_PROFILE_HEVC_MAIN_STILL_PICTURE: profile = HEVCPROFILE_MAIN_STILL_PICTURE; break; - case 4: + case FF_PROFILE_HEVC_REXT: profile = HEVCPROFILE_REXT; break; + // FF will treat the following profiles as FF_PROFILE_UNKNOWN case 5: profile = HEVCPROFILE_HIGH_THROUGHPUT; break; @@ -662,6 +647,13 @@ static_cast<int32_t*>(display_matrix)); } + // Prefer the color space found by libavcodec if available. + VideoColorSpace color_space = + VideoColorSpace(codec_context->color_primaries, codec_context->color_trc, + codec_context->colorspace, + codec_context->color_range == AVCOL_RANGE_JPEG + ? gfx::ColorSpace::RangeID::FULL + : gfx::ColorSpace::RangeID::LIMITED); if (!color_space.IsSpecified()) { // VP9 frames may have color information, but that information cannot // express new color spaces, like HDR. For that reason, color space
diff --git a/media/formats/mp4/avc.cc b/media/formats/mp4/avc.cc index c3a3b29e..a91f43b 100644 --- a/media/formats/mp4/avc.cc +++ b/media/formats/mp4/avc.cc
@@ -17,8 +17,8 @@ namespace media { namespace mp4 { -static constexpr uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; -static constexpr int kAnnexBStartCodeSize = 4; +static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; +static const int kAnnexBStartCodeSize = 4; static bool ConvertAVCToAnnexBInPlaceForLengthSize4(std::vector<uint8_t>* buf) { const size_t kLengthSize = 4;
diff --git a/media/formats/mp4/box_definitions.cc b/media/formats/mp4/box_definitions.cc index a9de5ea5..4e99b0f 100644 --- a/media/formats/mp4/box_definitions.cc +++ b/media/formats/mp4/box_definitions.cc
@@ -1126,7 +1126,6 @@ RCHECK(reader->ReadChild(hevcConfig.get())); video_codec = VideoCodec::kHEVC; video_codec_profile = hevcConfig->GetVideoProfile(); - video_color_space = hevcConfig->GetColorSpace(); frame_bitstream_converter = base::MakeRefCounted<HEVCBitstreamConverter>(std::move(hevcConfig)); #if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) @@ -1167,7 +1166,6 @@ std::unique_ptr<HEVCDecoderConfigurationRecord> hevcConfig( new HEVCDecoderConfigurationRecord()); RCHECK(reader->ReadChild(hevcConfig.get())); - video_color_space = hevcConfig->GetColorSpace(); frame_bitstream_converter = base::MakeRefCounted<HEVCBitstreamConverter>(std::move(hevcConfig)); DVLOG(2) << __func__ << " reading DolbyVisionConfiguration (dvcC/dvvC)";
diff --git a/media/formats/mp4/hevc.cc b/media/formats/mp4/hevc.cc index e56a770d..be9aa80 100644 --- a/media/formats/mp4/hevc.cc +++ b/media/formats/mp4/hevc.cc
@@ -15,14 +15,11 @@ #include "media/formats/mp4/avc.h" #include "media/formats/mp4/box_definitions.h" #include "media/formats/mp4/box_reader.h" -#include "media/video/h265_parser.h" +#include "media/video/h265_nalu_parser.h" namespace media { namespace mp4 { -static constexpr uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; -static constexpr int kAnnexBStartCodeSize = 4; - HEVCDecoderConfigurationRecord::HEVCDecoderConfigurationRecord() : configurationVersion(0), general_profile_space(0), @@ -154,44 +151,8 @@ return VIDEO_CODEC_PROFILE_UNKNOWN; } -VideoColorSpace HEVCDecoderConfigurationRecord::GetColorSpace() { - if (!arrays.size()) { - DVLOG(1) << "HVCCNALArray not found, fallback to default colorspace"; - return VideoColorSpace(); - } - - std::vector<uint8_t> param_sets; - if (!HEVC::ConvertConfigToAnnexB(*this, ¶m_sets)) - return VideoColorSpace(); - - H265Parser parser; - H265NALU nalu; - parser.SetStream(param_sets.data(), param_sets.size()); - while (true) { - H265Parser::Result result = parser.AdvanceToNextNALU(&nalu); - - if (result != H265Parser::kOk) - return VideoColorSpace(); - - switch (nalu.nal_unit_type) { - case H265NALU::SPS_NUT: { - int sps_id = -1; - result = parser.ParseSPS(&sps_id); - if (result != H265Parser::kOk) { - DVLOG(1) << "Could not parse SPS, fallback to default colorspace"; - return VideoColorSpace(); - } - - const H265SPS* sps = parser.GetSPS(sps_id); - DCHECK(sps); - return sps->GetColorSpace(); - } - default: - break; - } - } - NOTREACHED(); -} +static const uint8_t kAnnexBStartCode[] = {0, 0, 0, 1}; +static const int kAnnexBStartCodeSize = 4; // static bool HEVC::InsertParamSetsAnnexB(
diff --git a/media/formats/mp4/hevc.h b/media/formats/mp4/hevc.h index f84a883..7ec661a 100644 --- a/media/formats/mp4/hevc.h +++ b/media/formats/mp4/hevc.h
@@ -62,7 +62,6 @@ std::vector<HVCCNALArray> arrays; VideoCodecProfile GetVideoProfile() const; - VideoColorSpace GetColorSpace(); private: bool ParseInternal(BufferReader* reader, MediaLog* media_log);
diff --git a/media/gpu/windows/d3d11_video_decoder.cc b/media/gpu/windows/d3d11_video_decoder.cc index 6b9894f..ad84677 100644 --- a/media/gpu/windows/d3d11_video_decoder.cc +++ b/media/gpu/windows/d3d11_video_decoder.cc
@@ -212,14 +212,13 @@ D3D11Status::Or<ComD3D11VideoDecoder> D3D11VideoDecoder::CreateD3D11Decoder() { // By default we assume outputs are 8-bit for SDR color spaces and 10 bit for - // HDR color spaces (or VP9.2, or HEVC Main10) with HBD capable codecs (the - // decoder doesn't support H264PROFILE_HIGH10PROFILE). We'll get a config - // change once we know the real bit depth if this turns out to be wrong. + // HDR color spaces (or VP9.2) with HBD capable codecs (the decoder doesn't + // support H264PROFILE_HIGH10PROFILE). We'll get a config change once we know + // the real bit depth if this turns out to be wrong. bit_depth_ = accelerated_video_decoder_ ? accelerated_video_decoder_->GetBitDepth() : (config_.profile() == VP9PROFILE_PROFILE2 || - config_.profile() == HEVCPROFILE_MAIN10 || (config_.color_space_info().ToGfxColorSpace().IsHDR() && config_.codec() != VideoCodec::kH264) ? 10
diff --git a/net/base/network_activity_monitor.cc b/net/base/network_activity_monitor.cc index 03b2bf0..1ad94b7 100644 --- a/net/base/network_activity_monitor.cc +++ b/net/base/network_activity_monitor.cc
@@ -7,18 +7,14 @@ #include <atomic> #include <type_traits> +#include "third_party/abseil-cpp/absl/base/attributes.h" + namespace net { namespace activity_monitor { namespace { -std::atomic<uint64_t> g_bytes_received{0}; - -static_assert( - std::is_trivially_constructible<decltype(g_bytes_received)>::value, - "g_bytes_received generates a static initializer"); -static_assert(std::is_trivially_destructible<decltype(g_bytes_received)>::value, - "g_bytes_received generates a static destructor"); +ABSL_CONST_INIT std::atomic<uint64_t> g_bytes_received = 0; } // namespace
diff --git a/net/disk_cache/blockfile/file_lock.cc b/net/disk_cache/blockfile/file_lock.cc index 5719ddc..06ef394 100644 --- a/net/disk_cache/blockfile/file_lock.cc +++ b/net/disk_cache/blockfile/file_lock.cc
@@ -6,6 +6,8 @@ #include <atomic> +#include "build/build_config.h" + namespace { void Barrier() { @@ -21,7 +23,7 @@ FileLock::FileLock(BlockFileHeader* header) { updating_ = &header->updating; - (*updating_)++; + (*updating_) = (*updating_) + 1; Barrier(); acquired_ = true; } @@ -33,7 +35,7 @@ void FileLock::Lock() { if (acquired_) return; - (*updating_)++; + (*updating_) = (*updating_) + 1; Barrier(); } @@ -41,7 +43,7 @@ if (!acquired_) return; Barrier(); - (*updating_)--; + (*updating_) = (*updating_) - 1; } } // namespace disk_cache
diff --git a/net/dns/host_resolver.cc b/net/dns/host_resolver.cc index c6687d3..5f1eb669 100644 --- a/net/dns/host_resolver.cc +++ b/net/dns/host_resolver.cc
@@ -241,6 +241,10 @@ base::StringPiece host_mapping_rules, bool enable_caching) { #if BUILDFLAG(IS_ANDROID) + // Note that the logic below uses Android APIs that don't work on a sandboxed + // process: This is not problematic because this function is used only by + // Cronet which doesn't enable sandboxing. + auto resolve_context = std::make_unique<ResolveContext>( nullptr /*url_request_context */, enable_caching); auto manager_options = std::move(options).value_or(ManagerOptions());
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index 9050951..1641fdc 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc
@@ -92,8 +92,8 @@ // Negotiate Start: 6 // Negotiate Reject: 7 static const int kEventBucketsEnd = - HttpAuth::AUTH_SCHEME_MAX * AUTH_EVENT_MAX; - int event_bucket = auth_scheme * AUTH_EVENT_MAX + auth_event; + int{HttpAuth::AUTH_SCHEME_MAX} * AUTH_EVENT_MAX; + int event_bucket = int{auth_scheme} * AUTH_EVENT_MAX + auth_event; DCHECK(event_bucket >= 0 && event_bucket < kEventBucketsEnd); UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthCount", event_bucket, kEventBucketsEnd); @@ -120,9 +120,9 @@ if (auth_event != AUTH_EVENT_START) return; static const int kTargetBucketsEnd = - HttpAuth::AUTH_SCHEME_MAX * AUTH_TARGET_MAX; + int{HttpAuth::AUTH_SCHEME_MAX} * AUTH_TARGET_MAX; AuthTarget auth_target = DetermineAuthTarget(handler); - int target_bucket = auth_scheme * AUTH_TARGET_MAX + auth_target; + int target_bucket = int{auth_scheme} * AUTH_TARGET_MAX + auth_target; DCHECK(target_bucket >= 0 && target_bucket < kTargetBucketsEnd); UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthTarget", target_bucket, kTargetBucketsEnd);
diff --git a/net/reporting/reporting_cache_impl.cc b/net/reporting/reporting_cache_impl.cc index f7d1317..0bfc777 100644 --- a/net/reporting/reporting_cache_impl.cc +++ b/net/reporting/reporting_cache_impl.cc
@@ -630,6 +630,14 @@ // Insert the endpoints corresponding to this group. while (endpoints_it != loaded_endpoints.end() && endpoints_it->group_key == group_key) { + if (FindEndpointIt(group_key, endpoints_it->info.url) != + endpoints_.end()) { + // This endpoint is duplicated in the store, so discard it and move on + // to the next endpoint. This should not happen unless the store is + // corrupted. + ++endpoints_it; + continue; + } EndpointMap::iterator inserted = endpoints_.insert( std::make_pair(group_key, std::move(*endpoints_it))); endpoint_its_by_url_.insert(
diff --git a/net/reporting/reporting_cache_unittest.cc b/net/reporting/reporting_cache_unittest.cc index 5734908..604b506 100644 --- a/net/reporting/reporting_cache_unittest.cc +++ b/net/reporting/reporting_cache_unittest.cc
@@ -1917,6 +1917,43 @@ EXPECT_TRUE(EndpointExistsInCache(group4, kEndpoint1_)); } +TEST_P(ReportingCacheTest, DoNotAddDuplicatedEntriesFromStore) { + if (!store()) + return; + + base::Time now = clock()->Now(); + + std::vector<ReportingEndpoint> endpoints; + endpoints.emplace_back(kGroupKey11_, + ReportingEndpoint::EndpointInfo{kEndpoint1_}); + endpoints.emplace_back(kGroupKey22_, + ReportingEndpoint::EndpointInfo{kEndpoint2_}); + endpoints.emplace_back(kGroupKey11_, + ReportingEndpoint::EndpointInfo{kEndpoint1_}); + std::vector<CachedReportingEndpointGroup> groups; + groups.emplace_back(kGroupKey11_, OriginSubdomains::DEFAULT, + now + base::Minutes(1) /* expires */, + now /* last_used */); + groups.emplace_back(kGroupKey22_, OriginSubdomains::DEFAULT, + now + base::Minutes(3) /* expires */, + now /* last_used */); + groups.emplace_back(kGroupKey11_, OriginSubdomains::DEFAULT, + now + base::Minutes(1) /* expires */, + now /* last_used */); + store()->SetPrestoredClients(endpoints, groups); + + LoadReportingClients(); + + EXPECT_EQ(2u, cache()->GetEndpointCount()); + EXPECT_EQ(2u, cache()->GetEndpointGroupCountForTesting()); + EXPECT_TRUE(EndpointExistsInCache(kGroupKey11_, kEndpoint1_)); + EXPECT_TRUE(EndpointExistsInCache(kGroupKey22_, kEndpoint2_)); + EXPECT_TRUE(EndpointGroupExistsInCache( + kGroupKey11_, OriginSubdomains::DEFAULT, now + base::Minutes(1))); + EXPECT_TRUE(EndpointGroupExistsInCache( + kGroupKey22_, OriginSubdomains::DEFAULT, now + base::Minutes(3))); +} + TEST_P(ReportingCacheTest, GetIsolationInfoForEndpoint) { LoadReportingClients();
diff --git a/sandbox/linux/bpf_dsl/syscall_set.h b/sandbox/linux/bpf_dsl/syscall_set.h index 1bebe66f..226216a 100644 --- a/sandbox/linux/bpf_dsl/syscall_set.h +++ b/sandbox/linux/bpf_dsl/syscall_set.h
@@ -70,9 +70,14 @@ // Iterator provides C++ input iterator semantics for traversing a // SyscallSet. -class SyscallSet::Iterator - : public std::iterator<std::input_iterator_tag, uint32_t> { +class SyscallSet::Iterator { public: + using iterator_category = std::input_iterator_tag; + using value_type = uint32_t; + using difference_type = std::ptrdiff_t; + using pointer = uint32_t*; + using reference = uint32_t&; + Iterator(const Iterator& it) : set_(it.set_), done_(it.done_), num_(it.num_) {}
diff --git a/sandbox/win/tests/common/controller.cc b/sandbox/win/tests/common/controller.cc index 6560ba3d..00d5871 100644 --- a/sandbox/win/tests/common/controller.cc +++ b/sandbox/win/tests/common/controller.cc
@@ -6,6 +6,7 @@ #include <string> +#include "base/check.h" #include "base/dcheck_is_on.h" #include "base/memory/platform_shared_memory_region.h" #include "base/memory/read_only_shared_memory_region.h" @@ -237,6 +238,15 @@ if (SBOX_ALL_OK != result) return SBOX_TEST_FAILED_TO_RUN_TEST; + FILETIME creation_time, exit_time, kernel_time, user_time; + // Can never fail. If it does, then something really bad has happened. + CHECK(::GetProcessTimes(target.hProcess, &creation_time, &exit_time, + &kernel_time, &user_time)); + + // Execution times should be zero. If not, something has changed in Windows. + CHECK_EQ(0, base::TimeDelta::FromFileTime(user_time).InMicroseconds()); + CHECK_EQ(0, base::TimeDelta::FromFileTime(kernel_time).InMicroseconds()); + ::ResumeThread(target.hThread); // For an asynchronous run we don't bother waiting.
diff --git a/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc index a46e047..a2367972 100644 --- a/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc +++ b/storage/browser/file_system/obfuscated_file_util_memory_delegate.cc
@@ -33,7 +33,7 @@ #else int64_t max_allocatable = std::min(base::SysInfo::AmountOfAvailablePhysicalMemory(), - static_cast<int64_t>(base::MaxDirectMapped())); + static_cast<int64_t>(partition_alloc::MaxDirectMapped())); return max_allocatable >= required_memory; #endif @@ -549,7 +549,7 @@ // |MaxDirectMapped| function is not implemented on FUCHSIA, yet. // (crbug.com/986608) #if !BUILDFLAG(IS_FUCHSIA) - if (last_position >= base::MaxDirectMapped() / 2) { + if (last_position >= partition_alloc::MaxDirectMapped() / 2) { // TODO(https://crbug.com/1043914): Allocated memory is rounded up to // 100MB blocks to reduce memory allocation delays. Switch to a more // proper container to remove this dependency.
diff --git a/storage/browser/test/mock_quota_manager.cc b/storage/browser/test/mock_quota_manager.cc index dcffd11..15cabbb 100644 --- a/storage/browser/test/mock_quota_manager.cc +++ b/storage/browser/test/mock_quota_manager.cc
@@ -98,6 +98,13 @@ std::move(callback).Run(std::move(bucket)); } +void MockQuotaManager::GetBucketById( + const BucketId& bucket_id, + base::OnceCallback<void(QuotaErrorOr<BucketInfo>)> callback) { + QuotaErrorOr<BucketInfo> bucket = FindBucketById(bucket_id); + std::move(callback).Run(std::move(bucket)); +} + void MockQuotaManager::GetBucket( const blink::StorageKey& storage_key, const std::string& bucket_name, @@ -228,6 +235,18 @@ MockQuotaManager::~MockQuotaManager() = default; +QuotaErrorOr<BucketInfo> MockQuotaManager::FindBucketById( + const BucketId& bucket_id) { + auto it = std::find_if(buckets_.begin(), buckets_.end(), + [bucket_id](const BucketData& bucket_data) { + return bucket_data.bucket.id == bucket_id; + }); + if (it != buckets_.end()) { + return it->bucket; + } + return QuotaError::kNotFound; +} + QuotaErrorOr<BucketInfo> MockQuotaManager::FindBucket( const blink::StorageKey& storage_key, const std::string& bucket_name,
diff --git a/storage/browser/test/mock_quota_manager.h b/storage/browser/test/mock_quota_manager.h index ecbbb6f0..b793f91 100644 --- a/storage/browser/test/mock_quota_manager.h +++ b/storage/browser/test/mock_quota_manager.h
@@ -60,6 +60,12 @@ // Overrides QuotaManager's implementation to fetch from an internal // container populated by calls to GetOrCreateBucket. + void GetBucketById( + const BucketId& bucket_id, + base::OnceCallback<void(QuotaErrorOr<BucketInfo>)>) override; + + // Overrides QuotaManager's implementation to fetch from an internal + // container populated by calls to GetOrCreateBucket. void GetBucket(const blink::StorageKey& storage_key, const std::string& bucket_name, blink::mojom::StorageType type, @@ -179,6 +185,8 @@ blink::mojom::UsageBreakdownPtr usage_breakdown; }; + QuotaErrorOr<BucketInfo> FindBucketById(const BucketId& bucket_id); + QuotaErrorOr<BucketInfo> FindBucket(const blink::StorageKey& storage_key, const std::string& bucket_name, blink::mojom::StorageType type);
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 86e2d4e7..2c15ba7 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -8154,15 +8154,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--client-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8239,15 +8239,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8273,7 +8273,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -8664,15 +8664,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--impl-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8749,15 +8749,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -8783,7 +8783,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index a222998..cac95c7 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -46128,15 +46128,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--client-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46213,15 +46213,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46247,7 +46247,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -46638,15 +46638,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--impl-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46723,15 +46723,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -46757,7 +46757,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -47152,15 +47152,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--client-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47237,15 +47237,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47271,7 +47271,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -47662,15 +47662,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--impl-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47747,15 +47747,15 @@ { "args": [ "--additional-apk=apks/ChromePublic.apk", - "--webview-apk-path=apks/AOSP_SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/AOSP_SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -47781,7 +47781,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -48244,15 +48244,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--client-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48329,15 +48329,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48363,7 +48363,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -48754,15 +48754,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--impl-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48839,15 +48839,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -48873,7 +48873,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -49336,15 +49336,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--client-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -49421,15 +49421,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", - "--client-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--implementation-outdir", ".", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--client-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--client-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -49455,7 +49455,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -49846,15 +49846,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M101/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M101/out/Release", "--impl-version=101", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -49931,15 +49931,15 @@ { "args": [ "--additional-apk=apks/WebLayerShellSystemWebView.apk", - "--webview-apk-path=apks/SystemWebView.apk", "--test-runner-outdir", ".", "--client-outdir", ".", - "--implementation-outdir", - "../../weblayer_instrumentation_test_M102/out/Release", "--test-expectations", "../../weblayer/browser/android/javatests/skew/expectations.txt", + "--webview-apk-path=apks/SystemWebView.apk", + "--implementation-outdir", + "../../weblayer_instrumentation_test_M102/out/Release", "--impl-version=102", "--gs-results-bucket=chromium-result-details", "--recover-devices", @@ -49965,7 +49965,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M102", - "revision": "version:102.0.5005.49" + "revision": "version:102.0.5005.50" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index 1a4616fb..a8b07df 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5919,21 +5919,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -5945,7 +5945,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "args": [ @@ -6065,21 +6065,21 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -6091,7 +6091,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "isolate_profile_data": true,
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 63586ea..936a4ff 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -87922,28 +87922,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "args": [ @@ -88043,28 +88043,28 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "isolate_profile_data": true, "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "isolate_profile_data": true, @@ -89439,20 +89439,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -89465,7 +89465,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "args": [ @@ -89585,20 +89585,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -89611,7 +89611,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "merge": { @@ -91144,20 +91144,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -91170,7 +91170,7 @@ }, "test": "lacros_chrome_browsertests", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "args": [ @@ -91290,20 +91290,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5055.0", + "name": "lacros_chrome_browsertests_run_in_series Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -91316,7 +91316,7 @@ }, "test": "lacros_chrome_browsertests_run_in_series", "test_id_prefix": "ninja://chrome/test:lacros_chrome_browsertests_run_in_series/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" }, { "merge": { @@ -92051,20 +92051,20 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome" ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "interactive_ui_tests Lacros version skew testing ash 103.0.5055.0", + "name": "interactive_ui_tests Lacros version skew testing ash 103.0.5056.0", "swarming": { "can_use_on_swarming_builders": true, "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v103.0.5055.0", - "revision": "version:103.0.5055.0" + "location": "lacros_version_skew_tests_v103.0.5056.0", + "revision": "version:103.0.5056.0" } ], "dimension_sets": [ @@ -92077,7 +92077,7 @@ }, "test": "interactive_ui_tests", "test_id_prefix": "ninja://chrome/test:interactive_ui_tests/", - "variant_id": "Lacros version skew testing ash 103.0.5055.0" + "variant_id": "Lacros version skew testing ash 103.0.5056.0" } ] },
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index 8c69f98..11537c4c 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,15 +22,15 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5055.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v103.0.5056.0/test_ash_chrome', ], - 'identifier': 'Lacros version skew testing ash 103.0.5055.0', + 'identifier': 'Lacros version skew testing ash 103.0.5056.0', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v103.0.5055.0', - 'revision': 'version:103.0.5055.0', + 'location': 'lacros_version_skew_tests_v103.0.5056.0', + 'revision': 'version:103.0.5056.0', }, ], }, @@ -462,16 +462,16 @@ }, 'WEBLAYER_10_AND_M_IMPL_SKEW_TESTS_NTH_MILESTONE': { 'args': [ - '--webview-apk-path=apks/AOSP_SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=102', + '--webview-apk-path=apks/AOSP_SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--impl-version=102' ], 'identifier': 'with_impl_from_102', 'swarming': { @@ -479,23 +479,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.49', + 'revision': 'version:102.0.5005.50' } - ], - }, + ] + } }, 'WEBLAYER_10_AND_M_IMPL_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/AOSP_SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M101/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=101', + '--webview-apk-path=apks/AOSP_SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M101/out/Release', + '--impl-version=101' ], 'identifier': 'with_impl_from_101', 'swarming': { @@ -503,10 +503,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M101', - 'revision': 'version:101.0.4951.66', + 'revision': 'version:101.0.4951.66' } - ], - }, + ] + } }, 'WEBLAYER_10_AND_M_IMPL_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [ @@ -606,16 +606,16 @@ }, 'WEBLAYER_IMPL_SKEW_TESTS_NTH_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=102', + '--webview-apk-path=apks/SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--impl-version=102' ], 'identifier': 'with_impl_from_102', 'swarming': { @@ -623,23 +623,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.49', + 'revision': 'version:102.0.5005.50' } - ], - }, + ] + } }, 'WEBLAYER_IMPL_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', '--client-outdir', '.', - '--implementation-outdir', - '../../weblayer_instrumentation_test_M101/out/Release', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--impl-version=101', + '--webview-apk-path=apks/SystemWebView.apk', + '--implementation-outdir', + '../../weblayer_instrumentation_test_M101/out/Release', + '--impl-version=101' ], 'identifier': 'with_impl_from_101', 'swarming': { @@ -647,10 +647,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M101', - 'revision': 'version:101.0.4951.66', + 'revision': 'version:101.0.4951.66' } - ], - }, + ] + } }, 'WEBLAYER_IMPL_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [ @@ -750,16 +750,16 @@ }, 'WEBLAYER_CLIENT_SKEW_TESTS_NTH_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', - '--client-outdir', - '../../weblayer_instrumentation_test_M102/out/Release', '--implementation-outdir', '.', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--client-version=102', + '--webview-apk-path=apks/SystemWebView.apk', + '--client-outdir', + '../../weblayer_instrumentation_test_M102/out/Release', + '--client-version=102' ], 'identifier': 'with_client_from_102', 'swarming': { @@ -767,23 +767,23 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M102', - 'revision': 'version:102.0.5005.49', + 'revision': 'version:102.0.5005.50' } - ], - }, + ] + } }, 'WEBLAYER_CLIENT_SKEW_TESTS_NTH_MINUS_ONE_MILESTONE': { 'args': [ - '--webview-apk-path=apks/SystemWebView.apk', '--test-runner-outdir', '.', - '--client-outdir', - '../../weblayer_instrumentation_test_M101/out/Release', '--implementation-outdir', '.', '--test-expectations', '../../weblayer/browser/android/javatests/skew/expectations.txt', - '--client-version=101', + '--webview-apk-path=apks/SystemWebView.apk', + '--client-outdir', + '../../weblayer_instrumentation_test_M101/out/Release', + '--client-version=101' ], 'identifier': 'with_client_from_101', 'swarming': { @@ -791,10 +791,10 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M101', - 'revision': 'version:101.0.4951.66', + 'revision': 'version:101.0.4951.66' } - ], - }, + ] + } }, 'WEBLAYER_CLIENT_SKEW_TESTS_NTH_MINUS_TWO_MILESTONE': { 'args': [
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 755201a..9160f38 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -4315,6 +4315,28 @@ ] } ], + "InitialNavigationEntry": [ + { + "platforms": [ + "android", + "android_weblayer", + "android_webview", + "chromeos", + "ios", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "InitialNavigationEntry" + ] + } + ] + } + ], "JourneysUseEngagementScoreCache": [ { "platforms": [
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index c79216e3..e0555ae 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -7491,93 +7491,6 @@ StyleRef().LogicalMaxHeight().IsPercentOrCalc(); } -static void MarkBoxForRelayoutAfterSplit(LayoutBoxModelObject* box) { - // FIXME: The table code should handle that automatically. If not, - // we should fix it and remove the table part checks. - if (box->IsTable()) { - // Because we may have added some sections with already computed column - // structures, we need to sync the table structure with them now. This - // avoids crashes when adding new cells to the table. - ToInterface<LayoutNGTableInterface>(box)->ForceSectionsRecalc(); - } else if (box->IsTableSection()) { - ToInterface<LayoutNGTableSectionInterface>(box)->SetNeedsCellRecalc(); - } - - box->SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation( - layout_invalidation_reason::kAnonymousBlockChange); -} - -static void CollapseLoneAnonymousBlockChild(LayoutBox* parent, - LayoutObject* child) { - auto* child_block_flow = DynamicTo<LayoutBlockFlow>(child); - auto* parent_block_flow = DynamicTo<LayoutBlockFlow>(parent); - if (!child->IsAnonymousBlock() || !child_block_flow) - return; - if (!parent_block_flow) - return; - parent_block_flow->CollapseAnonymousBlockChild(child_block_flow); -} - -// TODO(kojii): Move to `layout_box_model_object.cc`. -LayoutObject* LayoutBoxModelObject::SplitAnonymousBoxesAroundChild( - LayoutObject* before_child) { - NOT_DESTROYED(); - LayoutBox* box_at_top_of_new_branch = nullptr; - - while (before_child->Parent() != this) { - auto* box_to_split = To<LayoutBox>(before_child->Parent()); - if (box_to_split->SlowFirstChild() != before_child && - box_to_split->IsAnonymous()) { - // We have to split the parent box into two boxes and move children - // from |beforeChild| to end into the new post box. - LayoutBox* post_box = CreateAnonymousBoxToSplit(box_to_split); - post_box->SetChildrenInline(box_to_split->ChildrenInline()); - auto* parent_box = To<LayoutBoxModelObject>(box_to_split->Parent()); - // We need to invalidate the |parentBox| before inserting the new node - // so that the table paint invalidation logic knows the structure is - // dirty. See for example LayoutTableCell:localVisualRect(). - MarkBoxForRelayoutAfterSplit(parent_box); - parent_box->VirtualChildren()->InsertChildNode( - parent_box, post_box, box_to_split->NextSibling()); - box_to_split->MoveChildrenTo(post_box, before_child, nullptr, true); - - LayoutObject* child = post_box->SlowFirstChild(); - DCHECK(child); - if (child && !child->NextSibling()) - CollapseLoneAnonymousBlockChild(post_box, child); - child = box_to_split->SlowFirstChild(); - DCHECK(child); - if (child && !child->NextSibling()) - CollapseLoneAnonymousBlockChild(box_to_split, child); - - MarkBoxForRelayoutAfterSplit(box_to_split); - MarkBoxForRelayoutAfterSplit(post_box); - box_at_top_of_new_branch = post_box; - - before_child = post_box; - } else { - before_child = box_to_split; - } - } - - // Splitting the box means the left side of the container chain will lose any - // percent height descendants below |boxAtTopOfNewBranch| on the right hand - // side. - if (box_at_top_of_new_branch) { - box_at_top_of_new_branch->ClearPercentHeightDescendants(); - MarkBoxForRelayoutAfterSplit(this); - } - - DCHECK_EQ(before_child->Parent(), this); - return before_child; -} - -LayoutBox* LayoutBoxModelObject::CreateAnonymousBoxToSplit( - const LayoutBox* box_to_split) const { - NOT_DESTROYED(); - return box_to_split->CreateAnonymousBoxWithSameTypeAs(this); -} - LayoutUnit LayoutBox::OffsetFromLogicalTopOfFirstPage() const { NOT_DESTROYED(); LayoutState* layout_state = View()->GetLayoutState();
diff --git a/third_party/blink/renderer/core/layout/layout_box_model_object.cc b/third_party/blink/renderer/core/layout/layout_box_model_object.cc index b5df6e3..c6f8e8c 100644 --- a/third_party/blink/renderer/core/layout/layout_box_model_object.cc +++ b/third_party/blink/renderer/core/layout/layout_box_model_object.cc
@@ -42,6 +42,8 @@ #include "third_party/blink/renderer/core/layout/ng/legacy_layout_tree_walking.h" #include "third_party/blink/renderer/core/layout/ng/ng_constraint_space.h" #include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h" +#include "third_party/blink/renderer/core/layout/ng/table/layout_ng_table_interface.h" +#include "third_party/blink/renderer/core/layout/ng/table/layout_ng_table_section_interface.h" #include "third_party/blink/renderer/core/paint/object_paint_invalidator.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" @@ -94,6 +96,32 @@ return false; } +void MarkBoxForRelayoutAfterSplit(LayoutBoxModelObject* box) { + // FIXME: The table code should handle that automatically. If not, + // we should fix it and remove the table part checks. + if (box->IsTable()) { + // Because we may have added some sections with already computed column + // structures, we need to sync the table structure with them now. This + // avoids crashes when adding new cells to the table. + ToInterface<LayoutNGTableInterface>(box)->ForceSectionsRecalc(); + } else if (box->IsTableSection()) { + ToInterface<LayoutNGTableSectionInterface>(box)->SetNeedsCellRecalc(); + } + + box->SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation( + layout_invalidation_reason::kAnonymousBlockChange); +} + +void CollapseLoneAnonymousBlockChild(LayoutBox* parent, LayoutObject* child) { + auto* child_block_flow = DynamicTo<LayoutBlockFlow>(child); + auto* parent_block_flow = DynamicTo<LayoutBlockFlow>(parent); + if (!child->IsAnonymousBlock() || !child_block_flow) + return; + if (!parent_block_flow) + return; + parent_block_flow->CollapseAnonymousBlockChild(child_block_flow); +} + } // namespace // The HashMap for storing continuation pointers. @@ -1448,6 +1476,65 @@ } } +LayoutObject* LayoutBoxModelObject::SplitAnonymousBoxesAroundChild( + LayoutObject* before_child) { + NOT_DESTROYED(); + LayoutBox* box_at_top_of_new_branch = nullptr; + + while (before_child->Parent() != this) { + auto* box_to_split = To<LayoutBox>(before_child->Parent()); + if (box_to_split->SlowFirstChild() != before_child && + box_to_split->IsAnonymous()) { + // We have to split the parent box into two boxes and move children + // from |beforeChild| to end into the new post box. + LayoutBox* post_box = CreateAnonymousBoxToSplit(box_to_split); + post_box->SetChildrenInline(box_to_split->ChildrenInline()); + auto* parent_box = To<LayoutBoxModelObject>(box_to_split->Parent()); + // We need to invalidate the |parentBox| before inserting the new node + // so that the table paint invalidation logic knows the structure is + // dirty. See for example LayoutTableCell:localVisualRect(). + MarkBoxForRelayoutAfterSplit(parent_box); + parent_box->VirtualChildren()->InsertChildNode( + parent_box, post_box, box_to_split->NextSibling()); + box_to_split->MoveChildrenTo(post_box, before_child, nullptr, true); + + LayoutObject* child = post_box->SlowFirstChild(); + DCHECK(child); + if (child && !child->NextSibling()) + CollapseLoneAnonymousBlockChild(post_box, child); + child = box_to_split->SlowFirstChild(); + DCHECK(child); + if (child && !child->NextSibling()) + CollapseLoneAnonymousBlockChild(box_to_split, child); + + MarkBoxForRelayoutAfterSplit(box_to_split); + MarkBoxForRelayoutAfterSplit(post_box); + box_at_top_of_new_branch = post_box; + + before_child = post_box; + } else { + before_child = box_to_split; + } + } + + // Splitting the box means the left side of the container chain will lose any + // percent height descendants below |boxAtTopOfNewBranch| on the right hand + // side. + if (box_at_top_of_new_branch) { + box_at_top_of_new_branch->ClearPercentHeightDescendants(); + MarkBoxForRelayoutAfterSplit(this); + } + + DCHECK_EQ(before_child->Parent(), this); + return before_child; +} + +LayoutBox* LayoutBoxModelObject::CreateAnonymousBoxToSplit( + const LayoutBox* box_to_split) const { + NOT_DESTROYED(); + return box_to_split->CreateAnonymousBoxWithSameTypeAs(this); +} + bool LayoutBoxModelObject::BackgroundTransfersToView( const ComputedStyle* document_element_style) const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/layout_inline.cc b/third_party/blink/renderer/core/layout/layout_inline.cc index 3d33a8fd..1f97993 100644 --- a/third_party/blink/renderer/core/layout/layout_inline.cc +++ b/third_party/blink/renderer/core/layout/layout_inline.cc
@@ -549,30 +549,7 @@ !new_child->IsTablePart()) { if (UNLIKELY(RuntimeEnabledFeatures::LayoutNGBlockInInlineEnabled()) && !ForceLegacyLayout()) { - DCHECK(!new_child->IsInline()); - LayoutBlockFlow* anonymous_box; - if (!before_child) { - anonymous_box = DynamicTo<LayoutBlockFlow>(LastChild()); - } else if (before_child->IsInline() || - before_child->IsFloatingOrOutOfFlowPositioned()) { - anonymous_box = - DynamicTo<LayoutBlockFlow>(before_child->PreviousSibling()); - } else { - // If |before_child| is not inline, it should have been added to the - // anonymous block. - anonymous_box = DynamicTo<LayoutBlockFlow>(before_child->Parent()); - DCHECK(anonymous_box); - DCHECK(anonymous_box->IsBlockInInline()); - anonymous_box->AddChild(new_child, before_child); - return; - } - if (!anonymous_box || !anonymous_box->IsBlockInInline()) { - anonymous_box = - CreateAnonymousContainerForBlockChildren(/* split_flow */ false); - LayoutBoxModelObject::AddChild(anonymous_box, before_child); - } - DCHECK(anonymous_box->IsBlockInInline()); - anonymous_box->AddChild(new_child); + AddChildAsBlockInInline(new_child, before_child); return; } LayoutBlockFlow* new_box = @@ -602,6 +579,35 @@ layout_invalidation_reason::kChildChanged); } +void LayoutInline::AddChildAsBlockInInline(LayoutObject* new_child, + LayoutObject* before_child) { + DCHECK(RuntimeEnabledFeatures::LayoutNGBlockInInlineEnabled()); + DCHECK(!ForceLegacyLayout()); + DCHECK(!new_child->IsInline()); + LayoutBlockFlow* anonymous_box; + if (!before_child) { + anonymous_box = DynamicTo<LayoutBlockFlow>(LastChild()); + } else if (before_child->IsInline() || + before_child->IsFloatingOrOutOfFlowPositioned()) { + anonymous_box = DynamicTo<LayoutBlockFlow>(before_child->PreviousSibling()); + } else { + // If |before_child| is not inline, it should have been added to the + // anonymous block. + anonymous_box = DynamicTo<LayoutBlockFlow>(before_child->Parent()); + DCHECK(anonymous_box); + DCHECK(anonymous_box->IsBlockInInline()); + anonymous_box->AddChild(new_child, before_child); + return; + } + if (!anonymous_box || !anonymous_box->IsBlockInInline()) { + anonymous_box = + CreateAnonymousContainerForBlockChildren(/* split_flow */ false); + LayoutBoxModelObject::AddChild(anonymous_box, before_child); + } + DCHECK(anonymous_box->IsBlockInInline()); + anonymous_box->AddChild(new_child); +} + LayoutInline* LayoutInline::Clone() const { NOT_DESTROYED(); DCHECK(!IsAnonymous());
diff --git a/third_party/blink/renderer/core/layout/layout_inline.h b/third_party/blink/renderer/core/layout/layout_inline.h index 61cc23c..2a655c8 100644 --- a/third_party/blink/renderer/core/layout/layout_inline.h +++ b/third_party/blink/renderer/core/layout/layout_inline.h
@@ -355,6 +355,8 @@ LayoutObject* before_child); void AddChildIgnoringContinuation(LayoutObject* new_child, LayoutObject* before_child = nullptr) final; + void AddChildAsBlockInInline(LayoutObject* new_child, + LayoutObject* before_child); void MoveChildrenToIgnoringContinuation(LayoutInline* to, LayoutObject* start_child);
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc index 96fc49c..cd8f46d 100644 --- a/third_party/blink/renderer/core/layout/layout_object.cc +++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -86,6 +86,7 @@ #include "third_party/blink/renderer/core/layout/layout_object_factory.h" #include "third_party/blink/renderer/core/layout/layout_object_inl.h" #include "third_party/blink/renderer/core/layout/layout_object_inlines.h" +#include "third_party/blink/renderer/core/layout/layout_ruby_run.h" #include "third_party/blink/renderer/core/layout/layout_table_caption.h" #include "third_party/blink/renderer/core/layout/layout_text_fragment.h" #include "third_party/blink/renderer/core/layout/layout_theme.h" @@ -3760,6 +3761,12 @@ if (destroy_root_parent->Parent() && destroy_root_parent->Parent()->IsLayoutNGFieldset()) break; + // RubyBase should be kept if RubyText exists + if (destroy_root_parent->IsRubyBase()) { + auto* ruby_run = DynamicTo<LayoutRubyRun>(destroy_root_parent->Parent()); + if (ruby_run && ruby_run->HasRubyText()) + break; + } // We need to keep the anonymous parent, if it won't become empty by the // removal of this LayoutObject. @@ -3939,13 +3946,7 @@ if (BehavesLikeBlockContainer()) { if (const ComputedStyle* cached = StyleRef().GetCachedPseudoElementStyle(kPseudoIdFirstLine)) { - // If the style is cached by getComputedStyle(element, "::first-line"), it - // is marked with IsEnsuredInDisplayNone(). In that case we might not have - // the correct ::first-line style for laying out the ::first-line. Ignore - // the cached ComputedStyle and overwrite it using - // ReplaceCachedPseudoElementStyle() below. - if (!cached->IsEnsuredInDisplayNone()) - return cached; + return cached; } if (Element* element = DynamicTo<Element>(GetNode())) { @@ -3979,7 +3980,7 @@ if (scoped_refptr<ComputedStyle> first_line_style = first_line_block->GetUncachedPseudoElementStyle( StyleRequest(kPseudoIdFirstLine, Style()))) { - return StyleRef().ReplaceCachedPseudoElementStyle( + return StyleRef().AddCachedPseudoElementStyle( std::move(first_line_style), kPseudoIdFirstLine, g_null_atom); } }
diff --git a/third_party/blink/renderer/core/layout/layout_ruby.cc b/third_party/blink/renderer/core/layout/layout_ruby.cc index 3bbb3566..8315c34 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby.cc
@@ -85,7 +85,7 @@ run->AddChild(child, before_child); return; } - NOTREACHED(); // beforeChild should always have a run as parent! + NOTREACHED(); // before_child should always have a run as parent! // Emergency fallback: fall through and just append. } @@ -94,8 +94,9 @@ // (The LayoutRubyRun object will handle the details) LayoutRubyRun* last_run = LastRubyRun(this); if (!last_run || last_run->HasRubyText()) { - last_run = LayoutRubyRun::StaticCreateRubyRun(this, *ContainingBlock()); + last_run = &LayoutRubyRun::Create(this, *ContainingBlock()); LayoutInline::AddChild(last_run, before_child); + last_run->EnsureRubyBase(); } last_run->AddChild(child); } @@ -153,7 +154,7 @@ run->AddChild(child, before_child); return; } - NOTREACHED(); // beforeChild should always have a run as parent! + NOTREACHED(); // before_child should always have a run as parent! // Emergency fallback: fall through and just append. } @@ -162,8 +163,9 @@ // (The LayoutRubyRun object will handle the details) LayoutRubyRun* last_run = LastRubyRun(this); if (!last_run || last_run->HasRubyText()) { - last_run = LayoutRubyRun::StaticCreateRubyRun(this, *this); + last_run = &LayoutRubyRun::Create(this, *this); LayoutBlockFlow::AddChild(last_run, before_child); + last_run->EnsureRubyBase(); } last_run->AddChild(child); }
diff --git a/third_party/blink/renderer/core/layout/layout_ruby.h b/third_party/blink/renderer/core/layout/layout_ruby.h index aed48d4..98fda66 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby.h +++ b/third_party/blink/renderer/core/layout/layout_ruby.h
@@ -46,9 +46,9 @@ // 0 or 1 LayoutRubyText - shuffled to the front in order to re-use // existing block layouting // 0-n inline object(s) -// 0 or 1 LayoutRubyBase - contains the inline objects that make up the -// ruby base -// 1-n inline object(s) +// 1 LayoutRubyBase - contains the inline objects that make up the +// ruby base +// 0-n inline object(s) // // Note: <rp> elements are defined as having 'display:none' and thus normally // are not assigned a layoutObject.
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_base.cc b/third_party/blink/renderer/core/layout/layout_ruby_base.cc index 4aaa979e..e7b47f9 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_base.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby_base.cc
@@ -60,12 +60,11 @@ return child->IsInline(); } -void LayoutRubyBase::MoveChildren(LayoutRubyBase* to_base, +// This function removes all children that are before (!) before_child +// and appends them to to_base. +void LayoutRubyBase::MoveChildren(LayoutRubyBase& to_base, LayoutObject* before_child) { NOT_DESTROYED(); - // This function removes all children that are before (!) beforeChild - // and appends them to toBase. - DCHECK(to_base); // Callers should have handled the percent height descendant map. DCHECK(!HasPercentHeightDescendants()); @@ -79,55 +78,53 @@ SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation( layout_invalidation_reason::kUnknown); - to_base->SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation( + to_base.SetNeedsLayoutAndIntrinsicWidthsRecalcAndFullPaintInvalidation( layout_invalidation_reason::kUnknown); } -void LayoutRubyBase::MoveInlineChildren(LayoutRubyBase* to_base, +void LayoutRubyBase::MoveInlineChildren(LayoutRubyBase& to_base, LayoutObject* before_child) { NOT_DESTROYED(); DCHECK(ChildrenInline()); - DCHECK(to_base); if (!FirstChild()) return; LayoutBlock* to_block; - if (to_base->ChildrenInline()) { + if (to_base.ChildrenInline()) { // The standard and easy case: move the children into the target base - to_block = to_base; + to_block = &to_base; } else { // We need to wrap the inline objects into an anonymous block. // If toBase has a suitable block, we re-use it, otherwise create a new one. - LayoutObject* last_child = to_base->LastChild(); + LayoutObject* last_child = to_base.LastChild(); if (last_child && last_child->IsAnonymousBlock() && last_child->ChildrenInline()) { to_block = To<LayoutBlock>(last_child); } else { - to_block = to_base->CreateAnonymousBlock(); - to_base->Children()->AppendChildNode(to_base, to_block); + to_block = to_base.CreateAnonymousBlock(); + to_base.Children()->AppendChildNode(&to_base, to_block); } } // Move our inline children into the target block we determined above. MoveChildrenTo(to_block, FirstChild(), before_child); } -void LayoutRubyBase::MoveBlockChildren(LayoutRubyBase* to_base, +void LayoutRubyBase::MoveBlockChildren(LayoutRubyBase& to_base, LayoutObject* before_child) { NOT_DESTROYED(); DCHECK(!ChildrenInline()); - DCHECK(to_base); if (!FirstChild()) return; - if (to_base->ChildrenInline()) - to_base->MakeChildrenNonInline(); + if (to_base.ChildrenInline()) + to_base.MakeChildrenNonInline(); // If an anonymous block would be put next to another such block, then merge // those. LayoutObject* first_child_here = FirstChild(); - LayoutObject* last_child_there = to_base->LastChild(); + LayoutObject* last_child_there = to_base.LastChild(); if (first_child_here->IsAnonymousBlock() && first_child_here->ChildrenInline() && last_child_there && last_child_there->IsAnonymousBlock() && @@ -142,7 +139,7 @@ // Move all remaining children normally. If moving all children, include our // float list. if (!before_child) { - bool full_remove_insert = to_base->HasLayer() || HasLayer(); + bool full_remove_insert = to_base.HasLayer() || HasLayer(); // TODO(kojii): |this| is |!ChildrenInline()| when we enter this function, // but it may turn to |ChildrenInline()| when |anon_block_here| is destroyed // above. Probably the correct fix is to do it earlier and switch to @@ -150,9 +147,9 @@ // using |full_remove_insert| can prevent inconsistent LayoutObject tree // that leads to CHECK failures. full_remove_insert |= ChildrenInline(); - MoveAllChildrenIncludingFloatsTo(to_base, full_remove_insert); + MoveAllChildrenIncludingFloatsTo(&to_base, full_remove_insert); } else { - MoveChildrenTo(to_base, FirstChild(), before_child); + MoveChildrenTo(&to_base, FirstChild(), before_child); RemoveFloatingObjectsFromDescendants(); } }
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_base.h b/third_party/blink/renderer/core/layout/layout_ruby_base.h index 40bc3e0..869f2f4 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_base.h +++ b/third_party/blink/renderer/core/layout/layout_ruby_base.h
@@ -68,11 +68,11 @@ LayoutUnit& logical_left, LayoutUnit& logical_width) const override; - void MoveChildren(LayoutRubyBase* to_base, + void MoveChildren(LayoutRubyBase& to_base, LayoutObject* before_child = nullptr); - void MoveInlineChildren(LayoutRubyBase* to_base, + void MoveInlineChildren(LayoutRubyBase& to_base, LayoutObject* before_child = nullptr); - void MoveBlockChildren(LayoutRubyBase* to_base, + void MoveBlockChildren(LayoutRubyBase& to_base, LayoutObject* before_child = nullptr); friend class LayoutNGMixin<LayoutRubyBase>;
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_run.cc b/third_party/blink/renderer/core/layout/layout_ruby_run.cc index 55738bbd7..0b51f7cf 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_run.cc +++ b/third_party/blink/renderer/core/layout/layout_ruby_run.cc
@@ -70,25 +70,21 @@ // text, layout will have to be changed to handle them properly. DCHECK(!child || !child->IsRubyText() || !child->IsFloatingOrOutOfFlowPositioned()); - return child && child->IsRubyText() ? static_cast<LayoutRubyText*>(child) - : nullptr; + return DynamicTo<LayoutRubyText>(child); } LayoutRubyBase* LayoutRubyRun::RubyBase() const { NOT_DESTROYED(); - LayoutObject* child = LastChild(); - return child && child->IsRubyBase() ? static_cast<LayoutRubyBase*>(child) - : nullptr; + return DynamicTo<LayoutRubyBase>(LastChild()); } -LayoutRubyBase* LayoutRubyRun::RubyBaseSafe() { +LayoutRubyBase& LayoutRubyRun::EnsureRubyBase() { NOT_DESTROYED(); - LayoutRubyBase* base = RubyBase(); - if (!base) { - base = CreateRubyBase(); - LayoutBlockFlow::AddChild(base); - } - return base; + if (auto* base = RubyBase()) + return *base; + auto& new_base = CreateRubyBase(); + LayoutBlockFlow::AddChild(&new_base); + return new_base; } bool LayoutRubyRun::IsChildAllowed(LayoutObject* child, @@ -114,40 +110,42 @@ DCHECK_EQ(before_child->Parent(), this); LayoutObject* ruby = Parent(); DCHECK(ruby->IsRuby()); - LayoutBlock* new_run = StaticCreateRubyRun(ruby, *ContainingBlock()); - ruby->AddChild(new_run, NextSibling()); + auto& new_run = Create(ruby, *ContainingBlock()); + ruby->AddChild(&new_run, NextSibling()); + new_run.EnsureRubyBase(); // Add the new ruby text and move the old one to the new run // Note: Doing it in this order and not using LayoutRubyRun's methods, // in order to avoid automatic removal of the ruby run in case there is no // other child besides the old ruby text. LayoutBlockFlow::AddChild(child, before_child); LayoutBlockFlow::RemoveChild(before_child); - new_run->AddChild(before_child); - } else if (HasRubyBase()) { + new_run.AddChild(before_child); + } else if (RubyBase()->FirstChild()) { // Insertion before a ruby base object. // In this case we need insert a new run before the current one and split // the base. LayoutObject* ruby = Parent(); - LayoutRubyRun* new_run = StaticCreateRubyRun(ruby, *ContainingBlock()); - ruby->AddChild(new_run, this); - new_run->AddChild(child); + LayoutRubyRun& new_run = Create(ruby, *ContainingBlock()); + ruby->AddChild(&new_run, this); + auto& new_base = new_run.EnsureRubyBase(); + new_run.AddChild(child); // Make sure we don't leave anything in the percentage descendant // map before moving the children to the new base. if (HasPercentHeightDescendants()) ClearPercentHeightDescendants(); - RubyBaseSafe()->MoveChildren(new_run->RubyBaseSafe(), before_child); + EnsureRubyBase().MoveChildren(new_base, before_child); } } else { // child is not a text -> insert it into the base // (append it instead if beforeChild is the ruby text) - LayoutRubyBase* base = RubyBaseSafe(); - if (before_child == base) - before_child = base->FirstChild(); + LayoutRubyBase& base = EnsureRubyBase(); + if (before_child == &base) + before_child = base.FirstChild(); if (before_child && before_child->IsRubyText()) before_child = nullptr; - DCHECK(!before_child || before_child->IsDescendantOf(base)); - base->AddChild(child, before_child); + DCHECK(!before_child || before_child->IsDescendantOf(&base)); + base.AddChild(child, before_child); } } @@ -158,16 +156,14 @@ if (!BeingDestroyed() && !DocumentBeingDestroyed() && child->IsRubyText()) { LayoutRubyBase* base = RubyBase(); LayoutObject* right_neighbour = NextSibling(); - if (base && right_neighbour && right_neighbour->IsRubyRun()) { - // Ruby run without a base can happen only at the first run. + if (base->FirstChild() && right_neighbour && right_neighbour->IsRubyRun()) { auto* right_run = To<LayoutRubyRun>(right_neighbour); - if (right_run->HasRubyBase()) { - LayoutRubyBase* right_base = right_run->RubyBaseSafe(); + LayoutRubyBase& right_base = right_run->EnsureRubyBase(); + if (right_base.FirstChild()) { // Collect all children in a single base, then swap the bases. - right_base->MoveChildren(base); + right_base.MoveChildren(*base); MoveChildTo(right_run, base); - right_run->MoveChildTo(this, right_base); - // The now empty ruby base will be removed below. + right_run->MoveChildTo(this, &right_base); DCHECK(!RubyBase()->FirstChild()); } } @@ -176,37 +172,33 @@ LayoutBlockFlow::RemoveChild(child); if (!BeingDestroyed() && !DocumentBeingDestroyed()) { - // Check if our base (if any) is now empty. If so, destroy it. + // If this has only an empty LayoutRubyBase, destroy this sub-tree. LayoutBlockFlow* base = RubyBase(); - if (base && !base->FirstChild()) { + if (!HasRubyText() && !base->FirstChild()) { LayoutBlockFlow::RemoveChild(base); base->DeleteLineBoxTree(); base->Destroy(); - } - - // If any of the above leaves the run empty, destroy it as well. - if (!HasRubyText() && !HasRubyBase()) { DeleteLineBoxTree(); Destroy(); } } } -LayoutRubyBase* LayoutRubyRun::CreateRubyBase() const { +LayoutRubyBase& LayoutRubyRun::CreateRubyBase() const { NOT_DESTROYED(); - LayoutRubyBase* layout_object = - LayoutRubyBase::CreateAnonymous(&GetDocument(), *this); + auto* layout_object = LayoutRubyBase::CreateAnonymous(&GetDocument(), *this); scoped_refptr<ComputedStyle> new_style = GetDocument().GetStyleResolver().CreateAnonymousStyleWithDisplay( StyleRef(), EDisplay::kBlock); new_style->SetTextAlign(ETextAlign::kCenter); // FIXME: use WEBKIT_CENTER? + new_style->SetHasLineIfEmpty(true); layout_object->SetStyle(std::move(new_style)); - return layout_object; + return *layout_object; } -LayoutRubyRun* LayoutRubyRun::StaticCreateRubyRun( - const LayoutObject* parent_ruby, - const LayoutBlock& containing_block) { +// static +LayoutRubyRun& LayoutRubyRun::Create(const LayoutObject* parent_ruby, + const LayoutBlock& containing_block) { DCHECK(parent_ruby); DCHECK(parent_ruby->IsRuby()); LayoutRubyRun* rr; @@ -222,7 +214,7 @@ .CreateAnonymousStyleWithDisplay(parent_ruby->StyleRef(), EDisplay::kInlineBlock); rr->SetStyle(std::move(new_style)); - return rr; + return *rr; } LayoutObject* LayoutRubyRun::LayoutSpecialExcludedChild(
diff --git a/third_party/blink/renderer/core/layout/layout_ruby_run.h b/third_party/blink/renderer/core/layout/layout_ruby_run.h index 5ca11d38..0f05ba4 100644 --- a/third_party/blink/renderer/core/layout/layout_ruby_run.h +++ b/third_party/blink/renderer/core/layout/layout_ruby_run.h
@@ -43,18 +43,22 @@ // LayoutRubyRun are 'inline-block/table' like objects,and wrap a single pairing // of a ruby base with its ruby text(s). -// See LayoutRuby.h for further comments on the structure +// See layout_ruby.h for further comments on the structure class LayoutRubyRun : public LayoutBlockFlow { public: + // The argument must be nullptr. + explicit LayoutRubyRun(ContainerNode*); + static LayoutRubyRun& Create(const LayoutObject* parent_ruby, + const LayoutBlock& containing_block); ~LayoutRubyRun() override; bool HasRubyText() const; bool HasRubyBase() const; LayoutRubyText* RubyText() const; LayoutRubyBase* RubyBase() const; - LayoutRubyBase* - RubyBaseSafe(); // creates the base if it doesn't already exist + // Creates the base if it doesn't already exist + LayoutRubyBase& EnsureRubyBase(); LayoutObject* LayoutSpecialExcludedChild(bool relayout_children, SubtreeLayoutScope&) override; @@ -71,10 +75,6 @@ int& start_overhang, int& end_overhang) const; - static LayoutRubyRun* StaticCreateRubyRun( - const LayoutObject* parent_ruby, - const LayoutBlock& containing_block); - bool CanBreakBefore(const LazyLineBreakIterator&) const; const char* GetName() const override { @@ -82,11 +82,8 @@ return "LayoutRubyRun"; } - // The argument must be nullptr. - explicit LayoutRubyRun(ContainerNode*); - protected: - LayoutRubyBase* CreateRubyBase() const; + LayoutRubyBase& CreateRubyBase() const; private: bool IsOfType(LayoutObjectType type) const override {
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.cc index 1e76b8f..98ad7055 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_box_state.cc
@@ -994,12 +994,16 @@ break; } case EBaselineShiftType::kSub: - baseline_shift = LayoutUnit( - box->font->PrimaryFont()->GetFontMetrics().FloatHeight() / 2); + if (const auto* font_data = box->font->PrimaryFont()) { + baseline_shift = + LayoutUnit(font_data->GetFontMetrics().FloatHeight() / 2); + } break; case EBaselineShiftType::kSuper: - baseline_shift = LayoutUnit( - -box->font->PrimaryFont()->GetFontMetrics().FloatHeight() / 2); + if (const auto* font_data = box->font->PrimaryFont()) { + baseline_shift = + LayoutUnit(-font_data->GetFontMetrics().FloatHeight() / 2); + } break; } baseline_shift += ComputeAlignmentBaselineShift(box);
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index edb3323..ab10fb9 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -613,25 +613,6 @@ return result; } -const ComputedStyle* ComputedStyle::ReplaceCachedPseudoElementStyle( - scoped_refptr<const ComputedStyle> pseudo_style, - PseudoId pseudo_id, - const AtomicString& pseudo_argument) const { - DCHECK(pseudo_style->StyleType() != kPseudoIdNone && - pseudo_style->StyleType() != kPseudoIdFirstLineInherited); - if (HasCachedPseudoElementStyles()) { - for (auto& cached_style : *GetPseudoElementStyleCache()) { - if (cached_style->StyleType() == pseudo_id && - (!PseudoElementHasArguments(pseudo_id) || - cached_style->PseudoArgument() == pseudo_argument)) { - cached_style = pseudo_style; - return pseudo_style.get(); - } - } - } - return AddCachedPseudoElementStyle(pseudo_style, pseudo_id, pseudo_argument); -} - void ComputedStyle::ClearCachedPseudoElementStyles() const { if (cached_data_ && cached_data_->pseudo_element_styles_) cached_data_->pseudo_element_styles_->clear();
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 872aea1..9c32287d 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -425,10 +425,6 @@ scoped_refptr<const ComputedStyle>, PseudoId, const AtomicString&) const; - const ComputedStyle* ReplaceCachedPseudoElementStyle( - scoped_refptr<const ComputedStyle> pseudo_style, - PseudoId pseudo_id, - const AtomicString& pseudo_argument) const; void ClearCachedPseudoElementStyles() const; // If this ComputedStyle is affected by animation/transitions, then the
diff --git a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.cc b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.cc index e885627..8703ee9 100644 --- a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.cc +++ b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.cc
@@ -34,10 +34,22 @@ void CrosWindowManagement::Trace(Visitor* visitor) const { visitor->Trace(cros_window_management_); Supplement<ExecutionContext>::Trace(visitor); + EventTargetWithInlineData::Trace(visitor); ExecutionContextClient::Trace(visitor); ScriptWrappable::Trace(visitor); } +const WTF::AtomicString& CrosWindowManagement::InterfaceName() const { + // TODO(b/221130654): Move to event_target_names::kCrosWindowManagement. + DEFINE_STATIC_LOCAL(const AtomicString, kInterfaceName, + ("CrosWindowManagement")); + return kInterfaceName; +} + +ExecutionContext* CrosWindowManagement::GetExecutionContext() const { + return ExecutionContextClient::GetExecutionContext(); +} + mojom::blink::CrosWindowManagement* CrosWindowManagement::GetCrosWindowManagementOrNull() { auto* execution_context = GetExecutionContext();
diff --git a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.h b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.h index 9142936..70108e1d 100644 --- a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.h +++ b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.h
@@ -7,6 +7,7 @@ #include "third_party/blink/public/mojom/chromeos/system_extensions/window_management/cros_window_management.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" @@ -15,7 +16,7 @@ namespace blink { class ScriptPromiseResolver; -class CrosWindowManagement : public ScriptWrappable, +class CrosWindowManagement : public EventTargetWithInlineData, public Supplement<ExecutionContext>, public ExecutionContextClient { DEFINE_WRAPPERTYPEINFO(); @@ -27,6 +28,11 @@ explicit CrosWindowManagement(ExecutionContext&); + // EventTarget + const AtomicString& InterfaceName() const override; + ExecutionContext* GetExecutionContext() const override; + + // GC void Trace(Visitor*) const override; // Returns the remote for communication with the browser's window management
diff --git a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.idl b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.idl index 075fde0f..74e32e7 100644 --- a/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.idl +++ b/third_party/blink/renderer/extensions/chromeos/system_extensions/window_management/cros_window_management.idl
@@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -interface CrosWindowManagement { +interface CrosWindowManagement : EventTarget { [CallWith=ScriptState] Promise<sequence<CrosWindow>> getWindows(); };
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_source.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_source.cc index f979d12..dd89aae 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_source.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_audio_underlying_source.cc
@@ -65,6 +65,12 @@ if (!disconnect_callback_ || !GetExecutionContext()) { return; } + if (!Controller()) { + // TODO(ricea): Maybe avoid dropping frames during transfer? + DVLOG(1) << "Dropped frame due to null Controller(). This can happen " + "during transfer."; + return; + } if (Controller()->DesiredSize() <= kMinQueueDesiredSize) { dropped_frames_++; VLOG_IF(2, (dropped_frames_ % 20 == 0))
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_source.cc b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_source.cc index 561f83b..20919a2 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_source.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_encoded_video_underlying_source.cc
@@ -56,6 +56,12 @@ if (!disconnect_callback_ || !GetExecutionContext()) { return; } + if (!Controller()) { + // TODO(ricea): Maybe avoid dropping frames during transfer? + DVLOG(1) << "Dropped frame due to null Controller(). This can happen " + "during transfer."; + return; + } if (Controller()->DesiredSize() <= kMinQueueDesiredSize) { dropped_frames_++; VLOG_IF(2, (dropped_frames_ % 20 == 0))
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 72ce02a..250a636 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1215,6 +1215,7 @@ }, { name: "HighlightOverlayPainting", + status: "stable", }, { name: "HrefTranslate", @@ -2425,7 +2426,6 @@ }, { name: "VideoTrackGeneratorInWorker", - status: "test", }, { name: "VideoWakeLockOptimisationHiddenMuted",
diff --git a/third_party/blink/renderer/platform/wtf/allocator/partition_allocator.h b/third_party/blink/renderer/platform/wtf/allocator/partition_allocator.h index 081077b..5b24ebbc 100644 --- a/third_party/blink/renderer/platform/wtf/allocator/partition_allocator.h +++ b/third_party/blink/renderer/platform/wtf/allocator/partition_allocator.h
@@ -23,7 +23,7 @@ template <typename T> static size_t MaxElementCountInBackingStore() { - return base::MaxDirectMapped() / sizeof(T); + return partition_alloc::MaxDirectMapped() / sizeof(T); } template <typename T>
diff --git a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng index a783780..1e637a3 100644 --- a/third_party/blink/web_tests/FlagExpectations/disable-layout-ng +++ b/third_party/blink/web_tests/FlagExpectations/disable-layout-ng
@@ -609,7 +609,6 @@ crbug.com/1108830 external/wpt/css/css-pseudo/marker-word-break.html [ Failure ] crbug.com/1012289 external/wpt/css/css-pseudo/marker-unicode-bidi-default.html [ Failure ] crbug.com/1012289 external/wpt/css/css-pseudo/marker-unicode-bidi-normal.html [ Failure ] -crbug.com/1136817 external/wpt/css/css-pseudo/target-text-004.html [ Pass ] crbug.com/1136817 external/wpt/css/css-pseudo/target-text-007.html [ Failure ] crbug.com/1035708 wpt_internal/css/css-pseudo/spelling-error-color-001.html [ Failure ] crbug.com/1035708 wpt_internal/css/css-pseudo/spelling-error-color-002.html [ Failure ] @@ -621,6 +620,8 @@ crbug.com/1035708 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/selection-originating-decoration-color.html [ Failure ] ### external/wpt/css/css-ruby/ +crbug.com/591099 external/wpt/css/css-ruby/abs-in-ruby-base-container.html [ Failure ] +crbug.com/591099 external/wpt/css/css-ruby/abs-in-ruby-base.html [ Failure ] crbug.com/591099 external/wpt/css/css-ruby/br-clear-all-002.html [ Failure ] crbug.com/591099 external/wpt/css/css-ruby/ruby-line-breaking-002.html [ Failure ] crbug.com/591099 external/wpt/css/css-ruby/ruby-with-floats-002.html [ Failure ] @@ -1739,6 +1740,120 @@ # HighlightOverlayPainting is only implemented in ng crbug.com/1147859 virtual/css-highlight-overlay-painting/* [ Skip ] +crbug.com/1147859 dark-mode/colors/selection.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-005.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-006.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-007.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-008.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-009.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-010.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-011.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-012.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-013.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-014.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-015.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-016.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-017.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-018.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-below-selection.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-004.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-005.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-inheritance-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-inheritance-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-004.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-005.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-006.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-007.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-shadow.tentative.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-currentcolor-004.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/highlight-paired-cascade-004.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-001.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-002.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-003.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-004.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-005.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-006.html [ Failure ] +crbug.com/1147859 external/wpt/css/css-pseudo/target-text-text-decoration-001.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-font-8px.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-125.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-150.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-175.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-200.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-2000.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers-zoom-250.html [ Failure ] +crbug.com/1147859 paint/markers/document-markers.html [ Failure ] +crbug.com/1147859 paint/markers/first-letter.html [ Failure ] +crbug.com/1147859 paint/markers/grammar-markers-hidpi.html [ Failure ] +crbug.com/1147859 paint/markers/grammar-markers.html [ Failure ] +crbug.com/1147859 paint/markers/inline-spelling-markers-hidpi-composited.html [ Failure ] +crbug.com/1147859 paint/markers/inline-spelling-markers-hidpi.html [ Failure ] +crbug.com/1147859 paint/markers/marker-early-break-bug.html [ Failure ] +crbug.com/1147859 paint/markers/markers-zoomed.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-005.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-006.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-007.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-008.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-009.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-010.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-011.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-012.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-013.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-014.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-015.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-016.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-017.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-018.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-below-selection.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-004.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-005.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-004.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-005.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-006.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-007.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-shadow.tentative.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/highlight-painting-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/highlight-painting-currentcolor-004.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/highlight-paired-cascade-004.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-002.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-003.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-004.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-005.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-006.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/external/wpt/css/css-pseudo/target-text-text-decoration-001.html [ Failure ] +crbug.com/1147859 virtual/css-highlight-inheritance/wpt_internal/css/css-pseudo/target-text-002.html [ Failure ] +crbug.com/1147859 virtual/dark-mode-default/dark-mode/colors/selection.html [ Failure ] +crbug.com/1147859 virtual/dark-mode-increase-text-contrast/dark-mode/colors/selection.html [ Failure ] +crbug.com/1147859 wpt_internal/css/css-pseudo/target-text-002.html [ Failure ] crbug.com/1303102 wpt_internal/css/css-images/object-view-box* [ Skip ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 23a02f52..480f481e 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1183,8 +1183,6 @@ crbug.com/880802 external/wpt/css/css-contain/contain-layout-017.html [ Failure ] crbug.com/868704 external/wpt/css/css-contain/contain-layout-breaks-002.html [ Failure ] -crbug.com/847274 external/wpt/css/css-contain/contain-paint-005.html [ Failure ] -crbug.com/847274 external/wpt/css/css-contain/contain-paint-006.html [ Failure ] crbug.com/880802 external/wpt/css/css-contain/contain-paint-021.html [ Failure ] crbug.com/882367 external/wpt/css/css-contain/contain-paint-clip-015.html [ Failure ] crbug.com/882367 external/wpt/css/css-contain/contain-paint-clip-016.html [ Failure ] @@ -1752,13 +1750,9 @@ crbug.com/1163437 external/wpt/css/css-pseudo/grammar-spelling-errors-002.html [ Failure ] crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-001.html [ Failure ] crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-002.html [ Failure ] -crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-003.html [ Failure ] crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-004.html [ Failure ] crbug.com/1295264 crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-currentcolor-001.html [ Failure ] crbug.com/1295264 crbug.com/1147859 external/wpt/css/css-pseudo/highlight-painting-currentcolor-002.html [ Failure ] -crbug.com/1179938 external/wpt/css/css-pseudo/highlight-painting-currentcolor-003.html [ Failure ] -crbug.com/1179938 external/wpt/css/css-pseudo/highlight-painting-currentcolor-004.html [ Failure ] -crbug.com/1179938 external/wpt/css/css-pseudo/highlight-painting-currentcolor-005.html [ Failure ] crbug.com/1024156 external/wpt/css/css-pseudo/highlight-pseudos-inheritance-computed-001.html [ Failure ] crbug.com/1024156 external/wpt/css/css-pseudo/highlight-pseudos-currentcolor-inheritance-computed-001.html [ Failure ] crbug.com/995106 external/wpt/css/css-pseudo/first-letter-exclude-inline-marker.html [ Failure ] @@ -1778,12 +1772,16 @@ crbug.com/1035708 wpt_internal/css/css-pseudo/grammar-error-color-dynamic-003.html [ Failure ] crbug.com/1035708 wpt_internal/css/css-pseudo/grammar-error-color-dynamic-004.html [ Failure ] crbug.com/1147859 external/wpt/css/css-pseudo/target-text-004.html [ Failure ] -crbug.com/1179938 external/wpt/css/css-pseudo/target-text-006.html [ Failure ] crbug.com/1035708 external/wpt/css/css-pseudo/target-text-dynamic-001.html [ Failure ] crbug.com/1035708 external/wpt/css/css-pseudo/target-text-dynamic-002.html [ Failure ] crbug.com/1035708 external/wpt/css/css-pseudo/target-text-dynamic-003.html [ Failure ] crbug.com/1035708 external/wpt/css/css-pseudo/target-text-dynamic-004.html [ Failure ] -crbug.com/1179938 external/wpt/css/css-pseudo/target-text-text-decoration-001.html [ Failure ] + +# CSS highlight painting (HighlightOverlayPainting) +crbug.com/1147859 [ Mac ] external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html [ Failure ] +crbug.com/1147859 [ Mac ] external/wpt/css/css-pseudo/highlight-painting-003.html [ Failure ] +crbug.com/1321106 external/wpt/css/css-text-decor/text-decoration-color-selection-001.html [ Failure ] +crbug.com/1321114 paint/markers/suggestion-marker-basic.html [ Failure ] crbug.com/1205953 external/wpt/css/css-will-change/will-change-fixpos-cb-position-1.html [ Failure ] crbug.com/1207788 external/wpt/css/css-will-change/will-change-stacking-context-mask-1.html [ Failure ] @@ -2993,8 +2991,6 @@ crbug.com/1024156 external/wpt/css/css-pseudo/active-selection-027.html [ Failure ] crbug.com/1024156 external/wpt/css/css-pseudo/active-selection-025.html [ Failure ] -crbug.com/27659 external/wpt/css/css-ruby/abs-in-ruby-base-container.html [ Failure ] -crbug.com/27659 external/wpt/css/css-ruby/abs-in-ruby-base.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/block-ruby-001.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/block-ruby-002.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/block-ruby-005.html [ Failure ] @@ -3012,6 +3008,7 @@ crbug.com/27659 external/wpt/css/css-ruby/ruby-annotation-pairing-001.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/ruby-base-container-abs.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/ruby-base-container-float.html [ Failure ] +crbug.com/27659 external/wpt/css/css-ruby/ruby-base-different-size.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/ruby-bidi-002.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/ruby-bidi-003.html [ Failure ] crbug.com/27659 external/wpt/css/css-ruby/ruby-box-generation-001.html [ Failure ] @@ -3101,73 +3098,6 @@ crbug.com/1035708 virtual/css-highlight-inheritance/wpt_internal/css/css-pseudo/spelling-error-color-dynamic-003.html [ Pass ] crbug.com/1035708 virtual/css-highlight-inheritance/wpt_internal/css/css-pseudo/spelling-error-color-dynamic-004.html [ Pass ] -# virtual/css-highlight-overlay-painting/ -crbug.com/1295264 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-001.html [ Failure ] -crbug.com/1295264 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-overlapping-highlights-002.html [ Failure ] -crbug.com/1147859 [ Mac ] virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html [ Failure ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/grammar-error-color-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/grammar-error-color-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/spelling-error-color-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/spelling-error-color-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-005.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-006.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-007.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-008.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-009.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-010.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-011.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-012.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-013.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-014.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-015.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-016.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-017.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-018.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-below-selection.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-004.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-005.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-iframe-006.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-inheritance-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-inheritance-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-inheritance-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-004.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-005.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-006.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-invalidation-007.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-prioritization-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-001.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-002.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-004.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-005.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-006.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-staticrange-007.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-shadow.tentative.html [ Pass ] -crbug.com/1147859 [ Mac11 ] virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-003.html [ Failure ] -crbug.com/1147859 [ Win ] virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-003.html [ Pass ] -crbug.com/1147859 [ Linux ] virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-003.html [ Pass ] -crbug.com/1147859 [ Fuchsia ] virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-currentcolor-003.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/highlight-painting-currentcolor-004.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/target-text-006.html [ Pass ] -crbug.com/1147859 virtual/css-highlight-overlay-painting/external/wpt/css/css-pseudo/target-text-text-decoration-001.html [ Pass ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/grammar-error-color-dynamic-001.html [ Failure ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/grammar-error-color-dynamic-003.html [ Failure ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/grammar-error-color-dynamic-004.html [ Failure ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/spelling-error-color-dynamic-001.html [ Failure ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/spelling-error-color-dynamic-003.html [ Failure ] -crbug.com/1251193 crbug.com/1024156 virtual/css-highlight-overlay-painting/wpt_internal/css/css-pseudo/spelling-error-color-dynamic-004.html [ Failure ] - crbug.com/825270 external/wpt/payment-request/delegate-request.https.sub.html [ Failure ] crbug.com/1105958 external/wpt/payment-request/payment-is-showing.https.html [ Failure Timeout ] @@ -5976,10 +5906,7 @@ crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-004.html [ Failure ] crbug.com/1163437 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-below-grammar.html [ Failure ] crbug.com/1147859 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-below-target-text.html [ Failure ] -crbug.com/1274174 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-001.html [ Pass ] -crbug.com/1274174 external/wpt/css/css-highlight-api/painting/custom-highlight-painting-text-decoration-dynamic-001.html [ Pass ] -crbug.com/1147859 [ Linux ] external/wpt/css/css-highlight-api/painting/* [ Failure ] -crbug.com/1147859 [ Linux ] virtual/css-highlight-inheritance/external/wpt/css/css-highlight-api/painting/* [ Failure ] +crbug.com/1147859 [ Linux ] external/wpt/css/css-highlight-api/painting/custom-highlight-painting-004-2.html [ Failure ] crbug.com/1147859 [ Linux ] paint/custom-highlight-only-inheritance.html [ Failure ] # Green Mac11 Test @@ -6870,8 +6797,8 @@ crbug.com/1316341 virtual/fenced-frame-mparch/wpt_internal/fenced_frame/script-focus.https.html [ Failure Pass Timeout ] crbug.com/1316341 virtual/fenced-frame-shadow-dom/wpt_internal/fenced_frame/script-focus.https.html [ Failure Pass Timeout ] -# Sheriff 2022-04-18 -crbug.com/1317007 [ Mac ] external/wpt/mimesniff/mime-types/charset-parameter.window.html [ Failure Pass ] +# Sheriff 2022-04-18, failing on Mac and WebKit Win10 builders. +crbug.com/1317007 external/wpt/mimesniff/mime-types/charset-parameter.window.html [ Failure Pass ] # Sheriff 2022-04-18 # TODO(crbug.com/1316144): Re-enable this test @@ -6956,5 +6883,5 @@ crbug.com/1323626 [ Mac11-arm64 ] compositing/lots-of-img-layers-with-opacity.html [ Failure Pass ] crbug.com/1323627 [ Mac11-arm64 ] virtual/gpu-rasterization/images/color-profile-svg-foreign-object.html [ Failure Pass ] -# Sheriff 2022-05-10 -crbug.com/1280621 [ Linux Debug ] http/tests/devtools/persistence/persistence-move-breakpoints.js [ Failure ] \ No newline at end of file +# Sheriff 2022-05-11 +crbug.com/1324428 fast/webgl/canvas-toDataURL-crash.html [ Crash Pass ]
diff --git a/third_party/blink/web_tests/external/wpt/content-security-policy/frame-ancestors/frame-ancestors-sandbox-same-origin-self.html b/third_party/blink/web_tests/external/wpt/content-security-policy/frame-ancestors/frame-ancestors-sandbox-same-origin-self.html new file mode 100644 index 0000000..4a2a196 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/content-security-policy/frame-ancestors/frame-ancestors-sandbox-same-origin-self.html
@@ -0,0 +1,17 @@ +<!DOCTYPE html> +<html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="support/frame-ancestors-test.sub.js"></script> +</head> +<body> + <script> + test = async_test("A 'frame-ancestors' CSP directive with a 'self' value " + + "should compare the child URL (self) against each parent's origin's URL" + + " rather then URL. When the ancestors are sandboxed, they never match."); + + testNestedSandboxedIFrame('self', SAME_ORIGIN, SAME_ORIGIN, EXPECT_BLOCK); + </script> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-green-ref.html b/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-green-ref.html deleted file mode 100644 index 99e9c334..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-green-ref.html +++ /dev/null
@@ -1,3 +0,0 @@ -<!doctype html> -<title>CSS Test Reference</title> -<div style="color:green">This text should be green.</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-nested-gcs.html b/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-nested-gcs.html deleted file mode 100644 index 6777e54..0000000 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/first-line-nested-gcs.html +++ /dev/null
@@ -1,14 +0,0 @@ -<!doctype html> -<title>CSS Pseudo Test: Query ::first-line computed style before outer block ::first-line matches</title> -<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-line-pseudo"> -<link rel="match" href="first-line-green-ref.html"> -<style> - #outer::first-line { color: green } -</style> -<div id="outer"> - <div id="inner"></div> -</div> -<script> - getComputedStyle(inner, "::first-line").color; - inner.appendChild(document.createTextNode("This text should be green.")); -</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001-ref.html b/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001-ref.html index b15f74c..0ee37b1 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001-ref.html +++ b/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001-ref.html
@@ -4,6 +4,8 @@ <style> div { text-decoration: solid underline magenta; + color: initial; + background: transparent; } </style> <p>The test passes if the following line has a magenta underline.</p>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001.html b/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001.html index 1709ce70..d90d5d9 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-pseudo/target-text-text-decoration-001.html
@@ -7,6 +7,8 @@ <style> ::target-text { text-decoration: solid underline magenta; + color: initial; + background: transparent; } </style> <p>The test passes if the following line has a magenta underline.</p>
diff --git a/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/indexeddb.tentative.https.window.js b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/indexeddb.tentative.https.window.js new file mode 100644 index 0000000..197d782 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/anonymous-iframe/indexeddb.tentative.https.window.js
@@ -0,0 +1,104 @@ +// META: timeout=long +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/common/dispatcher/dispatcher.js +// META: script=/html/cross-origin-embedder-policy/credentialless/resources/common.js +// META: script=./resources/common.js + +// "token()" is used to get unique value for every execution of the test. This +// avoids potential side effects of one run toward the second. +const g_db_store = token(); +const g_db_name = token(); +const g_db_version = 1; + +// A script storing "|id|=|value|" in IndexedDB. +const write_script = (id, value, done) => ` + // Open the database: + const request = indexedDB.open("${g_db_name}", "${g_db_version}"); + request.onupgradeneeded = () => { + request.result.createObjectStore("${g_db_store}", {keyPath: "id"}); + }; + await new Promise(r => request.onsuccess = r); + const db = request.result; + + // Write the value: + const transaction_write = db.transaction("${g_db_store}", "readwrite"); + transaction_write.objectStore("${g_db_store}").add({ + id: "${id}", + value: "${value}", + }); + await transaction_write.complete; + + db.close(); + send("${done}", "Done"); +`; + +// A script retrieving what was stored inside IndexedDB. +const read_script = (done) => ` + // Open the database: + const request = indexedDB.open("${g_db_name}", "${g_db_version}"); + await new Promise(r => request.onsuccess = r); + const db = request.result; + + // Read: + const transaction_read = db.transaction("${g_db_store}", "readonly"); + const get_all = transaction_read.objectStore("${g_db_store}").getAll(); + await new Promise(r => transaction_read.oncomplete = r); + + db.close(); + send("${done}", JSON.stringify(get_all.result)); +`; + +promise_test(async test => { + // 4 actors: 2 anonymous iframe and 2 normal iframe. + const origin = get_host_info().HTTPS_REMOTE_ORIGIN; + const iframes = [ + newAnonymousIframe(origin), + newAnonymousIframe(origin), + newIframe(origin), + newIframe(origin), + ]; + + // 1. Write a different key-value pair from the iframes in IndexedDB: + const keys = iframes.map(token); + const values = iframes.map(token); + const response_queues = iframes.map(token); + await Promise.all(iframes.map(async (_, i) => { + send(iframes[i], write_script(keys[i], values[i], response_queues[i])); + assert_equals(await receive(response_queues[i]), "Done"); + })); + + // 2. Read the state from every iframes: + const states = await Promise.all(iframes.map(async (_, i) => { + send(iframes[i], read_script(response_queues[i])); + const reply = JSON.parse(await receive(response_queues[i])); + + const state = {} + for(entry of reply) + state[entry.id] = entry.value; + return state; + })); + + + // Verify the two anonymous iframe share the same state and the normal iframe + // share a second state + assert_equals(states[0][keys[0]], values[0]); + assert_equals(states[0][keys[1]], values[1]); + assert_equals(states[0][keys[2]], undefined); + assert_equals(states[0][keys[3]], undefined); + + assert_equals(states[1][keys[0]], values[0]); + assert_equals(states[1][keys[1]], values[1]); + assert_equals(states[1][keys[2]], undefined); + assert_equals(states[1][keys[3]], undefined); + + assert_equals(states[2][keys[0]], undefined); + assert_equals(states[2][keys[1]], undefined); + assert_equals(states[2][keys[2]], values[2]); + assert_equals(states[2][keys[3]], values[3]); + + assert_equals(states[3][keys[0]], undefined); + assert_equals(states[3][keys[1]], undefined); + assert_equals(states[3][keys[2]], values[2]); + assert_equals(states[3][keys[3]], values[3]); +})
diff --git a/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-empty-rt-expected.png b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-empty-rt-expected.png index 5741ae18..3b9b18f 100644 --- a/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-empty-rt-expected.png +++ b/third_party/blink/web_tests/flag-specific/disable-layout-ng/fast/ruby/ruby-empty-rt-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/devtools/persistence/persistence-move-breakpoints.js b/third_party/blink/web_tests/http/tests/devtools/persistence/persistence-move-breakpoints.js index bd39fc9e..ca8b0e58 100644 --- a/third_party/blink/web_tests/http/tests/devtools/persistence/persistence-move-breakpoints.js +++ b/third_party/blink/web_tests/http/tests/devtools/persistence/persistence-move-breakpoints.js
@@ -21,7 +21,7 @@ async function setBreakpointInFileSystemUISourceCode(next) { var uiSourceCode = await TestRunner.waitForUISourceCode('foo.js', Workspace.projectTypes.FileSystem); var sourceFrame = await SourcesTestRunner.showUISourceCodePromise(uiSourceCode); - await SourcesTestRunner.setBreakpoint(sourceFrame, 0, '', true); + await SourcesTestRunner.setBreakpoint(sourceFrame, 2, '', true); await SourcesTestRunner.waitBreakpointSidebarPane(); dumpBreakpointSidebarPane(); next();
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt index cd88d3b..c0de386 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/devtools/persistence/persistence-move-breakpoints-expected.txt
@@ -4,12 +4,12 @@ Running: addFileSystem Running: setBreakpointInFileSystemUISourceCode - file:///var/www/devtools/persistence/resources/foo.js:0 + file:///var/www/devtools/persistence/resources/foo.js:2 Running: addFileMapping http://127.0.0.1:8000/devtools/persistence/resources/foo.js:2 Running: removeFileMapping - file:///var/www/devtools/persistence/resources/foo.js:0 + file:///var/www/devtools/persistence/resources/foo.js:2 http://127.0.0.1:8000/devtools/persistence/resources/foo.js:2
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/security/contentSecurityPolicy/1.1/form-action-blocked-when-target-blank-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/security/contentSecurityPolicy/1.1/form-action-blocked-when-target-blank-expected.txt index b155f04..5f67cf1 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/security/contentSecurityPolicy/1.1/form-action-blocked-when-target-blank-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/security/contentSecurityPolicy/1.1/form-action-blocked-when-target-blank-expected.txt
@@ -14,4 +14,5 @@ =============================================== ============== Back Forward List ============== +curr-> ===============================================
diff --git a/third_party/blink/web_tests/platform/generic/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/blink/web_tests/platform/generic/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt index 5730221..897cff8 100644 --- a/third_party/blink/web_tests/platform/generic/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt +++ b/third_party/blink/web_tests/platform/generic/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -1617,13 +1617,6 @@ getter hasBeenActive getter isActive method constructor -interface VideoTrackGenerator - attribute @@toStringTag - getter muted - getter track - getter writable - method constructor - setter muted interface WebGL2RenderingContext attribute @@toStringTag attribute ACTIVE_ATTRIBUTES
diff --git a/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-dedicated-worker-expected.txt index c93d3423..27a42b7 100644 --- a/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-dedicated-worker-expected.txt +++ b/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -1845,13 +1845,6 @@ [Worker] method close [Worker] method constructor [Worker] method copyTo -[Worker] interface VideoTrackGenerator -[Worker] attribute @@toStringTag -[Worker] getter muted -[Worker] getter track -[Worker] getter writable -[Worker] method constructor -[Worker] setter muted [Worker] interface WakeLock [Worker] attribute @@toStringTag [Worker] method constructor
diff --git a/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-shared-worker-expected.txt index 69b6fcb..4f31b0a 100644 --- a/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-shared-worker-expected.txt +++ b/third_party/blink/web_tests/platform/generic/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -1496,13 +1496,6 @@ [Worker] getter hasBeenActive [Worker] getter isActive [Worker] method constructor -[Worker] interface VideoTrackGenerator -[Worker] attribute @@toStringTag -[Worker] getter muted -[Worker] getter track -[Worker] getter writable -[Worker] method constructor -[Worker] setter muted [Worker] interface WebGL2RenderingContext [Worker] attribute @@toStringTag [Worker] attribute ACTIVE_ATTRIBUTES
diff --git a/third_party/blink/web_tests/platform/linux/dark-mode/colors/selection-expected.png b/third_party/blink/web_tests/platform/linux/dark-mode/colors/selection-expected.png index 644446fa..231145c4 100644 --- a/third_party/blink/web_tests/platform/linux/dark-mode/colors/selection-expected.png +++ b/third_party/blink/web_tests/platform/linux/dark-mode/colors/selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/editing/selection/line-wrap-2-expected.png b/third_party/blink/web_tests/platform/linux/editing/selection/line-wrap-2-expected.png index ea678ec..a9106581 100644 --- a/third_party/blink/web_tests/platform/linux/editing/selection/line-wrap-2-expected.png +++ b/third_party/blink/web_tests/platform/linux/editing/selection/line-wrap-2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-empty-rt-expected.png b/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-empty-rt-expected.png index be4ca08..7ce4aa4 100644 --- a/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-empty-rt-expected.png +++ b/third_party/blink/web_tests/platform/linux/fast/ruby/ruby-empty-rt-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/paint/markers/document-markers-zoom-2000-expected.png b/third_party/blink/web_tests/platform/linux/paint/markers/document-markers-zoom-2000-expected.png index 81a9e407..fc548fb 100644 --- a/third_party/blink/web_tests/platform/linux/paint/markers/document-markers-zoom-2000-expected.png +++ b/third_party/blink/web_tests/platform/linux/paint/markers/document-markers-zoom-2000-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-deco-01-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-deco-01-b-expected.png index 22db64d..6bfd44f 100644 --- a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-deco-01-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-deco-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-03-b-expected.png b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-03-b-expected.png index f7fdebd2..6c8d1f9 100644 --- a/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-03-b-expected.png +++ b/third_party/blink/web_tests/platform/linux/svg/text/text-selection-text-03-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-mode-default/dark-mode/colors/selection-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-mode-default/dark-mode/colors/selection-expected.png index a488bdd9..432e3d6 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-mode-default/dark-mode/colors/selection-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-mode-default/dark-mode/colors/selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/dark-mode-increase-text-contrast/dark-mode/colors/selection-expected.png b/third_party/blink/web_tests/platform/linux/virtual/dark-mode-increase-text-contrast/dark-mode/colors/selection-expected.png index 6d51f1d5..2fd8929 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/dark-mode-increase-text-contrast/dark-mode/colors/selection-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/dark-mode-increase-text-contrast/dark-mode/colors/selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/selection/khmer-selection-expected.png index 4dae189..4ba52e7 100644 --- a/third_party/blink/web_tests/platform/linux/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/linux/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/fast/css/bidi-override-in-anonymous-block-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/fast/css/bidi-override-in-anonymous-block-expected.png deleted file mode 100644 index 79494bb..0000000 --- a/third_party/blink/web_tests/platform/mac-mac10.12/fast/css/bidi-override-in-anonymous-block-expected.png +++ /dev/null Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-empty-rt-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-empty-rt-expected.png index fd42ab80..d5ed9f1 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-empty-rt-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/fast/ruby/ruby-empty-rt-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/text-antialias/selection/khmer-selection-expected.png index 25e0c799..d34eed0 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.12/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.12/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/editing/selection/line-wrap-2-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/editing/selection/line-wrap-2-expected.png index b0e106b..6468907 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/editing/selection/line-wrap-2-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/editing/selection/line-wrap-2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-font-8px-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-font-8px-expected.png index 1547a596..422df4c 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-font-8px-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-font-8px-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-zoom-2000-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-zoom-2000-expected.png index 52f9143..b723e3e 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-zoom-2000-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/paint/markers/document-markers-zoom-2000-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-deco-01-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-deco-01-b-expected.png index eead15c..8005621 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-deco-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-deco-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-03-b-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-03-b-expected.png index 416870c..9ec97f6 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-03-b-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/svg/text/text-selection-text-03-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/selection/khmer-selection-expected.png index 89a1690e..43c4731 100644 --- a/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/mac-mac10.13/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/editing/selection/line-wrap-2-expected.png b/third_party/blink/web_tests/platform/mac/editing/selection/line-wrap-2-expected.png index f79c9b86..9d089a7 100644 --- a/third_party/blink/web_tests/platform/mac/editing/selection/line-wrap-2-expected.png +++ b/third_party/blink/web_tests/platform/mac/editing/selection/line-wrap-2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/css/bidi-override-in-anonymous-block-expected.png b/third_party/blink/web_tests/platform/mac/fast/css/bidi-override-in-anonymous-block-expected.png index 19859b2..79494bb 100644 --- a/third_party/blink/web_tests/platform/mac/fast/css/bidi-override-in-anonymous-block-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/css/bidi-override-in-anonymous-block-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-empty-rt-expected.png b/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-empty-rt-expected.png index 8154d4d..5bf26ef1 100644 --- a/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-empty-rt-expected.png +++ b/third_party/blink/web_tests/platform/mac/fast/ruby/ruby-empty-rt-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-font-8px-expected.png b/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-font-8px-expected.png index 1e0b12d..fe00a90 100644 --- a/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-font-8px-expected.png +++ b/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-font-8px-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-zoom-2000-expected.png b/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-zoom-2000-expected.png index f0b7adb1..9627203b 100644 --- a/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-zoom-2000-expected.png +++ b/third_party/blink/web_tests/platform/mac/paint/markers/document-markers-zoom-2000-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-deco-01-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-deco-01-b-expected.png index c1b9339..ee87b3b 100644 --- a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-deco-01-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-deco-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-03-b-expected.png b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-03-b-expected.png index 6d3823b4..17c6e79 100644 --- a/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-03-b-expected.png +++ b/third_party/blink/web_tests/platform/mac/svg/text/text-selection-text-03-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/selection/khmer-selection-expected.png index ce97e889..343126b 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/editing/selection/line-wrap-2-expected.png b/third_party/blink/web_tests/platform/win/editing/selection/line-wrap-2-expected.png index 450abb2..46e3bdb 100644 --- a/third_party/blink/web_tests/platform/win/editing/selection/line-wrap-2-expected.png +++ b/third_party/blink/web_tests/platform/win/editing/selection/line-wrap-2-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/fast/ruby/ruby-empty-rt-expected.png b/third_party/blink/web_tests/platform/win/fast/ruby/ruby-empty-rt-expected.png index a248ba37..24e6afdc 100644 --- a/third_party/blink/web_tests/platform/win/fast/ruby/ruby-empty-rt-expected.png +++ b/third_party/blink/web_tests/platform/win/fast/ruby/ruby-empty-rt-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/paint/markers/document-markers-zoom-2000-expected.png b/third_party/blink/web_tests/platform/win/paint/markers/document-markers-zoom-2000-expected.png index 7dba21f1..cb1fa3f 100644 --- a/third_party/blink/web_tests/platform/win/paint/markers/document-markers-zoom-2000-expected.png +++ b/third_party/blink/web_tests/platform/win/paint/markers/document-markers-zoom-2000-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/text/text-selection-deco-01-b-expected.png b/third_party/blink/web_tests/platform/win/svg/text/text-selection-deco-01-b-expected.png index a498ad2..15b6be2b 100644 --- a/third_party/blink/web_tests/platform/win/svg/text/text-selection-deco-01-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/text/text-selection-deco-01-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-03-b-expected.png b/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-03-b-expected.png index d236f98..3fe7ec3 100644 --- a/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-03-b-expected.png +++ b/third_party/blink/web_tests/platform/win/svg/text/text-selection-text-03-b-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/win/virtual/text-antialias/selection/khmer-selection-expected.png index 884ccb4..4c5de446 100644 --- a/third_party/blink/web_tests/platform/win/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/win/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win7/virtual/text-antialias/selection/khmer-selection-expected.png b/third_party/blink/web_tests/platform/win7/virtual/text-antialias/selection/khmer-selection-expected.png index 3669edc3..bea9b0c6 100644 --- a/third_party/blink/web_tests/platform/win7/virtual/text-antialias/selection/khmer-selection-expected.png +++ b/third_party/blink/web_tests/platform/win7/virtual/text-antialias/selection/khmer-selection-expected.png Binary files differ
diff --git a/third_party/closure_compiler/externs/file_manager_private.js b/third_party/closure_compiler/externs/file_manager_private.js index 15c9ae6..b3d4fd1 100644 --- a/third_party/closure_compiler/externs/file_manager_private.js +++ b/third_party/closure_compiler/externs/file_manager_private.js
@@ -875,14 +875,21 @@ callback) {}; /** - * Mounts a resource or a file. - * @param {string} source Mount point source. For compressed files it is - * the relative file path within the external file system. - * @param {string|undefined} password Optional password to decrypt the file. + * Mounts a resource or an archive. + * @param {string} fileUrl Mount point source. + * @param {string|undefined} password Optional password to decrypt the archive. * @param {function(string): void} callback callback Callback called with the * source path of the mount. */ -chrome.fileManagerPrivate.addMount = function(source, password, callback) {}; +chrome.fileManagerPrivate.addMount = function(fileUrl, password, callback) {}; + +/** + * Cancels an archive mounting operation. + * @param {string} fileUrl Mount point source. Should be same as the one passed + * to addMount. + * @param {function()} callback + */ +chrome.fileManagerPrivate.cancelMounting = function(fileUrl, callback) {}; /** * Unmounts a mounted resource. |volumeId| An ID of the volume.
diff --git a/third_party/material_web_components/BUILD.gn b/third_party/material_web_components/BUILD.gn index 3543bca..a615495 100644 --- a/third_party/material_web_components/BUILD.gn +++ b/third_party/material_web_components/BUILD.gn
@@ -5,65 +5,87 @@ import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/tools/generate_grd.gni") -# This file is generated by //third_party/material_web_components/reproduce.sh - generate_grd("build_grdp") { grd_prefix = "material_web_components" out_grd = "${target_gen_dir}/${grd_prefix}_resources.grdp" # TODO(b/229804752): Clean up and find the minimal set of necessary resources. input_files = [ - "lit-element/lib/decorators.js", - "lit-element/lib/updating-element.js", - "lit-element/lib/css-tag.js", + "lit-element/decorators.js", + "lit-element/index.js", "lit-element/lit-element.js", - "tslib/tslib.es6.js", + "@lit/reactive-element/reactive-controller.js", + "@lit/reactive-element/decorators.js", + "@lit/reactive-element/decorators/state.js", + "@lit/reactive-element/decorators/query-async.js", + "@lit/reactive-element/decorators/event-options.js", + "@lit/reactive-element/decorators/query-assigned-elements.js", + "@lit/reactive-element/decorators/query.js", + "@lit/reactive-element/decorators/custom-element.js", + "@lit/reactive-element/decorators/query-assigned-nodes.js", + "@lit/reactive-element/decorators/base.js", + "@lit/reactive-element/decorators/query-all.js", + "@lit/reactive-element/decorators/property.js", + "@lit/reactive-element/reactive-element.js", + "@lit/reactive-element/css-tag.js", + "lit/directives/template-content.js", + "lit/directives/choose.js", + "lit/directives/when.js", + "lit/directives/live.js", + "lit/directives/if-defined.js", + "lit/directives/unsafe-svg.js", + "lit/directives/async-append.js", + "lit/directives/until.js", + "lit/directives/class-map.js", + "lit/directives/ref.js", + "lit/directives/async-replace.js", + "lit/directives/repeat.js", + "lit/directives/range.js", + "lit/directives/map.js", + "lit/directives/join.js", + "lit/directives/keyed.js", + "lit/directives/guard.js", + "lit/directives/style-map.js", + "lit/directives/unsafe-html.js", + "lit/directives/cache.js", + "lit/directive-helpers.js", + "lit/decorators.js", + "lit/directive.js", + "lit/static-html.js", + "lit/index.js", + "lit/async-directive.js", + "lit/html.js", "tslib/tslib.js", - "tslib/modules/index.js", "lit-html/lit-html.js", - "lit-html/polyfills/template_polyfill.js", "lit-html/directives/template-content.js", + "lit-html/directives/choose.js", + "lit-html/directives/when.js", "lit-html/directives/live.js", "lit-html/directives/if-defined.js", "lit-html/directives/unsafe-svg.js", "lit-html/directives/async-append.js", "lit-html/directives/until.js", "lit-html/directives/class-map.js", + "lit-html/directives/ref.js", "lit-html/directives/async-replace.js", "lit-html/directives/repeat.js", + "lit-html/directives/range.js", + "lit-html/directives/map.js", + "lit-html/directives/join.js", + "lit-html/directives/keyed.js", "lit-html/directives/guard.js", "lit-html/directives/style-map.js", "lit-html/directives/unsafe-html.js", "lit-html/directives/cache.js", - "lit-html/lib/template-factory.js", - "lit-html/lib/part.js", - "lit-html/lib/default-template-processor.js", - "lit-html/lib/render.js", - "lit-html/lib/directive.js", - "lit-html/lib/modify-template.js", - "lit-html/lib/template-processor.js", - "lit-html/lib/template-result.js", - "lit-html/lib/template-instance.js", - "lit-html/lib/template.js", - "lit-html/lib/shady-render.js", - "lit-html/lib/dom.js", - "lit-html/lib/parts.js", - "lit-html/lib/render-options.js", - "@material/animation/node_modules/tslib/tslib.es6.js", - "@material/animation/node_modules/tslib/tslib.js", - "@material/animation/node_modules/tslib/modules/index.js", - "@material/animation/index.js", - "@material/animation/util.js", - "@material/animation/dist/mdc.animation.js", - "@material/animation/dist/mdc.animation.min.js", - "@material/animation/types.js", - "@material/animation/animationframe.js", - "@material/base/node_modules/tslib/tslib.es6.js", - "@material/base/node_modules/tslib/tslib.js", - "@material/base/node_modules/tslib/modules/index.js", + "lit-html/directives/private-async-helpers.js", + "lit-html/directive-helpers.js", + "lit-html/static.js", + "lit-html/directive.js", + "lit-html/async-directive.js", + "@material/base/observer-proxy.js", + "@material/base/observer-foundation.js", + "@material/base/observer.js", "@material/base/index.js", - "@material/base/dist/mdc.base.min.js", - "@material/base/dist/mdc.base.js", "@material/base/component.js", "@material/base/types.js", "@material/base/foundation.js", @@ -71,40 +93,29 @@ "@material/mwc-base/form-element.js", "@material/mwc-base/utils.js", "@material/mwc-base/observer.js", + "@material/mwc-base/aria-property.js", "@material/ripple/constants.js", - "@material/ripple/node_modules/tslib/tslib.es6.js", - "@material/ripple/node_modules/tslib/tslib.js", - "@material/ripple/node_modules/tslib/modules/index.js", "@material/ripple/index.js", "@material/ripple/adapter.js", "@material/ripple/util.js", - "@material/ripple/dist/mdc.ripple.min.js", - "@material/ripple/dist/mdc.ripple.js", "@material/ripple/component.js", "@material/ripple/types.js", "@material/ripple/foundation.js", + "@material/mwc-button/demo_styles.css.js", "@material/mwc-button/mwc-button.js", - "@material/mwc-button/demo_styles-css.js", - "@material/mwc-button/styles-css.js", + "@material/mwc-button/styles.css.js", "@material/mwc-button/mwc-button-base.js", "@material/dom/focus-trap.js", - "@material/dom/node_modules/tslib/tslib.es6.js", - "@material/dom/node_modules/tslib/tslib.js", - "@material/dom/node_modules/tslib/modules/index.js", "@material/dom/keyboard.js", "@material/dom/ponyfill.js", "@material/dom/index.js", "@material/dom/announce.js", "@material/dom/events.js", - "@material/dom/dist/mdc.dom.min.js", - "@material/dom/dist/mdc.dom.js", "@material/mwc-ripple/mwc-ripple.js", - "@material/mwc-ripple/ripple-directive.js", - "@material/mwc-ripple/mwc-ripple-global-css.js", + "@material/mwc-ripple/mwc-ripple.css.js", "@material/mwc-ripple/ripple-handlers.js", - "@material/mwc-ripple/mwc-ripple-css.js", "@material/mwc-ripple/mwc-ripple-base.js", - "@material/mwc-icon/mwc-icon-host-css.js", + "@material/mwc-icon/mwc-icon-host.css.js", "@material/mwc-icon/mwc-icon.js", ] @@ -118,92 +129,90 @@ # TODO(b/229804752): Clean up and find the minimal set of necessary resources. definitions = [ - "components-chromium/node_modules/lit-element/src/env.d.ts", "components-chromium/node_modules/lit-element/lit-element.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/src/env.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/demo/ts-element.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/lit-element.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/lib/updating-element.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/lib/css-tag.d.ts", - "components-chromium/node_modules/lit-element/ts3.4/lib/decorators.d.ts", - "components-chromium/node_modules/lit-element/lib/updating-element.d.ts", - "components-chromium/node_modules/lit-element/lib/css-tag.d.ts", - "components-chromium/node_modules/lit-element/lib/decorators.d.ts", + "components-chromium/node_modules/lit-element/decorators.d.ts", + "components-chromium/node_modules/lit-element/index.d.ts", + "components-chromium/node_modules/@types/trusted-types/index.d.ts", + "components-chromium/node_modules/@types/trusted-types/lib/index.d.ts", + "components-chromium/node_modules/@lit/reactive-element/reactive-element.d.ts", + "components-chromium/node_modules/@lit/reactive-element/css-tag.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/state.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/query-all.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/query.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/query-async.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/property.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/base.d.ts", + "components-chromium/node_modules/@lit/reactive-element/decorators/event-options.d.ts", + "components-chromium/node_modules/@lit/reactive-element/reactive-controller.d.ts", + "components-chromium/node_modules/lit/async-directive.d.ts", + "components-chromium/node_modules/lit/directives/range.d.ts", + "components-chromium/node_modules/lit/directives/cache.d.ts", + "components-chromium/node_modules/lit/directives/unsafe-html.d.ts", + "components-chromium/node_modules/lit/directives/async-replace.d.ts", + "components-chromium/node_modules/lit/directives/ref.d.ts", + "components-chromium/node_modules/lit/directives/style-map.d.ts", + "components-chromium/node_modules/lit/directives/map.d.ts", + "components-chromium/node_modules/lit/directives/choose.d.ts", + "components-chromium/node_modules/lit/directives/template-content.d.ts", + "components-chromium/node_modules/lit/directives/class-map.d.ts", + "components-chromium/node_modules/lit/directives/if-defined.d.ts", + "components-chromium/node_modules/lit/directives/unsafe-svg.d.ts", + "components-chromium/node_modules/lit/directives/keyed.d.ts", + "components-chromium/node_modules/lit/directives/guard.d.ts", + "components-chromium/node_modules/lit/directives/when.d.ts", + "components-chromium/node_modules/lit/directives/join.d.ts", + "components-chromium/node_modules/lit/directives/repeat.d.ts", + "components-chromium/node_modules/lit/directives/until.d.ts", + "components-chromium/node_modules/lit/directives/live.d.ts", + "components-chromium/node_modules/lit/directives/async-append.d.ts", + "components-chromium/node_modules/lit/static-html.d.ts", + "components-chromium/node_modules/lit/directive.d.ts", + "components-chromium/node_modules/lit/directive-helpers.d.ts", + "components-chromium/node_modules/lit/decorators.d.ts", + "components-chromium/node_modules/lit/index.d.ts", + "components-chromium/node_modules/lit/html.d.ts", "components-chromium/node_modules/tslib/tslib.d.ts", - "components-chromium/node_modules/lit-html/src/env.d.ts", - "components-chromium/node_modules/lit-html/polyfills/template_polyfill.d.ts", + "components-chromium/node_modules/lit-html/async-directive.d.ts", + "components-chromium/node_modules/lit-html/directives/private-async-helpers.d.ts", + "components-chromium/node_modules/lit-html/directives/range.d.ts", "components-chromium/node_modules/lit-html/directives/cache.d.ts", "components-chromium/node_modules/lit-html/directives/unsafe-html.d.ts", "components-chromium/node_modules/lit-html/directives/async-replace.d.ts", + "components-chromium/node_modules/lit-html/directives/ref.d.ts", "components-chromium/node_modules/lit-html/directives/style-map.d.ts", + "components-chromium/node_modules/lit-html/directives/map.d.ts", + "components-chromium/node_modules/lit-html/directives/choose.d.ts", "components-chromium/node_modules/lit-html/directives/template-content.d.ts", "components-chromium/node_modules/lit-html/directives/class-map.d.ts", "components-chromium/node_modules/lit-html/directives/if-defined.d.ts", "components-chromium/node_modules/lit-html/directives/unsafe-svg.d.ts", + "components-chromium/node_modules/lit-html/directives/keyed.d.ts", "components-chromium/node_modules/lit-html/directives/guard.d.ts", + "components-chromium/node_modules/lit-html/directives/when.d.ts", + "components-chromium/node_modules/lit-html/directives/join.d.ts", "components-chromium/node_modules/lit-html/directives/repeat.d.ts", "components-chromium/node_modules/lit-html/directives/until.d.ts", "components-chromium/node_modules/lit-html/directives/live.d.ts", "components-chromium/node_modules/lit-html/directives/async-append.d.ts", + "components-chromium/node_modules/lit-html/static.d.ts", + "components-chromium/node_modules/lit-html/directive.d.ts", + "components-chromium/node_modules/lit-html/directive-helpers.d.ts", "components-chromium/node_modules/lit-html/lit-html.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/src/env.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/polyfills/template_polyfill.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/cache.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-html.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/async-replace.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/style-map.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/template-content.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/class-map.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/if-defined.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-svg.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/guard.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/repeat.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/until.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/live.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/directives/async-append.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lit-html.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/parts.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/template.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/directive.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/render.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/template-result.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/template-factory.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/template-processor.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/dom.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/shady-render.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/template-instance.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/default-template-processor.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/modify-template.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/render-options.d.ts", - "components-chromium/node_modules/lit-html/ts3.4/lib/part.d.ts", - "components-chromium/node_modules/lit-html/lib/parts.d.ts", - "components-chromium/node_modules/lit-html/lib/template.d.ts", - "components-chromium/node_modules/lit-html/lib/directive.d.ts", - "components-chromium/node_modules/lit-html/lib/render.d.ts", - "components-chromium/node_modules/lit-html/lib/template-result.d.ts", - "components-chromium/node_modules/lit-html/lib/template-factory.d.ts", - "components-chromium/node_modules/lit-html/lib/template-processor.d.ts", - "components-chromium/node_modules/lit-html/lib/dom.d.ts", - "components-chromium/node_modules/lit-html/lib/shady-render.d.ts", - "components-chromium/node_modules/lit-html/lib/template-instance.d.ts", - "components-chromium/node_modules/lit-html/lib/default-template-processor.d.ts", - "components-chromium/node_modules/lit-html/lib/modify-template.d.ts", - "components-chromium/node_modules/lit-html/lib/render-options.d.ts", - "components-chromium/node_modules/lit-html/lib/part.d.ts", - "components-chromium/node_modules/@material/animation/animationframe.d.ts", - "components-chromium/node_modules/@material/animation/util.d.ts", - "components-chromium/node_modules/@material/animation/types.d.ts", - "components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.d.ts", - "components-chromium/node_modules/@material/animation/index.d.ts", - "components-chromium/node_modules/@material/animation/dist/mdc.animation.d.ts", + "components-chromium/node_modules/@material/base/observer-foundation.d.ts", + "components-chromium/node_modules/@material/base/observer.d.ts", "components-chromium/node_modules/@material/base/foundation.d.ts", + "components-chromium/node_modules/@material/base/externs.d.ts", "components-chromium/node_modules/@material/base/types.d.ts", - "components-chromium/node_modules/@material/base/node_modules/tslib/tslib.d.ts", + "components-chromium/node_modules/@material/base/observer-proxy.d.ts", "components-chromium/node_modules/@material/base/index.d.ts", - "components-chromium/node_modules/@material/base/dist/mdc.base.d.ts", "components-chromium/node_modules/@material/base/component.d.ts", "components-chromium/node_modules/@material/mwc-base/observer.d.ts", "components-chromium/node_modules/@material/mwc-base/utils.d.ts", + "components-chromium/node_modules/@material/mwc-base/aria-property.d.ts", "components-chromium/node_modules/@material/mwc-base/base-element.d.ts", "components-chromium/node_modules/@material/mwc-base/form-element.d.ts", "components-chromium/node_modules/@material/ripple/constants.d.ts", @@ -211,29 +220,23 @@ "components-chromium/node_modules/@material/ripple/util.d.ts", "components-chromium/node_modules/@material/ripple/adapter.d.ts", "components-chromium/node_modules/@material/ripple/types.d.ts", - "components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.d.ts", "components-chromium/node_modules/@material/ripple/index.d.ts", - "components-chromium/node_modules/@material/ripple/dist/mdc.ripple.d.ts", "components-chromium/node_modules/@material/ripple/component.d.ts", + "components-chromium/node_modules/@material/mwc-button/demo_styles.css.d.ts", "components-chromium/node_modules/@material/mwc-button/mwc-button.d.ts", "components-chromium/node_modules/@material/mwc-button/mwc-button-base.d.ts", - "components-chromium/node_modules/@material/mwc-button/styles-css.d.ts", - "components-chromium/node_modules/@material/mwc-button/demo_styles-css.d.ts", + "components-chromium/node_modules/@material/mwc-button/styles.css.d.ts", "components-chromium/node_modules/@material/dom/ponyfill.d.ts", "components-chromium/node_modules/@material/dom/events.d.ts", - "components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.d.ts", "components-chromium/node_modules/@material/dom/focus-trap.d.ts", "components-chromium/node_modules/@material/dom/index.d.ts", - "components-chromium/node_modules/@material/dom/dist/mdc.dom.d.ts", "components-chromium/node_modules/@material/dom/announce.d.ts", "components-chromium/node_modules/@material/dom/keyboard.d.ts", + "components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.d.ts", "components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.d.ts", "components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.d.ts", - "components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.d.ts", - "components-chromium/node_modules/@material/mwc-ripple/ripple-directive.d.ts", - "components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.d.ts", "components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.d.ts", - "components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.d.ts", + "components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.d.ts", "components-chromium/node_modules/@material/mwc-icon/mwc-icon.d.ts", ] }
diff --git a/third_party/material_web_components/components-chromium/node_modules/.package-lock.json b/third_party/material_web_components/components-chromium/node_modules/.package-lock.json index 68cc8b17..c05d7e7 100644 --- a/third_party/material_web_components/components-chromium/node_modules/.package-lock.json +++ b/third_party/material_web_components/components-chromium/node_modules/.package-lock.json
@@ -4,139 +4,155 @@ "lockfileVersion": 2, "requires": true, "packages": { - "node_modules/@material/animation": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/animation/-/animation-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-m3eUpFRwxcP1tEWJlIH5q77YGSYEe5ITRw5OtyDvxU7ZzF0xKJbBeauQEdCmyig9UvK+J7jUUnCgkT/t/ldLtw==", - "dependencies": { - "tslib": "^1.9.3" - } + "node_modules/@lit/reactive-element": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.3.2.tgz", + "integrity": "sha512-A2e18XzPMrIh35nhIdE4uoqRzoIpEU5vZYuQN4S3Ee1zkGdYC27DP12pewbw/RLgPHzaE4kx/YqxMzebOpm0dA==" }, - "node_modules/@material/animation/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@material/animation": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/animation/-/animation-14.0.0.tgz", + "integrity": "sha512-VlYSfUaIj/BBVtRZI8Gv0VvzikFf+XgK0Zdgsok5c1v5DDnNz5tpB8mnGrveWz0rHbp1X4+CWLKrTwNmjrw3Xw==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@material/base": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/base/-/base-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r98qY6EsPx6BlzT0Pj+H+BTI7r76GEX/zZPgajxZjbPAJSeeK+uCh69Dmhf63meLKaFkKgvLwH5udKJLMqqjpQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/base/-/base-14.0.0.tgz", + "integrity": "sha512-Ou7vS7n1H4Y10MUZyYAbt6H0t67c6urxoCgeVT7M38aQlaNUwFMODp7KT/myjYz2YULfhu3PtfSV3Sltgac9mA==", "dependencies": { - "tslib": "^1.9.3" + "tslib": "^2.1.0" } }, - "node_modules/@material/base/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@material/dom": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/dom/-/dom-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-AwiQDzquolB7rqy8k4+QMVQ8Njb6k0CT+otJ/UNJbj0qNVXZB4njVaWRWrWCt70hYp1rG0cRNkZ01ZJDqABUFw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/dom/-/dom-14.0.0.tgz", + "integrity": "sha512-8t88XyacclTj8qsIw9q0vEj4PI2KVncLoIsIMzwuMx49P2FZg6TsLjor262MI3Qs00UWAifuLMrhnOnfyrbe7Q==", "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" } }, - "node_modules/@material/dom/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@material/feature-targeting": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-HWd0+GMnkVB3anmUc9+MeWCNoogAbb4U7ihzwq7lzLCQyC+i/kunppkUVV7DhL3ZVl1O6zIw1eAT+dgQpN8x4Q==" + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-14.0.0.tgz", + "integrity": "sha512-a5WGgHEq5lJeeNL5yevtgoZjBjXWy6+klfVWQEh8oyix/rMJygGgO7gEc52uv8fB8uAIoYEB3iBMOv8jRq8FeA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@material/mwc-base": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.20.0.tgz", - "integrity": "sha512-q35jN1TGBts3LzKk2RVtgBpLDfBfRrx2hJ4GEVAeJsEGiO5CZrCD0bPlZSRTammzQBbDAh7szvhMiWo0TkRaWw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.26.0.tgz", + "integrity": "sha512-G2xJQ667OzSieXw3IJzRrjDsngfCOnlVPCkl7TnmCThWziTgQISX6kHOEXPYEXwnJmZZrXcxaoc+aeC5cv+nxQ==", "dependencies": { - "@material/base": "=9.0.0-canary.1c156d69d.0", - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", + "@material/base": "=14.0.0", + "@material/dom": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-button": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.20.0.tgz", - "integrity": "sha512-kqQpeuLfaqfH4PZbENT9rwx1sgeFPLHuKy5M31ZeKG1deRTxw11FDGeMxSkePfm1QFfY6DNTsIAG5qC56tUNlw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.26.0.tgz", + "integrity": "sha512-tRO/uSiajvCSR5YVDSoFC6kPCt2okttYOvAfyVkljgNtnhORekcitgKFNQq6JBN2uvD6s/svJXlW7Xv0j/XCQA==", "dependencies": { - "@material/mwc-icon": "^0.20.0", - "@material/mwc-ripple": "^0.20.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/mwc-icon": "^0.26.0", + "@material/mwc-ripple": "^0.26.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-icon": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.20.0.tgz", - "integrity": "sha512-YCtzWbJVSZGcvWKVHwIhwfGMLEqAmRSVGcXTCAH/rOzGU7RkOxQkfNDkLAuTRAX9a7HYQStIJ39ENVcysElljg==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.26.0.tgz", + "integrity": "sha512-snI+u1xru4Q9FwEXhVxUoVjY3zvZ+H2ezYZa8Zn3OLArRcuz6R4yDxp1CZelaxTwyK2Sb6Hsp0h3liPCc2zl6A==", "dependencies": { - "lit-element": "^2.3.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-ripple": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.20.0.tgz", - "integrity": "sha512-4rlIu+Kk//NsW/u3CnU1kz3dsvwEozax0Zf2CUp+ao0ozclHfQ2+sTZVY0Mr8+GJLn7Oz51gT5OHoarZuWWljA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.26.0.tgz", + "integrity": "sha512-unDFbwhZiqojOLF20/5MnYghBk1V1H1r7mJbXG7Jam8x/V1nbdljPIXj0EP3YInt5dBPQHKcf+JkW1En1LGNFw==", "dependencies": { - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "@material/mwc-base": "^0.20.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/dom": "=14.0.0", + "@material/mwc-base": "^0.26.0", + "@material/ripple": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/ripple": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-F1e/LQmYHQFORM/C3hchmANnRwJCXlc7Cp7W+VGpvJdtdzYlTd8DKKcShuOozxUQOjutbNf+Ql8gpZIdYRQaoQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-14.0.0.tgz", + "integrity": "sha512-9XoGBFd5JhFgELgW7pqtiLy+CnCIcV2s9cQ2BWbOQeA8faX9UZIDUx/g76nHLZ7UzKFtsULJxZTwORmsEt2zvw==", "dependencies": { - "@material/animation": "9.0.0-canary.1c156d69d.0", - "@material/base": "9.0.0-canary.1c156d69d.0", - "@material/dom": "9.0.0-canary.1c156d69d.0", - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "@material/theme": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/animation": "^14.0.0", + "@material/base": "^14.0.0", + "@material/dom": "^14.0.0", + "@material/feature-targeting": "^14.0.0", + "@material/rtl": "^14.0.0", + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" } }, - "node_modules/@material/ripple/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@material/rtl": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/rtl/-/rtl-14.0.0.tgz", + "integrity": "sha512-xl6OZYyRjuiW2hmbjV2omMV8sQtfmKAjeWnD1RMiAPLCTyOW9Lh/PYYnXjxUrNa0cRwIIbOn5J7OYXokja8puA==", + "dependencies": { + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" + } }, "node_modules/@material/theme": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/theme/-/theme-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r1610TPwUplt4FHMk7cR06Oz1jU/G31wBIh4Frs/YIB0ZonVlI5cZdIkG0IFtNt9ZYWoDwfP/1nQBxdqrDPPhg==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/theme/-/theme-14.0.0.tgz", + "integrity": "sha512-6/SENWNIFuXzeHMPHrYwbsXKgkvCtWuzzQ3cUu4UEt3KcQ5YpViazIM6h8ByYKZP8A9d8QpkJ0WGX5btGDcVoA==", "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, + "node_modules/lit": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.2.3.tgz", + "integrity": "sha512-5/v+r9dH3Pw/o0rhp/qYk3ERvOUclNF31bWb0FiW6MPgwdQIr+/KCt/p3zcd8aPl8lIGnxdGrVcZA+gWS6oFOQ==", + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" } }, "node_modules/lit-element": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", - "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.0.tgz", + "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==", "dependencies": { - "lit-html": "^1.1.1" + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" } }, "node_modules/lit-html": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.3.0.tgz", - "integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.2.3.tgz", + "integrity": "sha512-vI4j3eWwtQaR8q/O63juZVliBIFMio716X719/lSsGH4UWPy2/7Qf377jsNs4cx3gCHgIbx8yxFgXFQ/igZyXQ==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } }, "node_modules/tslib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", - "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" } } }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/LICENSE new file mode 100644 index 0000000..be7a97b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/LICENSE
@@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2017 Google LLC. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.d.ts new file mode 100644 index 0000000..1c8b27c2 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.d.ts
@@ -0,0 +1,65 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Whether the current browser supports `adoptedStyleSheets`. + */ +export declare const supportsAdoptingStyleSheets: boolean; +/** + * A CSSResult or native CSSStyleSheet. + * + * In browsers that support constructible CSS style sheets, CSSStyleSheet + * object can be used for styling along side CSSResult from the `css` + * template tag. + */ +export declare type CSSResultOrNative = CSSResult | CSSStyleSheet; +export declare type CSSResultArray = Array<CSSResultOrNative | CSSResultArray>; +/** + * A single CSSResult, CSSStyleSheet, or an array or nested arrays of those. + */ +export declare type CSSResultGroup = CSSResultOrNative | CSSResultArray; +/** + * A container for a string of CSS text, that may be used to create a CSSStyleSheet. + * + * CSSResult is the return value of `css`-tagged template literals and + * `unsafeCSS()`. In order to ensure that CSSResults are only created via the + * `css` tag and `unsafeCSS()`, CSSResult cannot be constructed directly. + */ +export declare class CSSResult { + ['_$cssResult$']: boolean; + readonly cssText: string; + private constructor(); + get styleSheet(): CSSStyleSheet | undefined; + toString(): string; +} +/** + * Wrap a value for interpolation in a {@linkcode css} tagged template literal. + * + * This is unsafe because untrusted CSS text can be used to phone home + * or exfiltrate data to an attacker controlled site. Take care to only use + * this with trusted input. + */ +export declare const unsafeCSS: (value: unknown) => CSSResult; +/** + * A template literal tag which can be used with LitElement's + * {@linkcode LitElement.styles} property to set element styles. + * + * For security reasons, only literal string values and number may be used in + * embedded expressions. To incorporate non-literal values {@linkcode unsafeCSS} + * may be used inside an expression. + */ +export declare const css: (strings: TemplateStringsArray, ...values: (CSSResultGroup | number)[]) => CSSResult; +/** + * Applies the given styles to a `shadowRoot`. When Shadow DOM is + * available but `adoptedStyleSheets` is not, styles are appended to the + * `shadowRoot` to [mimic spec behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets). + * Note, when shimming is used, any styles that are subsequently placed into + * the shadowRoot should be placed *before* any shimmed adopted styles. This + * will match spec behavior that gives adopted sheets precedence over styles in + * shadowRoot. + */ +export declare const adoptStyles: (renderRoot: ShadowRoot, styles: Array<CSSResultOrNative>) => void; +export declare const getCompatibleStyle: (s: CSSResultOrNative) => CSSResultOrNative; +//# sourceMappingURL=css-tag.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.js new file mode 100644 index 0000000..ee47ea5b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/css-tag.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),n=new Map;class s{constructor(t,n){if(this._$cssResult$=!0,n!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let e=n.get(this.cssText);return t&&void 0===e&&(n.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const o=t=>new s("string"==typeof t?t:t+"",e),r=(t,...n)=>{const o=1===t.length?t[0]:n.reduce(((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[s+1]),t[0]);return new s(o,e)},i=(e,n)=>{t?e.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((t=>{const n=document.createElement("style"),s=window.litNonce;void 0!==s&&n.setAttribute("nonce",s),n.textContent=t.cssText,e.appendChild(n)}))},S=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return o(e)})(t):t;export{s as CSSResult,i as adoptStyles,r as css,S as getCompatibleStyle,t as supportsAdoptingStyleSheets,o as unsafeCSS}; +//# sourceMappingURL=css-tag.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.d.ts new file mode 100644 index 0000000..f78d64e4 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.d.ts
@@ -0,0 +1,16 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from './decorators/base.js'; +export * from './decorators/custom-element.js'; +export * from './decorators/property.js'; +export * from './decorators/state.js'; +export * from './decorators/event-options.js'; +export * from './decorators/query.js'; +export * from './decorators/query-all.js'; +export * from './decorators/query-async.js'; +export * from './decorators/query-assigned-elements.js'; +export * from './decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.js new file mode 100644 index 0000000..35c8be5 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators.js
@@ -0,0 +1,2 @@ +export{decorateProperty,legacyPrototypeMethod,standardPrototypeMethod}from'./decorators/base.js';export{customElement}from'./decorators/custom-element.js';export{property}from'./decorators/property.js';export{state}from'./decorators/state.js';export{eventOptions}from'./decorators/event-options.js';export{query}from'./decorators/query.js';export{queryAll}from'./decorators/query-all.js';export{queryAsync}from'./decorators/query-async.js';export{queryAssignedElements}from'./decorators/query-assigned-elements.js';export{queryAssignedNodes}from'./decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.d.ts new file mode 100644 index 0000000..f175e1a6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.d.ts
@@ -0,0 +1,48 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ReactiveElement } from '../reactive-element.js'; +export declare type Constructor<T> = { + new (...args: any[]): T; +}; +export interface ClassDescriptor { + kind: 'class'; + elements: ClassElement[]; + finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>; +} +export interface ClassElement { + kind: 'field' | 'method'; + key: PropertyKey; + placement: 'static' | 'prototype' | 'own'; + initializer?: Function; + extras?: ClassElement[]; + finisher?: <T>(clazz: Constructor<T>) => void | Constructor<T>; + descriptor?: PropertyDescriptor; +} +export declare const legacyPrototypeMethod: (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => void; +export declare const standardPrototypeMethod: (descriptor: PropertyDescriptor, element: ClassElement) => { + kind: string; + placement: string; + key: PropertyKey; + descriptor: PropertyDescriptor; +}; +/** + * Helper for decorating a property that is compatible with both TypeScript + * and Babel decorators. The optional `finisher` can be used to perform work on + * the class. The optional `descriptor` should return a PropertyDescriptor + * to install for the given property. + * + * @param finisher {function} Optional finisher method; receives the element + * constructor and property key as arguments and has no return value. + * @param descriptor {function} Optional descriptor method; receives the + * property key as an argument and returns a property descriptor to define for + * the given property. + * @returns {ClassElement|void} + */ +export declare const decorateProperty: ({ finisher, descriptor, }: { + finisher?: ((ctor: typeof ReactiveElement, property: PropertyKey) => void) | null | undefined; + descriptor?: ((property: PropertyKey) => PropertyDescriptor) | undefined; +}) => (protoOrDescriptor: ReactiveElement | ClassElement, name?: PropertyKey | undefined) => void | any; +//# sourceMappingURL=base.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.js new file mode 100644 index 0000000..63419f92 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/base.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const e=(e,t,o)=>{Object.defineProperty(t,o,e)},t=(e,t)=>({kind:"method",placement:"prototype",key:t.key,descriptor:e}),o=({finisher:e,descriptor:t})=>(o,n)=>{var r;if(void 0===n){const n=null!==(r=o.originalKey)&&void 0!==r?r:o.key,i=null!=t?{kind:"method",placement:"prototype",key:n,descriptor:t(o.key)}:{...o,key:n};return null!=e&&(i.finisher=function(t){e(t,n)}),i}{const r=o.constructor;void 0!==t&&Object.defineProperty(o,n,t(n)),null==e||e(r,n)}};export{o as decorateProperty,e as legacyPrototypeMethod,t as standardPrototypeMethod}; +//# sourceMappingURL=base.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.d.ts new file mode 100644 index 0000000..37fd2c9e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.d.ts
@@ -0,0 +1,27 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ClassDescriptor } from './base.js'; +/** + * Allow for custom element classes with private constructors + */ +declare type CustomElementClass = Omit<typeof HTMLElement, 'new'>; +/** + * Class decorator factory that defines the decorated class as a custom element. + * + * ```js + * @customElement('my-element') + * class MyElement extends LitElement { + * render() { + * return html``; + * } + * } + * ``` + * @category Decorator + * @param tagName The tag name of the custom element to define. + */ +export declare const customElement: (tagName: string) => (classOrDescriptor: CustomElementClass | ClassDescriptor) => any; +export {}; +//# sourceMappingURL=custom-element.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.js new file mode 100644 index 0000000..a90963f0 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/custom-element.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const n=n=>e=>"function"==typeof e?((n,e)=>(window.customElements.define(n,e),e))(n,e):((n,e)=>{const{kind:t,elements:i}=e;return{kind:t,elements:i,finisher(e){window.customElements.define(n,e)}}})(n,e);export{n as customElement}; +//# sourceMappingURL=custom-element.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.d.ts new file mode 100644 index 0000000..2d3c5ce --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.d.ts
@@ -0,0 +1,38 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ReactiveElement } from '../reactive-element.js'; +/** + * Adds event listener options to a method used as an event listener in a + * lit-html template. + * + * @param options An object that specifies event listener options as accepted by + * `EventTarget#addEventListener` and `EventTarget#removeEventListener`. + * + * Current browsers support the `capture`, `passive`, and `once` options. See: + * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters + * + * ```ts + * class MyElement { + * clicked = false; + * + * render() { + * return html` + * <div @click=${this._onClick}> + * <button></button> + * </div> + * `; + * } + * + * @eventOptions({capture: true}) + * _onClick(e) { + * this.clicked = true; + * } + * } + * ``` + * @category Decorator + */ +export declare function eventOptions(options: AddEventListenerOptions): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=event-options.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.js new file mode 100644 index 0000000..ca059db --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/event-options.js
@@ -0,0 +1,7 @@ +import{decorateProperty as r}from'./base.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function e(e){return r({finisher:(r,t)=>{Object.assign(r.prototype[t],e)}})}export{e as eventOptions}; +//# sourceMappingURL=event-options.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.d.ts new file mode 100644 index 0000000..98b20e8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.d.ts
@@ -0,0 +1,41 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { PropertyDeclaration } from '../reactive-element.js'; +import { ClassElement } from './base.js'; +/** + * A property decorator which creates a reactive property that reflects a + * corresponding attribute value. When a decorated property is set + * the element will update and render. A {@linkcode PropertyDeclaration} may + * optionally be supplied to configure property features. + * + * This decorator should only be used for public fields. As public fields, + * properties should be considered as primarily settable by element users, + * either via attribute or the property itself. + * + * Generally, properties that are changed by the element should be private or + * protected fields and should use the {@linkcode state} decorator. + * + * However, sometimes element code does need to set a public property. This + * should typically only be done in response to user interaction, and an event + * should be fired informing the user; for example, a checkbox sets its + * `checked` property when clicked and fires a `changed` event. Mutating public + * properties should typically not be done for non-primitive (object or array) + * properties. In other cases when an element needs to manage state, a private + * property decorated via the {@linkcode state} decorator should be used. When + * needed, state properties can be initialized via public properties to + * facilitate complex interactions. + * + * ```ts + * class MyElement { + * @property({ type: Boolean }) + * clicked = false; + * } + * ``` + * @category Decorator + * @ExportDecoratedItems + */ +export declare function property(options?: PropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=property.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.js new file mode 100644 index 0000000..eeb6d10f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/property.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const i=(i,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(n){n.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(n){n.createProperty(e.key,i)}};function e(e){return(n,t)=>void 0!==t?((i,e,n)=>{e.constructor.createProperty(n,i)})(e,n,t):i(e,n)}export{e as property}; +//# sourceMappingURL=property.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.d.ts new file mode 100644 index 0000000..5dd59fed --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.d.ts
@@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ReactiveElement } from '../reactive-element.js'; +/** + * A property decorator that converts a class property into a getter + * that executes a querySelectorAll on the element's renderRoot. + * + * @param selector A DOMString containing one or more selectors to match. + * + * See: + * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll + * + * ```ts + * class MyElement { + * @queryAll('div') + * divs: NodeListOf<HTMLDivElement>; + * + * render() { + * return html` + * <div id="first"></div> + * <div id="second"></div> + * `; + * } + * } + * ``` + * @category Decorator + */ +export declare function queryAll(selector: string): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=query-all.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.js new file mode 100644 index 0000000..d0f3087 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-all.js
@@ -0,0 +1,7 @@ +import{decorateProperty as r}from'./base.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function e(e){return r({descriptor:r=>({get(){var r,o;return null!==(o=null===(r=this.renderRoot)||void 0===r?void 0:r.querySelectorAll(e))&&void 0!==o?o:[]},enumerable:!0,configurable:!0})})}export{e as queryAll}; +//# sourceMappingURL=query-all.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts new file mode 100644 index 0000000..39c698b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.d.ts
@@ -0,0 +1,50 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import type { ReactiveElement } from '../reactive-element.js'; +import type { QueryAssignedNodesOptions } from './query-assigned-nodes.js'; +/** + * Options for the {@linkcode queryAssignedElements} decorator. Extends the + * options that can be passed into + * [HTMLSlotElement.assignedElements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements). + */ +export interface QueryAssignedElementsOptions extends QueryAssignedNodesOptions { + /** + * CSS selector used to filter the elements returned. For example, a selector + * of `".item"` will only include elements with the `item` class. + */ + selector?: string; +} +/** + * A property decorator that converts a class property into a getter that + * returns the `assignedElements` of the given `slot`. Provides a declarative + * way to use + * [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements). + * + * Can be passed an optional {@linkcode QueryAssignedElementsOptions} object. + * + * Example usage: + * ```ts + * class MyElement { + * @queryAssignedElements({ slot: 'list' }) + * listItems!: Array<HTMLElement>; + * @queryAssignedElements() + * unnamedSlotEls!: Array<HTMLElement>; + * + * render() { + * return html` + * <slot name="list"></slot> + * <slot></slot> + * `; + * } + * } + * ``` + * + * Note, the type of this property should be annotated as `Array<HTMLElement>`. + * + * @category Decorator + */ +export declare function queryAssignedElements(options?: QueryAssignedElementsOptions): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=query-assigned-elements.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js new file mode 100644 index 0000000..23036fd --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js
@@ -0,0 +1,7 @@ +import{decorateProperty as o}from'./base.js'; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */var n;const e=null!=(null===(n=window.HTMLSlotElement)||void 0===n?void 0:n.prototype.assignedElements)?(o,n)=>o.assignedElements(n):(o,n)=>o.assignedNodes(n).filter((o=>o.nodeType===Node.ELEMENT_NODE));function l(n){const{slot:l,selector:t}=null!=n?n:{};return o({descriptor:o=>({get(){var o;const r="slot"+(l?`[name=${l}]`:":not([name])"),i=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(r),s=null!=i?e(i,n):[];return t?s.filter((o=>o.matches(t))):s},enumerable:!0,configurable:!0})})}export{l as queryAssignedElements}; +//# sourceMappingURL=query-assigned-elements.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts new file mode 100644 index 0000000..926630cb --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.d.ts
@@ -0,0 +1,80 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Options for the {@linkcode queryAssignedNodes} decorator. Extends the options + * that can be passed into [HTMLSlotElement.assignedNodes](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedNodes). + */ +export interface QueryAssignedNodesOptions extends AssignedNodesOptions { + /** + * Name of the slot to query. Leave empty for the default slot. + */ + slot?: string; +} +declare type TSDecoratorReturnType = void | any; +/** + * A property decorator that converts a class property into a getter that + * returns the `assignedNodes` of the given `slot`. + * + * Can be passed an optional {@linkcode QueryAssignedNodesOptions} object. + * + * Example usage: + * ```ts + * class MyElement { + * @queryAssignedNodes({slot: 'list', flatten: true}) + * listItems!: Array<Node>; + * + * render() { + * return html` + * <slot name="list"></slot> + * `; + * } + * } + * ``` + * + * Note the type of this property should be annotated as `Array<Node>`. + * + * @category Decorator + */ +export declare function queryAssignedNodes(options?: QueryAssignedNodesOptions): TSDecoratorReturnType; +/** + * A property decorator that converts a class property into a getter that + * returns the `assignedNodes` of the given named `slot`. + * + * Example usage: + * ```ts + * class MyElement { + * @queryAssignedNodes('list', true, '.item') + * listItems!: Array<HTMLElement>; + * + * render() { + * return html` + * <slot name="list"></slot> + * `; + * } + * } + * ``` + * + * Note the type of this property should be annotated as `Array<Node>` if used + * without a `selector` or `Array<HTMLElement>` if a selector is provided. + * Use {@linkcode queryAssignedElements @queryAssignedElements} to list only + * elements, and optionally filter the element list using a CSS selector. + * + * @param slotName A string name of the slot. + * @param flatten A boolean which when true flattens the assigned nodes, + * meaning any assigned nodes that are slot elements are replaced with their + * assigned nodes. + * @param selector A CSS selector used to filter the elements returned. + * + * @category Decorator + * @deprecated Prefer passing in a single options object, i.e. `{slot: 'list'}`. + * If using `selector` please use `@queryAssignedElements`. + * `@queryAssignedNodes('', false, '.item')` is functionally identical to + * `@queryAssignedElements({slot: '', flatten: false, selector: '.item'})` or + * `@queryAssignedElements({selector: '.item'})`. + */ +export declare function queryAssignedNodes(slotName?: string, flatten?: boolean, selector?: string): TSDecoratorReturnType; +export {}; +//# sourceMappingURL=query-assigned-nodes.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js new file mode 100644 index 0000000..bac1a8a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-assigned-nodes.js
@@ -0,0 +1,7 @@ +import{decorateProperty as e}from'./base.js';import{queryAssignedElements as t}from'./query-assigned-elements.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function o(o,n,r){let l,s=o;return"object"==typeof o?(s=o.slot,l=o):l={flatten:n},r?t({slot:s,flatten:n,selector:r}):e({descriptor:e=>({get(){var e,t;const o="slot"+(s?`[name=${s}]`:":not([name])"),n=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(o);return null!==(t=null==n?void 0:n.assignedNodes(l))&&void 0!==t?t:[]},enumerable:!0,configurable:!0})})}export{o as queryAssignedNodes}; +//# sourceMappingURL=query-assigned-nodes.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.d.ts new file mode 100644 index 0000000..7a2a29a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.d.ts
@@ -0,0 +1,40 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ReactiveElement } from '../reactive-element.js'; +/** + * A property decorator that converts a class property into a getter that + * returns a promise that resolves to the result of a querySelector on the + * element's renderRoot done after the element's `updateComplete` promise + * resolves. When the queried property may change with element state, this + * decorator can be used instead of requiring users to await the + * `updateComplete` before accessing the property. + * + * @param selector A DOMString containing one or more selectors to match. + * + * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector + * + * ```ts + * class MyElement { + * @queryAsync('#first') + * first: Promise<HTMLDivElement>; + * + * render() { + * return html` + * <div id="first"></div> + * <div id="second"></div> + * `; + * } + * } + * + * // external usage + * async doSomethingWithFirst() { + * (await aMyElement.first).doSomething(); + * } + * ``` + * @category Decorator + */ +export declare function queryAsync(selector: string): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=query-async.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.js new file mode 100644 index 0000000..61f851a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query-async.js
@@ -0,0 +1,8 @@ +import{decorateProperty as r}from'./base.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function e(e){return r({descriptor:r=>({async get(){var r;return await this.updateComplete,null===(r=this.renderRoot)||void 0===r?void 0:r.querySelector(e)},enumerable:!0,configurable:!0})})}export{e as queryAsync}; +//# sourceMappingURL=query-async.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.d.ts new file mode 100644 index 0000000..c28707d --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.d.ts
@@ -0,0 +1,33 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ReactiveElement } from '../reactive-element.js'; +/** + * A property decorator that converts a class property into a getter that + * executes a querySelector on the element's renderRoot. + * + * @param selector A DOMString containing one or more selectors to match. + * @param cache An optional boolean which when true performs the DOM query only + * once and caches the result. + * + * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector + * + * ```ts + * class MyElement { + * @query('#first') + * first: HTMLDivElement; + * + * render() { + * return html` + * <div id="first"></div> + * <div id="second"></div> + * `; + * } + * } + * ``` + * @category Decorator + */ +export declare function query(selector: string, cache?: boolean): (protoOrDescriptor: ReactiveElement | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=query.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.js new file mode 100644 index 0000000..fab6310 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/query.js
@@ -0,0 +1,7 @@ +import{decorateProperty as o}from'./base.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function i(i,n){return o({descriptor:o=>{const t={get(){var o,n;return null!==(n=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==n?n:null},enumerable:!0,configurable:!0};if(n){const n="symbol"==typeof o?Symbol():"__"+o;t.get=function(){var o,t;return void 0===this[n]&&(this[n]=null!==(t=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(i))&&void 0!==t?t:null),this[n]}}return t}})}export{i as query}; +//# sourceMappingURL=query.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.d.ts new file mode 100644 index 0000000..0302910 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.d.ts
@@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export interface InternalPropertyDeclaration<Type = unknown> { + /** + * A function that indicates if a property should be considered changed when + * it is set. The function should take the `newValue` and `oldValue` and + * return `true` if an update should be requested. + */ + hasChanged?(value: Type, oldValue: Type): boolean; +} +/** + * Declares a private or protected reactive property that still triggers + * updates to the element when it changes. It does not reflect from the + * corresponding attribute. + * + * Properties declared this way must not be used from HTML or HTML templating + * systems, they're solely for properties internal to the element. These + * properties may be renamed by optimization tools like closure compiler. + * @category Decorator + */ +export declare function state(options?: InternalPropertyDeclaration): (protoOrDescriptor: Object | import("./base.js").ClassElement, name?: PropertyKey | undefined) => any; +//# sourceMappingURL=state.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.js new file mode 100644 index 0000000..c0f6e808 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/decorators/state.js
@@ -0,0 +1,7 @@ +import{property as r}from'./property.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function t(t){return r({...t,state:!0})}export{t as state}; +//# sourceMappingURL=state.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/package.json b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/package.json new file mode 100644 index 0000000..2bf35b8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/package.json
@@ -0,0 +1,132 @@ +{ + "name": "@lit/reactive-element", + "version": "1.3.2", + "publishConfig": { + "access": "public" + }, + "description": "A simple low level base class for creating fast, lightweight web components", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "https://github.com/lit/lit.git", + "directory": "packages/reactive-element" + }, + "author": "Google LLC", + "homepage": "https://lit.dev/", + "main": "reactive-element.js", + "module": "reactive-element.js", + "type": "module", + "exports": { + ".": { + "development": "./development/reactive-element.js", + "default": "./reactive-element.js" + }, + "./css-tag.js": { + "development": "./development/css-tag.js", + "default": "./css-tag.js" + }, + "./decorators.js": { + "development": "./development/decorators.js", + "default": "./decorators.js" + }, + "./decorators/base.js": { + "development": "./development/decorators/base.js", + "default": "./decorators/base.js" + }, + "./decorators/custom-element.js": { + "development": "./development/decorators/custom-element.js", + "default": "./decorators/custom-element.js" + }, + "./decorators/event-options.js": { + "development": "./development/decorators/event-options.js", + "default": "./decorators/event-options.js" + }, + "./decorators/property.js": { + "development": "./development/decorators/property.js", + "default": "./decorators/property.js" + }, + "./decorators/query-all.js": { + "development": "./development/decorators/query-all.js", + "default": "./decorators/query-all.js" + }, + "./decorators/query-assigned-elements.js": { + "development": "./development/decorators/query-assigned-elements.js", + "default": "./decorators/query-assigned-elements.js" + }, + "./decorators/query-assigned-nodes.js": { + "development": "./development/decorators/query-assigned-nodes.js", + "default": "./decorators/query-assigned-nodes.js" + }, + "./decorators/query-async.js": { + "development": "./development/decorators/query-async.js", + "default": "./decorators/query-async.js" + }, + "./decorators/query.js": { + "development": "./development/decorators/query.js", + "default": "./decorators/query.js" + }, + "./decorators/state.js": { + "development": "./development/decorators/state.js", + "default": "./decorators/state.js" + }, + "./polyfill-support.js": { + "development": "./development/polyfill-support.js", + "default": "./polyfill-support.js" + }, + "./reactive-controller.js": { + "development": "./development/reactive-controller.js", + "default": "./reactive-controller.js" + } + }, + "scripts": { + "build": "npm run clean && npm run build:ts && rollup -c && npm run build:babel", + "build:watch": "rollup -c --watch", + "build:ts": "tsc --build && treemirror development . '**/*.d.ts{,.map}'", + "build:ts:watch": "tsc --build --watch", + "build:babel": "babel --extensions '.ts' src/test/decorators --out-dir development/test/decorators-babel", + "check-version": "node scripts/check-version-tracker.js", + "checksize": "rollup -c --environment=CHECKSIZE", + "clean": "rm -rf {css-tag,decorators,polyfill-support,reactive-controller,reactive-element}.{js,js.map,d.ts} test/ decorators/ development/ *.tsbuildinfo", + "dev": "scripts/dev.sh", + "prepublishOnly": "npm run check-version", + "publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev", + "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", + "test": "npm run test:dev && npm run test:prod", + "test:dev": "cd ../tests && npx wtr '../reactive-element/development/**/*_test.(js|html)'", + "test:prod": "MODE=prod npm run test:dev", + "test:prod:watch": "MODE=prod npm run test:dev -- --watch", + "test:watch": "npm run test:dev -- --watch" + }, + "files": [ + "/css-tag.{d.ts,d.ts.map,js,js.map}", + "/decorators.{d.ts,d.ts.map,js,js.map}", + "/polyfill-support.{d.ts,d.ts.map,js,js.map}", + "/reactive-controller.{d.ts,d.ts.map,js,js.map}", + "/reactive-element.{d.ts,d.ts.map,js,js.map}", + "/decorators/", + "/development/", + "!/development/test/" + ], + "devDependencies": { + "@babel/cli": "^7.14.6", + "@babel/core": "^7.14.6", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-decorators": "^7.14.5", + "@babel/plugin-transform-typescript": "^7.14.6", + "@esm-bundle/chai": "^4.1.5", + "@types/chai": "^4.0.1", + "@types/mocha": "^9.0.0", + "@webcomponents/shadycss": "^1.8.0", + "@webcomponents/template": "^1.4.4", + "@webcomponents/webcomponentsjs": "^2.6.0", + "chokidar-cli": "^3.0.0", + "internal-scripts": "^1.0.0", + "mocha": "^9.1.1", + "rollup": "^2.70.2", + "typescript": "^4.3.5" + }, + "typings": "reactive-element.d.ts", + "directories": { + "test": "test" + } +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.d.ts new file mode 100644 index 0000000..3a35f10 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.d.ts
@@ -0,0 +1,77 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * An object that can host Reactive Controllers and call their lifecycle + * callbacks. + */ +export interface ReactiveControllerHost { + /** + * Adds a controller to the host, which sets up the controller's lifecycle + * methods to be called with the host's lifecycle. + */ + addController(controller: ReactiveController): void; + /** + * Removes a controller from the host. + */ + removeController(controller: ReactiveController): void; + /** + * Requests a host update which is processed asynchronously. The update can + * be waited on via the `updateComplete` property. + */ + requestUpdate(): void; + /** + * Returns a Promise that resolves when the host has completed updating. + * The Promise value is a boolean that is `true` if the element completed the + * update without triggering another update. The Promise result is `false` if + * a property was set inside `updated()`. If the Promise is rejected, an + * exception was thrown during the update. + * + * @return A promise of a boolean that indicates if the update resolved + * without triggering another update. + */ + readonly updateComplete: Promise<boolean>; +} +/** + * A Reactive Controller is an object that enables sub-component code + * organization and reuse by aggregating the state, behavior, and lifecycle + * hooks related to a single feature. + * + * Controllers are added to a host component, or other object that implements + * the `ReactiveControllerHost` interface, via the `addController()` method. + * They can hook their host components's lifecycle by implementing one or more + * of the lifecycle callbacks, or initiate an update of the host component by + * calling `requestUpdate()` on the host. + */ +export interface ReactiveController { + /** + * Called when the host is connected to the component tree. For custom + * element hosts, this corresponds to the `connectedCallback()` lifecycle, + * which is only called when the component is connected to the document. + */ + hostConnected?(): void; + /** + * Called when the host is disconnected from the component tree. For custom + * element hosts, this corresponds to the `disconnectedCallback()` lifecycle, + * which is called the host or an ancestor component is disconnected from the + * document. + */ + hostDisconnected?(): void; + /** + * Called during the client-side host update, just before the host calls + * its own update. + * + * Code in `update()` can depend on the DOM as it is not called in + * server-side rendering. + */ + hostUpdate?(): void; + /** + * Called after a host update, just before the host calls firstUpdated and + * updated. It is not called in server-side rendering. + * + */ + hostUpdated?(): void; +} +//# sourceMappingURL=reactive-controller.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.js new file mode 100644 index 0000000..8f792e4 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-controller.js
@@ -0,0 +1,2 @@ + +//# sourceMappingURL=reactive-controller.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.d.ts new file mode 100644 index 0000000..a810e9411 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.d.ts
@@ -0,0 +1,727 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Use this module if you want to create your own base class extending + * {@link ReactiveElement}. + * @packageDocumentation + */ +import { CSSResultGroup, CSSResultOrNative } from './css-tag.js'; +import type { ReactiveController, ReactiveControllerHost } from './reactive-controller.js'; +export * from './css-tag.js'; +export type { ReactiveController, ReactiveControllerHost, } from './reactive-controller.js'; +/** + * Contains types that are part of the unstable debug API. + * + * Everything in this API is not stable and may change or be removed in the future, + * even on patch releases. + */ +export declare namespace ReactiveUnstable { + /** + * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true, + * we will emit 'lit-debug' events to window, with live details about the update and render + * lifecycle. These can be useful for writing debug tooling and visualizations. + * + * Please be aware that running with window.emitLitDebugLogEvents has performance overhead, + * making certain operations that are normally very cheap (like a no-op render) much slower, + * because we must copy data and dispatch events. + */ + namespace DebugLog { + type Entry = Update; + interface Update { + kind: 'update'; + } + } +} +/** + * Converts property values to and from attribute values. + */ +export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> { + /** + * Called to convert an attribute value to a property + * value. + */ + fromAttribute?(value: string | null, type?: TypeHint): Type; + /** + * Called to convert a property value to an attribute + * value. + * + * It returns unknown instead of string, to be compatible with + * https://github.com/WICG/trusted-types (and similar efforts). + */ + toAttribute?(value: Type, type?: TypeHint): unknown; +} +declare type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type); +/** + * Defines options for a property accessor. + */ +export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> { + /** + * When set to `true`, indicates the property is internal private state. The + * property should not be set by users. When using TypeScript, this property + * should be marked as `private` or `protected`, and it is also a common + * practice to use a leading `_` in the name. The property is not added to + * `observedAttributes`. + */ + readonly state?: boolean; + /** + * Indicates how and whether the property becomes an observed attribute. + * If the value is `false`, the property is not added to `observedAttributes`. + * If true or absent, the lowercased property name is observed (e.g. `fooBar` + * becomes `foobar`). If a string, the string value is observed (e.g + * `attribute: 'foo-bar'`). + */ + readonly attribute?: boolean | string; + /** + * Indicates the type of the property. This is used only as a hint for the + * `converter` to determine how to convert the attribute + * to/from a property. + */ + readonly type?: TypeHint; + /** + * Indicates how to convert the attribute to/from a property. If this value + * is a function, it is used to convert the attribute value a the property + * value. If it's an object, it can have keys for `fromAttribute` and + * `toAttribute`. If no `toAttribute` function is provided and + * `reflect` is set to `true`, the property value is set directly to the + * attribute. A default `converter` is used if none is provided; it supports + * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note, + * when a property changes and the converter is used to update the attribute, + * the property is never updated again as a result of the attribute changing, + * and vice versa. + */ + readonly converter?: AttributeConverter<Type, TypeHint>; + /** + * Indicates if the property should reflect to an attribute. + * If `true`, when the property is set, the attribute is set using the + * attribute name determined according to the rules for the `attribute` + * property option and the value of the property converted using the rules + * from the `converter` property option. + */ + readonly reflect?: boolean; + /** + * A function that indicates if a property should be considered changed when + * it is set. The function should take the `newValue` and `oldValue` and + * return `true` if an update should be requested. + */ + hasChanged?(value: Type, oldValue: Type): boolean; + /** + * Indicates whether an accessor will be created for this property. By + * default, an accessor will be generated for this property that requests an + * update when set. If this flag is `true`, no accessor will be created, and + * it will be the user's responsibility to call + * `this.requestUpdate(propertyName, oldValue)` to request an update when + * the property changes. + */ + readonly noAccessor?: boolean; +} +/** + * Map of properties to PropertyDeclaration options. For each property an + * accessor is made, and the property is processed according to the + * PropertyDeclaration options. + */ +export interface PropertyDeclarations { + readonly [key: string]: PropertyDeclaration; +} +declare type PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>; +/** + * A Map of property keys to values. + * + * Takes an optional type parameter T, which when specified as a non-any, + * non-unknown type, will make the Map more strongly-typed, associating the map + * keys with their corresponding value type on T. + * + * Use `PropertyValues<this>` when overriding ReactiveElement.update() and + * other lifecycle methods in order to get stronger type-checking on keys + * and values. + */ +export declare type PropertyValues<T = any> = T extends object ? PropertyValueMap<T> : Map<PropertyKey, unknown>; +/** + * Do not use, instead prefer {@linkcode PropertyValues}. + */ +export interface PropertyValueMap<T> extends Map<PropertyKey, unknown> { + get<K extends keyof T>(k: K): T[K]; + set<K extends keyof T>(key: K, value: T[K]): this; + has<K extends keyof T>(k: K): boolean; + delete<K extends keyof T>(k: K): boolean; +} +export declare const defaultConverter: ComplexAttributeConverter; +export interface HasChanged { + (value: unknown, old: unknown): boolean; +} +/** + * Change function that returns true if `value` is different from `oldValue`. + * This method is used as the default for a property's `hasChanged` function. + */ +export declare const notEqual: HasChanged; +/** + * The Closure JS Compiler doesn't currently have good support for static + * property semantics where "this" is dynamic (e.g. + * https://github.com/google/closure-compiler/issues/3177 and others) so we use + * this hack to bypass any rewriting by the compiler. + */ +declare const finalized = "finalized"; +/** + * A string representing one of the supported dev mode warning categories. + */ +export declare type WarningKind = 'change-in-update' | 'migration'; +export declare type Initializer = (element: ReactiveElement) => void; +/** + * Base element class which manages element properties and attributes. When + * properties change, the `update` method is asynchronously called. This method + * should be supplied by subclassers to render updates as desired. + * @noInheritDoc + */ +export declare abstract class ReactiveElement extends HTMLElement implements ReactiveControllerHost { + /** + * Read or set all the enabled warning categories for this class. + * + * This property is only used in development builds. + * + * @nocollapse + * @category dev-mode + */ + static enabledWarnings?: WarningKind[]; + /** + * Enable the given warning category for this class. + * + * This method only exists in development builds, so it should be accessed + * with a guard like: + * + * ```ts + * // Enable for all ReactiveElement subclasses + * ReactiveElement.enableWarning?.('migration'); + * + * // Enable for only MyElement and subclasses + * MyElement.enableWarning?.('migration'); + * ``` + * + * @nocollapse + * @category dev-mode + */ + static enableWarning?: (warningKind: WarningKind) => void; + /** + * Disable the given warning category for this class. + * + * This method only exists in development builds, so it should be accessed + * with a guard like: + * + * ```ts + * // Disable for all ReactiveElement subclasses + * ReactiveElement.disableWarning?.('migration'); + * + * // Disable for only MyElement and subclasses + * MyElement.disableWarning?.('migration'); + * ``` + * + * @nocollapse + * @category dev-mode + */ + static disableWarning?: (warningKind: WarningKind) => void; + /** + * Adds an initializer function to the class that is called during instance + * construction. + * + * This is useful for code that runs against a `ReactiveElement` + * subclass, such as a decorator, that needs to do work for each + * instance, such as setting up a `ReactiveController`. + * + * ```ts + * const myDecorator = (target: typeof ReactiveElement, key: string) => { + * target.addInitializer((instance: ReactiveElement) => { + * // This is run during construction of the element + * new MyController(instance); + * }); + * } + * ``` + * + * Decorating a field will then cause each instance to run an initializer + * that adds a controller: + * + * ```ts + * class MyElement extends LitElement { + * @myDecorator foo; + * } + * ``` + * + * Initializers are stored per-constructor. Adding an initializer to a + * subclass does not add it to a superclass. Since initializers are run in + * constructors, initializers will run in order of the class hierarchy, + * starting with superclasses and progressing to the instance's class. + * + * @nocollapse + */ + static addInitializer(initializer: Initializer): void; + static _initializers?: Initializer[]; + /** + * Maps attribute names to properties; for example `foobar` attribute to + * `fooBar` property. Created lazily on user subclasses when finalizing the + * class. + * @nocollapse + */ + private static __attributeToPropertyMap; + /** + * Marks class as having finished creating properties. + */ + protected static [finalized]: boolean; + /** + * Memoized list of all element properties, including any superclass properties. + * Created lazily on user subclasses when finalizing the class. + * @nocollapse + * @category properties + */ + static elementProperties: PropertyDeclarationMap; + /** + * User-supplied object that maps property names to `PropertyDeclaration` + * objects containing options for configuring reactive properties. When + * a reactive property is set the element will update and render. + * + * By default properties are public fields, and as such, they should be + * considered as primarily settable by element users, either via attribute or + * the property itself. + * + * Generally, properties that are changed by the element should be private or + * protected fields and should use the `state: true` option. Properties + * marked as `state` do not reflect from the corresponding attribute + * + * However, sometimes element code does need to set a public property. This + * should typically only be done in response to user interaction, and an event + * should be fired informing the user; for example, a checkbox sets its + * `checked` property when clicked and fires a `changed` event. Mutating + * public properties should typically not be done for non-primitive (object or + * array) properties. In other cases when an element needs to manage state, a + * private property set with the `state: true` option should be used. When + * needed, state properties can be initialized via public properties to + * facilitate complex interactions. + * @nocollapse + * @category properties + */ + static properties: PropertyDeclarations; + /** + * Memoized list of all element styles. + * Created lazily on user subclasses when finalizing the class. + * @nocollapse + * @category styles + */ + static elementStyles: Array<CSSResultOrNative>; + /** + * Array of styles to apply to the element. The styles should be defined + * using the {@linkcode css} tag function, via constructible stylesheets, or + * imported from native CSS module scripts. + * + * Note on Content Security Policy: + * + * Element styles are implemented with `<style>` tags when the browser doesn't + * support adopted StyleSheets. To use such `<style>` tags with the style-src + * CSP directive, the style-src value must either include 'unsafe-inline' or + * 'nonce-<base64-value>' with <base64-value> replaced be a server-generated + * nonce. + * + * To provide a nonce to use on generated <style> elements, set + * `window.litNonce` to a server-generated nonce in your page's HTML, before + * loading application code: + * + * ```html + * <script> + * // Generated and unique per request: + * window.litNonce = 'a1b2c3d4'; + * </script> + * ``` + * @nocollapse + * @category styles + */ + static styles?: CSSResultGroup; + /** + * The set of properties defined by this class that caused an accessor to be + * added during `createProperty`. + * @nocollapse + */ + private static __reactivePropertyKeys?; + /** + * Returns a list of attributes corresponding to the registered properties. + * @nocollapse + * @category attributes + */ + static get observedAttributes(): string[]; + /** + * Creates a property accessor on the element prototype if one does not exist + * and stores a {@linkcode PropertyDeclaration} for the property with the + * given options. The property setter calls the property's `hasChanged` + * property option or uses a strict identity check to determine whether or not + * to request an update. + * + * This method may be overridden to customize properties; however, + * when doing so, it's important to call `super.createProperty` to ensure + * the property is setup correctly. This method calls + * `getPropertyDescriptor` internally to get a descriptor to install. + * To customize what properties do when they are get or set, override + * `getPropertyDescriptor`. To customize the options for a property, + * implement `createProperty` like this: + * + * ```ts + * static createProperty(name, options) { + * options = Object.assign(options, {myOption: true}); + * super.createProperty(name, options); + * } + * ``` + * + * @nocollapse + * @category properties + */ + static createProperty(name: PropertyKey, options?: PropertyDeclaration): void; + /** + * Returns a property descriptor to be defined on the given named property. + * If no descriptor is returned, the property will not become an accessor. + * For example, + * + * ```ts + * class MyElement extends LitElement { + * static getPropertyDescriptor(name, key, options) { + * const defaultDescriptor = + * super.getPropertyDescriptor(name, key, options); + * const setter = defaultDescriptor.set; + * return { + * get: defaultDescriptor.get, + * set(value) { + * setter.call(this, value); + * // custom action. + * }, + * configurable: true, + * enumerable: true + * } + * } + * } + * ``` + * + * @nocollapse + * @category properties + */ + protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): PropertyDescriptor | undefined; + /** + * Returns the property options associated with the given property. + * These options are defined with a `PropertyDeclaration` via the `properties` + * object or the `@property` decorator and are registered in + * `createProperty(...)`. + * + * Note, this method should be considered "final" and not overridden. To + * customize the options for a given property, override + * {@linkcode createProperty}. + * + * @nocollapse + * @final + * @category properties + */ + static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>; + /** + * Creates property accessors for registered properties, sets up element + * styling, and ensures any superclasses are also finalized. Returns true if + * the element was finalized. + * @nocollapse + */ + protected static finalize(): boolean; + /** + * Options used when calling `attachShadow`. Set this property to customize + * the options for the shadowRoot; for example, to create a closed + * shadowRoot: `{mode: 'closed'}`. + * + * Note, these options are used in `createRenderRoot`. If this method + * is customized, options should be respected if possible. + * @nocollapse + * @category rendering + */ + static shadowRootOptions: ShadowRootInit; + /** + * Takes the styles the user supplied via the `static styles` property and + * returns the array of styles to apply to the element. + * Override this method to integrate into a style management system. + * + * Styles are deduplicated preserving the _last_ instance in the list. This + * is a performance optimization to avoid duplicated styles that can occur + * especially when composing via subclassing. The last item is kept to try + * to preserve the cascade order with the assumption that it's most important + * that last added styles override previous styles. + * + * @nocollapse + * @category styles + */ + protected static finalizeStyles(styles?: CSSResultGroup): Array<CSSResultOrNative>; + /** + * Node or ShadowRoot into which element DOM should be rendered. Defaults + * to an open shadowRoot. + * @category rendering + */ + readonly renderRoot: HTMLElement | ShadowRoot; + /** + * Returns the property name for the given attribute `name`. + * @nocollapse + */ + private static __attributeNameForProperty; + private __instanceProperties?; + private __updatePromise; + /** + * True if there is a pending update as a result of calling `requestUpdate()`. + * Should only be read. + * @category updates + */ + isUpdatePending: boolean; + /** + * Is set to `true` after the first update. The element code cannot assume + * that `renderRoot` exists before the element `hasUpdated`. + * @category updates + */ + hasUpdated: boolean; + /** + * Map with keys of properties that should be reflected when updated. + */ + private __reflectingProperties?; + /** + * Name of currently reflecting property + */ + private __reflectingProperty; + /** + * Set of controllers. + */ + private __controllers?; + constructor(); + /** + * Registers a `ReactiveController` to participate in the element's reactive + * update cycle. The element automatically calls into any registered + * controllers during its lifecycle callbacks. + * + * If the element is connected when `addController()` is called, the + * controller's `hostConnected()` callback will be immediately called. + * @category controllers + */ + addController(controller: ReactiveController): void; + /** + * Removes a `ReactiveController` from the element. + * @category controllers + */ + removeController(controller: ReactiveController): void; + /** + * Fixes any properties set on the instance before upgrade time. + * Otherwise these would shadow the accessor and break these properties. + * The properties are stored in a Map which is played back after the + * constructor runs. Note, on very old versions of Safari (<=9) or Chrome + * (<=41), properties created for native platform properties like (`id` or + * `name`) may not have default values set in the element constructor. On + * these browsers native properties appear on instances and therefore their + * default value will overwrite any element default (e.g. if the element sets + * this.id = 'id' in the constructor, the 'id' will become '' since this is + * the native platform default). + */ + private __saveInstanceProperties; + /** + * Returns the node into which the element should render and by default + * creates and returns an open shadowRoot. Implement to customize where the + * element's DOM is rendered. For example, to render into the element's + * childNodes, return `this`. + * + * @return Returns a node into which to render. + * @category rendering + */ + protected createRenderRoot(): Element | ShadowRoot; + /** + * On first connection, creates the element's renderRoot, sets up + * element styling, and enables updating. + * @category lifecycle + */ + connectedCallback(): void; + /** + * Note, this method should be considered final and not overridden. It is + * overridden on the element instance with a function that triggers the first + * update. + * @category updates + */ + protected enableUpdating(_requestedUpdate: boolean): void; + /** + * Allows for `super.disconnectedCallback()` in extensions while + * reserving the possibility of making non-breaking feature additions + * when disconnecting at some point in the future. + * @category lifecycle + */ + disconnectedCallback(): void; + /** + * Synchronizes property values when attributes change. + * + * Specifically, when an attribute is set, the corresponding property is set. + * You should rarely need to implement this callback. If this method is + * overridden, `super.attributeChangedCallback(name, _old, value)` must be + * called. + * + * See [using the lifecycle callbacks](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements#using_the_lifecycle_callbacks) + * on MDN for more information about the `attributeChangedCallback`. + * @category attributes + */ + attributeChangedCallback(name: string, _old: string | null, value: string | null): void; + private __propertyToAttribute; + /** + * Requests an update which is processed asynchronously. This should be called + * when an element should update based on some state not triggered by setting + * a reactive property. In this case, pass no arguments. It should also be + * called when manually implementing a property setter. In this case, pass the + * property `name` and `oldValue` to ensure that any configured property + * options are honored. + * + * @param name name of requesting property + * @param oldValue old value of requesting property + * @param options property options to use instead of the previously + * configured options + * @category updates + */ + requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void; + /** + * Sets up the element to asynchronously update. + */ + private __enqueueUpdate; + /** + * Schedules an element update. You can override this method to change the + * timing of updates by returning a Promise. The update will await the + * returned Promise, and you should resolve the Promise to allow the update + * to proceed. If this method is overridden, `super.scheduleUpdate()` + * must be called. + * + * For instance, to schedule updates to occur just before the next frame: + * + * ```ts + * override protected async scheduleUpdate(): Promise<unknown> { + * await new Promise((resolve) => requestAnimationFrame(() => resolve())); + * super.scheduleUpdate(); + * } + * ``` + * @category updates + */ + protected scheduleUpdate(): void | Promise<unknown>; + /** + * Performs an element update. Note, if an exception is thrown during the + * update, `firstUpdated` and `updated` will not be called. + * + * Call `performUpdate()` to immediately process a pending update. This should + * generally not be needed, but it can be done in rare cases when you need to + * update synchronously. + * + * Note: To ensure `performUpdate()` synchronously completes a pending update, + * it should not be overridden. In LitElement 2.x it was suggested to override + * `performUpdate()` to also customizing update scheduling. Instead, you should now + * override `scheduleUpdate()`. For backwards compatibility with LitElement 2.x, + * scheduling updates via `performUpdate()` continues to work, but will make + * also calling `performUpdate()` to synchronously process updates difficult. + * + * @category updates + */ + protected performUpdate(): void | Promise<unknown>; + /** + * Invoked before `update()` to compute values needed during the update. + * + * Implement `willUpdate` to compute property values that depend on other + * properties and are used in the rest of the update process. + * + * ```ts + * willUpdate(changedProperties) { + * // only need to check changed properties for an expensive computation. + * if (changedProperties.has('firstName') || changedProperties.has('lastName')) { + * this.sha = computeSHA(`${this.firstName} ${this.lastName}`); + * } + * } + * + * render() { + * return html`SHA: ${this.sha}`; + * } + * ``` + * + * @category updates + */ + protected willUpdate(_changedProperties: PropertyValues): void; + private __markUpdated; + /** + * Returns a Promise that resolves when the element has completed updating. + * The Promise value is a boolean that is `true` if the element completed the + * update without triggering another update. The Promise result is `false` if + * a property was set inside `updated()`. If the Promise is rejected, an + * exception was thrown during the update. + * + * To await additional asynchronous work, override the `getUpdateComplete` + * method. For example, it is sometimes useful to await a rendered element + * before fulfilling this Promise. To do this, first await + * `super.getUpdateComplete()`, then any subsequent state. + * + * @return A promise of a boolean that resolves to true if the update completed + * without triggering another update. + * @category updates + */ + get updateComplete(): Promise<boolean>; + /** + * Override point for the `updateComplete` promise. + * + * It is not safe to override the `updateComplete` getter directly due to a + * limitation in TypeScript which means it is not possible to call a + * superclass getter (e.g. `super.updateComplete.then(...)`) when the target + * language is ES5 (https://github.com/microsoft/TypeScript/issues/338). + * This method should be overridden instead. For example: + * + * ```ts + * class MyElement extends LitElement { + * override async getUpdateComplete() { + * const result = await super.getUpdateComplete(); + * await this._myChild.updateComplete; + * return result; + * } + * } + * ``` + * + * @return A promise of a boolean that resolves to true if the update completed + * without triggering another update. + * @category updates + */ + protected getUpdateComplete(): Promise<boolean>; + /** + * Controls whether or not `update()` should be called when the element requests + * an update. By default, this method always returns `true`, but this can be + * customized to control when to update. + * + * @param _changedProperties Map of changed properties with old values + * @category updates + */ + protected shouldUpdate(_changedProperties: PropertyValues): boolean; + /** + * Updates the element. This method reflects property values to attributes. + * It can be overridden to render and keep updated element DOM. + * Setting properties inside this method will *not* trigger + * another update. + * + * @param _changedProperties Map of changed properties with old values + * @category updates + */ + protected update(_changedProperties: PropertyValues): void; + /** + * Invoked whenever the element is updated. Implement to perform + * post-updating tasks via DOM APIs, for example, focusing an element. + * + * Setting properties inside this method will trigger the element to update + * again after this update cycle completes. + * + * @param _changedProperties Map of changed properties with old values + * @category updates + */ + protected updated(_changedProperties: PropertyValues): void; + /** + * Invoked when the element is first updated. Implement to perform one time + * work on the element after update. + * + * ```ts + * firstUpdated() { + * this.renderRoot.getElementById('my-text-area').focus(); + * } + * ``` + * + * Setting properties inside this method will trigger the element to update + * again after this update cycle completes. + * + * @param _changedProperties Map of changed properties with old values + * @category updates + */ + protected firstUpdated(_changedProperties: PropertyValues): void; +} +//# sourceMappingURL=reactive-element.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.js b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.js new file mode 100644 index 0000000..d5169f7 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@lit/reactive-element/reactive-element.js
@@ -0,0 +1,7 @@ +import{getCompatibleStyle as t,adoptStyles as i}from'./css-tag.js';export{CSSResult,adoptStyles,css,getCompatibleStyle,supportsAdoptingStyleSheets,unsafeCSS}from'./css-tag.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */var s;const e=window.trustedTypes,r=e?e.emptyScript:"",h=window.reactiveElementPolyfillSupport,o={toAttribute(t,i){switch(i){case Boolean:t=t?r:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,i){let s=t;switch(i){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},n=(t,i)=>i!==t&&(i==i||t==t),l={attribute:!0,type:String,converter:o,reflect:!1,hasChanged:n};class a extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var i;null!==(i=this.l)&&void 0!==i||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((i,s)=>{const e=this._$Eh(s,i);void 0!==e&&(this._$Eu.set(e,s),t.push(e))})),t}static createProperty(t,i=l){if(i.state&&(i.attribute=!1),this.finalize(),this.elementProperties.set(t,i),!i.noAccessor&&!this.prototype.hasOwnProperty(t)){const s="symbol"==typeof t?Symbol():"__"+t,e=this.getPropertyDescriptor(t,s,i);void 0!==e&&Object.defineProperty(this.prototype,t,e)}}static getPropertyDescriptor(t,i,s){return{get(){return this[i]},set(e){const r=this[t];this[i]=e,this.requestUpdate(t,r,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||l}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of i)this.createProperty(s,t[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(i){const s=[];if(Array.isArray(i)){const e=new Set(i.flat(1/0).reverse());for(const i of e)s.unshift(t(i))}else void 0!==i&&s.push(t(i));return s}static _$Eh(t,i){const s=i.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var i,s;(null!==(i=this._$Eg)&&void 0!==i?i:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(s=t.hostConnected)||void 0===s||s.call(t))}removeController(t){var i;null===(i=this._$Eg)||void 0===i||i.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,i)=>{this.hasOwnProperty(i)&&(this._$Et.set(i,this[i]),delete this[i])}))}createRenderRoot(){var t;const s=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return i(s,this.constructor.elementStyles),s}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostConnected)||void 0===i?void 0:i.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostDisconnected)||void 0===i?void 0:i.call(t)}))}attributeChangedCallback(t,i,s){this._$AK(t,s)}_$ES(t,i,s=l){var e,r;const h=this.constructor._$Eh(t,s);if(void 0!==h&&!0===s.reflect){const n=(null!==(r=null===(e=s.converter)||void 0===e?void 0:e.toAttribute)&&void 0!==r?r:o.toAttribute)(i,s.type);this._$Ei=t,null==n?this.removeAttribute(h):this.setAttribute(h,n),this._$Ei=null}}_$AK(t,i){var s,e,r;const h=this.constructor,n=h._$Eu.get(t);if(void 0!==n&&this._$Ei!==n){const t=h.getPropertyOptions(n),l=t.converter,a=null!==(r=null!==(e=null===(s=l)||void 0===s?void 0:s.fromAttribute)&&void 0!==e?e:"function"==typeof l?l:null)&&void 0!==r?r:o.fromAttribute;this._$Ei=n,this[n]=a(i,t.type),this._$Ei=null}}requestUpdate(t,i,s){let e=!0;void 0!==t&&(((s=s||this.constructor.getPropertyOptions(t)).hasChanged||n)(this[t],i)?(this._$AL.has(t)||this._$AL.set(t,i),!0===s.reflect&&this._$Ei!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,s))):e=!1),!this.isUpdatePending&&e&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,i)=>this[i]=t)),this._$Et=void 0);let i=!1;const s=this._$AL;try{i=this.shouldUpdate(s),i?(this.willUpdate(s),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var i;return null===(i=t.hostUpdate)||void 0===i?void 0:i.call(t)})),this.update(s)):this._$EU()}catch(t){throw i=!1,this._$EU(),t}i&&this._$AE(s)}willUpdate(t){}_$AE(t){var i;null===(i=this._$Eg)||void 0===i||i.forEach((t=>{var i;return null===(i=t.hostUpdated)||void 0===i?void 0:i.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,i)=>this._$ES(i,this[i],t))),this._$EC=void 0),this._$EU()}updated(t){}firstUpdated(t){}}a.finalized=!0,a.elementProperties=new Map,a.elementStyles=[],a.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:a}),(null!==(s=globalThis.reactiveElementVersions)&&void 0!==s?s:globalThis.reactiveElementVersions=[]).push("1.3.2");export{a as ReactiveElement,o as defaultConverter,n as notEqual}; +//# sourceMappingURL=reactive-element.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.d.ts deleted file mode 100644 index 3855636..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.d.ts +++ /dev/null
@@ -1,48 +0,0 @@ -/** - * @license - * Copyright 2020 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -/** - * AnimationFrame provides a user-friendly abstraction around requesting - * and canceling animation frames. - */ -export declare class AnimationFrame { - private readonly rafIDs; - /** - * Requests an animation frame. Cancels any existing frame with the same key. - * @param {string} key The key for this callback. - * @param {FrameRequestCallback} callback The callback to be executed. - */ - request(key: string, callback: FrameRequestCallback): void; - /** - * Cancels a queued callback with the given key. - * @param {string} key The key for this callback. - */ - cancel(key: string): void; - /** - * Cancels all queued callback. - */ - cancelAll(): void; - /** - * Returns the queue of unexecuted callback keys. - */ - getQueue(): string[]; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.js deleted file mode 100644 index 1eadc3e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/animationframe.js +++ /dev/null
@@ -1,86 +0,0 @@ -/** - * @license - * Copyright 2020 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -/** - * AnimationFrame provides a user-friendly abstraction around requesting - * and canceling animation frames. - */ -var AnimationFrame = /** @class */ (function () { - function AnimationFrame() { - this.rafIDs = new Map(); - } - /** - * Requests an animation frame. Cancels any existing frame with the same key. - * @param {string} key The key for this callback. - * @param {FrameRequestCallback} callback The callback to be executed. - */ - AnimationFrame.prototype.request = function (key, callback) { - var _this = this; - this.cancel(key); - var frameID = requestAnimationFrame(function (frame) { - _this.rafIDs.delete(key); - // Callback must come *after* the key is deleted so that nested calls to - // request with the same key are not deleted. - callback(frame); - }); - this.rafIDs.set(key, frameID); - }; - /** - * Cancels a queued callback with the given key. - * @param {string} key The key for this callback. - */ - AnimationFrame.prototype.cancel = function (key) { - var rafID = this.rafIDs.get(key); - if (rafID) { - cancelAnimationFrame(rafID); - this.rafIDs.delete(key); - } - }; - /** - * Cancels all queued callback. - */ - AnimationFrame.prototype.cancelAll = function () { - var _this = this; - // Need to use forEach because it's the only iteration method supported - // by IE11. Suppress the underscore because we don't need it. - // tslint:disable-next-line:enforce-name-casing - this.rafIDs.forEach(function (_, key) { - _this.cancel(key); - }); - }; - /** - * Returns the queue of unexecuted callback keys. - */ - AnimationFrame.prototype.getQueue = function () { - var queue = []; - // Need to use forEach because it's the only iteration method supported - // by IE11. Suppress the underscore because we don't need it. - // tslint:disable-next-line:enforce-name-casing - this.rafIDs.forEach(function (_, key) { - queue.push(key); - }); - return queue; - }; - return AnimationFrame; -}()); -export { AnimationFrame }; -//# sourceMappingURL=animationframe.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.d.ts deleted file mode 100644 index 5a159571..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.d.ts +++ /dev/null
@@ -1,132 +0,0 @@ -// Generated by dts-bundle v0.7.3 - -declare module '@material/animation' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import * as util from '@material/animation/util'; - export { util }; - export * from '@material/animation/animationframe'; - export * from '@material/animation/types'; - export * from '@material/animation/util'; -} - -declare module '@material/animation/util' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { PrefixedCssPropertyName, PrefixedJsEventType, StandardCssPropertyName, StandardJsEventType } from '@material/animation/types'; - export function getCorrectPropertyName(windowObj: Window, cssProperty: StandardCssPropertyName): StandardCssPropertyName | PrefixedCssPropertyName; - export function getCorrectEventName(windowObj: Window, eventType: StandardJsEventType): StandardJsEventType | PrefixedJsEventType; -} - -declare module '@material/animation/animationframe' { - /** - * AnimationFrame provides a user-friendly abstraction around requesting - * and canceling animation frames. - */ - export class AnimationFrame { - /** - * Requests an animation frame. Cancels any existing frame with the same key. - * @param {string} key The key for this callback. - * @param {FrameRequestCallback} callback The callback to be executed. - */ - request(key: string, callback: FrameRequestCallback): void; - /** - * Cancels a queued callback with the given key. - * @param {string} key The key for this callback. - */ - cancel(key: string): void; - /** - * Cancels all queued callback. - */ - cancelAll(): void; - /** - * Returns the queue of unexecuted callback keys. - */ - getQueue(): string[]; - } -} - -declare module '@material/animation/types' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export type StandardCssPropertyName = 'animation' | 'transform' | 'transition'; - export type PrefixedCssPropertyName = '-webkit-animation' | '-webkit-transform' | '-webkit-transition'; - export type StandardJsEventType = 'animationend' | 'animationiteration' | 'animationstart' | 'transitionend'; - export type PrefixedJsEventType = 'webkitAnimationEnd' | 'webkitAnimationIteration' | 'webkitAnimationStart' | 'webkitTransitionEnd'; - export interface CssVendorProperty { - prefixed: PrefixedCssPropertyName; - standard: StandardCssPropertyName; - } - export interface JsVendorProperty { - cssProperty: StandardCssPropertyName; - prefixed: PrefixedJsEventType; - standard: StandardJsEventType; - } - export type CssVendorPropertyMap = { - [K in StandardCssPropertyName]: CssVendorProperty; - }; - export type JsVendorPropertyMap = { - [K in StandardJsEventType]: JsVendorProperty; - }; -} -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.js deleted file mode 100644 index b5c4f1c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.js +++ /dev/null
@@ -1,360 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["animation"] = factory(); - else - root["mdc"] = root["mdc"] || {}, root["mdc"]["animation"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-animation/index.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./packages/mdc-animation/animationframe.ts": -/*!**************************************************!*\ - !*** ./packages/mdc-animation/animationframe.ts ***! - \**************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2020 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * AnimationFrame provides a user-friendly abstraction around requesting - * and canceling animation frames. - */ -var AnimationFrame = /** @class */function () { - function AnimationFrame() { - this.rafIDs = new Map(); - } - /** - * Requests an animation frame. Cancels any existing frame with the same key. - * @param {string} key The key for this callback. - * @param {FrameRequestCallback} callback The callback to be executed. - */ - AnimationFrame.prototype.request = function (key, callback) { - var _this = this; - this.cancel(key); - var frameID = requestAnimationFrame(function (frame) { - _this.rafIDs.delete(key); - // Callback must come *after* the key is deleted so that nested calls to - // request with the same key are not deleted. - callback(frame); - }); - this.rafIDs.set(key, frameID); - }; - /** - * Cancels a queued callback with the given key. - * @param {string} key The key for this callback. - */ - AnimationFrame.prototype.cancel = function (key) { - var rafID = this.rafIDs.get(key); - if (rafID) { - cancelAnimationFrame(rafID); - this.rafIDs.delete(key); - } - }; - /** - * Cancels all queued callback. - */ - AnimationFrame.prototype.cancelAll = function () { - var _this = this; - // Need to use forEach because it's the only iteration method supported - // by IE11. Suppress the underscore because we don't need it. - // tslint:disable-next-line:enforce-name-casing - this.rafIDs.forEach(function (_, key) { - _this.cancel(key); - }); - }; - /** - * Returns the queue of unexecuted callback keys. - */ - AnimationFrame.prototype.getQueue = function () { - var queue = []; - // Need to use forEach because it's the only iteration method supported - // by IE11. Suppress the underscore because we don't need it. - // tslint:disable-next-line:enforce-name-casing - this.rafIDs.forEach(function (_, key) { - queue.push(key); - }); - return queue; - }; - return AnimationFrame; -}(); -exports.AnimationFrame = AnimationFrame; - -/***/ }), - -/***/ "./packages/mdc-animation/index.ts": -/*!*****************************************!*\ - !*** ./packages/mdc-animation/index.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -function __export(m) { - for (var p in m) { - if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - } -} -var __importStar = this && this.__importStar || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) { - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - }result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-animation/util.ts")); -exports.util = util; -__export(__webpack_require__(/*! ./animationframe */ "./packages/mdc-animation/animationframe.ts")); -__export(__webpack_require__(/*! ./util */ "./packages/mdc-animation/util.ts")); // Old namespace for backward compatibility - -/***/ }), - -/***/ "./packages/mdc-animation/util.ts": -/*!****************************************!*\ - !*** ./packages/mdc-animation/util.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -var cssPropertyNameMap = { - animation: { - prefixed: '-webkit-animation', - standard: 'animation' - }, - transform: { - prefixed: '-webkit-transform', - standard: 'transform' - }, - transition: { - prefixed: '-webkit-transition', - standard: 'transition' - } -}; -var jsEventTypeMap = { - animationend: { - cssProperty: 'animation', - prefixed: 'webkitAnimationEnd', - standard: 'animationend' - }, - animationiteration: { - cssProperty: 'animation', - prefixed: 'webkitAnimationIteration', - standard: 'animationiteration' - }, - animationstart: { - cssProperty: 'animation', - prefixed: 'webkitAnimationStart', - standard: 'animationstart' - }, - transitionend: { - cssProperty: 'transition', - prefixed: 'webkitTransitionEnd', - standard: 'transitionend' - } -}; -function isWindow(windowObj) { - return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; -} -function getCorrectPropertyName(windowObj, cssProperty) { - if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { - var el = windowObj.document.createElement('div'); - var _a = cssPropertyNameMap[cssProperty], - standard = _a.standard, - prefixed = _a.prefixed; - var isStandard = standard in el.style; - return isStandard ? standard : prefixed; - } - return cssProperty; -} -exports.getCorrectPropertyName = getCorrectPropertyName; -function getCorrectEventName(windowObj, eventType) { - if (isWindow(windowObj) && eventType in jsEventTypeMap) { - var el = windowObj.document.createElement('div'); - var _a = jsEventTypeMap[eventType], - standard = _a.standard, - prefixed = _a.prefixed, - cssProperty = _a.cssProperty; - var isStandard = cssProperty in el.style; - return isStandard ? standard : prefixed; - } - return eventType; -} -exports.getCorrectEventName = getCorrectEventName; - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=mdc.animation.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.min.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.min.js deleted file mode 100644 index 7c5f6ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/dist/mdc.animation.min.js +++ /dev/null
@@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.animation=e():(t.mdc=t.mdc||{},t.mdc.animation=e())}(this,function(){return r={},i.m=n={12:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a={animation:{prefixed:"-webkit-animation",standard:"animation"},transform:{prefixed:"-webkit-transform",standard:"transform"},transition:{prefixed:"-webkit-transition",standard:"transition"}},u={animationend:{cssProperty:"animation",prefixed:"webkitAnimationEnd",standard:"animationend"},animationiteration:{cssProperty:"animation",prefixed:"webkitAnimationIteration",standard:"animationiteration"},animationstart:{cssProperty:"animation",prefixed:"webkitAnimationStart",standard:"animationstart"},transitionend:{cssProperty:"transition",prefixed:"webkitTransitionEnd",standard:"transitionend"}};function f(t){return Boolean(t.document)&&"function"==typeof t.document.createElement}e.getCorrectPropertyName=function(t,e){if(f(t)&&e in a){var n=t.document.createElement("div"),r=a[e],i=r.standard,o=r.prefixed;return i in n.style?i:o}return e},e.getCorrectEventName=function(t,e){if(f(t)&&e in u){var n=t.document.createElement("div"),r=u[e],i=r.standard,o=r.prefixed;return r.cssProperty in n.style?i:o}return e}},123:function(t,n,e){"use strict";function r(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}var i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var o=i(e(12));n.util=o,r(e(50)),r(e(12))},50:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=(i.prototype.request=function(e,n){var r=this;this.cancel(e);var t=requestAnimationFrame(function(t){r.rafIDs.delete(e),n(t)});this.rafIDs.set(e,t)},i.prototype.cancel=function(t){var e=this.rafIDs.get(t);e&&(cancelAnimationFrame(e),this.rafIDs.delete(t))},i.prototype.cancelAll=function(){var n=this;this.rafIDs.forEach(function(t,e){n.cancel(e)})},i.prototype.getQueue=function(){var n=[];return this.rafIDs.forEach(function(t,e){n.push(e)}),n},i);function i(){this.rafIDs=new Map}e.AnimationFrame=r}},i.c=r,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=123);function i(t){if(r[t])return r[t].exports;var e=r[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,i),e.l=!0,e.exports}var n,r}); \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.d.ts deleted file mode 100644 index 095db6a4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.d.ts +++ /dev/null
@@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -import * as util from './util'; -export { util }; -export * from './animationframe'; -export * from './types'; -export * from './util';
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.js deleted file mode 100644 index e90fc75..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/index.js +++ /dev/null
@@ -1,27 +0,0 @@ -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -import * as util from './util.js'; -export { util }; // New namespace -export * from './animationframe.js'; -export * from './util.js'; // Old namespace for backward compatibility -//# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/CopyrightNotice.txt b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 2e4a05c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/CopyrightNotice.txt +++ /dev/null
@@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/LICENSE.txt b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/LICENSE.txt deleted file mode 100644 index fa7d1bd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/LICENSE.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/index.js deleted file mode 100644 index 506f5cc4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/index.js +++ /dev/null
@@ -1,51 +0,0 @@ -import tslib from '../tslib.es6.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/package.json deleted file mode 100644 index 96ae6e5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/modules/package.json +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/package.json deleted file mode 100644 index f8c2a53..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/package.json +++ /dev/null
@@ -1,37 +0,0 @@ -{ - "name": "tslib", - "author": "Microsoft Corp.", - "homepage": "https://www.typescriptlang.org/", - "version": "1.14.1", - "license": "0BSD", - "description": "Runtime library for TypeScript helper functions", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/tslib.git" - }, - "main": "tslib.js", - "module": "tslib.es6.js", - "jsnext:main": "tslib.es6.js", - "typings": "tslib.d.ts", - "sideEffects": false, - "exports": { - ".": { - "module": "./tslib.es6.js", - "import": "./modules/index.js", - "default": "./tslib.js" - }, - "./": "./" - } -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.d.ts deleted file mode 100644 index 0756b28..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar<T>(mod: T): T; -export declare function __importDefault<T>(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.html b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.es6.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 7fdec02..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.es6.js +++ /dev/null
@@ -1,218 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -export function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.html b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba51..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.js deleted file mode 100644 index fbce018..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/node_modules/tslib/tslib.js +++ /dev/null
@@ -1,284 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __createBinding = function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }; - - __exportStar = function (m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -});
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/animation/package.json deleted file mode 100644 index 0bdb571..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/package.json +++ /dev/null
@@ -1,24 +0,0 @@ -{ - "name": "@material/animation", - "description": "Animation Variables and Mixins used by Material Components for the web", - "version": "9.0.0-canary.1c156d69d.0", - "license": "MIT", - "keywords": [ - "material components", - "material design", - "animation" - ], - "main": "dist/mdc.animation.js", - "module": "index.js", - "sideEffects": false, - "types": "dist/mdc.animation.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/material-components/material-components-web.git", - "directory": "packages/mdc-animation" - }, - "dependencies": { - "tslib": "^1.9.3" - }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/types.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/types.d.ts deleted file mode 100644 index 5f4d9934..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/types.d.ts +++ /dev/null
@@ -1,41 +0,0 @@ -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -export declare type StandardCssPropertyName = 'animation' | 'transform' | 'transition'; -export declare type PrefixedCssPropertyName = '-webkit-animation' | '-webkit-transform' | '-webkit-transition'; -export declare type StandardJsEventType = 'animationend' | 'animationiteration' | 'animationstart' | 'transitionend'; -export declare type PrefixedJsEventType = 'webkitAnimationEnd' | 'webkitAnimationIteration' | 'webkitAnimationStart' | 'webkitTransitionEnd'; -export interface CssVendorProperty { - prefixed: PrefixedCssPropertyName; - standard: StandardCssPropertyName; -} -export interface JsVendorProperty { - cssProperty: StandardCssPropertyName; - prefixed: PrefixedJsEventType; - standard: StandardJsEventType; -} -export declare type CssVendorPropertyMap = { - [K in StandardCssPropertyName]: CssVendorProperty; -}; -export declare type JsVendorPropertyMap = { - [K in StandardJsEventType]: JsVendorProperty; -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.d.ts deleted file mode 100644 index 522b0a1f..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.d.ts +++ /dev/null
@@ -1,25 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -import { PrefixedCssPropertyName, PrefixedJsEventType, StandardCssPropertyName, StandardJsEventType } from './types'; -export declare function getCorrectPropertyName(windowObj: Window, cssProperty: StandardCssPropertyName): StandardCssPropertyName | PrefixedCssPropertyName; -export declare function getCorrectEventName(windowObj: Window, eventType: StandardJsEventType): StandardJsEventType | PrefixedJsEventType;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.js b/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.js deleted file mode 100644 index 86b46d4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/util.js +++ /dev/null
@@ -1,80 +0,0 @@ -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -var cssPropertyNameMap = { - animation: { - prefixed: '-webkit-animation', - standard: 'animation', - }, - transform: { - prefixed: '-webkit-transform', - standard: 'transform', - }, - transition: { - prefixed: '-webkit-transition', - standard: 'transition', - }, -}; -var jsEventTypeMap = { - animationend: { - cssProperty: 'animation', - prefixed: 'webkitAnimationEnd', - standard: 'animationend', - }, - animationiteration: { - cssProperty: 'animation', - prefixed: 'webkitAnimationIteration', - standard: 'animationiteration', - }, - animationstart: { - cssProperty: 'animation', - prefixed: 'webkitAnimationStart', - standard: 'animationstart', - }, - transitionend: { - cssProperty: 'transition', - prefixed: 'webkitTransitionEnd', - standard: 'transitionend', - }, -}; -function isWindow(windowObj) { - return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; -} -export function getCorrectPropertyName(windowObj, cssProperty) { - if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { - var el = windowObj.document.createElement('div'); - var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed; - var isStandard = standard in el.style; - return isStandard ? standard : prefixed; - } - return cssProperty; -} -export function getCorrectEventName(windowObj, eventType) { - if (isWindow(windowObj) && eventType in jsEventTypeMap) { - var el = windowObj.document.createElement('div'); - var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty; - var isStandard = cssProperty in el.style; - return isStandard ? standard : prefixed; - } - return eventType; -} -//# sourceMappingURL=util.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/component.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/component.js index da67746..89e9267 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/component.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/component.js
@@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -import { __read, __spread } from './node_modules/tslib/tslib.es6.js'; +import { __read, __spreadArray } from '../../tslib/tslib.js'; import { MDCFoundation } from './foundation.js'; var MDCComponent = /** @class */ (function () { function MDCComponent(root, foundation) { @@ -29,9 +29,10 @@ args[_i - 2] = arguments[_i]; } this.root = root; - this.initialize.apply(this, __spread(args)); - // Note that we initialize foundation here and not within the constructor's default param so that - // this.root_ is defined and can be used within the foundation class. + this.initialize.apply(this, __spreadArray([], __read(args))); + // Note that we initialize foundation here and not within the constructor's + // default param so that this.root is defined and can be used within the + // foundation class. this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation.init();
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.d.ts deleted file mode 100644 index b73ebd6..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.d.ts +++ /dev/null
@@ -1,154 +0,0 @@ -// Generated by dts-bundle v0.7.3 - -declare module '@material/base' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export * from '@material/base/component'; - export * from '@material/base/foundation'; - export * from '@material/base/types'; -} - -declare module '@material/base/component' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { MDCFoundation } from '@material/base/foundation'; - import { CustomEventListener, EventType, SpecificEventListener } from '@material/base/types'; - export class MDCComponent<FoundationType extends MDCFoundation> { - root: Element; - static attachTo(root: Element): MDCComponent<MDCFoundation<{}>>; - protected foundation: FoundationType; - constructor(root: Element, foundation?: FoundationType, ...args: unknown[]); - initialize(..._args: Array<unknown>): void; - getDefaultFoundation(): FoundationType; - initialSyncWithDOM(): void; - destroy(): void; - /** - * Wrapper method to add an event listener to the component's root element. This is most useful when - * listening for custom events. - */ - listen<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void; - listen<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void; - /** - * Wrapper method to remove an event listener to the component's root element. This is most useful when - * unlistening for custom events. - */ - unlisten<K extends EventType>(evtType: K, handler: SpecificEventListener<K>, options?: AddEventListenerOptions | boolean): void; - unlisten<E extends Event>(evtType: string, handler: CustomEventListener<E>, options?: AddEventListenerOptions | boolean): void; - /** - * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. - */ - emit<T extends object>(evtType: string, evtData: T, shouldBubble?: boolean): void; - } - export default MDCComponent; -} - -declare module '@material/base/foundation' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export class MDCFoundation<AdapterType extends {} = {}> { - protected adapter: AdapterType; - static get cssClasses(): { - [key: string]: string; - }; - static get strings(): { - [key: string]: string; - }; - static get numbers(): { - [key: string]: number; - }; - static get defaultAdapter(): {}; - constructor(adapter?: AdapterType); - init(): void; - destroy(): void; - } - export default MDCFoundation; -} - -declare module '@material/base/types' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export type EventType = keyof GlobalEventHandlersEventMap; - export type SpecificEventListener<K extends EventType> = (evt: GlobalEventHandlersEventMap[K]) => void; - export type CustomEventListener<E extends Event> = (evt: E) => void; -} -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.js deleted file mode 100644 index 6323fe4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.js +++ /dev/null
@@ -1,383 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["base"] = factory(); - else - root["mdc"] = root["mdc"] || {}, root["mdc"]["base"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-base/index.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./packages/mdc-base/component.ts": -/*!****************************************!*\ - !*** ./packages/mdc-base/component.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var __read = this && this.__read || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), - r, - ar = [], - e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { - ar.push(r.value); - } - } catch (error) { - e = { error: error }; - } finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally { - if (e) throw e.error; - } - } - return ar; -}; -var __spread = this && this.__spread || function () { - for (var ar = [], i = 0; i < arguments.length; i++) { - ar = ar.concat(__read(arguments[i])); - }return ar; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"); -var MDCComponent = /** @class */function () { - function MDCComponent(root, foundation) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - this.root = root; - this.initialize.apply(this, __spread(args)); - // Note that we initialize foundation here and not within the constructor's default param so that - // this.root_ is defined and can be used within the foundation class. - this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; - this.foundation.init(); - this.initialSyncWithDOM(); - } - MDCComponent.attachTo = function (root) { - // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and - // returns an instantiated component with its root set to that element. Also note that in the cases of - // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized - // from getDefaultFoundation(). - return new MDCComponent(root, new foundation_1.MDCFoundation({})); - }; - /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ - MDCComponent.prototype.initialize = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - // Subclasses can override this to do any additional setup work that would be considered part of a - // "constructor". Essentially, it is a hook into the parent constructor before the foundation is - // initialized. Any additional arguments besides root and foundation will be passed in here. - }; - MDCComponent.prototype.getDefaultFoundation = function () { - // Subclasses must override this method to return a properly configured foundation class for the - // component. - throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); - }; - MDCComponent.prototype.initialSyncWithDOM = function () { - // Subclasses should override this method if they need to perform work to synchronize with a host DOM - // object. An example of this would be a form control wrapper that needs to synchronize its internal state - // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM - // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. - }; - MDCComponent.prototype.destroy = function () { - // Subclasses may implement this method to release any resources / deregister any listeners they have - // attached. An example of this might be deregistering a resize event from the window object. - this.foundation.destroy(); - }; - MDCComponent.prototype.listen = function (evtType, handler, options) { - this.root.addEventListener(evtType, handler, options); - }; - MDCComponent.prototype.unlisten = function (evtType, handler, options) { - this.root.removeEventListener(evtType, handler, options); - }; - /** - * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. - */ - MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { - if (shouldBubble === void 0) { - shouldBubble = false; - } - var evt; - if (typeof CustomEvent === 'function') { - evt = new CustomEvent(evtType, { - bubbles: shouldBubble, - detail: evtData - }); - } else { - evt = document.createEvent('CustomEvent'); - evt.initCustomEvent(evtType, shouldBubble, false, evtData); - } - this.root.dispatchEvent(evt); - }; - return MDCComponent; -}(); -exports.MDCComponent = MDCComponent; -// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. -exports.default = MDCComponent; - -/***/ }), - -/***/ "./packages/mdc-base/foundation.ts": -/*!*****************************************!*\ - !*** ./packages/mdc-base/foundation.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -var MDCFoundation = /** @class */function () { - function MDCFoundation(adapter) { - if (adapter === void 0) { - adapter = {}; - } - this.adapter = adapter; - } - Object.defineProperty(MDCFoundation, "cssClasses", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports every - // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "strings", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports all - // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "numbers", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports all - // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "defaultAdapter", { - get: function get() { - // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient - // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter - // validation. - return {}; - }, - enumerable: true, - configurable: true - }); - MDCFoundation.prototype.init = function () { - // Subclasses should override this method to perform initialization routines (registering events, etc.) - }; - MDCFoundation.prototype.destroy = function () { - // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) - }; - return MDCFoundation; -}(); -exports.MDCFoundation = MDCFoundation; -// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. -exports.default = MDCFoundation; - -/***/ }), - -/***/ "./packages/mdc-base/index.ts": -/*!************************************!*\ - !*** ./packages/mdc-base/index.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -function __export(m) { - for (var p in m) { - if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - } -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts")); -__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts")); - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=mdc.base.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.min.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.min.js deleted file mode 100644 index 62612d45..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/dist/mdc.base.min.js +++ /dev/null
@@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.base=e():(t.mdc=t.mdc||{},t.mdc.base=e())}(this,function(){return o={},r.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=(Object.defineProperty(r,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),r.prototype.init=function(){},r.prototype.destroy=function(){},r);function r(t){void 0===t&&(t={}),this.adapter=t}e.MDCFoundation=o,e.default=o},1:function(t,e,n){"use strict";var o=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),u=[];try{for(;(void 0===e||0<e--)&&!(o=i.next()).done;)u.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return u},r=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),u=(f.attachTo=function(t){return new f(t,new i.MDCFoundation({}))},f.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},f.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},f.prototype.initialSyncWithDOM=function(){},f.prototype.destroy=function(){this.foundation.destroy()},f.prototype.listen=function(t,e,n){this.root.addEventListener(t,e,n)},f.prototype.unlisten=function(t,e,n){this.root.removeEventListener(t,e,n)},f.prototype.emit=function(t,e,n){var o;void 0===n&&(n=!1),"function"==typeof CustomEvent?o=new CustomEvent(t,{bubbles:n,detail:e}):(o=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root.dispatchEvent(o)},f);function f(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.root=t,this.initialize.apply(this,r(n)),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}e.MDCComponent=u,e.default=u},128:function(t,n,e){"use strict";function o(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}Object.defineProperty(n,"__esModule",{value:!0}),o(e(1)),o(e(0))}},r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=128);function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}var n,o}); \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/types.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/externs.d.ts similarity index 88% rename from third_party/material_web_components/components-chromium/node_modules/@material/animation/types.js rename to third_party/material_web_components/components-chromium/node_modules/@material/base/externs.d.ts index 347c73f5..e08cce3 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/animation/types.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/externs.d.ts
@@ -20,4 +20,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -//# sourceMappingURL=types.js.map \ No newline at end of file + +declare interface Element { + msMatchesSelector?: (selector: string) => boolean; +} + +declare interface Window { + CSS: typeof CSS; +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.d.ts index 6e8cdbc..3e06f985 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.d.ts
@@ -36,4 +36,26 @@ init(): void; destroy(): void; } +/** + * The constructor for MDCFoundation. + */ +export interface MDCFoundationConstructor<AdapterType extends object = any> { + new (adapter: AdapterType): MDCFoundation<AdapterType>; + readonly prototype: MDCFoundation<AdapterType>; +} +/** + * The deprecated constructor for MDCFoundation. + */ +export interface MDCFoundationDeprecatedConstructor<AdapterType extends object = any> { + readonly cssClasses: Record<string, string>; + readonly strings: Record<string, string>; + readonly numbers: Record<string, number>; + readonly defaultAdapter: AdapterType; + new (adapter?: Partial<AdapterType>): MDCFoundation<AdapterType>; + readonly prototype: MDCFoundation<AdapterType>; +} +/** + * Retrieves the AdapaterType from the provided MDCFoundation generic type. + */ +export declare type MDCFoundationAdapter<T> = T extends MDCFoundation<infer A> ? A : never; export default MDCFoundation;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.js index 4351ff8..b172386 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/foundation.js
@@ -31,7 +31,7 @@ // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} return {}; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "strings", { @@ -40,7 +40,7 @@ // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} return {}; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "numbers", { @@ -49,7 +49,7 @@ // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} return {}; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "defaultAdapter", { @@ -59,7 +59,7 @@ // validation. return {}; }, - enumerable: true, + enumerable: false, configurable: true }); MDCFoundation.prototype.init = function () {
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/index.js index ace937a..8410072 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/index.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/index.js
@@ -22,4 +22,5 @@ */ export * from './component.js'; export * from './foundation.js'; +export * from './types.js'; //# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/CopyrightNotice.txt b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 2e4a05c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/CopyrightNotice.txt +++ /dev/null
@@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/LICENSE.txt b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/LICENSE.txt deleted file mode 100644 index fa7d1bd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/LICENSE.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/index.js deleted file mode 100644 index 506f5cc4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/index.js +++ /dev/null
@@ -1,51 +0,0 @@ -import tslib from '../tslib.es6.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/package.json deleted file mode 100644 index 96ae6e5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/modules/package.json +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/package.json deleted file mode 100644 index f8c2a53..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/package.json +++ /dev/null
@@ -1,37 +0,0 @@ -{ - "name": "tslib", - "author": "Microsoft Corp.", - "homepage": "https://www.typescriptlang.org/", - "version": "1.14.1", - "license": "0BSD", - "description": "Runtime library for TypeScript helper functions", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/tslib.git" - }, - "main": "tslib.js", - "module": "tslib.es6.js", - "jsnext:main": "tslib.es6.js", - "typings": "tslib.d.ts", - "sideEffects": false, - "exports": { - ".": { - "module": "./tslib.es6.js", - "import": "./modules/index.js", - "default": "./tslib.js" - }, - "./": "./" - } -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.d.ts deleted file mode 100644 index 0756b28..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar<T>(mod: T): T; -export declare function __importDefault<T>(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.html b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.es6.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 7fdec02..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.es6.js +++ /dev/null
@@ -1,218 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -export function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.html b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba51..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.js deleted file mode 100644 index fbce018..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/node_modules/tslib/tslib.js +++ /dev/null
@@ -1,284 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __createBinding = function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }; - - __exportStar = function (m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -});
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.d.ts new file mode 100644 index 0000000..d546598c --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.d.ts
@@ -0,0 +1,73 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { MDCFoundation } from './foundation'; +import { Observer, ObserverRecord } from './observer'; +export declare class MDCObserverFoundation<Adapter> extends MDCFoundation<Adapter> { + /** A set of cleanup functions to unobserve changes. */ + protected unobserves: Set<Function>; + constructor(adapter: Adapter); + destroy(): void; + /** + * Observe a target's properties for changes using the provided map of + * property names and observer functions. + * + * @template T The target type. + * @param target - The target to observe. + * @param observers - An object whose keys are target properties and values + * are observer functions that are called when the associated property + * changes. + * @return A cleanup function that can be called to unobserve the + * target. + */ + protected observe<T extends object>(target: T, observers: ObserverRecord<T, this>): () => void; + /** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current + * and previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the + * provided `Observer`. + */ + protected observeProperty<T extends object, K extends keyof T>(target: T, property: K, observer: Observer<T, K>): () => void; + /** + * Enables or disables all observers for the provided target. Disabling + * observers will prevent them from being called until they are re-enabled. + * + * @param target - The target to enable or disable observers for. + * @param enabled - Whether or not observers should be called. + */ + protected setObserversEnabled(target: object, enabled: boolean): void; + /** + * Clean up all observers and stop listening for property changes. + */ + protected unobserve(): void; +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.js new file mode 100644 index 0000000..f56c942 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-foundation.js
@@ -0,0 +1,141 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { __extends, __read, __spreadArray, __values } from '../../tslib/tslib.js'; +import { MDCFoundation } from './foundation.js'; +import { observeProperty, setObserversEnabled } from './observer.js'; +var MDCObserverFoundation = /** @class */ (function (_super) { + __extends(MDCObserverFoundation, _super); + function MDCObserverFoundation(adapter) { + var _this = _super.call(this, adapter) || this; + /** A set of cleanup functions to unobserve changes. */ + _this.unobserves = new Set(); + return _this; + } + MDCObserverFoundation.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.unobserve(); + }; + /** + * Observe a target's properties for changes using the provided map of + * property names and observer functions. + * + * @template T The target type. + * @param target - The target to observe. + * @param observers - An object whose keys are target properties and values + * are observer functions that are called when the associated property + * changes. + * @return A cleanup function that can be called to unobserve the + * target. + */ + MDCObserverFoundation.prototype.observe = function (target, observers) { + var e_1, _a; + var _this = this; + var cleanup = []; + try { + for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) { + var property = _c.value; + var observer = observers[property].bind(this); + cleanup.push(this.observeProperty(target, property, observer)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + var unobserve = function () { + var e_2, _a; + try { + for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) { + var cleanupFn = cleanup_1_1.value; + cleanupFn(); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1); + } + finally { if (e_2) throw e_2.error; } + } + _this.unobserves.delete(unobserve); + }; + this.unobserves.add(unobserve); + return unobserve; + }; + /** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current + * and previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the + * provided `Observer`. + */ + MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) { + return observeProperty(target, property, observer); + }; + /** + * Enables or disables all observers for the provided target. Disabling + * observers will prevent them from being called until they are re-enabled. + * + * @param target - The target to enable or disable observers for. + * @param enabled - Whether or not observers should be called. + */ + MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) { + setObserversEnabled(target, enabled); + }; + /** + * Clean up all observers and stop listening for property changes. + */ + MDCObserverFoundation.prototype.unobserve = function () { + var e_3, _a; + try { + // Iterate over a copy since unobserve() will remove themselves from the set + for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) { + var unobserve = _c.value; + unobserve(); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + }; + return MDCObserverFoundation; +}(MDCFoundation)); +export { MDCObserverFoundation }; +//# sourceMappingURL=observer-foundation.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.d.ts new file mode 100644 index 0000000..a09bf7e1 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.d.ts
@@ -0,0 +1,70 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { MDCObserver, Observer } from './observer'; +import { Constructor } from './types'; +/** + * Mixin to add `MDCObserver` functionality. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @return A class with `MDCObserver` functionality. + */ +export declare function mdcObserver(): Constructor<MDCObserver>; +/** + * Mixin to add `MDCObserver` functionality to a base class. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @template T Base class instance type. Specify this generic if the base class + * itself has generics that cannot be inferred. + * @template C Base class constructor type. + * @param baseClass - Base class. + * @return A class that extends the optional base class with `MDCObserver` + * functionality. + */ +export declare function mdcObserver<T, C extends Constructor<T>>(baseClass: C): Constructor<MDCObserver> & Constructor<T> & C; +/** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current and + * previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the provided + * `Observer`. + */ +export declare function observeProperty<T extends object, K extends keyof T>(target: T, property: K, observer: Observer<T, K>): () => void; +/** + * Enables or disables all observers for a provided target. Changes to observed + * properties will not call any observers when disabled. + * + * @template T The observed target type. + * @param target - The target to enable or disable observers for. + * @param enabled - True to enable or false to disable observers. + */ +export declare function setObserversEnabled<T extends object>(target: T, enabled: boolean): void;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.js new file mode 100644 index 0000000..fd1814a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer-proxy.js
@@ -0,0 +1,256 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { __extends, __read, __spreadArray, __values } from '../../tslib/tslib.js'; +import { getDescriptor } from './observer.js'; +/** + * Mixin to add `MDCObserver` functionality to an optional base class. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @template C Optional base class constructor type. + * @param baseClass - Optional base class. + * @return A class that extends the optional base class with `MDCObserver` + * functionality. + */ +export function mdcObserver(baseClass) { + var _a, _b; + if (baseClass === void 0) { baseClass = /** @class */ (function () { + function class_1() { + } + return class_1; + }()); } + var unobserves = Symbol(); + return _b = /** @class */ (function (_super) { + __extends(MDCObserver, _super); + function MDCObserver() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this[_a] = []; + return _this; + } + MDCObserver.prototype.observe = function (target, observers) { + var e_1, _b; + var _this = this; + var cleanup = []; + try { + for (var _c = __values(Object.keys(observers)), _d = _c.next(); !_d.done; _d = _c.next()) { + var property = _d.value; + var observer = observers[property].bind(this); + cleanup.push(observeProperty(target, property, observer)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_d && !_d.done && (_b = _c.return)) _b.call(_c); + } + finally { if (e_1) throw e_1.error; } + } + var unobserve = function () { + var e_2, _b; + try { + for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) { + var cleanupFn = cleanup_1_1.value; + cleanupFn(); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (cleanup_1_1 && !cleanup_1_1.done && (_b = cleanup_1.return)) _b.call(cleanup_1); + } + finally { if (e_2) throw e_2.error; } + } + var index = _this[unobserves].indexOf(unobserve); + if (index > -1) { + _this[unobserves].splice(index, 1); + } + }; + this[unobserves].push(unobserve); + return unobserve; + }; + MDCObserver.prototype.setObserversEnabled = function (target, enabled) { + setObserversEnabled(target, enabled); + }; + MDCObserver.prototype.unobserve = function () { + var e_3, _b; + try { + // Iterate over a copy since unobserve() will remove themselves from the + // array + for (var _c = __values(__spreadArray([], __read(this[unobserves]))), _d = _c.next(); !_d.done; _d = _c.next()) { + var unobserve = _d.value; + unobserve(); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_d && !_d.done && (_b = _c.return)) _b.call(_c); + } + finally { if (e_3) throw e_3.error; } + } + }; + return MDCObserver; + }(baseClass)), + _a = unobserves, + _b; +} +var isTargetObservers = Symbol(); +var isEnabled = Symbol(); +var getObservers = Symbol(); +/** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current and + * previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the provided + * `Observer`. + */ +export function observeProperty(target, property, observer) { + var observerPrototype = installObserver(target); + var observers = observerPrototype[getObservers](property); + observers.push(observer); + return function () { + observers.splice(observers.indexOf(observer), 1); + }; +} +/** + * Installs a `TargetObservers` for the provided target (if not already + * installed). + * + * A target's `TargetObservers` is installed as a Proxy on the target's + * prototype. + * + * @template T The observed target type. + * @param target - The target to observe. + * @return The installed `TargetObservers` for the provided target. + */ +function installObserver(target) { + var e_4, _a, e_5, _b; + var prototype = Object.getPrototypeOf(target); + if (prototype[isTargetObservers]) { + return prototype; + } + // Proxy prototypes will not trap plain properties (not a getter/setter) that + // are already defined. They only work on new plain properties. + // We can work around this by deleting the properties, installing the Proxy, + // then re-setting the properties. + var existingKeyValues = new Map(); + var keys = Object.getOwnPropertyNames(target); + try { + for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) { + var key = keys_1_1.value; + var descriptor = getDescriptor(target, key); + if (descriptor && descriptor.writable) { + existingKeyValues.set(key, descriptor.value); + delete target[key]; + } + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1); + } + finally { if (e_4) throw e_4.error; } + } + var proxy = new Proxy(Object.create(prototype), { + get: function (target, key, receiver) { + return Reflect.get(target, key, receiver); + }, + set: function (target, key, newValue, receiver) { + var e_6, _a; + var isTargetObserversKey = key === isTargetObservers || + key === isEnabled || key === getObservers; + var previous = Reflect.get(target, key, receiver); + // Do not use receiver when setting the target's key. We do not want + // to change whatever the target's inherent receiver is. + Reflect.set(target, key, newValue); + if (!isTargetObserversKey && proxy[isEnabled] && + newValue !== previous) { + try { + for (var _b = __values(proxy[getObservers](key)), _c = _b.next(); !_c.done; _c = _b.next()) { + var observer = _c.value; + observer(newValue, previous); + } + } + catch (e_6_1) { e_6 = { error: e_6_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_6) throw e_6.error; } + } + } + return true; + } + }); + proxy[isTargetObservers] = true; + proxy[isEnabled] = true; + var observersMap = new Map(); + proxy[getObservers] = function (key) { + var observers = observersMap.get(key) || []; + if (!observersMap.has(key)) { + observersMap.set(key, observers); + } + return observers; + }; + Object.setPrototypeOf(target, proxy); + try { + // Re-set plain pre-existing properties so that the Proxy can trap them + for (var _c = __values(existingKeyValues.entries()), _d = _c.next(); !_d.done; _d = _c.next()) { + var _e = __read(_d.value, 2), key = _e[0], value = _e[1]; + target[key] = value; + } + } + catch (e_5_1) { e_5 = { error: e_5_1 }; } + finally { + try { + if (_d && !_d.done && (_b = _c.return)) _b.call(_c); + } + finally { if (e_5) throw e_5.error; } + } + return proxy; +} +/** + * Enables or disables all observers for a provided target. Changes to observed + * properties will not call any observers when disabled. + * + * @template T The observed target type. + * @param target - The target to enable or disable observers for. + * @param enabled - True to enable or false to disable observers. + */ +export function setObserversEnabled(target, enabled) { + var prototype = Object.getPrototypeOf(target); + if (prototype[isTargetObservers]) { + prototype[isEnabled] = enabled; + } +} +//# sourceMappingURL=observer-proxy.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.d.ts new file mode 100644 index 0000000..00b089d4 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.d.ts
@@ -0,0 +1,133 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { Constructor } from './types'; +/** + * A class that can observe targets and perform cleanup logic. Classes may + * implement this using the `mdcObserver()` mixin. + */ +export interface MDCObserver { + /** + * Observe a target's properties for changes using the provided map of + * property names and observer functions. + * + * @template T The target type. + * @param target - The target to observe. + * @param observers - An object whose keys are target properties and values + * are observer functions that are called when the associated property + * changes. + * @return A cleanup function that can be called to unobserve the + * target. + */ + observe<T extends object>(target: T, observers: ObserverRecord<T, this>): () => void; + /** + * Enables or disables all observers for the provided target. Disabling + * observers will prevent them from being called until they are re-enabled. + * + * @param target - The target to enable or disable observers for. + * @param enabled - Whether or not observers should be called. + */ + setObserversEnabled(target: object, enabled: boolean): void; + /** + * Clean up all observers and stop listening for property changes. + */ + unobserve(): void; +} +/** + * A function used to observe property changes on a target. + * + * @template T The observed target type. + * @template K The observed property. + * @template This The `this` context of the observer function. + * @param current - The current value of the property. + * @param previous - The previous value of the property. + */ +export declare type Observer<T extends object, K extends keyof T = keyof T, This = unknown> = (this: This, current: T[K], previous: T[K]) => void; +/** + * An object map whose keys are properties of a target to observe and values + * are `Observer` functions for each property. + * + * @template T The observed target type. + * @template This The `this` context of observer functions. + */ +export declare type ObserverRecord<T extends object, This = unknown> = { + [K in keyof T]?: Observer<T, K, This>; +}; +/** + * Mixin to add `MDCObserver` functionality. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @return A class with `MDCObserver` functionality. + */ +export declare function mdcObserver(): Constructor<MDCObserver>; +/** + * Mixin to add `MDCObserver` functionality to a base class. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @template T Base class instance type. Specify this generic if the base class + * itself has generics that cannot be inferred. + * @template C Base class constructor type. + * @param baseClass - Base class. + * @return A class that extends the optional base class with `MDCObserver` + * functionality. + */ +export declare function mdcObserver<T, C extends Constructor<T>>(baseClass: C): Constructor<MDCObserver> & Constructor<T> & C; +/** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current and + * previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the provided + * `Observer`. + */ +export declare function observeProperty<T extends object, K extends keyof T>(target: T, property: K, observer: Observer<T, K>): () => void; +/** + * Retrieves the descriptor for a property from the provided target. This + * function will walk up the target's prototype chain to search for the + * descriptor. + * + * @template T The target type. + * @template K The property type. + * @param target - The target to retrieve a descriptor from. + * @param property - The name of the property to retrieve a descriptor for. + * @return the descriptor, or undefined if it does not exist. Keep in mind that + * plain properties may not have a descriptor defined. + */ +export declare function getDescriptor<T extends object, K extends keyof T>(target: T, property: K): TypedPropertyDescriptor<T[K]> | undefined; +/** + * Enables or disables all observers for a provided target. Changes to observed + * properties will not call any observers when disabled. + * + * @template T The observed target type. + * @param target - The target to enable or disable observers for. + * @param enabled - True to enable or false to disable observers. + */ +export declare function setObserversEnabled<T extends object>(target: T, enabled: boolean): void;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.js new file mode 100644 index 0000000..bc809d0 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/observer.js
@@ -0,0 +1,283 @@ +/** + * @license + * Copyright 2021 Google Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +import { __assign, __extends, __read, __spreadArray, __values } from '../../tslib/tslib.js'; +/** + * Mixin to add `MDCObserver` functionality to an optional base class. + * + * @deprecated Prefer MDCObserverFoundation for stricter closure compliance. + * @template C Optional base class constructor type. + * @param baseClass - Optional base class. + * @return A class that extends the optional base class with `MDCObserver` + * functionality. + */ +export function mdcObserver(baseClass) { + if (baseClass === void 0) { baseClass = /** @class */ (function () { + function class_1() { + } + return class_1; + }()); } + // Mixin classes cannot use private members and Symbol() cannot be used in 3P + // for IE11. + var unobserveMap = new WeakMap(); + return /** @class */ (function (_super) { + __extends(MDCObserver, _super); + function MDCObserver() { + return _super !== null && _super.apply(this, arguments) || this; + } + MDCObserver.prototype.observe = function (target, observers) { + var e_1, _a; + var _this = this; + var cleanup = []; + try { + for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) { + var property = _c.value; + var observer = observers[property].bind(this); + cleanup.push(observeProperty(target, property, observer)); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + var unobserve = function () { + var e_2, _a; + try { + for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) { + var cleanupFn = cleanup_1_1.value; + cleanupFn(); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1); + } + finally { if (e_2) throw e_2.error; } + } + var unobserves = unobserveMap.get(_this) || []; + var index = unobserves.indexOf(unobserve); + if (index > -1) { + unobserves.splice(index, 1); + } + }; + var unobserves = unobserveMap.get(this); + if (!unobserves) { + unobserves = []; + unobserveMap.set(this, unobserves); + } + unobserves.push(unobserve); + return unobserve; + }; + MDCObserver.prototype.setObserversEnabled = function (target, enabled) { + setObserversEnabled(target, enabled); + }; + MDCObserver.prototype.unobserve = function () { + var e_3, _a; + // Iterate over a copy since unobserve() will remove themselves from the + // array + var unobserves = unobserveMap.get(this) || []; + try { + for (var _b = __values(__spreadArray([], __read(unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) { + var unobserve = _c.value; + unobserve(); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + }; + return MDCObserver; + }(baseClass)); +} +/** + * Observe a target's property for changes. When a property changes, the + * provided `Observer` function will be invoked with the properties current and + * previous values. + * + * The returned cleanup function will stop listening to changes for the + * provided `Observer`. + * + * @template T The observed target type. + * @template K The observed property. + * @param target - The target to observe. + * @param property - The property of the target to observe. + * @param observer - An observer function to invoke each time the property + * changes. + * @return A cleanup function that will stop observing changes for the provided + * `Observer`. + */ +export function observeProperty(target, property, observer) { + var targetObservers = installObserver(target, property); + var observers = targetObservers.getObservers(property); + observers.push(observer); + return function () { + observers.splice(observers.indexOf(observer), 1); + }; +} +/** + * A Map of all `TargetObservers` that have been installed. + */ +var allTargetObservers = new WeakMap(); +/** + * Installs a `TargetObservers` for the provided target (if not already + * installed), and replaces the given property with a getter and setter that + * will respond to changes and call `TargetObservers`. + * + * Subsequent calls to `installObserver()` with the same target and property + * will not override the property's previously installed getter/setter. + * + * @template T The observed target type. + * @template K The observed property to create a getter/setter for. + * @param target - The target to observe. + * @param property - The property to create a getter/setter for, if needed. + * @return The installed `TargetObservers` for the provided target. + */ +function installObserver(target, property) { + var observersMap = new Map(); + if (!allTargetObservers.has(target)) { + allTargetObservers.set(target, { + isEnabled: true, + getObservers: function (key) { + var observers = observersMap.get(key) || []; + if (!observersMap.has(key)) { + observersMap.set(key, observers); + } + return observers; + }, + installedProperties: new Set() + }); + } + var targetObservers = allTargetObservers.get(target); + if (targetObservers.installedProperties.has(property)) { + // The getter/setter has already been replaced for this property + return targetObservers; + } + // Retrieve (or create if it's a plain property) the original descriptor from + // the target... + var descriptor = getDescriptor(target, property) || { + configurable: true, + enumerable: true, + value: target[property], + writable: true + }; + // ...and create a copy that will be used for the observer. + var observedDescriptor = __assign({}, descriptor); + var descGet = descriptor.get, descSet = descriptor.set; + if ('value' in descriptor) { + // The descriptor is a simple value (not a getter/setter). + // For our observer descriptor that we copied, delete the value/writable + // properties, since they are incompatible with the get/set properties + // for descriptors. + delete observedDescriptor.value; + delete observedDescriptor.writable; + // Set up a simple getter... + var value_1 = descriptor.value; + descGet = function () { return value_1; }; + // ...and setter (if the original property was writable). + if (descriptor.writable) { + descSet = function (newValue) { + value_1 = newValue; + }; + } + } + if (descGet) { + observedDescriptor.get = function () { + // `this as T` needed for closure conformance + return descGet.call(this); + }; + } + if (descSet) { + observedDescriptor.set = function (newValue) { + var e_4, _a; + // `thus as T` needed for closure conformance + var previous = descGet ? descGet.call(this) : newValue; + descSet.call(this, newValue); + if (targetObservers.isEnabled && (!descGet || newValue !== previous)) { + try { + for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) { + var observer = _c.value; + observer(newValue, previous); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_4) throw e_4.error; } + } + } + }; + } + targetObservers.installedProperties.add(property); + Object.defineProperty(target, property, observedDescriptor); + return targetObservers; +} +/** + * Retrieves the descriptor for a property from the provided target. This + * function will walk up the target's prototype chain to search for the + * descriptor. + * + * @template T The target type. + * @template K The property type. + * @param target - The target to retrieve a descriptor from. + * @param property - The name of the property to retrieve a descriptor for. + * @return the descriptor, or undefined if it does not exist. Keep in mind that + * plain properties may not have a descriptor defined. + */ +export function getDescriptor(target, property) { + var descriptorTarget = target; + var descriptor; + while (descriptorTarget) { + descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property); + if (descriptor) { + break; + } + // Walk up the instance's prototype chain in case the property is declared + // on a superclass. + descriptorTarget = Object.getPrototypeOf(descriptorTarget); + } + return descriptor; +} +/** + * Enables or disables all observers for a provided target. Changes to observed + * properties will not call any observers when disabled. + * + * @template T The observed target type. + * @param target - The target to enable or disable observers for. + * @param enabled - True to enable or false to disable observers. + */ +export function setObserversEnabled(target, enabled) { + var targetObservers = allTargetObservers.get(target); + if (targetObservers) { + targetObservers.isEnabled = enabled; + } +} +//# sourceMappingURL=observer.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/base/package.json index cfc0049b..41d7352d8 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/package.json
@@ -1,19 +1,18 @@ { "name": "@material/base", "description": "The set of base classes for Material Components for the web", - "version": "9.0.0-canary.1c156d69d.0", + "version": "14.0.0", "license": "MIT", "main": "dist/mdc.base.js", "module": "index.js", "sideEffects": false, - "types": "dist/mdc.base.d.ts", "repository": { "type": "git", "url": "https://github.com/material-components/material-components-web.git", "directory": "packages/mdc-base" }, "dependencies": { - "tslib": "^1.9.3" + "tslib": "^2.1.0" }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/types.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/base/types.d.ts index 15b5f56..4439e9b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/types.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/types.d.ts
@@ -23,3 +23,14 @@ export declare type EventType = keyof GlobalEventHandlersEventMap; export declare type SpecificEventListener<K extends EventType> = (evt: GlobalEventHandlersEventMap[K]) => void; export declare type CustomEventListener<E extends Event> = (evt: E) => void; +export declare type WindowEventType = keyof WindowEventMap; +export declare type SpecificWindowEventListener<K extends WindowEventType> = (evt: WindowEventMap[K]) => void; +/** + * A generic type for the constructor of an instance type. Note that this type + * does not preserve accurate constructor parameters. + * + * @template T The instance type. + */ +export declare type Constructor<T = any> = { + new (...args: any[]): T; +};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/base/types.js b/third_party/material_web_components/components-chromium/node_modules/@material/base/types.js index 347c73f5..5daa469 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/base/types.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/base/types.js
@@ -20,4 +20,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +export {}; +// tslint:enable:no-any //# sourceMappingURL=types.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.d.ts index 2297691..5be45036 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.d.ts
@@ -21,17 +21,24 @@ * THE SOFTWARE. */ /** - * Priorities for the announce function + * Priorities for the announce function. */ export declare enum AnnouncerPriority { POLITE = "polite", ASSERTIVE = "assertive" } /** + * Options for the announce function. + */ +export interface AnnouncerMessageOptions { + priority?: AnnouncerPriority; + ownerDocument?: Document; +} +/** * Data attribute added to live region element. */ export declare const DATA_MDC_DOM_ANNOUNCE = "data-mdc-dom-announce"; /** * Announces the given message with optional priority, defaulting to "polite" */ -export declare function announce(message: string, priority?: AnnouncerPriority): void; +export declare function announce(message: string, options?: AnnouncerMessageOptions): void;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.js index b46f5ab..af8a7c53 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/announce.js
@@ -21,7 +21,7 @@ * THE SOFTWARE. */ /** - * Priorities for the announce function + * Priorities for the announce function. */ export var AnnouncerPriority; (function (AnnouncerPriority) { @@ -35,8 +35,8 @@ /** * Announces the given message with optional priority, defaulting to "polite" */ -export function announce(message, priority) { - Announcer.getInstance().say(message, priority); +export function announce(message, options) { + Announcer.getInstance().say(message, options); } var Announcer = /** @class */ (function () { // Constructor made private to ensure only the singleton is used @@ -49,34 +49,41 @@ } return Announcer.instance; }; - Announcer.prototype.say = function (message, priority) { - if (priority === void 0) { priority = AnnouncerPriority.POLITE; } - var liveRegion = this.getLiveRegion(priority); + Announcer.prototype.say = function (message, options) { + var _a, _b; + var priority = (_a = options === null || options === void 0 ? void 0 : options.priority) !== null && _a !== void 0 ? _a : AnnouncerPriority.POLITE; + var ownerDocument = (_b = options === null || options === void 0 ? void 0 : options.ownerDocument) !== null && _b !== void 0 ? _b : document; + var liveRegion = this.getLiveRegion(priority, ownerDocument); // Reset the region to pick up the message, even if the message is the // exact same as before. liveRegion.textContent = ''; // Timeout is necessary for screen readers like NVDA and VoiceOver. setTimeout(function () { liveRegion.textContent = message; - document.addEventListener('click', clearLiveRegion); + ownerDocument.addEventListener('click', clearLiveRegion); }, 1); function clearLiveRegion() { liveRegion.textContent = ''; - document.removeEventListener('click', clearLiveRegion); + ownerDocument.removeEventListener('click', clearLiveRegion); } }; - Announcer.prototype.getLiveRegion = function (priority) { - var existingLiveRegion = this.liveRegions.get(priority); + Announcer.prototype.getLiveRegion = function (priority, ownerDocument) { + var documentLiveRegions = this.liveRegions.get(ownerDocument); + if (!documentLiveRegions) { + documentLiveRegions = new Map(); + this.liveRegions.set(ownerDocument, documentLiveRegions); + } + var existingLiveRegion = documentLiveRegions.get(priority); if (existingLiveRegion && - document.body.contains(existingLiveRegion)) { + ownerDocument.body.contains(existingLiveRegion)) { return existingLiveRegion; } - var liveRegion = this.createLiveRegion(priority); - this.liveRegions.set(priority, liveRegion); + var liveRegion = this.createLiveRegion(priority, ownerDocument); + documentLiveRegions.set(priority, liveRegion); return liveRegion; }; - Announcer.prototype.createLiveRegion = function (priority) { - var el = document.createElement('div'); + Announcer.prototype.createLiveRegion = function (priority, ownerDocument) { + var el = ownerDocument.createElement('div'); el.style.position = 'absolute'; el.style.top = '-9999px'; el.style.left = '-9999px'; @@ -85,7 +92,7 @@ el.setAttribute('aria-atomic', 'true'); el.setAttribute('aria-live', priority); el.setAttribute(DATA_MDC_DOM_ANNOUNCE, 'true'); - document.body.appendChild(el); + ownerDocument.body.appendChild(el); return el; }; return Announcer;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.d.ts deleted file mode 100644 index 188899f..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.d.ts +++ /dev/null
@@ -1,116 +0,0 @@ -// Generated by dts-bundle v0.7.3 - -declare module '@material/dom' { - /** - * @license - * Copyright 2018 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import * as events from '@material/dom/events'; - import * as focusTrap from '@material/dom/focus-trap'; - import * as keyboard from '@material/dom/keyboard'; - import * as ponyfill from '@material/dom/ponyfill'; - export { events, focusTrap, keyboard, ponyfill }; -} - -declare module '@material/dom/events' { - /** - * Determine whether the current browser supports passive event listeners, and - * if so, use them. - */ - export function applyPassive(globalObj?: Window): boolean | EventListenerOptions; -} - -declare module '@material/dom/focus-trap' { - /** - * Utility to trap focus in a given root element, e.g. for modal components such - * as dialogs. The root should have at least one focusable child element, - * for setting initial focus when trapping focus. - * Also tracks the previously focused element, and restores focus to that - * element when releasing focus. - */ - export class FocusTrap { - constructor(root: HTMLElement, options?: FocusOptions); - /** - * Traps focus in `root`. Also focuses on either `initialFocusEl` if set; - * otherwises sets initial focus to the first focusable child element. - */ - trapFocus(): void; - /** - * Releases focus from `root`. Also restores focus to the previously focused - * element. - */ - releaseFocus(): void; - } - /** Customization options. */ - export interface FocusOptions { - initialFocusEl?: HTMLElement; - skipInitialFocus?: boolean; - } -} - -declare module '@material/dom/keyboard' { - /** - * KEY provides normalized string values for keys. - */ - export const KEY: { - UNKNOWN: string; - BACKSPACE: string; - ENTER: string; - SPACEBAR: string; - PAGE_UP: string; - PAGE_DOWN: string; - END: string; - HOME: string; - ARROW_LEFT: string; - ARROW_UP: string; - ARROW_RIGHT: string; - ARROW_DOWN: string; - DELETE: string; - ESCAPE: string; - }; - /** - * normalizeKey returns the normalized string for a navigational action. - */ - export function normalizeKey(evt: KeyboardEvent): string; - /** - * isNavigationEvent returns whether the event is a navigation event - */ - export function isNavigationEvent(evt: KeyboardEvent): boolean; -} - -declare module '@material/dom/ponyfill' { - /** - * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. - * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. - */ - export function closest(element: Element, selector: string): Element | null; - export function matches(element: Element, selector: string): boolean; - /** - * Used to compute the estimated scroll width of elements. When an element is - * hidden due to display: none; being applied to a parent element, the width is - * returned as 0. However, the element will have a true width once no longer - * inside a display: none context. This method computes an estimated width when - * the element is hidden or returns the true width when the element is visble. - * @param {Element} element the element whose width to estimate - */ - export function estimateScrollWidth(element: Element): number; -} -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.js deleted file mode 100644 index 474574a..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.js +++ /dev/null
@@ -1,592 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["dom"] = factory(); - else - root["mdc"] = root["mdc"] || {}, root["mdc"]["dom"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-dom/index.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./packages/mdc-dom/events.ts": -/*!************************************!*\ - !*** ./packages/mdc-dom/events.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Determine whether the current browser supports passive event listeners, and - * if so, use them. - */ -function applyPassive(globalObj) { - if (globalObj === void 0) { - globalObj = window; - } - return supportsPassiveOption(globalObj) ? { passive: true } : false; -} -exports.applyPassive = applyPassive; -function supportsPassiveOption(globalObj) { - if (globalObj === void 0) { - globalObj = window; - } - // See - // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener - var passiveSupported = false; - try { - var options = { - // This function will be called when the browser - // attempts to access the passive property. - get passive() { - passiveSupported = true; - return false; - } - }; - var handler = function handler() {}; - globalObj.document.addEventListener('test', handler, options); - globalObj.document.removeEventListener('test', handler, options); - } catch (err) { - passiveSupported = false; - } - return passiveSupported; -} - -/***/ }), - -/***/ "./packages/mdc-dom/focus-trap.ts": -/*!****************************************!*\ - !*** ./packages/mdc-dom/focus-trap.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2020 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel'; -/** - * Utility to trap focus in a given root element, e.g. for modal components such - * as dialogs. The root should have at least one focusable child element, - * for setting initial focus when trapping focus. - * Also tracks the previously focused element, and restores focus to that - * element when releasing focus. - */ -var FocusTrap = /** @class */function () { - function FocusTrap(root, options) { - if (options === void 0) { - options = {}; - } - this.root = root; - this.options = options; - // Previously focused element before trapping focus. - this.elFocusedBeforeTrapFocus = null; - } - /** - * Traps focus in `root`. Also focuses on either `initialFocusEl` if set; - * otherwises sets initial focus to the first focusable child element. - */ - FocusTrap.prototype.trapFocus = function () { - var focusableEls = this.getFocusableElements(this.root); - if (focusableEls.length === 0) { - throw new Error('FocusTrap: Element must have at least one focusable child.'); - } - this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; - this.wrapTabFocus(this.root, focusableEls); - if (!this.options.skipInitialFocus) { - this.focusInitialElement(focusableEls, this.options.initialFocusEl); - } - }; - /** - * Releases focus from `root`. Also restores focus to the previously focused - * element. - */ - FocusTrap.prototype.releaseFocus = function () { - [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) { - sentinelEl.parentElement.removeChild(sentinelEl); - }); - if (this.elFocusedBeforeTrapFocus) { - this.elFocusedBeforeTrapFocus.focus(); - } - }; - /** - * Wraps tab focus within `el` by adding two hidden sentinel divs which are - * used to mark the beginning and the end of the tabbable region. When - * focused, these sentinel elements redirect focus to the first/last - * children elements of the tabbable region, ensuring that focus is trapped - * within that region. - */ - FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) { - var sentinelStart = this.createSentinel(); - var sentinelEnd = this.createSentinel(); - sentinelStart.addEventListener('focus', function () { - if (focusableEls.length > 0) { - focusableEls[focusableEls.length - 1].focus(); - } - }); - sentinelEnd.addEventListener('focus', function () { - if (focusableEls.length > 0) { - focusableEls[0].focus(); - } - }); - el.insertBefore(sentinelStart, el.children[0]); - el.appendChild(sentinelEnd); - }; - /** - * Focuses on `initialFocusEl` if defined and a child of the root element. - * Otherwise, focuses on the first focusable child element of the root. - */ - FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) { - var focusIndex = 0; - if (initialFocusEl) { - focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0); - } - focusableEls[focusIndex].focus(); - }; - FocusTrap.prototype.getFocusableElements = function (root) { - var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button')); - return focusableEls.filter(function (el) { - var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true'; - var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden; - var isProgrammaticallyHidden = false; - if (isTabbableAndVisible) { - var style = getComputedStyle(el); - isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden'; - } - return isTabbableAndVisible && !isProgrammaticallyHidden; - }); - }; - FocusTrap.prototype.createSentinel = function () { - var sentinel = document.createElement('div'); - sentinel.setAttribute('tabindex', '0'); - // Don't announce in screen readers. - sentinel.setAttribute('aria-hidden', 'true'); - sentinel.classList.add(FOCUS_SENTINEL_CLASS); - return sentinel; - }; - return FocusTrap; -}(); -exports.FocusTrap = FocusTrap; - -/***/ }), - -/***/ "./packages/mdc-dom/index.ts": -/*!***********************************!*\ - !*** ./packages/mdc-dom/index.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2018 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var __importStar = this && this.__importStar || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) { - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - }result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts")); -exports.events = events; -var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts")); -exports.focusTrap = focusTrap; -var keyboard = __importStar(__webpack_require__(/*! ./keyboard */ "./packages/mdc-dom/keyboard.ts")); -exports.keyboard = keyboard; -var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts")); -exports.ponyfill = ponyfill; - -/***/ }), - -/***/ "./packages/mdc-dom/keyboard.ts": -/*!**************************************!*\ - !*** ./packages/mdc-dom/keyboard.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2020 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * KEY provides normalized string values for keys. - */ -exports.KEY = { - UNKNOWN: 'Unknown', - BACKSPACE: 'Backspace', - ENTER: 'Enter', - SPACEBAR: 'Spacebar', - PAGE_UP: 'PageUp', - PAGE_DOWN: 'PageDown', - END: 'End', - HOME: 'Home', - ARROW_LEFT: 'ArrowLeft', - ARROW_UP: 'ArrowUp', - ARROW_RIGHT: 'ArrowRight', - ARROW_DOWN: 'ArrowDown', - DELETE: 'Delete', - ESCAPE: 'Escape' -}; -var normalizedKeys = new Set(); -// IE11 has no support for new Map with iterable so we need to initialize this -// by hand. -normalizedKeys.add(exports.KEY.BACKSPACE); -normalizedKeys.add(exports.KEY.ENTER); -normalizedKeys.add(exports.KEY.SPACEBAR); -normalizedKeys.add(exports.KEY.PAGE_UP); -normalizedKeys.add(exports.KEY.PAGE_DOWN); -normalizedKeys.add(exports.KEY.END); -normalizedKeys.add(exports.KEY.HOME); -normalizedKeys.add(exports.KEY.ARROW_LEFT); -normalizedKeys.add(exports.KEY.ARROW_UP); -normalizedKeys.add(exports.KEY.ARROW_RIGHT); -normalizedKeys.add(exports.KEY.ARROW_DOWN); -normalizedKeys.add(exports.KEY.DELETE); -normalizedKeys.add(exports.KEY.ESCAPE); -var KEY_CODE = { - BACKSPACE: 8, - ENTER: 13, - SPACEBAR: 32, - PAGE_UP: 33, - PAGE_DOWN: 34, - END: 35, - HOME: 36, - ARROW_LEFT: 37, - ARROW_UP: 38, - ARROW_RIGHT: 39, - ARROW_DOWN: 40, - DELETE: 46, - ESCAPE: 27 -}; -var mappedKeyCodes = new Map(); -// IE11 has no support for new Map with iterable so we need to initialize this -// by hand. -mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE); -mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER); -mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR); -mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP); -mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN); -mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END); -mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME); -mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT); -mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP); -mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT); -mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN); -mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE); -mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE); -var navigationKeys = new Set(); -// IE11 has no support for new Set with iterable so we need to initialize this -// by hand. -navigationKeys.add(exports.KEY.PAGE_UP); -navigationKeys.add(exports.KEY.PAGE_DOWN); -navigationKeys.add(exports.KEY.END); -navigationKeys.add(exports.KEY.HOME); -navigationKeys.add(exports.KEY.ARROW_LEFT); -navigationKeys.add(exports.KEY.ARROW_UP); -navigationKeys.add(exports.KEY.ARROW_RIGHT); -navigationKeys.add(exports.KEY.ARROW_DOWN); -/** - * normalizeKey returns the normalized string for a navigational action. - */ -function normalizeKey(evt) { - var key = evt.key; - // If the event already has a normalized key, return it - if (normalizedKeys.has(key)) { - return key; - } - // tslint:disable-next-line:deprecation - var mappedKey = mappedKeyCodes.get(evt.keyCode); - if (mappedKey) { - return mappedKey; - } - return exports.KEY.UNKNOWN; -} -exports.normalizeKey = normalizeKey; -/** - * isNavigationEvent returns whether the event is a navigation event - */ -function isNavigationEvent(evt) { - return navigationKeys.has(normalizeKey(evt)); -} -exports.isNavigationEvent = isNavigationEvent; - -/***/ }), - -/***/ "./packages/mdc-dom/ponyfill.ts": -/*!**************************************!*\ - !*** ./packages/mdc-dom/ponyfill.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2018 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. - * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. - */ -function closest(element, selector) { - if (element.closest) { - return element.closest(selector); - } - var el = element; - while (el) { - if (matches(el, selector)) { - return el; - } - el = el.parentElement; - } - return null; -} -exports.closest = closest; -function matches(element, selector) { - var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; - return nativeMatches.call(element, selector); -} -exports.matches = matches; -/** - * Used to compute the estimated scroll width of elements. When an element is - * hidden due to display: none; being applied to a parent element, the width is - * returned as 0. However, the element will have a true width once no longer - * inside a display: none context. This method computes an estimated width when - * the element is hidden or returns the true width when the element is visble. - * @param {Element} element the element whose width to estimate - */ -function estimateScrollWidth(element) { - // Check the offsetParent. If the element inherits display: none from any - // parent, the offsetParent property will be null (see - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). - // This check ensures we only clone the node when necessary. - var htmlEl = element; - if (htmlEl.offsetParent !== null) { - return htmlEl.scrollWidth; - } - var clone = htmlEl.cloneNode(true); - clone.style.setProperty('position', 'absolute'); - clone.style.setProperty('transform', 'translate(-9999px, -9999px)'); - document.documentElement.appendChild(clone); - var scrollWidth = clone.scrollWidth; - document.documentElement.removeChild(clone); - return scrollWidth; -} -exports.estimateScrollWidth = estimateScrollWidth; - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=mdc.dom.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.min.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.min.js deleted file mode 100644 index af6d01b..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/dist/mdc.dom.min.js +++ /dev/null
@@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dom=t():(e.mdc=e.mdc||{},e.mdc.dom=t())}(this,function(){return r={},o.m=n={142:function(e,t,n){"use strict";var r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(5));t.events=o;var i=r(n(33));t.focusTrap=i;var a=r(n(9));t.keyboard=a;var s=r(n(2));t.ponyfill=s},2:function(e,t,n){"use strict";function r(e,t){return(e.matches||e.webkitMatchesSelector||e.msMatchesSelector).call(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.closest=function(e,t){if(e.closest)return e.closest(t);for(var n=e;n;){if(r(n,t))return n;n=n.parentElement}return null},t.matches=r,t.estimateScrollWidth=function(e){var t=e;if(null!==t.offsetParent)return t.scrollWidth;var n=t.cloneNode(!0);n.style.setProperty("position","absolute"),n.style.setProperty("transform","translate(-9999px, -9999px)"),document.documentElement.appendChild(n);var r=n.scrollWidth;return document.documentElement.removeChild(n),r}},33:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="mdc-dom-focus-sentinel",r=(o.prototype.trapFocus=function(){var e=this.getFocusableElements(this.root);if(0===e.length)throw new Error("FocusTrap: Element must have at least one focusable child.");this.elFocusedBeforeTrapFocus=document.activeElement instanceof HTMLElement?document.activeElement:null,this.wrapTabFocus(this.root,e),this.options.skipInitialFocus||this.focusInitialElement(e,this.options.initialFocusEl)},o.prototype.releaseFocus=function(){[].slice.call(this.root.querySelectorAll("."+i)).forEach(function(e){e.parentElement.removeChild(e)}),this.elFocusedBeforeTrapFocus&&this.elFocusedBeforeTrapFocus.focus()},o.prototype.wrapTabFocus=function(e,t){var n=this.createSentinel(),r=this.createSentinel();n.addEventListener("focus",function(){0<t.length&&t[t.length-1].focus()}),r.addEventListener("focus",function(){0<t.length&&t[0].focus()}),e.insertBefore(n,e.children[0]),e.appendChild(r)},o.prototype.focusInitialElement=function(e,t){var n=0;t&&(n=Math.max(e.indexOf(t),0)),e[n].focus()},o.prototype.getFocusableElements=function(e){return[].slice.call(e.querySelectorAll("[autofocus], [tabindex], a, input, textarea, select, button")).filter(function(e){var t="true"===e.getAttribute("aria-disabled")||null!=e.getAttribute("disabled")||null!=e.getAttribute("hidden")||"true"===e.getAttribute("aria-hidden"),n=0<=e.tabIndex&&0<e.getBoundingClientRect().width&&!e.classList.contains(i)&&!t,r=!1;if(n){var o=getComputedStyle(e);r="none"===o.display||"hidden"===o.visibility}return n&&!r})},o.prototype.createSentinel=function(){var e=document.createElement("div");return e.setAttribute("tabindex","0"),e.setAttribute("aria-hidden","true"),e.classList.add(i),e},o);function o(e,t){void 0===t&&(t={}),this.root=e,this.options=t,this.elFocusedBeforeTrapFocus=null}t.FocusTrap=r},5:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyPassive=function(e){return void 0===e&&(e=window),!!function(e){void 0===e&&(e=window);var t=!1;try{var n={get passive(){return!(t=!0)}},r=function(){};e.document.addEventListener("test",r,n),e.document.removeEventListener("test",r,n)}catch(e){t=!1}return t}(e)&&{passive:!0}}},9:function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.KEY={UNKNOWN:"Unknown",BACKSPACE:"Backspace",ENTER:"Enter",SPACEBAR:"Spacebar",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",END:"End",HOME:"Home",ARROW_LEFT:"ArrowLeft",ARROW_UP:"ArrowUp",ARROW_RIGHT:"ArrowRight",ARROW_DOWN:"ArrowDown",DELETE:"Delete",ESCAPE:"Escape"};var o=new Set;o.add(r.KEY.BACKSPACE),o.add(r.KEY.ENTER),o.add(r.KEY.SPACEBAR),o.add(r.KEY.PAGE_UP),o.add(r.KEY.PAGE_DOWN),o.add(r.KEY.END),o.add(r.KEY.HOME),o.add(r.KEY.ARROW_LEFT),o.add(r.KEY.ARROW_UP),o.add(r.KEY.ARROW_RIGHT),o.add(r.KEY.ARROW_DOWN),o.add(r.KEY.DELETE),o.add(r.KEY.ESCAPE);var n=8,i=13,a=32,s=33,u=34,c=35,d=36,l=37,E=38,f=39,p=40,v=46,m=27,h=new Map;h.set(n,r.KEY.BACKSPACE),h.set(i,r.KEY.ENTER),h.set(a,r.KEY.SPACEBAR),h.set(s,r.KEY.PAGE_UP),h.set(u,r.KEY.PAGE_DOWN),h.set(c,r.KEY.END),h.set(d,r.KEY.HOME),h.set(l,r.KEY.ARROW_LEFT),h.set(E,r.KEY.ARROW_UP),h.set(f,r.KEY.ARROW_RIGHT),h.set(p,r.KEY.ARROW_DOWN),h.set(v,r.KEY.DELETE),h.set(m,r.KEY.ESCAPE);var A=new Set;function O(e){var t=e.key;if(o.has(t))return t;var n=h.get(e.keyCode);return n||r.KEY.UNKNOWN}A.add(r.KEY.PAGE_UP),A.add(r.KEY.PAGE_DOWN),A.add(r.KEY.END),A.add(r.KEY.HOME),A.add(r.KEY.ARROW_LEFT),A.add(r.KEY.ARROW_UP),A.add(r.KEY.ARROW_RIGHT),A.add(r.KEY.ARROW_DOWN),r.normalizeKey=O,r.isNavigationEvent=function(e){return A.has(O(e))}}},o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=142);function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,r}); \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.d.ts index c75a7f6..daa54f5d 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.d.ts
@@ -62,4 +62,5 @@ export interface FocusOptions { initialFocusEl?: HTMLElement; skipInitialFocus?: boolean; + skipRestoreFocus?: boolean; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.js index 1692bb4..3237256 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/focus-trap.js
@@ -48,7 +48,7 @@ this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; - this.wrapTabFocus(this.root, focusableEls); + this.wrapTabFocus(this.root); if (!this.options.skipInitialFocus) { this.focusInitialElement(focusableEls, this.options.initialFocusEl); } @@ -62,7 +62,7 @@ .forEach(function (sentinelEl) { sentinelEl.parentElement.removeChild(sentinelEl); }); - if (this.elFocusedBeforeTrapFocus) { + if (!this.options.skipRestoreFocus && this.elFocusedBeforeTrapFocus) { this.elFocusedBeforeTrapFocus.focus(); } }; @@ -73,15 +73,18 @@ * children elements of the tabbable region, ensuring that focus is trapped * within that region. */ - FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) { + FocusTrap.prototype.wrapTabFocus = function (el) { + var _this = this; var sentinelStart = this.createSentinel(); var sentinelEnd = this.createSentinel(); sentinelStart.addEventListener('focus', function () { + var focusableEls = _this.getFocusableElements(el); if (focusableEls.length > 0) { focusableEls[focusableEls.length - 1].focus(); } }); sentinelEnd.addEventListener('focus', function () { + var focusableEls = _this.getFocusableElements(el); if (focusableEls.length > 0) { focusableEls[0].focus(); }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.d.ts index e5b5f7c..73173626 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.d.ts
@@ -38,6 +38,7 @@ ARROW_DOWN: string; DELETE: string; ESCAPE: string; + TAB: string; }; /** * normalizeKey returns the normalized string for a navigational action.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.js index 17a9d9c9..62aeb47 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/keyboard.js
@@ -38,6 +38,7 @@ ARROW_DOWN: 'ArrowDown', DELETE: 'Delete', ESCAPE: 'Escape', + TAB: 'Tab', }; var normalizedKeys = new Set(); // IE11 has no support for new Map with iterable so we need to initialize this @@ -55,6 +56,7 @@ normalizedKeys.add(KEY.ARROW_DOWN); normalizedKeys.add(KEY.DELETE); normalizedKeys.add(KEY.ESCAPE); +normalizedKeys.add(KEY.TAB); var KEY_CODE = { BACKSPACE: 8, ENTER: 13, @@ -69,6 +71,7 @@ ARROW_DOWN: 40, DELETE: 46, ESCAPE: 27, + TAB: 9, }; var mappedKeyCodes = new Map(); // IE11 has no support for new Map with iterable so we need to initialize this @@ -86,6 +89,7 @@ mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, KEY.ARROW_DOWN); mappedKeyCodes.set(KEY_CODE.DELETE, KEY.DELETE); mappedKeyCodes.set(KEY_CODE.ESCAPE, KEY.ESCAPE); +mappedKeyCodes.set(KEY_CODE.TAB, KEY.TAB); var navigationKeys = new Set(); // IE11 has no support for new Set with iterable so we need to initialize this // by hand.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/CopyrightNotice.txt b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 2e4a05c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/CopyrightNotice.txt +++ /dev/null
@@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/LICENSE.txt b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/LICENSE.txt deleted file mode 100644 index fa7d1bd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/LICENSE.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/index.js deleted file mode 100644 index 506f5cc4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/index.js +++ /dev/null
@@ -1,51 +0,0 @@ -import tslib from '../tslib.es6.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/package.json deleted file mode 100644 index 96ae6e5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/modules/package.json +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/package.json deleted file mode 100644 index f8c2a53..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/package.json +++ /dev/null
@@ -1,37 +0,0 @@ -{ - "name": "tslib", - "author": "Microsoft Corp.", - "homepage": "https://www.typescriptlang.org/", - "version": "1.14.1", - "license": "0BSD", - "description": "Runtime library for TypeScript helper functions", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/tslib.git" - }, - "main": "tslib.js", - "module": "tslib.es6.js", - "jsnext:main": "tslib.es6.js", - "typings": "tslib.d.ts", - "sideEffects": false, - "exports": { - ".": { - "module": "./tslib.es6.js", - "import": "./modules/index.js", - "default": "./tslib.js" - }, - "./": "./" - } -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.d.ts deleted file mode 100644 index 0756b28..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar<T>(mod: T): T; -export declare function __importDefault<T>(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.html b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.es6.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 7fdec02..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.es6.js +++ /dev/null
@@ -1,218 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -export function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.html b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba51..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.js b/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.js deleted file mode 100644 index fbce018..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/node_modules/tslib/tslib.js +++ /dev/null
@@ -1,284 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __createBinding = function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }; - - __exportStar = function (m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -});
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/dom/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/dom/package.json index 1a6048557..e9894b2 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/dom/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/dom/package.json
@@ -1,12 +1,11 @@ { "name": "@material/dom", "description": "DOM manipulation utilities for Material Components for the web", - "version": "9.0.0-canary.1c156d69d.0", + "version": "14.0.0", "license": "MIT", "main": "dist/mdc.dom.js", "module": "index.js", "sideEffects": false, - "types": "dist/mdc.dom.d.ts", "repository": { "type": "git", "url": "https://github.com/material-components/material-components-web.git", @@ -16,8 +15,8 @@ "access": "public" }, "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/feature-targeting/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/feature-targeting/package.json index 6ab7cd9c..bbd60ec 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/feature-targeting/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/feature-targeting/package.json
@@ -1,7 +1,7 @@ { "name": "@material/feature-targeting", "description": "Material Components for the web Feature Targeting Scss helpers", - "version": "9.0.0-canary.1c156d69d.0", + "version": "14.0.0", "license": "MIT", "keywords": [ "material components", @@ -14,8 +14,11 @@ "url": "https://github.com/material-components/material-components-web.git", "directory": "packages/mdc-feature-targeting" }, + "dependencies": { + "tslib": "^2.1.0" + }, "publishConfig": { "access": "public" }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/LICENSE index 6c8dc68a..d645695 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/LICENSE
@@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018 Google, Inc + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.d.ts new file mode 100644 index 0000000..ef6b461 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.d.ts
@@ -0,0 +1,34 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * A value for the `aria-haspopup` ARIA attribute. + */ +export declare type AriaHasPopup = 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; +/** + * A property decorator proxies an aria attribute to an internal node + * + * This decorator is only intended for use with ARIA attributes, such as `role` + * and `aria-label` due to screenreader needs. + * + * Upon first render, `@ariaProperty` will remove the attribute from the host + * element to prevent screenreaders from reading the host instead of the + * internal node. + * + * This decorator should only be used for non-Symbol public fields decorated + * with `@property`, or on a setter with an optional getter. + * + * @example + * ```ts + * class MyElement { + * @ariaProperty + * @property({ type: String, attribute: 'aria-label' }) + * ariaLabel!: string; + * } + * ``` + * @category Decorator + * @ExportDecoratedItems + */ +export declare function ariaProperty(protoOrDescriptor: {}, name?: string, descriptor?: PropertyDescriptor): any;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.js new file mode 100644 index 0000000..b84dfbc --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/aria-property.js
@@ -0,0 +1,93 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +/** + * TypeScript version of the decorator + * @see https://www.typescriptlang.org/docs/handbook/decorators.html#property-decorators + */ +function tsDecorator(prototype, name, descriptor) { + const constructor = prototype.constructor; + if (!descriptor) { + /** + * lit uses internal properties with two leading underscores to + * provide storage for accessors + */ + const litInternalPropertyKey = `__${name}`; + descriptor = + constructor.getPropertyDescriptor(name, litInternalPropertyKey); + if (!descriptor) { + throw new Error('@ariaProperty must be used after a @property decorator'); + } + } + // descriptor must exist at this point, reassign so typescript understands + const propDescriptor = descriptor; + let attribute = ''; + if (!propDescriptor.set) { + throw new Error(`@ariaProperty requires a setter for ${name}`); + } + // TODO(b/202853219): Remove this check when internal tooling is + // compatible + // tslint:disable-next-line:no-any bail if applied to internal generated class + if (prototype.dispatchWizEvent) { + return descriptor; + } + const wrappedDescriptor = { + configurable: true, + enumerable: true, + set(value) { + if (attribute === '') { + const options = constructor.getPropertyOptions(name); + // if attribute is not a string, use `name` instead + attribute = + typeof options.attribute === 'string' ? options.attribute : name; + } + if (this.hasAttribute(attribute)) { + this.removeAttribute(attribute); + } + propDescriptor.set.call(this, value); + } + }; + if (propDescriptor.get) { + wrappedDescriptor.get = function () { + return propDescriptor.get.call(this); + }; + } + return wrappedDescriptor; +} +/** + * A property decorator proxies an aria attribute to an internal node + * + * This decorator is only intended for use with ARIA attributes, such as `role` + * and `aria-label` due to screenreader needs. + * + * Upon first render, `@ariaProperty` will remove the attribute from the host + * element to prevent screenreaders from reading the host instead of the + * internal node. + * + * This decorator should only be used for non-Symbol public fields decorated + * with `@property`, or on a setter with an optional getter. + * + * @example + * ```ts + * class MyElement { + * @ariaProperty + * @property({ type: String, attribute: 'aria-label' }) + * ariaLabel!: string; + * } + * ``` + * @category Decorator + * @ExportDecoratedItems + */ +export function ariaProperty(protoOrDescriptor, name, +// tslint:disable-next-line:no-any any is required as a return type from decorators +descriptor) { + if (name !== undefined) { + return tsDecorator(protoOrDescriptor, name, descriptor); + } + else { + throw new Error('@ariaProperty only supports TypeScript Decorators'); + } +} +//# sourceMappingURL=aria-property.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.d.ts index 0af08ad..e571943 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.d.ts
@@ -1,21 +1,10 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { MDCFoundation } from '@material/base'; -import { LitElement } from 'lit-element'; +import { LitElement } from 'lit'; import { Constructor } from './utils'; export { CustomEventListener, EventType, SpecificEventListener } from '@material/base/types'; export { addHasRemoveClass } from './utils';
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.js index 0f1b7ea..8d73490 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/base-element.js
@@ -1,20 +1,9 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { LitElement } from '../../lit-element/lit-element.js'; + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { LitElement } from '../../lit/index.js'; export { addHasRemoveClass } from './utils.js'; /** @soyCompatible */ export class BaseElement extends LitElement {
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.d.ts index cdbcd1d..0eb21f54 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.d.ts
@@ -1,36 +1,49 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { addHasRemoveClass, BaseElement, CustomEventListener, EventType, SpecificEventListener } from './base-element'; -import { HTMLElementWithRipple, RippleInterface } from './utils'; -export { addHasRemoveClass, BaseElement, CustomEventListener, EventType, HTMLElementWithRipple, RippleInterface, SpecificEventListener, }; +import { RippleInterface } from './utils'; +export { addHasRemoveClass, BaseElement, CustomEventListener, EventType, RippleInterface, SpecificEventListener }; +declare global { + interface FormDataEvent extends Event { + readonly formData: FormData; + } + interface HTMLElementEventMap { + formdata: FormDataEvent; + } +} /** @soyCompatible */ export declare abstract class FormElement extends BaseElement { + static shadowRootOptions: ShadowRootInit; /** * Form-capable element in the component ShadowRoot. * * Define in your component with the `@query` decorator */ protected abstract formElement: HTMLElement; - protected createRenderRoot(): ShadowRoot; + /** + * Disabled state for the component. When `disabled` is set to `true`, the + * component will not be added to form submission. + */ + disabled: boolean; /** * Implement ripple getter for Ripple integration with mwc-formfield */ - readonly ripple?: RippleInterface | Promise<RippleInterface | null>; + readonly ripple?: Promise<RippleInterface | null>; + /** + * Form element that contains this element + */ + protected containingForm: HTMLFormElement | null; + protected formDataListener: (ev: FormDataEvent) => void; + protected findFormElement(): HTMLFormElement | null; + /** + * Implement this callback to submit form data + */ + protected abstract setFormData(formData: FormData): void; + connectedCallback(): void; + disconnectedCallback(): void; click(): void; - setAriaLabel(label: string): void; protected firstUpdated(): void; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.js index 3a3f8ff..0e839e7 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/form-element.js
@@ -1,42 +1,81 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +var _a, _b; +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore +import { property } from '../../lit/decorators.js'; import { addHasRemoveClass, BaseElement } from './base-element.js'; -export { addHasRemoveClass, BaseElement, }; +export { addHasRemoveClass, BaseElement }; +// ShadyDOM should submit <input> elements in component internals +const USING_SHADY_DOM = (_b = (_a = window.ShadyDOM) === null || _a === void 0 ? void 0 : _a.inUse) !== null && _b !== void 0 ? _b : false; /** @soyCompatible */ export class FormElement extends BaseElement { - createRenderRoot() { - return this.attachShadow({ mode: 'open', delegatesFocus: true }); + constructor() { + super(...arguments); + /** + * Disabled state for the component. When `disabled` is set to `true`, the + * component will not be added to form submission. + */ + this.disabled = false; + /** + * Form element that contains this element + */ + this.containingForm = null; + this.formDataListener = (ev) => { + if (!this.disabled) { + this.setFormData(ev.formData); + } + }; + } + findFormElement() { + // If the component internals are not in Shadow DOM, subscribing to form + // data events could lead to duplicated data, which may not work correctly + // on the server side. + if (!this.shadowRoot || USING_SHADY_DOM) { + return null; + } + const root = this.getRootNode(); + const forms = root.querySelectorAll('form'); + for (const form of Array.from(forms)) { + if (form.contains(this)) { + return form; + } + } + return null; + } + connectedCallback() { + var _a; + super.connectedCallback(); + this.containingForm = this.findFormElement(); + (_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.addEventListener('formdata', this.formDataListener); + } + disconnectedCallback() { + var _a; + super.disconnectedCallback(); + (_a = this.containingForm) === null || _a === void 0 ? void 0 : _a.removeEventListener('formdata', this.formDataListener); + this.containingForm = null; } click() { - if (this.formElement) { + if (this.formElement && !this.disabled) { this.formElement.focus(); this.formElement.click(); } } - setAriaLabel(label) { - if (this.formElement) { - this.formElement.setAttribute('aria-label', label); - } - } firstUpdated() { super.firstUpdated(); - this.mdcRoot.addEventListener('change', (e) => { - this.dispatchEvent(new Event('change', e)); - }); + if (this.shadowRoot) { + this.mdcRoot.addEventListener('change', (e) => { + this.dispatchEvent(new Event('change', e)); + }); + } } } +FormElement.shadowRootOptions = { mode: 'open', delegatesFocus: true }; +__decorate([ + property({ type: Boolean }) +], FormElement.prototype, "disabled", void 0); //# sourceMappingURL=form-element.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.d.ts index 9351a24..4b4f5df 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.d.ts
@@ -1,19 +1,8 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ /** * Observer function type. */
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.js index 8890c6ace..0affe52 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/observer.js
@@ -1,19 +1,8 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ // tslint:disable:no-any + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ /** * Specifies an observer callback that is run when the decorated property * changes. The observer receives the current and old value as arguments.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/package.json index 94f3559..f2a8a48 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/package.json
@@ -1,6 +1,6 @@ { "name": "@material/mwc-base", - "version": "0.20.0", + "version": "0.26.0", "description": "", "main": "base-element.js", "module": "base-element.js", @@ -11,19 +11,19 @@ }, "license": "Apache-2.0", "dependencies": { - "@material/base": "=9.0.0-canary.1c156d69d.0", - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", + "@material/base": "=14.0.0", + "@material/dom": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" }, "devDependencies": { - "@material/elevation": "=9.0.0-canary.1c156d69d.0", - "@material/feature-targeting": "=9.0.0-canary.1c156d69d.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "@material/theme": "=9.0.0-canary.1c156d69d.0" + "@material/elevation": "=14.0.0", + "@material/feature-targeting": "=14.0.0", + "@material/ripple": "=14.0.0", + "@material/theme": "=14.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "d893b14a0846777b90c10839f3d05c36bc34692e" + "gitHead": "056b3ceffbe2fe3408dbdbb319932da85637e779" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.d.ts index e214d40..c6ec18e 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.d.ts
@@ -1,26 +1,14 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ /** * Determines whether a node is an element. * * @param node Node to check */ export declare const isNodeElement: (node: Node) => node is Element; -export declare function findAssignedElement(slot: HTMLSlotElement, selector: string): HTMLElement | null; export declare type Constructor<T> = new (...args: any[]) => T; export declare function addHasRemoveClass(element: HTMLElement): { addClass: (className: string) => void; @@ -33,12 +21,11 @@ export declare const supportsPassiveEventListener = false; export declare const deepActiveElementPath: (doc?: Document) => Element[]; export declare const doesElementContainFocus: (element: HTMLElement) => boolean; -export interface HTMLElementWithRipple extends HTMLElement { - ripple?: RippleInterface; -} export interface RippleInterface { startPress: (e?: Event) => void; endPress: () => void; startFocus: () => void; endFocus: () => void; + startHover: () => void; + endHover: () => void; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.js index 3fed9127..a1a4d18 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-base/utils.js
@@ -1,23 +1,10 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -/** - * Return an element assigned to a given slot that matches the given selector + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 */ -import { matches } from '../dom/ponyfill.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore /** * Determines whether a node is an element. * @@ -26,17 +13,6 @@ export const isNodeElement = (node) => { return node.nodeType === Node.ELEMENT_NODE; }; -export function findAssignedElement(slot, selector) { - for (const node of slot.assignedNodes({ flatten: true })) { - if (isNodeElement(node)) { - const el = node; - if (matches(el, selector)) { - return el; - } - } - } - return null; -} export function addHasRemoveClass(element) { return { addClass: (className) => {
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/LICENSE index 6c8dc68a..d645695 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/LICENSE
@@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018 Google, Inc + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.d.ts deleted file mode 100644 index c0f3b8ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.d.ts +++ /dev/null
@@ -1 +0,0 @@ -export declare const style: import("lit-element").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.js deleted file mode 100644 index 099b83c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles-css.js +++ /dev/null
@@ -1,19 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { css } from '../../lit-element/lit-element.js'; -export const style = css `mwc-button{--mdc-theme-primary:red;--mdc-button-disabled-ink-color:aqua;--mdc-shape-small:0 4px 4px 0;--mdc-button-horizontal-padding: 5px;--mdc-button-outline-width: 2px}mwc-button[outlined]{--mdc-theme-primary:red;--mdc-button-outline-color:blue;--mdc-button-disabled-outline-color:orange;--mdc-shape-small:0 4px 4px 0}mwc-button[raised],mwc-button[unelevated]{--mdc-theme-primary:red;--mdc-button-disabled-fill-color:green;--mdc-theme-on-primary:black;--mdc-button-disabled-ink-color:aqua;--mdc-shape-small:0 4px 4px 0}`; -//# sourceMappingURL=demo_styles-css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.d.ts new file mode 100644 index 0000000..1c75ade --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.d.ts
@@ -0,0 +1 @@ +export declare const styles: import("lit").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.js new file mode 100644 index 0000000..3e14a72 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/demo_styles.css.js
@@ -0,0 +1,8 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-LIcense-Identifier: Apache-2.0 + */ +import { css } from '../../lit/index.js'; +export const styles = css `mwc-button{--mdc-theme-primary:red;--mdc-button-disabled-ink-color:aqua;--mdc-shape-small:0 4px 4px 0;--mdc-button-horizontal-padding: 5px;--mdc-button-outline-width: 2px}mwc-button[outlined]{--mdc-theme-primary:red;--mdc-button-outline-color:blue;--mdc-button-disabled-outline-color:orange;--mdc-shape-small:0 4px 4px 0}mwc-button[raised],mwc-button[unelevated]{--mdc-theme-primary:red;--mdc-button-disabled-fill-color:green;--mdc-theme-on-primary:black;--mdc-button-disabled-ink-color:aqua;--mdc-shape-small:0 4px 4px 0}`; +//# sourceMappingURL=demo_styles.css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.d.ts index 87aa585..0e90abf1 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.d.ts
@@ -1,26 +1,20 @@ /** -@license -Copyright 2019 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import '@material/mwc-icon/mwc-icon'; import '@material/mwc-ripple/mwc-ripple'; +import { AriaHasPopup } from '@material/mwc-base/aria-property'; import { Ripple } from '@material/mwc-ripple/mwc-ripple'; import { RippleHandlers } from '@material/mwc-ripple/ripple-handlers'; -import { LitElement, TemplateResult } from 'lit-element'; +import { LitElement, TemplateResult } from 'lit'; +import { ClassInfo } from 'lit/directives/class-map'; /** @soyCompatible */ export declare class ButtonBase extends LitElement { + static shadowRootOptions: ShadowRootInit; + /** @soyPrefixAttribute */ + ariaHasPopup: AriaHasPopup; raised: boolean; unelevated: boolean; outlined: boolean; @@ -39,11 +33,10 @@ protected renderOverlay(): TemplateResult; /** @soyTemplate */ protected renderRipple(): TemplateResult | string; - protected createRenderRoot(): ShadowRoot; focus(): void; blur(): void; - /** @soyTemplate classMap */ - protected getRenderClasses(): (part: import("lit-html").Part) => void; + /** @soyTemplate */ + protected getRenderClasses(): ClassInfo; /** * @soyTemplate * @soyAttributes buttonAttributes: #button @@ -52,10 +45,10 @@ protected render(): TemplateResult; /** @soyTemplate */ protected renderIcon(): TemplateResult; - private handleRippleActivate; - private handleRippleDeactivate; - private handleRippleMouseEnter; - private handleRippleMouseLeave; - private handleRippleFocus; - private handleRippleBlur; + protected handleRippleActivate(evt?: Event): void; + protected handleRippleDeactivate(): void; + protected handleRippleMouseEnter(): void; + protected handleRippleMouseLeave(): void; + protected handleRippleFocus(): void; + protected handleRippleBlur(): void; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.js index 2828ed7..9592b0b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button-base.js
@@ -1,25 +1,19 @@ -import { __decorate } from '../../tslib/tslib.es6.js'; /** -@license -Copyright 2019 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore import '../mwc-icon/mwc-icon.js'; import '../mwc-ripple/mwc-ripple.js'; +import { ariaProperty } from '../mwc-base/aria-property.js'; import { RippleHandlers } from '../mwc-ripple/ripple-handlers.js'; -import { eventOptions, html, internalProperty, LitElement, property, query, queryAsync } from '../../lit-element/lit-element.js'; -import { classMap } from '../../lit-html/directives/class-map.js'; +import { html, LitElement } from '../../lit/index.js'; +import { eventOptions, property, query, queryAsync, state } from '../../lit/decorators.js'; +import { classMap } from '../../lit/directives/class-map.js'; +import { ifDefined } from '../../lit/directives/if-defined.js'; /** @soyCompatible */ export class ButtonBase extends LitElement { constructor() { @@ -51,9 +45,6 @@ html `<mwc-ripple class="ripple" .primary="${!filled}" .disabled="${this.disabled}"></mwc-ripple>` : ''; } - createRenderRoot() { - return this.attachShadow({ mode: 'open', delegatesFocus: true }); - } focus() { const buttonElement = this.buttonElement; if (buttonElement) { @@ -68,14 +59,14 @@ buttonElement.blur(); } } - /** @soyTemplate classMap */ + /** @soyTemplate */ getRenderClasses() { - return classMap({ + return { 'mdc-button--raised': this.raised, 'mdc-button--unelevated': this.unelevated, 'mdc-button--outlined': this.outlined, 'mdc-button--dense': this.dense, - }); + }; } /** * @soyTemplate @@ -86,9 +77,10 @@ return html ` <button id="button" - class="mdc-button ${this.getRenderClasses()}" + class="mdc-button ${classMap(this.getRenderClasses())}" ?disabled="${this.disabled}" aria-label="${this.label || this.icon}" + aria-haspopup="${ifDefined(this.ariaHasPopup)}" @focus="${this.handleRippleFocus}" @blur="${this.handleRippleBlur}" @mousedown="${this.handleRippleActivate}" @@ -148,6 +140,11 @@ this.rippleHandlers.endFocus(); } } +ButtonBase.shadowRootOptions = { mode: 'open', delegatesFocus: true }; +__decorate([ + ariaProperty, + property({ type: String, attribute: 'aria-haspopup' }) +], ButtonBase.prototype, "ariaHasPopup", void 0); __decorate([ property({ type: Boolean, reflect: true }) ], ButtonBase.prototype, "raised", void 0); @@ -185,7 +182,7 @@ queryAsync('mwc-ripple') ], ButtonBase.prototype, "ripple", void 0); __decorate([ - internalProperty() + state() ], ButtonBase.prototype, "shouldRenderRipple", void 0); __decorate([ eventOptions({ passive: true })
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.d.ts index 05d0dba..e815d307 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.d.ts
@@ -1,7 +1,12 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { ButtonBase } from './mwc-button-base'; /** @soyCompatible */ export declare class Button extends ButtonBase { - static styles: import("lit-element").CSSResult; + static styles: import("lit").CSSResult[]; } declare global { interface HTMLElementTagNameMap {
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.js index 29a028a..d77ec6f4 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/mwc-button.js
@@ -1,27 +1,18 @@ -import { __decorate } from '../../tslib/tslib.es6.js'; /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { customElement } from '../../lit-element/lit-element.js'; + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore +import { customElement } from '../../lit/decorators.js'; import { ButtonBase } from './mwc-button-base.js'; -import { style } from './styles-css.js'; +import { styles } from './styles.css.js'; /** @soyCompatible */ let Button = class Button extends ButtonBase { }; -Button.styles = style; +Button.styles = [styles]; Button = __decorate([ customElement('mwc-button') ], Button);
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/package.json index 3baaf65a5..33cdc6e 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/package.json
@@ -1,6 +1,6 @@ { "name": "@material/mwc-button", - "version": "0.20.0", + "version": "0.26.0", "description": "Material Design button web component", "keywords": [ "material design", @@ -16,21 +16,23 @@ }, "license": "Apache-2.0", "dependencies": { - "@material/mwc-icon": "^0.20.0", - "@material/mwc-ripple": "^0.20.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/mwc-icon": "^0.26.0", + "@material/mwc-ripple": "^0.26.0", + "lit": "^2.0.0", "tslib": "^2.0.1" }, + "scripts": { + "build:style": "node ../../scripts/sass-to-lit-css/index.js styles.scss demo_styles.scss" + }, "devDependencies": { - "@material/button": "=9.0.0-canary.1c156d69d.0", - "@material/elevation": "=9.0.0-canary.1c156d69d.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "@material/shape": "=9.0.0-canary.1c156d69d.0", - "@material/theme": "=9.0.0-canary.1c156d69d.0" + "@material/button": "=14.0.0", + "@material/elevation": "=14.0.0", + "@material/ripple": "=14.0.0", + "@material/shape": "=14.0.0", + "@material/theme": "=14.0.0" }, "publishConfig": { "access": "public" }, - "gitHead": "d893b14a0846777b90c10839f3d05c36bc34692e" + "gitHead": "056b3ceffbe2fe3408dbdbb319932da85637e779" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.d.ts deleted file mode 100644 index c0f3b8ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.d.ts +++ /dev/null
@@ -1 +0,0 @@ -export declare const style: import("lit-element").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.js deleted file mode 100644 index 0c40db1..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles-css.js +++ /dev/null
@@ -1,19 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { css } from '../../lit-element/lit-element.js'; -export const style = css `.mdc-touch-target-wrapper{display:inline}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-button{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase);padding:0 8px 0 8px;position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;user-select:none;-webkit-appearance:none;overflow:visible;vertical-align:middle;border-radius:4px;border-radius:var(--mdc-shape-small, 4px);height:36px}.mdc-button .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button:not(:disabled){background-color:transparent}.mdc-button:disabled{background-color:transparent}.mdc-button .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;width:18px;height:18px;font-size:18px;vertical-align:top}[dir=rtl] .mdc-button .mdc-button__icon,.mdc-button .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.mdc-button .mdc-button__touch{position:absolute;top:50%;right:0;height:48px;left:0;transform:translateY(-50%)}.mdc-button:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button__label+.mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .mdc-button__label+.mdc-button__icon,.mdc-button__label+.mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}svg.mdc-button__icon{fill:currentColor}.mdc-button--raised .mdc-button__icon,.mdc-button--unelevated .mdc-button__icon,.mdc-button--outlined .mdc-button__icon{margin-left:-4px;margin-right:8px}[dir=rtl] .mdc-button--raised .mdc-button__icon,.mdc-button--raised .mdc-button__icon[dir=rtl],[dir=rtl] .mdc-button--unelevated .mdc-button__icon,.mdc-button--unelevated .mdc-button__icon[dir=rtl],[dir=rtl] .mdc-button--outlined .mdc-button__icon,.mdc-button--outlined .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:-4px}.mdc-button--raised .mdc-button__label+.mdc-button__icon,.mdc-button--unelevated .mdc-button__label+.mdc-button__icon,.mdc-button--outlined .mdc-button__label+.mdc-button__icon{margin-left:8px;margin-right:-4px}[dir=rtl] .mdc-button--raised .mdc-button__label+.mdc-button__icon,.mdc-button--raised .mdc-button__label+.mdc-button__icon[dir=rtl],[dir=rtl] .mdc-button--unelevated .mdc-button__label+.mdc-button__icon,.mdc-button--unelevated .mdc-button__label+.mdc-button__icon[dir=rtl],[dir=rtl] .mdc-button--outlined .mdc-button__label+.mdc-button__icon,.mdc-button--outlined .mdc-button__label+.mdc-button__icon[dir=rtl]{margin-left:-4px;margin-right:8px}.mdc-button--raised,.mdc-button--unelevated{padding:0 16px 0 16px}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){background-color:#6200ee;background-color:var(--mdc-theme-primary, #6200ee)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){color:#fff;color:var(--mdc-theme-on-primary, #fff)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{background-color:rgba(0, 0, 0, 0.12)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12);transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--raised:hover,.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2),0px 4px 5px 0px rgba(0, 0, 0, 0.14),0px 1px 10px 0px rgba(0,0,0,.12)}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12)}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2),0px 0px 0px 0px rgba(0, 0, 0, 0.14),0px 0px 0px 0px rgba(0,0,0,.12)}.mdc-button--outlined{padding:0 15px 0 15px;border-width:1px;border-style:solid}.mdc-button--outlined .mdc-button__ripple{top:-1px;left:-1px;border:1px solid transparent}.mdc-button--outlined .mdc-button__touch{left:-1px;width:calc(100% + 2 * 1px)}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined:disabled{border-color:rgba(0, 0, 0, 0.12)}.mdc-button--touch{margin-top:6px;margin-bottom:6px}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:transparent;vertical-align:top}:host([fullwidth]){width:100%}:host([raised]),:host([unelevated]){--mdc-ripple-color: #fff;--mdc-ripple-focus-opacity: 0.24;--mdc-ripple-hover-opacity: 0.08;--mdc-ripple-press-opacity: 0.24}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon,.leading-icon ::slotted(*),.leading-icon .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;width:18px;height:18px;font-size:18px;vertical-align:top}[dir=rtl] .trailing-icon ::slotted(*),.trailing-icon ::slotted(*)[dir=rtl],[dir=rtl] .trailing-icon .mdc-button__icon,.trailing-icon .mdc-button__icon[dir=rtl],[dir=rtl] .leading-icon ::slotted(*),.leading-icon ::slotted(*)[dir=rtl],[dir=rtl] .leading-icon .mdc-button__icon,.leading-icon .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .trailing-icon ::slotted(*),.trailing-icon ::slotted(*)[dir=rtl],[dir=rtl] .trailing-icon .mdc-button__icon,.trailing-icon .mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}.slot-container{display:inline-flex;align-items:center;justify-content:center}.slot-container.flex{flex:auto}.mdc-button{flex:auto;overflow:hidden;padding-left:8px;padding-left:var(--mdc-button-horizontal-padding, 8px);padding-right:8px;padding-right:var(--mdc-button-horizontal-padding, 8px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-focus, var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)))}.mdc-button--raised:hover{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-active, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12))}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-disabled, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised,.mdc-button--unelevated{padding-left:16px;padding-left:var(--mdc-button-horizontal-padding, 16px);padding-right:16px;padding-right:var(--mdc-button-horizontal-padding, 16px)}.mdc-button--outlined{border-width:1px;border-width:var(--mdc-button-outline-width, 1px);padding-left:calc(16px - 1px);padding-left:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px));padding-right:calc(16px - 1px);padding-right:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px))}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-outline-color, rgba(0, 0, 0, 0.12))}.mdc-button--outlined .ripple{top:calc(-1 * 1px);top:calc(-1 * var(--mdc-button-outline-width, 1px));left:calc(-1 * 1px);left:calc(-1 * var(--mdc-button-outline-width, 1px));right:initial;border-width:1px;border-width:var(--mdc-button-outline-width, 1px);border-style:solid;border-color:transparent}[dir=rtl] .mdc-button--outlined .ripple,.mdc-button--outlined .ripple[dir=rtl]{left:initial;right:calc(-1 * 1px);right:calc(-1 * var(--mdc-button-outline-width, 1px))}.mdc-button--dense{height:28px;margin-top:0;margin-bottom:0}.mdc-button--dense .mdc-button__touch{display:none}:host([disabled]){pointer-events:none}:host([disabled]) .mdc-button{color:rgba(0, 0, 0, 0.38);color:var(--mdc-button-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-button--raised,:host([disabled]) .mdc-button--unelevated{background-color:rgba(0, 0, 0, 0.12);background-color:var(--mdc-button-disabled-fill-color, rgba(0, 0, 0, 0.12))}:host([disabled]) .mdc-button--outlined{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-disabled-outline-color, rgba(0, 0, 0, 0.12))}`; -//# sourceMappingURL=styles-css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.d.ts new file mode 100644 index 0000000..1c75ade --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.d.ts
@@ -0,0 +1 @@ +export declare const styles: import("lit").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.js new file mode 100644 index 0000000..3592f3c6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-button/styles.css.js
@@ -0,0 +1,8 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-LIcense-Identifier: Apache-2.0 + */ +import { css } from '../../lit/index.js'; +export const styles = css `.mdc-button{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase)}.mdc-touch-target-wrapper{display:inline}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-button{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:64px;border:none;outline:none;line-height:inherit;user-select:none;-webkit-appearance:none;overflow:visible;vertical-align:middle;background:transparent}.mdc-button .mdc-elevation-overlay{width:100%;height:100%;top:0;left:0}.mdc-button::-moz-focus-inner{padding:0;border:0}.mdc-button:active{outline:none}.mdc-button:hover{cursor:pointer}.mdc-button:disabled{cursor:default;pointer-events:none}.mdc-button .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top}[dir=rtl] .mdc-button .mdc-button__icon,.mdc-button .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.mdc-button .mdc-button__label{position:relative}.mdc-button .mdc-button__focus-ring{display:none}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{pointer-events:none;border:2px solid transparent;border-radius:6px;box-sizing:content-box;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc( 100% + 4px );width:calc( 100% + 4px );display:block}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring{border-color:CanvasText}}@media screen and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{content:"";border:2px solid transparent;border-radius:8px;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);height:calc(100% + 4px);width:calc(100% + 4px)}}@media screen and (forced-colors: active)and (forced-colors: active){.mdc-button.mdc-ripple-upgraded--background-focused .mdc-button__focus-ring::after,.mdc-button:not(.mdc-ripple-upgraded):focus .mdc-button__focus-ring::after{border-color:CanvasText}}.mdc-button .mdc-button__touch{position:absolute;top:50%;height:48px;left:0;right:0;transform:translateY(-50%)}.mdc-button__label+.mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .mdc-button__label+.mdc-button__icon,.mdc-button__label+.mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}svg.mdc-button__icon{fill:currentColor}.mdc-button--touch{margin-top:6px;margin-bottom:6px}.mdc-button{padding:0 8px 0 8px}.mdc-button--unelevated{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--unelevated.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--unelevated.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--raised{transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);padding:0 16px 0 16px}.mdc-button--raised.mdc-button--icon-trailing{padding:0 12px 0 16px}.mdc-button--raised.mdc-button--icon-leading{padding:0 16px 0 12px}.mdc-button--outlined{border-style:solid;transition:border 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--outlined .mdc-button__ripple{border-style:solid;border-color:transparent}.mdc-button{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised,.mdc-button--unelevated{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){background-color:#6200ee;background-color:var(--mdc-theme-primary, #6200ee)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{background-color:rgba(0, 0, 0, 0.12)}.mdc-button--raised:not(:disabled),.mdc-button--unelevated:not(:disabled){color:#fff;color:var(--mdc-theme-on-primary, #fff)}.mdc-button--raised:disabled,.mdc-button--unelevated:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--raised .mdc-button__icon,.mdc-button--unelevated .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--raised .mdc-button__ripple,.mdc-button--unelevated .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined{height:36px;border-radius:4px;border-radius:var(--mdc-shape-small, 4px);padding:0 15px 0 15px;border-width:1px}.mdc-button--outlined:not(:disabled){color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-button--outlined:disabled{color:rgba(0, 0, 0, 0.38)}.mdc-button--outlined .mdc-button__icon{font-size:1.125rem;width:1.125rem;height:1.125rem}.mdc-button--outlined .mdc-button__ripple{border-radius:4px;border-radius:var(--mdc-shape-small, 4px)}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined:disabled{border-color:rgba(0, 0, 0, 0.12)}.mdc-button--outlined.mdc-button--icon-trailing{padding:0 11px 0 15px}.mdc-button--outlined.mdc-button--icon-leading{padding:0 15px 0 11px}.mdc-button--outlined .mdc-button__ripple{top:-1px;left:-1px;bottom:-1px;right:-1px;border-width:1px}.mdc-button--outlined .mdc-button__touch{left:calc(-1 * 1px);width:calc(100% + 2 * 1px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2),0px 2px 2px 0px rgba(0, 0, 0, 0.14),0px 1px 5px 0px rgba(0,0,0,.12);transition:box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-button--raised:hover,.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2),0px 4px 5px 0px rgba(0, 0, 0, 0.14),0px 1px 10px 0px rgba(0,0,0,.12)}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2),0px 8px 10px 1px rgba(0, 0, 0, 0.14),0px 3px 14px 2px rgba(0,0,0,.12)}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2),0px 0px 0px 0px rgba(0, 0, 0, 0.14),0px 0px 0px 0px rgba(0,0,0,.12)}:host{display:inline-flex;outline:none;-webkit-tap-highlight-color:transparent;vertical-align:top}:host([fullwidth]){width:100%}:host([raised]),:host([unelevated]){--mdc-ripple-color:#fff;--mdc-ripple-focus-opacity:0.24;--mdc-ripple-hover-opacity:0.08;--mdc-ripple-press-opacity:0.24}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon,.leading-icon ::slotted(*),.leading-icon .mdc-button__icon{margin-left:0;margin-right:8px;display:inline-block;position:relative;vertical-align:top;font-size:1.125rem;height:1.125rem;width:1.125rem}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,[dir=rtl] .leading-icon ::slotted(*),[dir=rtl] .leading-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl],.leading-icon ::slotted(*[dir=rtl]),.leading-icon .mdc-button__icon[dir=rtl]{margin-left:8px;margin-right:0}.trailing-icon ::slotted(*),.trailing-icon .mdc-button__icon{margin-left:8px;margin-right:0}[dir=rtl] .trailing-icon ::slotted(*),[dir=rtl] .trailing-icon .mdc-button__icon,.trailing-icon ::slotted(*[dir=rtl]),.trailing-icon .mdc-button__icon[dir=rtl]{margin-left:0;margin-right:8px}.slot-container{display:inline-flex;align-items:center;justify-content:center}.slot-container.flex{flex:auto}.mdc-button{flex:auto;overflow:hidden;padding-left:8px;padding-left:var(--mdc-button-horizontal-padding, 8px);padding-right:8px;padding-right:var(--mdc-button-horizontal-padding, 8px)}.mdc-button--raised{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:focus{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-focus, var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12)))}.mdc-button--raised:hover{box-shadow:0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-hover, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised:active{box-shadow:0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-active, 0px 5px 5px -3px rgba(0, 0, 0, 0.2), 0px 8px 10px 1px rgba(0, 0, 0, 0.14), 0px 3px 14px 2px rgba(0, 0, 0, 0.12))}.mdc-button--raised:disabled{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-button-raised-box-shadow-disabled, 0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12))}.mdc-button--raised,.mdc-button--unelevated{padding-left:16px;padding-left:var(--mdc-button-horizontal-padding, 16px);padding-right:16px;padding-right:var(--mdc-button-horizontal-padding, 16px)}.mdc-button--outlined{border-width:1px;border-width:var(--mdc-button-outline-width, 1px);padding-left:calc(16px - 1px);padding-left:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px));padding-right:calc(16px - 1px);padding-right:calc(var(--mdc-button-horizontal-padding, 16px) - var(--mdc-button-outline-width, 1px))}.mdc-button--outlined:not(:disabled){border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-outline-color, rgba(0, 0, 0, 0.12))}.mdc-button--outlined .ripple{top:calc(-1 * 1px);top:calc(-1 * var(--mdc-button-outline-width, 1px));left:calc(-1 * 1px);left:calc(-1 * var(--mdc-button-outline-width, 1px));right:initial;right:initial;border-width:1px;border-width:var(--mdc-button-outline-width, 1px);border-style:solid;border-color:transparent}[dir=rtl] .mdc-button--outlined .ripple,.mdc-button--outlined .ripple[dir=rtl]{left:initial;left:initial;right:calc(-1 * 1px);right:calc(-1 * var(--mdc-button-outline-width, 1px))}.mdc-button--dense{height:28px;margin-top:0;margin-bottom:0}.mdc-button--dense .mdc-button__touch{height:100%}:host([disabled]){pointer-events:none}:host([disabled]) .mdc-button{color:rgba(0, 0, 0, 0.38);color:var(--mdc-button-disabled-ink-color, rgba(0, 0, 0, 0.38))}:host([disabled]) .mdc-button--raised,:host([disabled]) .mdc-button--unelevated{background-color:rgba(0, 0, 0, 0.12);background-color:var(--mdc-button-disabled-fill-color, rgba(0, 0, 0, 0.12))}:host([disabled]) .mdc-button--outlined{border-color:rgba(0, 0, 0, 0.12);border-color:var(--mdc-button-disabled-outline-color, rgba(0, 0, 0, 0.12))}`; +//# sourceMappingURL=styles.css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/LICENSE index 6c8dc68a..d645695 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/LICENSE
@@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018 Google, Inc + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.d.ts deleted file mode 100644 index c0f3b8ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.d.ts +++ /dev/null
@@ -1 +0,0 @@ -export declare const style: import("lit-element").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.js deleted file mode 100644 index 716528b6..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host-css.js +++ /dev/null
@@ -1,19 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { css } from '../../lit-element/lit-element.js'; -export const style = css `:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`; -//# sourceMappingURL=mwc-icon-host-css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.d.ts new file mode 100644 index 0000000..1c75ade --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.d.ts
@@ -0,0 +1 @@ +export declare const styles: import("lit").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.js new file mode 100644 index 0000000..8b4324b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon-host.css.js
@@ -0,0 +1,8 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-LIcense-Identifier: Apache-2.0 + */ +import { css } from '../../lit/index.js'; +export const styles = css `:host{font-family:var(--mdc-icon-font, "Material Icons");font-weight:normal;font-style:normal;font-size:var(--mdc-icon-size, 24px);line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:"liga"}`; +//# sourceMappingURL=mwc-icon-host.css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.d.ts index 0bd69719..8bf3d57 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.d.ts
@@ -1,23 +1,12 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { LitElement, TemplateResult } from 'lit-element'; + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { LitElement, TemplateResult } from 'lit'; /** @soyCompatible */ export declare class Icon extends LitElement { - static styles: import("lit-element").CSSResult; + static styles: import("lit").CSSResult[]; /** @soyTemplate */ protected render(): TemplateResult; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.js index 443edbb..e836b1b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/mwc-icon.js
@@ -1,30 +1,22 @@ -import { __decorate } from '../../tslib/tslib.es6.js'; /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { customElement, html, LitElement } from '../../lit-element/lit-element.js'; -import { style } from './mwc-icon-host-css.js'; + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore +import { html, LitElement } from '../../lit/index.js'; +import { customElement } from '../../lit/decorators.js'; +import { styles } from './mwc-icon-host.css.js'; /** @soyCompatible */ let Icon = class Icon extends LitElement { /** @soyTemplate */ render() { - return html `<slot></slot>`; + return html `<span><slot></slot></span>`; } }; -Icon.styles = style; +Icon.styles = [styles]; Icon = __decorate([ customElement('mwc-icon') ], Icon);
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/package.json index 77ccdbf..2c3b47275 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-icon/package.json
@@ -1,6 +1,6 @@ { "name": "@material/mwc-icon", - "version": "0.20.0", + "version": "0.26.0", "description": "Material Design icon web component", "keywords": [ "material design", @@ -16,11 +16,14 @@ }, "license": "Apache-2.0", "dependencies": { - "lit-element": "^2.3.0", + "lit": "^2.0.0", "tslib": "^2.0.1" }, + "scripts": { + "build:style": "node ../../scripts/sass-to-lit-css/index.js mwc-icon-host.scss" + }, "publishConfig": { "access": "public" }, - "gitHead": "d893b14a0846777b90c10839f3d05c36bc34692e" + "gitHead": "056b3ceffbe2fe3408dbdbb319932da85637e779" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/LICENSE index 6c8dc68a..d645695 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/LICENSE
@@ -1,3 +1,4 @@ + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -186,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2018 Google, Inc + Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License.
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.d.ts index e749faf167..d1ea11e 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.d.ts
@@ -1,26 +1,15 @@ /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { BaseElement } from '@material/mwc-base/base-element'; +import { RippleInterface } from '@material/mwc-base/utils'; import { MDCRippleAdapter } from '@material/ripple/adapter'; import MDCRippleFoundation from '@material/ripple/foundation'; -import { TemplateResult } from 'lit-element'; -import { RippleAPI } from './ripple-handlers'; +import { PropertyValues, TemplateResult } from 'lit'; /** @soyCompatible */ -export declare class RippleBase extends BaseElement implements RippleAPI { +export declare class RippleBase extends BaseElement implements RippleInterface { mdcRoot: HTMLElement; primary: boolean; accent: boolean; @@ -28,19 +17,20 @@ disabled: boolean; activated: boolean; selected: boolean; - private hovering; - private bgFocused; - private fgActivation; - private fgDeactivation; - private fgScale; - private fgSize; - private translateStart; - private translateEnd; - private leftPos; - private topPos; + internalUseStateLayerCustomProperties: boolean; + protected hovering: boolean; + protected bgFocused: boolean; + protected fgActivation: boolean; + protected fgDeactivation: boolean; + protected fgScale: string; + protected fgSize: string; + protected translateStart: string; + protected translateEnd: string; + protected leftPos: string; + protected topPos: string; protected mdcFoundationClass: typeof MDCRippleFoundation; protected mdcFoundation: MDCRippleFoundation; - get isActive(): boolean; + get isActive(): any; createAdapter(): MDCRippleAdapter; startPress(ev?: Event): void; endPress(): void; @@ -52,6 +42,7 @@ * Wait for the MDCFoundation to be created by `firstUpdated` */ protected waitForFoundation(fn: () => void): void; + protected update(changedProperties: PropertyValues<this>): void; /** @soyTemplate */ protected render(): TemplateResult; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.js index 7f2d789..485a3cf 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-base.js
@@ -1,25 +1,18 @@ -import { __decorate } from '../../tslib/tslib.es6.js'; /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore +import { matches } from '../dom/ponyfill.js'; import { BaseElement } from '../mwc-base/base-element.js'; import MDCRippleFoundation from '../ripple/foundation.js'; -import { html, internalProperty, property, query } from '../../lit-element/lit-element.js'; -import { classMap } from '../../lit-html/directives/class-map.js'; -import { styleMap } from '../../lit-html/directives/style-map.js'; +import { html } from '../../lit/index.js'; +import { property, query, state } from '../../lit/decorators.js'; +import { classMap } from '../../lit/directives/class-map.js'; +import { styleMap } from '../../lit/directives/style-map.js'; /** @soyCompatible */ export class RippleBase extends BaseElement { constructor() { @@ -30,6 +23,7 @@ this.disabled = false; this.activated = false; this.selected = false; + this.internalUseStateLayerCustomProperties = false; this.hovering = false; this.bgFocused = false; this.fgActivation = false; @@ -43,7 +37,7 @@ this.mdcFoundationClass = MDCRippleFoundation; } get isActive() { - return (this.parentElement || this).matches(':active'); + return matches(this.parentElement || this, ':active'); } createAdapter() { return { @@ -153,6 +147,17 @@ this.updateComplete.then(fn); } } + update(changedProperties) { + if (changedProperties.has('disabled')) { + // stop hovering when ripple is disabled to prevent a stuck "hover" state + // When re-enabled, the outer component will get a `mouseenter` event on + // the first movement, which will call `startHover()` + if (this.disabled) { + this.endHover(); + } + } + super.update(changedProperties); + } /** @soyTemplate */ render() { const shouldActivateInPrimary = this.activated && (this.primary || !this.accent); @@ -172,6 +177,7 @@ 'mdc-ripple-upgraded--foreground-activation': this.fgActivation, 'mdc-ripple-upgraded--foreground-deactivation': this.fgDeactivation, 'mdc-ripple-upgraded--unbounded': this.unbounded, + 'mdc-ripple-surface--internal-use-state-layer-custom-properties': this.internalUseStateLayerCustomProperties, }; return html ` <div class="mdc-ripple-surface mdc-ripple-upgraded ${classMap(classes)}" @@ -207,33 +213,36 @@ property({ type: Boolean }) ], RippleBase.prototype, "selected", void 0); __decorate([ - internalProperty() + property({ type: Boolean }) +], RippleBase.prototype, "internalUseStateLayerCustomProperties", void 0); +__decorate([ + state() ], RippleBase.prototype, "hovering", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "bgFocused", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "fgActivation", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "fgDeactivation", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "fgScale", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "fgSize", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "translateStart", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "translateEnd", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "leftPos", void 0); __decorate([ - internalProperty() + state() ], RippleBase.prototype, "topPos", void 0); //# sourceMappingURL=mwc-ripple-base.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.d.ts deleted file mode 100644 index c0f3b8ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.d.ts +++ /dev/null
@@ -1 +0,0 @@ -export declare const style: import("lit-element").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.js deleted file mode 100644 index 88b967a..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-css.js +++ /dev/null
@@ -1,19 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { css } from '../../lit-element/lit-element.js'; -export const style = css `.mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}`; -//# sourceMappingURL=mwc-ripple-css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.d.ts deleted file mode 100644 index c0f3b8ab..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.d.ts +++ /dev/null
@@ -1 +0,0 @@ -export declare const style: import("lit-element").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.js deleted file mode 100644 index 09f9f8cd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple-global-css.js +++ /dev/null
@@ -1,19 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { css } from '../../lit-element/lit-element.js'; -export const style = css `@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}`; -//# sourceMappingURL=mwc-ripple-global-css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.d.ts new file mode 100644 index 0000000..1c75ade --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.d.ts
@@ -0,0 +1 @@ +export declare const styles: import("lit").CSSResult;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.js new file mode 100644 index 0000000..87c9238 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.css.js
@@ -0,0 +1,8 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-LIcense-Identifier: Apache-2.0 + */ +import { css } from '../../lit/index.js'; +export const styles = css `.mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}:host{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;display:block}:host .mdc-ripple-surface{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;will-change:unset}.mdc-ripple-surface--primary::before,.mdc-ripple-surface--primary::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary:hover::before,.mdc-ripple-surface--primary.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--primary.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--primary--activated::before,.mdc-ripple-surface--primary--activated::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--activated:hover::before,.mdc-ripple-surface--primary--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--primary--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--primary--selected::before,.mdc-ripple-surface--primary--selected::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-ripple-surface--primary--selected:hover::before,.mdc-ripple-surface--primary--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--primary--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--primary--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent::before,.mdc-ripple-surface--accent::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent:hover::before,.mdc-ripple-surface--accent.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface--accent.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before{opacity:0.12;opacity:var(--mdc-ripple-activated-opacity, 0.12)}.mdc-ripple-surface--accent--activated::before,.mdc-ripple-surface--accent--activated::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--activated:hover::before,.mdc-ripple-surface--accent--activated.mdc-ripple-surface--hover::before{opacity:0.16;opacity:var(--mdc-ripple-hover-opacity, 0.16)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--activated:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--activated.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-ripple-surface--accent--selected::before{opacity:0.08;opacity:var(--mdc-ripple-selected-opacity, 0.08)}.mdc-ripple-surface--accent--selected::before,.mdc-ripple-surface--accent--selected::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-ripple-surface--accent--selected:hover::before,.mdc-ripple-surface--accent--selected.mdc-ripple-surface--hover::before{opacity:0.12;opacity:var(--mdc-ripple-hover-opacity, 0.12)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-focus-opacity, 0.2)}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--accent--selected:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.2;opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--accent--selected.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.2)}.mdc-ripple-surface--disabled{opacity:0}.mdc-ripple-surface--internal-use-state-layer-custom-properties::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties::after{background-color:#000;background-color:var(--mdc-ripple-hover-state-layer-color, #000)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:hover::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-state-layer-opacity, 0.04)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface--internal-use-state-layer-custom-properties:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}.mdc-ripple-surface--internal-use-state-layer-custom-properties.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-pressed-state-layer-opacity, 0.12)}`; +//# sourceMappingURL=mwc-ripple.css.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.d.ts index ab987da..85bdbea3 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.d.ts
@@ -1,3 +1,8 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { RippleBase } from './mwc-ripple-base'; declare global { interface HTMLElementTagNameMap { @@ -6,5 +11,5 @@ } /** @soyCompatible */ export declare class Ripple extends RippleBase { - static styles: import("lit-element").CSSResult; + static styles: import("lit").CSSResult[]; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.js index 9c8c822..4e84eb14 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/mwc-ripple.js
@@ -1,27 +1,18 @@ -import { __decorate } from '../../tslib/tslib.es6.js'; /** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { customElement } from '../../lit-element/lit-element.js'; + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +import { __decorate } from '../../tslib/tslib.js'; +// Style preference for leading underscores. +// tslint:disable:strip-private-property-underscore +import { customElement } from '../../lit/decorators.js'; import { RippleBase } from './mwc-ripple-base.js'; -import { style } from './mwc-ripple-css.js'; +import { styles } from './mwc-ripple.css.js'; /** @soyCompatible */ let Ripple = class Ripple extends RippleBase { }; -Ripple.styles = style; +Ripple.styles = [styles]; Ripple = __decorate([ customElement('mwc-ripple') ], Ripple);
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/package.json index 3fc6ca3..cea4a0d 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/package.json
@@ -1,6 +1,6 @@ { "name": "@material/mwc-ripple", - "version": "0.20.0", + "version": "0.26.0", "description": "Material Design ripple web component", "keywords": [ "material design", @@ -16,18 +16,20 @@ }, "license": "Apache-2.0", "dependencies": { - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "@material/mwc-base": "^0.20.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/dom": "=14.0.0", + "@material/mwc-base": "^0.26.0", + "@material/ripple": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" }, "devDependencies": { - "@material/theme": "=9.0.0-canary.1c156d69d.0" + "@material/theme": "=14.0.0" + }, + "scripts": { + "build:style": "node ../../scripts/sass-to-lit-css/index.js mwc-ripple.scss" }, "publishConfig": { "access": "public" }, - "gitHead": "d893b14a0846777b90c10839f3d05c36bc34692e" + "gitHead": "056b3ceffbe2fe3408dbdbb319932da85637e779" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.d.ts deleted file mode 100644 index 4b1573c76..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.d.ts +++ /dev/null
@@ -1,46 +0,0 @@ -import { RippleInterface } from '@material/mwc-base/form-element'; -import MDCRippleFoundation from '@material/ripple/foundation'; -import { PropertyPart } from 'lit-html'; -export interface RippleOptions { - interactionNode?: HTMLElement; - unbounded?: boolean; - disabled?: boolean; - active?: boolean; -} -export interface RippleNodeOptions extends RippleOptions { - surfaceNode: HTMLElement; -} -/** - * force the ripple directive to share API names with `mwc-ripple` after Closure - * Compiler. - */ -declare class RippleIntermediate implements RippleInterface { - private readonly foundation; - constructor(foundation: MDCRippleFoundation); - startPress(): void; - endPress(): void; - startFocus(): void; - endFocus(): void; - destroy(): void; - setUnbounded(value: boolean): void; -} -declare global { - interface HTMLElement { - ripple?: unknown; - } - interface Element { - ripple?: unknown; - } -} -/** - * Applied a ripple to the node specified by {surfaceNode}. - * @param options {RippleNodeOptions} - */ -export declare const rippleNode: (options: RippleNodeOptions) => RippleIntermediate; -/** - * A directive that applies a Material ripple to a part node. The directive - * should be applied to a PropertyPart. - * @param options {RippleOptions} - */ -export declare const ripple: (options?: RippleOptions) => (part: PropertyPart) => void; -export {};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.js deleted file mode 100644 index 4a27ef33..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-directive.js +++ /dev/null
@@ -1,154 +0,0 @@ -/** -@license -Copyright 2018 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -import { applyPassive } from '../dom/events.js'; -import { matches } from '../dom/ponyfill.js'; -import MDCRippleFoundation from '../ripple/foundation.js'; -import { supportsCssVariables } from '../ripple/util.js'; -import { directive, noChange, NodePart, templateFactory } from '../../lit-html/lit-html.js'; -import { style } from './mwc-ripple-global-css.js'; -const supportsCssVariablesWin = supportsCssVariables(window); -/** - * force the ripple directive to share API names with `mwc-ripple` after Closure - * Compiler. - */ -class RippleIntermediate { - constructor(foundation) { - this.foundation = foundation; - } - startPress() { - this.foundation.activate(); - } - endPress() { - this.foundation.deactivate(); - } - startFocus() { - this.foundation.handleFocus(); - } - endFocus() { - this.foundation.handleBlur(); - } - destroy() { - this.foundation.destroy(); - } - setUnbounded(value) { - this.foundation.setUnbounded(value); - } -} -// NOTE: This is a workaround for -// https://bugs.webkit.org/show_bug.cgi?id=173027. Since keyframes on -// pseudo-elements (:after) are not supported in Shadow DOM, we put the keyframe -// style into the <head> element. -const isSafari = navigator.userAgent.match(/Safari/); -let didApplyRippleStyle = false; -const applyRippleStyle = () => { - didApplyRippleStyle = true; - const styleElement = document.createElement('style'); - const part = new NodePart({ templateFactory }); - part.appendInto(styleElement); - part.setValue(style); - part.commit(); - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - document.head.appendChild(styleElement); -}; -/** - * Applied a ripple to the node specified by {surfaceNode}. - * @param options {RippleNodeOptions} - */ -export const rippleNode = (options) => { - if (isSafari && !didApplyRippleStyle) { - applyRippleStyle(); - } - // TODO(sorvell): This directive requires bringing css yourself. We probably - // need to do this because of ShadyCSS, but on Safari, the keyframes styling - // must be global. Perhaps this directive could fix that. - const surfaceNode = options.surfaceNode; - const interactionNode = options.interactionNode || surfaceNode; - // only style interaction node if not in the same root - if (interactionNode.getRootNode() !== surfaceNode.getRootNode()) { - if (interactionNode.style.position === '') { - interactionNode.style.position = 'relative'; - } - } - const adapter = { - browserSupportsCssVars: () => supportsCssVariablesWin, - isUnbounded: () => options.unbounded === undefined ? true : options.unbounded, - isSurfaceActive: () => matches(interactionNode, ':active'), - isSurfaceDisabled: () => Boolean(interactionNode.hasAttribute('disabled')), - addClass: (className) => surfaceNode.classList.add(className), - removeClass: (className) => surfaceNode.classList.remove(className), - containsEventTarget: (target) => interactionNode.contains(target), - registerInteractionHandler: (type, handler) => interactionNode.addEventListener(type, handler, applyPassive()), - deregisterInteractionHandler: (type, handler) => interactionNode.removeEventListener(type, handler, applyPassive()), - registerDocumentInteractionHandler: (evtType, handler) => - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - document.documentElement.addEventListener(evtType, handler, applyPassive()), - deregisterDocumentInteractionHandler: (evtType, handler) => - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - document.documentElement.removeEventListener(evtType, handler, applyPassive()), - registerResizeHandler: (handler) => window.addEventListener('resize', handler), - deregisterResizeHandler: (handler) => window.removeEventListener('resize', handler), - updateCssVariable: (varName, value) => surfaceNode.style.setProperty(varName, value), - computeBoundingRect: () => surfaceNode.getBoundingClientRect(), - getWindowPageOffset: () => ({ x: window.pageXOffset, y: window.pageYOffset }), - }; - const rippleFoundation = new MDCRippleFoundation(adapter); - rippleFoundation.init(); - return new RippleIntermediate(rippleFoundation); -}; -const rippleInteractionNodes = new WeakMap(); -/** - * A directive that applies a Material ripple to a part node. The directive - * should be applied to a PropertyPart. - * @param options {RippleOptions} - */ -export const ripple = directive((options = {}) => (part) => { - const surfaceNode = part.committer.element; - const interactionNode = options.interactionNode || surfaceNode; - let rippleFoundation = part.value; - // if the interaction node changes, destroy and invalidate the foundation. - const existingInteractionNode = rippleInteractionNodes.get(rippleFoundation); - if (existingInteractionNode !== undefined && - existingInteractionNode !== interactionNode) { - rippleFoundation.destroy(); - rippleFoundation = noChange; - } - // make the ripple, if needed - if (rippleFoundation === noChange) { - rippleFoundation = - rippleNode(Object.assign({}, options, { surfaceNode })); - rippleInteractionNodes.set(rippleFoundation, interactionNode); - part.setValue(rippleFoundation); - // otherwise update settings as needed. - } - else { - if (options.unbounded !== undefined) { - rippleFoundation - .setUnbounded(options.unbounded); - } - if (options.disabled !== undefined) { - rippleFoundation - .setUnbounded(options.disabled); - } - } - if (options.active === true) { - rippleFoundation.startPress(); - } - else if (options.active === false) { - rippleFoundation.endPress(); - } -}); -//# sourceMappingURL=ripple-directive.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.d.ts index 10eec75..b2d0ff6 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.d.ts
@@ -1,24 +1,9 @@ /** -@license -Copyright 2020 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ import { RippleInterface } from '@material/mwc-base/utils'; -export interface RippleAPI extends RippleInterface { - startHover: () => void; - endHover: () => void; -} /** * Class that encapsulates the events handlers for `mwc-ripple` * @@ -42,7 +27,7 @@ * } * ``` */ -export declare class RippleHandlers implements RippleAPI { +export declare class RippleHandlers implements RippleInterface { startPress: (ev?: Event) => void; endPress: () => void; startFocus: () => void; @@ -51,5 +36,5 @@ endHover: () => void; constructor( /** Function that returns a `mwc-ripple` */ - rippleFn: () => Promise<RippleAPI | null>); + rippleFn: () => Promise<RippleInterface | null>); }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.js b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.js index be386036..3286e4e8 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/mwc-ripple/ripple-handlers.js
@@ -1,19 +1,8 @@ /** -@license -Copyright 2020 Google Inc. All Rights Reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ /** * Class that encapsulates the events handlers for `mwc-ripple` *
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.d.ts index b89b1c0..5c6209a 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.d.ts
@@ -44,6 +44,6 @@ registerResizeHandler(handler: SpecificEventListener<'resize'>): void; deregisterResizeHandler(handler: SpecificEventListener<'resize'>): void; updateCssVariable(varName: string, value: string | null): void; - computeBoundingRect(): ClientRect; + computeBoundingRect(): DOMRect; getWindowPageOffset(): MDCRipplePoint; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.js index 510e9b7..21dc7ad 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/adapter.js
@@ -20,4 +20,5 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +export {}; //# sourceMappingURL=adapter.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.d.ts index 529f1c30..e0a9f87 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.d.ts
@@ -29,7 +29,7 @@ static attachTo(root: Element, opts?: MDCRippleAttachOpts): MDCRipple; static createAdapter(instance: MDCRippleCapableSurface): MDCRippleAdapter; disabled: boolean; - private unbounded_?; + private isUnbounded?; get unbounded(): boolean; set unbounded(unbounded: boolean); activate(): void; @@ -43,5 +43,5 @@ * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ - private setUnbounded_; + private setUnbounded; }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.js index 50ab60e..56fec291 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/component.js
@@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -import { __extends } from './node_modules/tslib/tslib.es6.js'; +import { __extends } from '../../tslib/tslib.js'; import { MDCComponent } from '../base/component.js'; import { applyPassive } from '../dom/events.js'; import { matches } from '../dom/ponyfill.js'; @@ -34,7 +34,9 @@ return _this; } MDCRipple.attachTo = function (root, opts) { - if (opts === void 0) { opts = { isUnbounded: undefined }; } + if (opts === void 0) { opts = { + isUnbounded: undefined + }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { @@ -82,13 +84,13 @@ }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function () { - return Boolean(this.unbounded_); + return Boolean(this.isUnbounded); }, set: function (unbounded) { - this.unbounded_ = Boolean(unbounded); - this.setUnbounded_(); + this.isUnbounded = Boolean(unbounded); + this.setUnbounded(); }, - enumerable: true, + enumerable: false, configurable: true }); MDCRipple.prototype.activate = function () { @@ -105,7 +107,7 @@ }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root; - this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; + this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a @@ -113,8 +115,8 @@ * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ - MDCRipple.prototype.setUnbounded_ = function () { - this.foundation.setUnbounded(Boolean(this.unbounded_)); + MDCRipple.prototype.setUnbounded = function () { + this.foundation.setUnbounded(Boolean(this.isUnbounded)); }; return MDCRipple; }(MDCComponent));
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/constants.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/constants.js index a0f69b8..eb1284bf 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/constants.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/constants.js
@@ -43,6 +43,6 @@ FG_DEACTIVATION_MS: 150, INITIAL_ORIGIN_SCALE: 0.6, PADDING: 10, - TAP_DELAY_MS: 300, + TAP_DELAY_MS: 300, // Delay between touch and simulated mouse events on touch devices }; //# sourceMappingURL=constants.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.css b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.css deleted file mode 100644 index 368388b..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.css +++ /dev/null
@@ -1,199 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -@-webkit-keyframes mdc-ripple-fg-radius-in { - from { - -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); - transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); - } - to { - -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); - transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); - } -} -@keyframes mdc-ripple-fg-radius-in { - from { - -webkit-animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - -webkit-transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); - transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1); - } - to { - -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); - transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); - } -} -@-webkit-keyframes mdc-ripple-fg-opacity-in { - from { - -webkit-animation-timing-function: linear; - animation-timing-function: linear; - opacity: 0; - } - to { - opacity: var(--mdc-ripple-fg-opacity, 0); - } -} -@keyframes mdc-ripple-fg-opacity-in { - from { - -webkit-animation-timing-function: linear; - animation-timing-function: linear; - opacity: 0; - } - to { - opacity: var(--mdc-ripple-fg-opacity, 0); - } -} -@-webkit-keyframes mdc-ripple-fg-opacity-out { - from { - -webkit-animation-timing-function: linear; - animation-timing-function: linear; - opacity: var(--mdc-ripple-fg-opacity, 0); - } - to { - opacity: 0; - } -} -@keyframes mdc-ripple-fg-opacity-out { - from { - -webkit-animation-timing-function: linear; - animation-timing-function: linear; - opacity: var(--mdc-ripple-fg-opacity, 0); - } - to { - opacity: 0; - } -} -.mdc-ripple-surface { - --mdc-ripple-fg-size: 0; - --mdc-ripple-left: 0; - --mdc-ripple-top: 0; - --mdc-ripple-fg-scale: 1; - --mdc-ripple-fg-translate-end: 0; - --mdc-ripple-fg-translate-start: 0; - -webkit-tap-highlight-color: rgba(0, 0, 0, 0); - will-change: transform, opacity; - position: relative; - outline: none; - overflow: hidden; -} -.mdc-ripple-surface::before, .mdc-ripple-surface::after { - position: absolute; - border-radius: 50%; - opacity: 0; - pointer-events: none; - content: ""; -} -.mdc-ripple-surface::before { - transition: opacity 15ms linear, background-color 15ms linear; - z-index: 1; - /* @alternate */ - z-index: var(--mdc-ripple-z-index, 1); -} -.mdc-ripple-surface::after { - z-index: 0; - /* @alternate */ - z-index: var(--mdc-ripple-z-index, 0); -} -.mdc-ripple-surface.mdc-ripple-upgraded::before { - -webkit-transform: scale(var(--mdc-ripple-fg-scale, 1)); - transform: scale(var(--mdc-ripple-fg-scale, 1)); -} -.mdc-ripple-surface.mdc-ripple-upgraded::after { - top: 0; - /* @noflip */ - left: 0; - -webkit-transform: scale(0); - transform: scale(0); - -webkit-transform-origin: center center; - transform-origin: center center; -} -.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after { - top: var(--mdc-ripple-top, 0); - /* @noflip */ - left: var(--mdc-ripple-left, 0); -} -.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after { - -webkit-animation: mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards; - animation: mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards; -} -.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after { - -webkit-animation: mdc-ripple-fg-opacity-out 150ms; - animation: mdc-ripple-fg-opacity-out 150ms; - -webkit-transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); - transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1)); -} -.mdc-ripple-surface::before, .mdc-ripple-surface::after { - background-color: #000; - /* @alternate */ - background-color: var(--mdc-ripple-color, #000); -} -.mdc-ripple-surface:hover::before, .mdc-ripple-surface.mdc-ripple-surface--hover::before { - opacity: 0.04; - /* @alternate */ - opacity: var(--mdc-ripple-hover-opacity, 0.04); -} -.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before, .mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before { - transition-duration: 75ms; - opacity: 0.12; - /* @alternate */ - opacity: var(--mdc-ripple-focus-opacity, 0.12); -} -.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after { - transition: opacity 150ms linear; -} -.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after { - transition-duration: 75ms; - opacity: 0.12; - /* @alternate */ - opacity: var(--mdc-ripple-press-opacity, 0.12); -} -.mdc-ripple-surface.mdc-ripple-upgraded { - --mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12); -} -.mdc-ripple-surface::before, .mdc-ripple-surface::after { - top: calc(50% - 100%); - /* @noflip */ - left: calc(50% - 100%); - width: 200%; - height: 200%; -} -.mdc-ripple-surface.mdc-ripple-upgraded::after { - width: var(--mdc-ripple-fg-size, 100%); - height: var(--mdc-ripple-fg-size, 100%); -} - -.mdc-ripple-surface[data-mdc-ripple-is-unbounded], -.mdc-ripple-upgraded--unbounded { - overflow: visible; -} -.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before, .mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after, -.mdc-ripple-upgraded--unbounded::before, -.mdc-ripple-upgraded--unbounded::after { - top: calc(50% - 50%); - /* @noflip */ - left: calc(50% - 50%); - width: 100%; - height: 100%; -} -.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before, .mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after, -.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before, -.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after { - top: var(--mdc-ripple-top, calc(50% - 50%)); - /* @noflip */ - left: var(--mdc-ripple-left, calc(50% - 50%)); - width: var(--mdc-ripple-fg-size, 100%); - height: var(--mdc-ripple-fg-size, 100%); -} -.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after, -.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after { - width: var(--mdc-ripple-fg-size, 100%); - height: var(--mdc-ripple-fg-size, 100%); -} - -/*# sourceMappingURL=mdc.ripple.css.map*/ \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.d.ts deleted file mode 100644 index 6a1696e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.d.ts +++ /dev/null
@@ -1,318 +0,0 @@ -// Generated by dts-bundle v0.7.3 -// Dependencies for this module: -// ../../@material/base/types -// ../../@material/base/component -// ../../@material/base/foundation - -declare module '@material/ripple' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import * as util from '@material/ripple/util'; - export { util }; - export * from '@material/ripple/adapter'; - export * from '@material/ripple/component'; - export * from '@material/ripple/constants'; - export * from '@material/ripple/foundation'; - export * from '@material/ripple/types'; -} - -declare module '@material/ripple/util' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { MDCRipplePoint } from '@material/ripple/types'; - export function supportsCssVariables(windowObj: typeof globalThis, forceRefresh?: boolean): boolean; - export function getNormalizedEventCoords(evt: Event | undefined, pageOffset: MDCRipplePoint, clientRect: ClientRect): MDCRipplePoint; -} - -declare module '@material/ripple/adapter' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { EventType, SpecificEventListener } from '@material/base/types'; - import { MDCRipplePoint } from '@material/ripple/types'; - /** - * Defines the shape of the adapter expected by the foundation. - * Implement this adapter for your framework of choice to delegate updates to - * the component in your framework of choice. See architecture documentation - * for more details. - * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md - */ - export interface MDCRippleAdapter { - browserSupportsCssVars(): boolean; - isUnbounded(): boolean; - isSurfaceActive(): boolean; - isSurfaceDisabled(): boolean; - addClass(className: string): void; - removeClass(className: string): void; - containsEventTarget(target: EventTarget | null): boolean; - registerInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void; - deregisterInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void; - registerDocumentInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void; - deregisterDocumentInteractionHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void; - registerResizeHandler(handler: SpecificEventListener<'resize'>): void; - deregisterResizeHandler(handler: SpecificEventListener<'resize'>): void; - updateCssVariable(varName: string, value: string | null): void; - computeBoundingRect(): ClientRect; - getWindowPageOffset(): MDCRipplePoint; - } -} - -declare module '@material/ripple/component' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { MDCComponent } from '@material/base/component'; - import { MDCRippleAdapter } from '@material/ripple/adapter'; - import { MDCRippleFoundation } from '@material/ripple/foundation'; - import { MDCRippleAttachOpts, MDCRippleCapableSurface } from '@material/ripple/types'; - export type MDCRippleFactory = (el: Element, foundation?: MDCRippleFoundation) => MDCRipple; - export class MDCRipple extends MDCComponent<MDCRippleFoundation> implements MDCRippleCapableSurface { - static attachTo(root: Element, opts?: MDCRippleAttachOpts): MDCRipple; - static createAdapter(instance: MDCRippleCapableSurface): MDCRippleAdapter; - disabled: boolean; - get unbounded(): boolean; - set unbounded(unbounded: boolean); - activate(): void; - deactivate(): void; - layout(): void; - getDefaultFoundation(): MDCRippleFoundation; - initialSyncWithDOM(): void; - } -} - -declare module '@material/ripple/constants' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export const cssClasses: { - BG_FOCUSED: string; - FG_ACTIVATION: string; - FG_DEACTIVATION: string; - ROOT: string; - UNBOUNDED: string; - }; - export const strings: { - VAR_FG_SCALE: string; - VAR_FG_SIZE: string; - VAR_FG_TRANSLATE_END: string; - VAR_FG_TRANSLATE_START: string; - VAR_LEFT: string; - VAR_TOP: string; - }; - export const numbers: { - DEACTIVATION_TIMEOUT_MS: number; - FG_DEACTIVATION_MS: number; - INITIAL_ORIGIN_SCALE: number; - PADDING: number; - TAP_DELAY_MS: number; - }; -} - -declare module '@material/ripple/foundation' { - /** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - import { MDCFoundation } from '@material/base/foundation'; - import { MDCRippleAdapter } from '@material/ripple/adapter'; - export class MDCRippleFoundation extends MDCFoundation<MDCRippleAdapter> { - static get cssClasses(): { - BG_FOCUSED: string; - FG_ACTIVATION: string; - FG_DEACTIVATION: string; - ROOT: string; - UNBOUNDED: string; - }; - static get strings(): { - VAR_FG_SCALE: string; - VAR_FG_SIZE: string; - VAR_FG_TRANSLATE_END: string; - VAR_FG_TRANSLATE_START: string; - VAR_LEFT: string; - VAR_TOP: string; - }; - static get numbers(): { - DEACTIVATION_TIMEOUT_MS: number; - FG_DEACTIVATION_MS: number; - INITIAL_ORIGIN_SCALE: number; - PADDING: number; - TAP_DELAY_MS: number; - }; - static get defaultAdapter(): MDCRippleAdapter; - constructor(adapter?: Partial<MDCRippleAdapter>); - init(): void; - destroy(): void; - /** - * @param evt Optional event containing position information. - */ - activate(evt?: Event): void; - deactivate(): void; - layout(): void; - setUnbounded(unbounded: boolean): void; - handleFocus(): void; - handleBlur(): void; - } - export default MDCRippleFoundation; -} - -declare module '@material/ripple/types' { - /** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - export interface MDCRipplePoint { - x: number; - y: number; - } - /** - * Options passed in when attaching a ripple to an object. - */ - export interface MDCRippleAttachOpts { - isUnbounded?: boolean; - } - /** - * See Material Design spec for more details on when to use ripples. - * https://material.io/guidelines/motion/choreography.html#choreography-creation - * unbounded Whether or not the ripple bleeds out of the bounds of the element. - * disabled Whether or not the ripple is attached to a disabled component. - */ - export interface MDCRippleCapableSurface { - root: Element; - unbounded?: boolean; - disabled?: boolean; - } -} -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.js deleted file mode 100644 index 6fadddf..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.js +++ /dev/null
@@ -1,1423 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["ripple"] = factory(); - else - root["mdc"] = root["mdc"] || {}, root["mdc"]["ripple"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-ripple/index.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./packages/mdc-base/component.ts": -/*!****************************************!*\ - !*** ./packages/mdc-base/component.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var __read = this && this.__read || function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), - r, - ar = [], - e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { - ar.push(r.value); - } - } catch (error) { - e = { error: error }; - } finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } finally { - if (e) throw e.error; - } - } - return ar; -}; -var __spread = this && this.__spread || function () { - for (var ar = [], i = 0; i < arguments.length; i++) { - ar = ar.concat(__read(arguments[i])); - }return ar; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"); -var MDCComponent = /** @class */function () { - function MDCComponent(root, foundation) { - var args = []; - for (var _i = 2; _i < arguments.length; _i++) { - args[_i - 2] = arguments[_i]; - } - this.root = root; - this.initialize.apply(this, __spread(args)); - // Note that we initialize foundation here and not within the constructor's default param so that - // this.root_ is defined and can be used within the foundation class. - this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; - this.foundation.init(); - this.initialSyncWithDOM(); - } - MDCComponent.attachTo = function (root) { - // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and - // returns an instantiated component with its root set to that element. Also note that in the cases of - // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized - // from getDefaultFoundation(). - return new MDCComponent(root, new foundation_1.MDCFoundation({})); - }; - /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ - MDCComponent.prototype.initialize = function () { - var _args = []; - for (var _i = 0; _i < arguments.length; _i++) { - _args[_i] = arguments[_i]; - } - // Subclasses can override this to do any additional setup work that would be considered part of a - // "constructor". Essentially, it is a hook into the parent constructor before the foundation is - // initialized. Any additional arguments besides root and foundation will be passed in here. - }; - MDCComponent.prototype.getDefaultFoundation = function () { - // Subclasses must override this method to return a properly configured foundation class for the - // component. - throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); - }; - MDCComponent.prototype.initialSyncWithDOM = function () { - // Subclasses should override this method if they need to perform work to synchronize with a host DOM - // object. An example of this would be a form control wrapper that needs to synchronize its internal state - // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM - // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. - }; - MDCComponent.prototype.destroy = function () { - // Subclasses may implement this method to release any resources / deregister any listeners they have - // attached. An example of this might be deregistering a resize event from the window object. - this.foundation.destroy(); - }; - MDCComponent.prototype.listen = function (evtType, handler, options) { - this.root.addEventListener(evtType, handler, options); - }; - MDCComponent.prototype.unlisten = function (evtType, handler, options) { - this.root.removeEventListener(evtType, handler, options); - }; - /** - * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. - */ - MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { - if (shouldBubble === void 0) { - shouldBubble = false; - } - var evt; - if (typeof CustomEvent === 'function') { - evt = new CustomEvent(evtType, { - bubbles: shouldBubble, - detail: evtData - }); - } else { - evt = document.createEvent('CustomEvent'); - evt.initCustomEvent(evtType, shouldBubble, false, evtData); - } - this.root.dispatchEvent(evt); - }; - return MDCComponent; -}(); -exports.MDCComponent = MDCComponent; -// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. -exports.default = MDCComponent; - -/***/ }), - -/***/ "./packages/mdc-base/foundation.ts": -/*!*****************************************!*\ - !*** ./packages/mdc-base/foundation.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -var MDCFoundation = /** @class */function () { - function MDCFoundation(adapter) { - if (adapter === void 0) { - adapter = {}; - } - this.adapter = adapter; - } - Object.defineProperty(MDCFoundation, "cssClasses", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports every - // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "strings", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports all - // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "numbers", { - get: function get() { - // Classes extending MDCFoundation should implement this method to return an object which exports all - // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350} - return {}; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCFoundation, "defaultAdapter", { - get: function get() { - // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient - // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter - // validation. - return {}; - }, - enumerable: true, - configurable: true - }); - MDCFoundation.prototype.init = function () { - // Subclasses should override this method to perform initialization routines (registering events, etc.) - }; - MDCFoundation.prototype.destroy = function () { - // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) - }; - return MDCFoundation; -}(); -exports.MDCFoundation = MDCFoundation; -// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. -exports.default = MDCFoundation; - -/***/ }), - -/***/ "./packages/mdc-dom/events.ts": -/*!************************************!*\ - !*** ./packages/mdc-dom/events.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Determine whether the current browser supports passive event listeners, and - * if so, use them. - */ -function applyPassive(globalObj) { - if (globalObj === void 0) { - globalObj = window; - } - return supportsPassiveOption(globalObj) ? { passive: true } : false; -} -exports.applyPassive = applyPassive; -function supportsPassiveOption(globalObj) { - if (globalObj === void 0) { - globalObj = window; - } - // See - // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener - var passiveSupported = false; - try { - var options = { - // This function will be called when the browser - // attempts to access the passive property. - get passive() { - passiveSupported = true; - return false; - } - }; - var handler = function handler() {}; - globalObj.document.addEventListener('test', handler, options); - globalObj.document.removeEventListener('test', handler, options); - } catch (err) { - passiveSupported = false; - } - return passiveSupported; -} - -/***/ }), - -/***/ "./packages/mdc-dom/ponyfill.ts": -/*!**************************************!*\ - !*** ./packages/mdc-dom/ponyfill.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2018 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. - * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. - */ -function closest(element, selector) { - if (element.closest) { - return element.closest(selector); - } - var el = element; - while (el) { - if (matches(el, selector)) { - return el; - } - el = el.parentElement; - } - return null; -} -exports.closest = closest; -function matches(element, selector) { - var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; - return nativeMatches.call(element, selector); -} -exports.matches = matches; -/** - * Used to compute the estimated scroll width of elements. When an element is - * hidden due to display: none; being applied to a parent element, the width is - * returned as 0. However, the element will have a true width once no longer - * inside a display: none context. This method computes an estimated width when - * the element is hidden or returns the true width when the element is visble. - * @param {Element} element the element whose width to estimate - */ -function estimateScrollWidth(element) { - // Check the offsetParent. If the element inherits display: none from any - // parent, the offsetParent property will be null (see - // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). - // This check ensures we only clone the node when necessary. - var htmlEl = element; - if (htmlEl.offsetParent !== null) { - return htmlEl.scrollWidth; - } - var clone = htmlEl.cloneNode(true); - clone.style.setProperty('position', 'absolute'); - clone.style.setProperty('transform', 'translate(-9999px, -9999px)'); - document.documentElement.appendChild(clone); - var scrollWidth = clone.scrollWidth; - document.documentElement.removeChild(clone); - return scrollWidth; -} -exports.estimateScrollWidth = estimateScrollWidth; - -/***/ }), - -/***/ "./packages/mdc-ripple/component.ts": -/*!******************************************!*\ - !*** ./packages/mdc-ripple/component.ts ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var __extends = this && this.__extends || function () { - var _extendStatics = function extendStatics(d, b) { - _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { - d.__proto__ = b; - } || function (d, b) { - for (var p in b) { - if (b.hasOwnProperty(p)) d[p] = b[p]; - } - }; - return _extendStatics(d, b); - }; - return function (d, b) { - _extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -}(); -var __importStar = this && this.__importStar || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) { - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - }result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); -var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); -var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); -var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"); -var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); -var MDCRipple = /** @class */function (_super) { - __extends(MDCRipple, _super); - function MDCRipple() { - var _this = _super !== null && _super.apply(this, arguments) || this; - _this.disabled = false; - return _this; - } - MDCRipple.attachTo = function (root, opts) { - if (opts === void 0) { - opts = { isUnbounded: undefined }; - } - var ripple = new MDCRipple(root); - // Only override unbounded behavior if option is explicitly specified - if (opts.isUnbounded !== undefined) { - ripple.unbounded = opts.isUnbounded; - } - return ripple; - }; - MDCRipple.createAdapter = function (instance) { - return { - addClass: function addClass(className) { - return instance.root.classList.add(className); - }, - browserSupportsCssVars: function browserSupportsCssVars() { - return util.supportsCssVariables(window); - }, - computeBoundingRect: function computeBoundingRect() { - return instance.root.getBoundingClientRect(); - }, - containsEventTarget: function containsEventTarget(target) { - return instance.root.contains(target); - }, - deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { - return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive()); - }, - deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { - return instance.root.removeEventListener(evtType, handler, events_1.applyPassive()); - }, - deregisterResizeHandler: function deregisterResizeHandler(handler) { - return window.removeEventListener('resize', handler); - }, - getWindowPageOffset: function getWindowPageOffset() { - return { x: window.pageXOffset, y: window.pageYOffset }; - }, - isSurfaceActive: function isSurfaceActive() { - return ponyfill_1.matches(instance.root, ':active'); - }, - isSurfaceDisabled: function isSurfaceDisabled() { - return Boolean(instance.disabled); - }, - isUnbounded: function isUnbounded() { - return Boolean(instance.unbounded); - }, - registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { - return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive()); - }, - registerInteractionHandler: function registerInteractionHandler(evtType, handler) { - return instance.root.addEventListener(evtType, handler, events_1.applyPassive()); - }, - registerResizeHandler: function registerResizeHandler(handler) { - return window.addEventListener('resize', handler); - }, - removeClass: function removeClass(className) { - return instance.root.classList.remove(className); - }, - updateCssVariable: function updateCssVariable(varName, value) { - return instance.root.style.setProperty(varName, value); - } - }; - }; - Object.defineProperty(MDCRipple.prototype, "unbounded", { - get: function get() { - return Boolean(this.unbounded_); - }, - set: function set(unbounded) { - this.unbounded_ = Boolean(unbounded); - this.setUnbounded_(); - }, - enumerable: true, - configurable: true - }); - MDCRipple.prototype.activate = function () { - this.foundation.activate(); - }; - MDCRipple.prototype.deactivate = function () { - this.foundation.deactivate(); - }; - MDCRipple.prototype.layout = function () { - this.foundation.layout(); - }; - MDCRipple.prototype.getDefaultFoundation = function () { - return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this)); - }; - MDCRipple.prototype.initialSyncWithDOM = function () { - var root = this.root; - this.unbounded = 'mdcRippleIsUnbounded' in root.dataset; - }; - /** - * Closure Compiler throws an access control error when directly accessing a - * protected or private property inside a getter/setter, like unbounded above. - * By accessing the protected property inside a method, we solve that problem. - * That's why this function exists. - */ - MDCRipple.prototype.setUnbounded_ = function () { - this.foundation.setUnbounded(Boolean(this.unbounded_)); - }; - return MDCRipple; -}(component_1.MDCComponent); -exports.MDCRipple = MDCRipple; - -/***/ }), - -/***/ "./packages/mdc-ripple/constants.ts": -/*!******************************************!*\ - !*** ./packages/mdc-ripple/constants.ts ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.cssClasses = { - // Ripple is a special case where the "root" component is really a "mixin" of sorts, - // given that it's an 'upgrade' to an existing component. That being said it is the root - // CSS class that all other CSS classes derive from. - BG_FOCUSED: 'mdc-ripple-upgraded--background-focused', - FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation', - FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation', - ROOT: 'mdc-ripple-upgraded', - UNBOUNDED: 'mdc-ripple-upgraded--unbounded' -}; -exports.strings = { - VAR_FG_SCALE: '--mdc-ripple-fg-scale', - VAR_FG_SIZE: '--mdc-ripple-fg-size', - VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end', - VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start', - VAR_LEFT: '--mdc-ripple-left', - VAR_TOP: '--mdc-ripple-top' -}; -exports.numbers = { - DEACTIVATION_TIMEOUT_MS: 225, - FG_DEACTIVATION_MS: 150, - INITIAL_ORIGIN_SCALE: 0.6, - PADDING: 10, - TAP_DELAY_MS: 300 -}; - -/***/ }), - -/***/ "./packages/mdc-ripple/foundation.ts": -/*!*******************************************!*\ - !*** ./packages/mdc-ripple/foundation.ts ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2016 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -var __extends = this && this.__extends || function () { - var _extendStatics = function extendStatics(d, b) { - _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { - d.__proto__ = b; - } || function (d, b) { - for (var p in b) { - if (b.hasOwnProperty(p)) d[p] = b[p]; - } - }; - return _extendStatics(d, b); - }; - return function (d, b) { - _extendStatics(d, b); - function __() { - this.constructor = d; - } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -}(); -var __assign = this && this.__assign || function () { - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) { - if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - } - return t; - }; - return __assign.apply(this, arguments); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); -var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts"); -var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"); -// Activation events registered on the root element of each instance for activation -var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown']; -// Deactivation events registered on documentElement when a pointer-related down event occurs -var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu']; -// simultaneous nested activations -var activatedTargets = []; -var MDCRippleFoundation = /** @class */function (_super) { - __extends(MDCRippleFoundation, _super); - function MDCRippleFoundation(adapter) { - var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this; - _this.activationAnimationHasEnded_ = false; - _this.activationTimer_ = 0; - _this.fgDeactivationRemovalTimer_ = 0; - _this.fgScale_ = '0'; - _this.frame_ = { width: 0, height: 0 }; - _this.initialSize_ = 0; - _this.layoutFrame_ = 0; - _this.maxRadius_ = 0; - _this.unboundedCoords_ = { left: 0, top: 0 }; - _this.activationState_ = _this.defaultActivationState_(); - _this.activationTimerCallback_ = function () { - _this.activationAnimationHasEnded_ = true; - _this.runDeactivationUXLogicIfReady_(); - }; - _this.activateHandler_ = function (e) { - return _this.activate_(e); - }; - _this.deactivateHandler_ = function () { - return _this.deactivate_(); - }; - _this.focusHandler_ = function () { - return _this.handleFocus(); - }; - _this.blurHandler_ = function () { - return _this.handleBlur(); - }; - _this.resizeHandler_ = function () { - return _this.layout(); - }; - return _this; - } - Object.defineProperty(MDCRippleFoundation, "cssClasses", { - get: function get() { - return constants_1.cssClasses; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCRippleFoundation, "strings", { - get: function get() { - return constants_1.strings; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCRippleFoundation, "numbers", { - get: function get() { - return constants_1.numbers; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { - get: function get() { - return { - addClass: function addClass() { - return undefined; - }, - browserSupportsCssVars: function browserSupportsCssVars() { - return true; - }, - computeBoundingRect: function computeBoundingRect() { - return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }; - }, - containsEventTarget: function containsEventTarget() { - return true; - }, - deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() { - return undefined; - }, - deregisterInteractionHandler: function deregisterInteractionHandler() { - return undefined; - }, - deregisterResizeHandler: function deregisterResizeHandler() { - return undefined; - }, - getWindowPageOffset: function getWindowPageOffset() { - return { x: 0, y: 0 }; - }, - isSurfaceActive: function isSurfaceActive() { - return true; - }, - isSurfaceDisabled: function isSurfaceDisabled() { - return true; - }, - isUnbounded: function isUnbounded() { - return true; - }, - registerDocumentInteractionHandler: function registerDocumentInteractionHandler() { - return undefined; - }, - registerInteractionHandler: function registerInteractionHandler() { - return undefined; - }, - registerResizeHandler: function registerResizeHandler() { - return undefined; - }, - removeClass: function removeClass() { - return undefined; - }, - updateCssVariable: function updateCssVariable() { - return undefined; - } - }; - }, - enumerable: true, - configurable: true - }); - MDCRippleFoundation.prototype.init = function () { - var _this = this; - var supportsPressRipple = this.supportsPressRipple_(); - this.registerRootHandlers_(supportsPressRipple); - if (supportsPressRipple) { - var _a = MDCRippleFoundation.cssClasses, - ROOT_1 = _a.ROOT, - UNBOUNDED_1 = _a.UNBOUNDED; - requestAnimationFrame(function () { - _this.adapter.addClass(ROOT_1); - if (_this.adapter.isUnbounded()) { - _this.adapter.addClass(UNBOUNDED_1); - // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple - _this.layoutInternal_(); - } - }); - } - }; - MDCRippleFoundation.prototype.destroy = function () { - var _this = this; - if (this.supportsPressRipple_()) { - if (this.activationTimer_) { - clearTimeout(this.activationTimer_); - this.activationTimer_ = 0; - this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); - } - if (this.fgDeactivationRemovalTimer_) { - clearTimeout(this.fgDeactivationRemovalTimer_); - this.fgDeactivationRemovalTimer_ = 0; - this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); - } - var _a = MDCRippleFoundation.cssClasses, - ROOT_2 = _a.ROOT, - UNBOUNDED_2 = _a.UNBOUNDED; - requestAnimationFrame(function () { - _this.adapter.removeClass(ROOT_2); - _this.adapter.removeClass(UNBOUNDED_2); - _this.removeCssVars_(); - }); - } - this.deregisterRootHandlers_(); - this.deregisterDeactivationHandlers_(); - }; - /** - * @param evt Optional event containing position information. - */ - MDCRippleFoundation.prototype.activate = function (evt) { - this.activate_(evt); - }; - MDCRippleFoundation.prototype.deactivate = function () { - this.deactivate_(); - }; - MDCRippleFoundation.prototype.layout = function () { - var _this = this; - if (this.layoutFrame_) { - cancelAnimationFrame(this.layoutFrame_); - } - this.layoutFrame_ = requestAnimationFrame(function () { - _this.layoutInternal_(); - _this.layoutFrame_ = 0; - }); - }; - MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { - var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED; - if (unbounded) { - this.adapter.addClass(UNBOUNDED); - } else { - this.adapter.removeClass(UNBOUNDED); - } - }; - MDCRippleFoundation.prototype.handleFocus = function () { - var _this = this; - requestAnimationFrame(function () { - return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); - }); - }; - MDCRippleFoundation.prototype.handleBlur = function () { - var _this = this; - requestAnimationFrame(function () { - return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED); - }); - }; - /** - * We compute this property so that we are not querying information about the client - * until the point in time where the foundation requests it. This prevents scenarios where - * client-side feature-detection may happen too early, such as when components are rendered on the server - * and then initialized at mount time on the client. - */ - MDCRippleFoundation.prototype.supportsPressRipple_ = function () { - return this.adapter.browserSupportsCssVars(); - }; - MDCRippleFoundation.prototype.defaultActivationState_ = function () { - return { - activationEvent: undefined, - hasDeactivationUXRun: false, - isActivated: false, - isProgrammatic: false, - wasActivatedByPointer: false, - wasElementMadeActive: false - }; - }; - /** - * supportsPressRipple Passed from init to save a redundant function call - */ - MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { - var _this = this; - if (supportsPressRipple) { - ACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_); - }); - if (this.adapter.isUnbounded()) { - this.adapter.registerResizeHandler(this.resizeHandler_); - } - } - this.adapter.registerInteractionHandler('focus', this.focusHandler_); - this.adapter.registerInteractionHandler('blur', this.blurHandler_); - }; - MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { - var _this = this; - if (evt.type === 'keydown') { - this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_); - } else { - POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); - }); - } - }; - MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { - var _this = this; - ACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_); - }); - this.adapter.deregisterInteractionHandler('focus', this.focusHandler_); - this.adapter.deregisterInteractionHandler('blur', this.blurHandler_); - if (this.adapter.isUnbounded()) { - this.adapter.deregisterResizeHandler(this.resizeHandler_); - } - }; - MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { - var _this = this; - this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_); - POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); - }); - }; - MDCRippleFoundation.prototype.removeCssVars_ = function () { - var _this = this; - var rippleStrings = MDCRippleFoundation.strings; - var keys = Object.keys(rippleStrings); - keys.forEach(function (key) { - if (key.indexOf('VAR_') === 0) { - _this.adapter.updateCssVariable(rippleStrings[key], null); - } - }); - }; - MDCRippleFoundation.prototype.activate_ = function (evt) { - var _this = this; - if (this.adapter.isSurfaceDisabled()) { - return; - } - var activationState = this.activationState_; - if (activationState.isActivated) { - return; - } - // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction - var previousActivationEvent = this.previousActivationEvent_; - var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; - if (isSameInteraction) { - return; - } - activationState.isActivated = true; - activationState.isProgrammatic = evt === undefined; - activationState.activationEvent = evt; - activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown'); - var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) { - return _this.adapter.containsEventTarget(target); - }); - if (hasActivatedChild) { - // Immediately reset activation state, while preserving logic that prevents touch follow-on events - this.resetActivationState_(); - return; - } - if (evt !== undefined) { - activatedTargets.push(evt.target); - this.registerDeactivationHandlers_(evt); - } - activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); - if (activationState.wasElementMadeActive) { - this.animateActivation_(); - } - requestAnimationFrame(function () { - // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples - activatedTargets = []; - if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) { - // If space was pressed, try again within an rAF call to detect :active, because different UAs report - // active states inconsistently when they're called within event handling code: - // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971 - // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 - // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS - // variable is set within a rAF callback for a submit button interaction (#2241). - activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); - if (activationState.wasElementMadeActive) { - _this.animateActivation_(); - } - } - if (!activationState.wasElementMadeActive) { - // Reset activation state immediately if element was not made active. - _this.activationState_ = _this.defaultActivationState_(); - } - }); - }; - MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { - return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true; - }; - MDCRippleFoundation.prototype.animateActivation_ = function () { - var _this = this; - var _a = MDCRippleFoundation.strings, - VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, - VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; - var _b = MDCRippleFoundation.cssClasses, - FG_DEACTIVATION = _b.FG_DEACTIVATION, - FG_ACTIVATION = _b.FG_ACTIVATION; - var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; - this.layoutInternal_(); - var translateStart = ''; - var translateEnd = ''; - if (!this.adapter.isUnbounded()) { - var _c = this.getFgTranslationCoordinates_(), - startPoint = _c.startPoint, - endPoint = _c.endPoint; - translateStart = startPoint.x + "px, " + startPoint.y + "px"; - translateEnd = endPoint.x + "px, " + endPoint.y + "px"; - } - this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); - this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); - // Cancel any ongoing activation/deactivation animations - clearTimeout(this.activationTimer_); - clearTimeout(this.fgDeactivationRemovalTimer_); - this.rmBoundedActivationClasses_(); - this.adapter.removeClass(FG_DEACTIVATION); - // Force layout in order to re-trigger the animation. - this.adapter.computeBoundingRect(); - this.adapter.addClass(FG_ACTIVATION); - this.activationTimer_ = setTimeout(function () { - return _this.activationTimerCallback_(); - }, DEACTIVATION_TIMEOUT_MS); - }; - MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { - var _a = this.activationState_, - activationEvent = _a.activationEvent, - wasActivatedByPointer = _a.wasActivatedByPointer; - var startPoint; - if (wasActivatedByPointer) { - startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()); - } else { - startPoint = { - x: this.frame_.width / 2, - y: this.frame_.height / 2 - }; - } - // Center the element around the start point. - startPoint = { - x: startPoint.x - this.initialSize_ / 2, - y: startPoint.y - this.initialSize_ / 2 - }; - var endPoint = { - x: this.frame_.width / 2 - this.initialSize_ / 2, - y: this.frame_.height / 2 - this.initialSize_ / 2 - }; - return { startPoint: startPoint, endPoint: endPoint }; - }; - MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { - var _this = this; - // This method is called both when a pointing device is released, and when the activation animation ends. - // The deactivation animation should only run after both of those occur. - var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; - var _a = this.activationState_, - hasDeactivationUXRun = _a.hasDeactivationUXRun, - isActivated = _a.isActivated; - var activationHasEnded = hasDeactivationUXRun || !isActivated; - if (activationHasEnded && this.activationAnimationHasEnded_) { - this.rmBoundedActivationClasses_(); - this.adapter.addClass(FG_DEACTIVATION); - this.fgDeactivationRemovalTimer_ = setTimeout(function () { - _this.adapter.removeClass(FG_DEACTIVATION); - }, constants_1.numbers.FG_DEACTIVATION_MS); - } - }; - MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { - var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; - this.adapter.removeClass(FG_ACTIVATION); - this.activationAnimationHasEnded_ = false; - this.adapter.computeBoundingRect(); - }; - MDCRippleFoundation.prototype.resetActivationState_ = function () { - var _this = this; - this.previousActivationEvent_ = this.activationState_.activationEvent; - this.activationState_ = this.defaultActivationState_(); - // Touch devices may fire additional events for the same interaction within a short time. - // Store the previous event until it's safe to assume that subsequent events are for new interactions. - setTimeout(function () { - return _this.previousActivationEvent_ = undefined; - }, MDCRippleFoundation.numbers.TAP_DELAY_MS); - }; - MDCRippleFoundation.prototype.deactivate_ = function () { - var _this = this; - var activationState = this.activationState_; - // This can happen in scenarios such as when you have a keyup event that blurs the element. - if (!activationState.isActivated) { - return; - } - var state = __assign({}, activationState); - if (activationState.isProgrammatic) { - requestAnimationFrame(function () { - return _this.animateDeactivation_(state); - }); - this.resetActivationState_(); - } else { - this.deregisterDeactivationHandlers_(); - requestAnimationFrame(function () { - _this.activationState_.hasDeactivationUXRun = true; - _this.animateDeactivation_(state); - _this.resetActivationState_(); - }); - } - }; - MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { - var wasActivatedByPointer = _a.wasActivatedByPointer, - wasElementMadeActive = _a.wasElementMadeActive; - if (wasActivatedByPointer || wasElementMadeActive) { - this.runDeactivationUXLogicIfReady_(); - } - }; - MDCRippleFoundation.prototype.layoutInternal_ = function () { - var _this = this; - this.frame_ = this.adapter.computeBoundingRect(); - var maxDim = Math.max(this.frame_.height, this.frame_.width); - // Surface diameter is treated differently for unbounded vs. bounded ripples. - // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately - // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically - // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter - // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via - // `overflow: hidden`. - var getBoundedRadius = function getBoundedRadius() { - var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); - return hypotenuse + MDCRippleFoundation.numbers.PADDING; - }; - this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); - // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform - var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); - // Unbounded ripple size should always be even number to equally center align. - if (this.adapter.isUnbounded() && initialSize % 2 !== 0) { - this.initialSize_ = initialSize - 1; - } else { - this.initialSize_ = initialSize; - } - this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; - this.updateLayoutCssVars_(); - }; - MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { - var _a = MDCRippleFoundation.strings, - VAR_FG_SIZE = _a.VAR_FG_SIZE, - VAR_LEFT = _a.VAR_LEFT, - VAR_TOP = _a.VAR_TOP, - VAR_FG_SCALE = _a.VAR_FG_SCALE; - this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); - this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_); - if (this.adapter.isUnbounded()) { - this.unboundedCoords_ = { - left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2), - top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2) - }; - this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); - this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); - } - }; - return MDCRippleFoundation; -}(foundation_1.MDCFoundation); -exports.MDCRippleFoundation = MDCRippleFoundation; -// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. -exports.default = MDCRippleFoundation; - -/***/ }), - -/***/ "./packages/mdc-ripple/index.ts": -/*!**************************************!*\ - !*** ./packages/mdc-ripple/index.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * @license - * Copyright 2019 Google Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -function __export(m) { - for (var p in m) { - if (!exports.hasOwnProperty(p)) exports[p] = m[p]; - } -} -var __importStar = this && this.__importStar || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) { - if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - }result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); -exports.util = util; -__export(__webpack_require__(/*! ./component */ "./packages/mdc-ripple/component.ts")); -__export(__webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts")); -__export(__webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts")); - -/***/ }), - -/***/ "./packages/mdc-ripple/util.ts": -/*!*************************************!*\ - !*** ./packages/mdc-ripple/util.ts ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Stores result from supportsCssVariables to avoid redundant processing to - * detect CSS custom variable support. - */ -var supportsCssVariables_; -function supportsCssVariables(windowObj, forceRefresh) { - if (forceRefresh === void 0) { - forceRefresh = false; - } - var CSS = windowObj.CSS; - var supportsCssVars = supportsCssVariables_; - if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) { - return supportsCssVariables_; - } - var supportsFunctionPresent = CSS && typeof CSS.supports === 'function'; - if (!supportsFunctionPresent) { - return false; - } - var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes'); - // See: https://bugs.webkit.org/show_bug.cgi?id=154669 - // See: README section on Safari - var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000'); - supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus; - if (!forceRefresh) { - supportsCssVariables_ = supportsCssVars; - } - return supportsCssVars; -} -exports.supportsCssVariables = supportsCssVariables; -function getNormalizedEventCoords(evt, pageOffset, clientRect) { - if (!evt) { - return { x: 0, y: 0 }; - } - var x = pageOffset.x, - y = pageOffset.y; - var documentX = x + clientRect.left; - var documentY = y + clientRect.top; - var normalizedX; - var normalizedY; - // Determine touch point relative to the ripple container. - if (evt.type === 'touchstart') { - var touchEvent = evt; - normalizedX = touchEvent.changedTouches[0].pageX - documentX; - normalizedY = touchEvent.changedTouches[0].pageY - documentY; - } else { - var mouseEvent = evt; - normalizedX = mouseEvent.pageX - documentX; - normalizedY = mouseEvent.pageY - documentY; - } - return { x: normalizedX, y: normalizedY }; -} -exports.getNormalizedEventCoords = getNormalizedEventCoords; - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=mdc.ripple.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.css b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.css deleted file mode 100644 index 9472f6c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.css +++ /dev/null
@@ -1,10 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -@-webkit-keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-radius-in{from{-webkit-animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{-webkit-transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@-webkit-keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-in{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@-webkit-keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}@keyframes mdc-ripple-fg-opacity-out{from{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-ripple-surface{--mdc-ripple-fg-size: 0;--mdc-ripple-left: 0;--mdc-ripple-top: 0;--mdc-ripple-fg-scale: 1;--mdc-ripple-fg-translate-end: 0;--mdc-ripple-fg-translate-start: 0;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:transform,opacity;position:relative;outline:none;overflow:hidden}.mdc-ripple-surface::before,.mdc-ripple-surface::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-ripple-surface::before{transition:opacity 15ms linear,background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-ripple-surface::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-ripple-surface.mdc-ripple-upgraded::before{-webkit-transform:scale(var(--mdc-ripple-fg-scale, 1));transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface.mdc-ripple-upgraded::after{top:0;left:0;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center center;transform-origin:center center}.mdc-ripple-surface.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-activation::after{-webkit-animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards;animation:mdc-ripple-fg-radius-in 225ms forwards,mdc-ripple-fg-opacity-in 75ms forwards}.mdc-ripple-surface.mdc-ripple-upgraded--foreground-deactivation::after{-webkit-animation:mdc-ripple-fg-opacity-out 150ms;animation:mdc-ripple-fg-opacity-out 150ms;-webkit-transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-ripple-surface::before,.mdc-ripple-surface::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-ripple-surface:hover::before,.mdc-ripple-surface.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-ripple-surface.mdc-ripple-upgraded--background-focused::before,.mdc-ripple-surface:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-ripple-surface:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-ripple-surface:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface.mdc-ripple-upgraded{--mdc-ripple-fg-opacity: var(--mdc-ripple-press-opacity, 0.12)}.mdc-ripple-surface::before,.mdc-ripple-surface::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-ripple-surface.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded],.mdc-ripple-upgraded--unbounded{overflow:visible}.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded]::after,.mdc-ripple-upgraded--unbounded::before,.mdc-ripple-upgraded--unbounded::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::before,.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::before,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-ripple-surface[data-mdc-ripple-is-unbounded].mdc-ripple-upgraded::after,.mdc-ripple-upgraded--unbounded.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)} - -/*# sourceMappingURL=mdc.ripple.min.css.map*/ \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.js deleted file mode 100644 index 4ba0e0ed..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/dist/mdc.ripple.min.js +++ /dev/null
@@ -1 +0,0 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ripple=e():(t.mdc=t.mdc||{},t.mdc.ripple=e())}(this,function(){return i={},r.m=n={0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=(Object.defineProperty(r,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(r,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),r.prototype.init=function(){},r.prototype.destroy=function(){},r);function r(t){void 0===t&&(t={}),this.adapter=t}e.MDCFoundation=i,e.default=i},1:function(t,e,n){"use strict";var i=this&&this.__read||function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,a=n.call(t),o=[];try{for(;(void 0===e||0<e--)&&!(i=a.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},r=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(i(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0});var a=n(0),o=(s.attachTo=function(t){return new s(t,new a.MDCFoundation({}))},s.prototype.initialize=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},s.prototype.getDefaultFoundation=function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")},s.prototype.initialSyncWithDOM=function(){},s.prototype.destroy=function(){this.foundation.destroy()},s.prototype.listen=function(t,e,n){this.root.addEventListener(t,e,n)},s.prototype.unlisten=function(t,e,n){this.root.removeEventListener(t,e,n)},s.prototype.emit=function(t,e,n){var i;void 0===n&&(n=!1),"function"==typeof CustomEvent?i=new CustomEvent(t,{bubbles:n,detail:e}):(i=document.createEvent("CustomEvent")).initCustomEvent(t,n,!1,e),this.root.dispatchEvent(i)},s);function s(t,e){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];this.root=t,this.initialize.apply(this,r(n)),this.foundation=void 0===e?this.getDefaultFoundation():e,this.foundation.init(),this.initialSyncWithDOM()}e.MDCComponent=o,e.default=o},158:function(t,n,e){"use strict";function i(t){for(var e in t)n.hasOwnProperty(e)||(n[e]=t[e])}var r=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(n,"__esModule",{value:!0});var a=r(e(3));n.util=a,i(e(6)),i(e(7)),i(e(4))},2:function(t,e,n){"use strict";function i(t,e){return(t.matches||t.webkitMatchesSelector||t.msMatchesSelector).call(t,e)}Object.defineProperty(e,"__esModule",{value:!0}),e.closest=function(t,e){if(t.closest)return t.closest(e);for(var n=t;n;){if(i(n,e))return n;n=n.parentElement}return null},e.matches=i,e.estimateScrollWidth=function(t){var e=t;if(null!==e.offsetParent)return e.scrollWidth;var n=e.cloneNode(!0);n.style.setProperty("position","absolute"),n.style.setProperty("transform","translate(-9999px, -9999px)"),document.documentElement.appendChild(n);var i=n.scrollWidth;return document.documentElement.removeChild(n),i}},3:function(t,e,n){"use strict";var o;Object.defineProperty(e,"__esModule",{value:!0}),e.supportsCssVariables=function(t,e){void 0===e&&(e=!1);var n,i=t.CSS;if("boolean"==typeof o&&!e)return o;if(!(i&&"function"==typeof i.supports))return!1;var r=i.supports("--css-vars","yes"),a=i.supports("(--css-vars: yes)")&&i.supports("color","#00000000");return n=r||a,e||(o=n),n},e.getNormalizedEventCoords=function(t,e,n){if(!t)return{x:0,y:0};var i,r,a=e.x,o=e.y,s=a+n.left,u=o+n.top;if("touchstart"===t.type){var c=t;i=c.changedTouches[0].pageX-s,r=c.changedTouches[0].pageY-u}else{var d=t;i=d.pageX-s,r=d.pageY-u}return{x:i,y:r}}},4:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(0),u=n(7),c=n(3),d=["touchstart","pointerdown","mousedown","keydown"],l=["touchend","pointerup","mouseup","contextmenu"],p=[],f=(o=s.MDCFoundation,r(v,o),Object.defineProperty(v,"cssClasses",{get:function(){return u.cssClasses},enumerable:!0,configurable:!0}),Object.defineProperty(v,"strings",{get:function(){return u.strings},enumerable:!0,configurable:!0}),Object.defineProperty(v,"numbers",{get:function(){return u.numbers},enumerable:!0,configurable:!0}),Object.defineProperty(v,"defaultAdapter",{get:function(){return{addClass:function(){},browserSupportsCssVars:function(){return!0},computeBoundingRect:function(){return{top:0,right:0,bottom:0,left:0,width:0,height:0}},containsEventTarget:function(){return!0},deregisterDocumentInteractionHandler:function(){},deregisterInteractionHandler:function(){},deregisterResizeHandler:function(){},getWindowPageOffset:function(){return{x:0,y:0}},isSurfaceActive:function(){return!0},isSurfaceDisabled:function(){return!0},isUnbounded:function(){return!0},registerDocumentInteractionHandler:function(){},registerInteractionHandler:function(){},registerResizeHandler:function(){},removeClass:function(){},updateCssVariable:function(){}}},enumerable:!0,configurable:!0}),v.prototype.init=function(){var t=this,e=this.supportsPressRipple_();if(this.registerRootHandlers_(e),e){var n=v.cssClasses,i=n.ROOT,r=n.UNBOUNDED;requestAnimationFrame(function(){t.adapter.addClass(i),t.adapter.isUnbounded()&&(t.adapter.addClass(r),t.layoutInternal_())})}},v.prototype.destroy=function(){var t=this;if(this.supportsPressRipple_()){this.activationTimer_&&(clearTimeout(this.activationTimer_),this.activationTimer_=0,this.adapter.removeClass(v.cssClasses.FG_ACTIVATION)),this.fgDeactivationRemovalTimer_&&(clearTimeout(this.fgDeactivationRemovalTimer_),this.fgDeactivationRemovalTimer_=0,this.adapter.removeClass(v.cssClasses.FG_DEACTIVATION));var e=v.cssClasses,n=e.ROOT,i=e.UNBOUNDED;requestAnimationFrame(function(){t.adapter.removeClass(n),t.adapter.removeClass(i),t.removeCssVars_()})}this.deregisterRootHandlers_(),this.deregisterDeactivationHandlers_()},v.prototype.activate=function(t){this.activate_(t)},v.prototype.deactivate=function(){this.deactivate_()},v.prototype.layout=function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){t.layoutInternal_(),t.layoutFrame_=0})},v.prototype.setUnbounded=function(t){var e=v.cssClasses.UNBOUNDED;t?this.adapter.addClass(e):this.adapter.removeClass(e)},v.prototype.handleFocus=function(){var t=this;requestAnimationFrame(function(){return t.adapter.addClass(v.cssClasses.BG_FOCUSED)})},v.prototype.handleBlur=function(){var t=this;requestAnimationFrame(function(){return t.adapter.removeClass(v.cssClasses.BG_FOCUSED)})},v.prototype.supportsPressRipple_=function(){return this.adapter.browserSupportsCssVars()},v.prototype.defaultActivationState_=function(){return{activationEvent:void 0,hasDeactivationUXRun:!1,isActivated:!1,isProgrammatic:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1}},v.prototype.registerRootHandlers_=function(t){var e=this;t&&(d.forEach(function(t){e.adapter.registerInteractionHandler(t,e.activateHandler_)}),this.adapter.isUnbounded()&&this.adapter.registerResizeHandler(this.resizeHandler_)),this.adapter.registerInteractionHandler("focus",this.focusHandler_),this.adapter.registerInteractionHandler("blur",this.blurHandler_)},v.prototype.registerDeactivationHandlers_=function(t){var e=this;"keydown"===t.type?this.adapter.registerInteractionHandler("keyup",this.deactivateHandler_):l.forEach(function(t){e.adapter.registerDocumentInteractionHandler(t,e.deactivateHandler_)})},v.prototype.deregisterRootHandlers_=function(){var e=this;d.forEach(function(t){e.adapter.deregisterInteractionHandler(t,e.activateHandler_)}),this.adapter.deregisterInteractionHandler("focus",this.focusHandler_),this.adapter.deregisterInteractionHandler("blur",this.blurHandler_),this.adapter.isUnbounded()&&this.adapter.deregisterResizeHandler(this.resizeHandler_)},v.prototype.deregisterDeactivationHandlers_=function(){var e=this;this.adapter.deregisterInteractionHandler("keyup",this.deactivateHandler_),l.forEach(function(t){e.adapter.deregisterDocumentInteractionHandler(t,e.deactivateHandler_)})},v.prototype.removeCssVars_=function(){var e=this,n=v.strings;Object.keys(n).forEach(function(t){0===t.indexOf("VAR_")&&e.adapter.updateCssVariable(n[t],null)})},v.prototype.activate_=function(t){var e=this;if(!this.adapter.isSurfaceDisabled()){var n=this.activationState_;if(!n.isActivated){var i=this.previousActivationEvent_;i&&void 0!==t&&i.type!==t.type||(n.isActivated=!0,n.isProgrammatic=void 0===t,n.activationEvent=t,n.wasActivatedByPointer=!n.isProgrammatic&&void 0!==t&&("mousedown"===t.type||"touchstart"===t.type||"pointerdown"===t.type),void 0!==t&&0<p.length&&p.some(function(t){return e.adapter.containsEventTarget(t)})?this.resetActivationState_():(void 0!==t&&(p.push(t.target),this.registerDeactivationHandlers_(t)),n.wasElementMadeActive=this.checkElementMadeActive_(t),n.wasElementMadeActive&&this.animateActivation_(),requestAnimationFrame(function(){p=[],n.wasElementMadeActive||void 0===t||" "!==t.key&&32!==t.keyCode||(n.wasElementMadeActive=e.checkElementMadeActive_(t),n.wasElementMadeActive&&e.animateActivation_()),n.wasElementMadeActive||(e.activationState_=e.defaultActivationState_())})))}}},v.prototype.checkElementMadeActive_=function(t){return void 0===t||"keydown"!==t.type||this.adapter.isSurfaceActive()},v.prototype.animateActivation_=function(){var t=this,e=v.strings,n=e.VAR_FG_TRANSLATE_START,i=e.VAR_FG_TRANSLATE_END,r=v.cssClasses,a=r.FG_DEACTIVATION,o=r.FG_ACTIVATION,s=v.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal_();var u="",c="";if(!this.adapter.isUnbounded()){var d=this.getFgTranslationCoordinates_(),l=d.startPoint,p=d.endPoint;u=l.x+"px, "+l.y+"px",c=p.x+"px, "+p.y+"px"}this.adapter.updateCssVariable(n,u),this.adapter.updateCssVariable(i,c),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter.removeClass(a),this.adapter.computeBoundingRect(),this.adapter.addClass(o),this.activationTimer_=setTimeout(function(){return t.activationTimerCallback_()},s)},v.prototype.getFgTranslationCoordinates_=function(){var t,e=this.activationState_,n=e.activationEvent;return{startPoint:t={x:(t=e.wasActivatedByPointer?c.getNormalizedEventCoords(n,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2}).x-this.initialSize_/2,y:t.y-this.initialSize_/2},endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}},v.prototype.runDeactivationUXLogicIfReady_=function(){var t=this,e=v.cssClasses.FG_DEACTIVATION,n=this.activationState_,i=n.hasDeactivationUXRun,r=n.isActivated;!i&&r||!this.activationAnimationHasEnded_||(this.rmBoundedActivationClasses_(),this.adapter.addClass(e),this.fgDeactivationRemovalTimer_=setTimeout(function(){t.adapter.removeClass(e)},u.numbers.FG_DEACTIVATION_MS))},v.prototype.rmBoundedActivationClasses_=function(){var t=v.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded_=!1,this.adapter.computeBoundingRect()},v.prototype.resetActivationState_=function(){var t=this;this.previousActivationEvent_=this.activationState_.activationEvent,this.activationState_=this.defaultActivationState_(),setTimeout(function(){return t.previousActivationEvent_=void 0},v.numbers.TAP_DELAY_MS)},v.prototype.deactivate_=function(){var t=this,e=this.activationState_;if(e.isActivated){var n=a({},e);e.isProgrammatic?(requestAnimationFrame(function(){return t.animateDeactivation_(n)}),this.resetActivationState_()):(this.deregisterDeactivationHandlers_(),requestAnimationFrame(function(){t.activationState_.hasDeactivationUXRun=!0,t.animateDeactivation_(n),t.resetActivationState_()}))}},v.prototype.animateDeactivation_=function(t){var e=t.wasActivatedByPointer,n=t.wasElementMadeActive;(e||n)&&this.runDeactivationUXLogicIfReady_()},v.prototype.layoutInternal_=function(){var t=this;this.frame_=this.adapter.computeBoundingRect();var e=Math.max(this.frame_.height,this.frame_.width);this.maxRadius_=this.adapter.isUnbounded()?e:Math.sqrt(Math.pow(t.frame_.width,2)+Math.pow(t.frame_.height,2))+v.numbers.PADDING;var n=Math.floor(e*v.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&n%2!=0?this.initialSize_=n-1:this.initialSize_=n,this.fgScale_=""+this.maxRadius_/this.initialSize_,this.updateLayoutCssVars_()},v.prototype.updateLayoutCssVars_=function(){var t=v.strings,e=t.VAR_FG_SIZE,n=t.VAR_LEFT,i=t.VAR_TOP,r=t.VAR_FG_SCALE;this.adapter.updateCssVariable(e,this.initialSize_+"px"),this.adapter.updateCssVariable(r,this.fgScale_),this.adapter.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter.updateCssVariable(n,this.unboundedCoords_.left+"px"),this.adapter.updateCssVariable(i,this.unboundedCoords_.top+"px"))},v);function v(t){var e=o.call(this,a(a({},v.defaultAdapter),t))||this;return e.activationAnimationHasEnded_=!1,e.activationTimer_=0,e.fgDeactivationRemovalTimer_=0,e.fgScale_="0",e.frame_={width:0,height:0},e.initialSize_=0,e.layoutFrame_=0,e.maxRadius_=0,e.unboundedCoords_={left:0,top:0},e.activationState_=e.defaultActivationState_(),e.activationTimerCallback_=function(){e.activationAnimationHasEnded_=!0,e.runDeactivationUXLogicIfReady_()},e.activateHandler_=function(t){return e.activate_(t)},e.deactivateHandler_=function(){return e.deactivate_()},e.focusHandler_=function(){return e.handleFocus()},e.blurHandler_=function(){return e.handleBlur()},e.resizeHandler_=function(){return e.layout()},e}e.MDCRippleFoundation=f,e.default=f},5:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.applyPassive=function(t){return void 0===t&&(t=window),!!function(t){void 0===t&&(t=window);var e=!1;try{var n={get passive(){return!(e=!0)}},i=function(){};t.document.addEventListener("test",i,n),t.document.removeEventListener("test",i,n)}catch(t){e=!1}return e}(t)&&{passive:!0}}},6:function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(1),u=n(5),c=n(2),d=n(4),l=a(n(3)),p=(o=s.MDCComponent,r(f,o),f.attachTo=function(t,e){void 0===e&&(e={isUnbounded:void 0});var n=new f(t);return void 0!==e.isUnbounded&&(n.unbounded=e.isUnbounded),n},f.createAdapter=function(n){return{addClass:function(t){return n.root.classList.add(t)},browserSupportsCssVars:function(){return l.supportsCssVariables(window)},computeBoundingRect:function(){return n.root.getBoundingClientRect()},containsEventTarget:function(t){return n.root.contains(t)},deregisterDocumentInteractionHandler:function(t,e){return document.documentElement.removeEventListener(t,e,u.applyPassive())},deregisterInteractionHandler:function(t,e){return n.root.removeEventListener(t,e,u.applyPassive())},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return c.matches(n.root,":active")},isSurfaceDisabled:function(){return Boolean(n.disabled)},isUnbounded:function(){return Boolean(n.unbounded)},registerDocumentInteractionHandler:function(t,e){return document.documentElement.addEventListener(t,e,u.applyPassive())},registerInteractionHandler:function(t,e){return n.root.addEventListener(t,e,u.applyPassive())},registerResizeHandler:function(t){return window.addEventListener("resize",t)},removeClass:function(t){return n.root.classList.remove(t)},updateCssVariable:function(t,e){return n.root.style.setProperty(t,e)}}},Object.defineProperty(f.prototype,"unbounded",{get:function(){return Boolean(this.unbounded_)},set:function(t){this.unbounded_=Boolean(t),this.setUnbounded_()},enumerable:!0,configurable:!0}),f.prototype.activate=function(){this.foundation.activate()},f.prototype.deactivate=function(){this.foundation.deactivate()},f.prototype.layout=function(){this.foundation.layout()},f.prototype.getDefaultFoundation=function(){return new d.MDCRippleFoundation(f.createAdapter(this))},f.prototype.initialSyncWithDOM=function(){var t=this.root;this.unbounded="mdcRippleIsUnbounded"in t.dataset},f.prototype.setUnbounded_=function(){this.foundation.setUnbounded(Boolean(this.unbounded_))},f);function f(){var t=null!==o&&o.apply(this,arguments)||this;return t.disabled=!1,t}e.MDCRipple=p},7:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.cssClasses={BG_FOCUSED:"mdc-ripple-upgraded--background-focused",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation",ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded"},e.strings={VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top"},e.numbers={DEACTIVATION_TIMEOUT_MS:225,FG_DEACTIVATION_MS:150,INITIAL_ORIGIN_SCALE:.6,PADDING:10,TAP_DELAY_MS:300}}},r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=158);function r(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}var n,i}); \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.d.ts index df6fd5a9..f4d7445 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.d.ts
@@ -46,23 +46,23 @@ TAP_DELAY_MS: number; }; static get defaultAdapter(): MDCRippleAdapter; - private activationAnimationHasEnded_; - private activationState_; - private activationTimer_; - private fgDeactivationRemovalTimer_; - private fgScale_; - private frame_; - private initialSize_; - private layoutFrame_; - private maxRadius_; - private unboundedCoords_; - private readonly activationTimerCallback_; - private readonly activateHandler_; - private readonly deactivateHandler_; - private readonly focusHandler_; - private readonly blurHandler_; - private readonly resizeHandler_; - private previousActivationEvent_?; + private activationAnimationHasEnded; + private activationState; + private activationTimer; + private fgDeactivationRemovalTimer; + private fgScale; + private frame; + private initialSize; + private layoutFrame; + private maxRadius; + private unboundedCoords; + private readonly activationTimerCallback; + private readonly activateHandler; + private readonly deactivateHandler; + private readonly focusHandler; + private readonly blurHandler; + private readonly resizeHandler; + private previousActivationEvent?; constructor(adapter?: Partial<MDCRippleAdapter>); init(): void; destroy(): void; @@ -81,26 +81,26 @@ * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ - private supportsPressRipple_; - private defaultActivationState_; + private supportsPressRipple; + private defaultActivationState; /** * supportsPressRipple Passed from init to save a redundant function call */ - private registerRootHandlers_; - private registerDeactivationHandlers_; - private deregisterRootHandlers_; - private deregisterDeactivationHandlers_; - private removeCssVars_; - private activate_; - private checkElementMadeActive_; - private animateActivation_; - private getFgTranslationCoordinates_; - private runDeactivationUXLogicIfReady_; - private rmBoundedActivationClasses_; - private resetActivationState_; - private deactivate_; - private animateDeactivation_; - private layoutInternal_; - private updateLayoutCssVars_; + private registerRootHandlers; + private registerDeactivationHandlers; + private deregisterRootHandlers; + private deregisterDeactivationHandlers; + private removeCssVars; + private activateImpl; + private checkElementMadeActive; + private animateActivation; + private getFgTranslationCoordinates; + private runDeactivationUXLogicIfReady; + private rmBoundedActivationClasses; + private resetActivationState; + private deactivateImpl; + private animateDeactivation; + private layoutInternal; + private updateLayoutCssVars; } export default MDCRippleFoundation;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.js index 6a0daf8..86372d0 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/foundation.js
@@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -import { __assign, __extends } from './node_modules/tslib/tslib.es6.js'; +import { __assign, __extends, __values } from '../../tslib/tslib.js'; import { MDCFoundation } from '../base/foundation.js'; import { cssClasses, numbers, strings } from './constants.js'; import { getNormalizedEventCoords } from './util.js'; @@ -38,46 +38,56 @@ __extends(MDCRippleFoundation, _super); function MDCRippleFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this; - _this.activationAnimationHasEnded_ = false; - _this.activationTimer_ = 0; - _this.fgDeactivationRemovalTimer_ = 0; - _this.fgScale_ = '0'; - _this.frame_ = { width: 0, height: 0 }; - _this.initialSize_ = 0; - _this.layoutFrame_ = 0; - _this.maxRadius_ = 0; - _this.unboundedCoords_ = { left: 0, top: 0 }; - _this.activationState_ = _this.defaultActivationState_(); - _this.activationTimerCallback_ = function () { - _this.activationAnimationHasEnded_ = true; - _this.runDeactivationUXLogicIfReady_(); + _this.activationAnimationHasEnded = false; + _this.activationTimer = 0; + _this.fgDeactivationRemovalTimer = 0; + _this.fgScale = '0'; + _this.frame = { width: 0, height: 0 }; + _this.initialSize = 0; + _this.layoutFrame = 0; + _this.maxRadius = 0; + _this.unboundedCoords = { left: 0, top: 0 }; + _this.activationState = _this.defaultActivationState(); + _this.activationTimerCallback = function () { + _this.activationAnimationHasEnded = true; + _this.runDeactivationUXLogicIfReady(); }; - _this.activateHandler_ = function (e) { return _this.activate_(e); }; - _this.deactivateHandler_ = function () { return _this.deactivate_(); }; - _this.focusHandler_ = function () { return _this.handleFocus(); }; - _this.blurHandler_ = function () { return _this.handleBlur(); }; - _this.resizeHandler_ = function () { return _this.layout(); }; + _this.activateHandler = function (e) { + _this.activateImpl(e); + }; + _this.deactivateHandler = function () { + _this.deactivateImpl(); + }; + _this.focusHandler = function () { + _this.handleFocus(); + }; + _this.blurHandler = function () { + _this.handleBlur(); + }; + _this.resizeHandler = function () { + _this.layout(); + }; return _this; } Object.defineProperty(MDCRippleFoundation, "cssClasses", { get: function () { return cssClasses; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCRippleFoundation, "strings", { get: function () { return strings; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCRippleFoundation, "numbers", { get: function () { return numbers; }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(MDCRippleFoundation, "defaultAdapter", { @@ -85,7 +95,9 @@ return { addClass: function () { return undefined; }, browserSupportsCssVars: function () { return true; }, - computeBoundingRect: function () { return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }); }, + computeBoundingRect: function () { + return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 }); + }, containsEventTarget: function () { return true; }, deregisterDocumentInteractionHandler: function () { return undefined; }, deregisterInteractionHandler: function () { return undefined; }, @@ -101,13 +113,13 @@ updateCssVariable: function () { return undefined; }, }; }, - enumerable: true, + enumerable: false, configurable: true }); MDCRippleFoundation.prototype.init = function () { var _this = this; - var supportsPressRipple = this.supportsPressRipple_(); - this.registerRootHandlers_(supportsPressRipple); + var supportsPressRipple = this.supportsPressRipple(); + this.registerRootHandlers(supportsPressRipple); if (supportsPressRipple) { var _a = MDCRippleFoundation.cssClasses, ROOT_1 = _a.ROOT, UNBOUNDED_1 = _a.UNBOUNDED; requestAnimationFrame(function () { @@ -115,51 +127,51 @@ if (_this.adapter.isUnbounded()) { _this.adapter.addClass(UNBOUNDED_1); // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple - _this.layoutInternal_(); + _this.layoutInternal(); } }); } }; MDCRippleFoundation.prototype.destroy = function () { var _this = this; - if (this.supportsPressRipple_()) { - if (this.activationTimer_) { - clearTimeout(this.activationTimer_); - this.activationTimer_ = 0; + if (this.supportsPressRipple()) { + if (this.activationTimer) { + clearTimeout(this.activationTimer); + this.activationTimer = 0; this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION); } - if (this.fgDeactivationRemovalTimer_) { - clearTimeout(this.fgDeactivationRemovalTimer_); - this.fgDeactivationRemovalTimer_ = 0; + if (this.fgDeactivationRemovalTimer) { + clearTimeout(this.fgDeactivationRemovalTimer); + this.fgDeactivationRemovalTimer = 0; this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION); } var _a = MDCRippleFoundation.cssClasses, ROOT_2 = _a.ROOT, UNBOUNDED_2 = _a.UNBOUNDED; requestAnimationFrame(function () { _this.adapter.removeClass(ROOT_2); _this.adapter.removeClass(UNBOUNDED_2); - _this.removeCssVars_(); + _this.removeCssVars(); }); } - this.deregisterRootHandlers_(); - this.deregisterDeactivationHandlers_(); + this.deregisterRootHandlers(); + this.deregisterDeactivationHandlers(); }; /** * @param evt Optional event containing position information. */ MDCRippleFoundation.prototype.activate = function (evt) { - this.activate_(evt); + this.activateImpl(evt); }; MDCRippleFoundation.prototype.deactivate = function () { - this.deactivate_(); + this.deactivateImpl(); }; MDCRippleFoundation.prototype.layout = function () { var _this = this; - if (this.layoutFrame_) { - cancelAnimationFrame(this.layoutFrame_); + if (this.layoutFrame) { + cancelAnimationFrame(this.layoutFrame); } - this.layoutFrame_ = requestAnimationFrame(function () { - _this.layoutInternal_(); - _this.layoutFrame_ = 0; + this.layoutFrame = requestAnimationFrame(function () { + _this.layoutInternal(); + _this.layoutFrame = 0; }); }; MDCRippleFoundation.prototype.setUnbounded = function (unbounded) { @@ -185,10 +197,10 @@ * client-side feature-detection may happen too early, such as when components are rendered on the server * and then initialized at mount time on the client. */ - MDCRippleFoundation.prototype.supportsPressRipple_ = function () { + MDCRippleFoundation.prototype.supportsPressRipple = function () { return this.adapter.browserSupportsCssVars(); }; - MDCRippleFoundation.prototype.defaultActivationState_ = function () { + MDCRippleFoundation.prototype.defaultActivationState = function () { return { activationEvent: undefined, hasDeactivationUXRun: false, @@ -201,49 +213,89 @@ /** * supportsPressRipple Passed from init to save a redundant function call */ - MDCRippleFoundation.prototype.registerRootHandlers_ = function (supportsPressRipple) { - var _this = this; + MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) { + var e_1, _a; if (supportsPressRipple) { - ACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.registerInteractionHandler(evtType, _this.activateHandler_); - }); + try { + for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) { + var evtType = ACTIVATION_EVENT_TYPES_1_1.value; + this.adapter.registerInteractionHandler(evtType, this.activateHandler); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1); + } + finally { if (e_1) throw e_1.error; } + } if (this.adapter.isUnbounded()) { - this.adapter.registerResizeHandler(this.resizeHandler_); + this.adapter.registerResizeHandler(this.resizeHandler); } } - this.adapter.registerInteractionHandler('focus', this.focusHandler_); - this.adapter.registerInteractionHandler('blur', this.blurHandler_); + this.adapter.registerInteractionHandler('focus', this.focusHandler); + this.adapter.registerInteractionHandler('blur', this.blurHandler); }; - MDCRippleFoundation.prototype.registerDeactivationHandlers_ = function (evt) { - var _this = this; + MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) { + var e_2, _a; if (evt.type === 'keydown') { - this.adapter.registerInteractionHandler('keyup', this.deactivateHandler_); + this.adapter.registerInteractionHandler('keyup', this.deactivateHandler); } else { - POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.registerDocumentInteractionHandler(evtType, _this.deactivateHandler_); - }); + try { + for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) { + var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value; + this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1); + } + finally { if (e_2) throw e_2.error; } + } } }; - MDCRippleFoundation.prototype.deregisterRootHandlers_ = function () { - var _this = this; - ACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.deregisterInteractionHandler(evtType, _this.activateHandler_); - }); - this.adapter.deregisterInteractionHandler('focus', this.focusHandler_); - this.adapter.deregisterInteractionHandler('blur', this.blurHandler_); + MDCRippleFoundation.prototype.deregisterRootHandlers = function () { + var e_3, _a; + try { + for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) { + var evtType = ACTIVATION_EVENT_TYPES_2_1.value; + this.adapter.deregisterInteractionHandler(evtType, this.activateHandler); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2); + } + finally { if (e_3) throw e_3.error; } + } + this.adapter.deregisterInteractionHandler('focus', this.focusHandler); + this.adapter.deregisterInteractionHandler('blur', this.blurHandler); if (this.adapter.isUnbounded()) { - this.adapter.deregisterResizeHandler(this.resizeHandler_); + this.adapter.deregisterResizeHandler(this.resizeHandler); } }; - MDCRippleFoundation.prototype.deregisterDeactivationHandlers_ = function () { - var _this = this; - this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler_); - POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (evtType) { - _this.adapter.deregisterDocumentInteractionHandler(evtType, _this.deactivateHandler_); - }); + MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () { + var e_4, _a; + this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler); + try { + for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) { + var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value; + this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler); + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2); + } + finally { if (e_4) throw e_4.error; } + } }; - MDCRippleFoundation.prototype.removeCssVars_ = function () { + MDCRippleFoundation.prototype.removeCssVars = function () { var _this = this; var rippleStrings = MDCRippleFoundation.strings; var keys = Object.keys(rippleStrings); @@ -253,17 +305,17 @@ } }); }; - MDCRippleFoundation.prototype.activate_ = function (evt) { + MDCRippleFoundation.prototype.activateImpl = function (evt) { var _this = this; if (this.adapter.isSurfaceDisabled()) { return; } - var activationState = this.activationState_; + var activationState = this.activationState; if (activationState.isActivated) { return; } // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction - var previousActivationEvent = this.previousActivationEvent_; + var previousActivationEvent = this.previousActivationEvent; var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type; if (isSameInteraction) { return; @@ -277,16 +329,16 @@ activatedTargets.some(function (target) { return _this.adapter.containsEventTarget(target); }); if (hasActivatedChild) { // Immediately reset activation state, while preserving logic that prevents touch follow-on events - this.resetActivationState_(); + this.resetActivationState(); return; } if (evt !== undefined) { activatedTargets.push(evt.target); - this.registerDeactivationHandlers_(evt); + this.registerDeactivationHandlers(evt); } - activationState.wasElementMadeActive = this.checkElementMadeActive_(evt); + activationState.wasElementMadeActive = this.checkElementMadeActive(evt); if (activationState.wasElementMadeActive) { - this.animateActivation_(); + this.animateActivation(); } requestAnimationFrame(function () { // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples @@ -300,130 +352,134 @@ // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS // variable is set within a rAF callback for a submit button interaction (#2241). - activationState.wasElementMadeActive = _this.checkElementMadeActive_(evt); + activationState.wasElementMadeActive = _this.checkElementMadeActive(evt); if (activationState.wasElementMadeActive) { - _this.animateActivation_(); + _this.animateActivation(); } } if (!activationState.wasElementMadeActive) { // Reset activation state immediately if element was not made active. - _this.activationState_ = _this.defaultActivationState_(); + _this.activationState = _this.defaultActivationState(); } }); }; - MDCRippleFoundation.prototype.checkElementMadeActive_ = function (evt) { + MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) { return (evt !== undefined && evt.type === 'keydown') ? this.adapter.isSurfaceActive() : true; }; - MDCRippleFoundation.prototype.animateActivation_ = function () { + MDCRippleFoundation.prototype.animateActivation = function () { var _this = this; var _a = MDCRippleFoundation.strings, VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START, VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END; var _b = MDCRippleFoundation.cssClasses, FG_DEACTIVATION = _b.FG_DEACTIVATION, FG_ACTIVATION = _b.FG_ACTIVATION; var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS; - this.layoutInternal_(); + this.layoutInternal(); var translateStart = ''; var translateEnd = ''; if (!this.adapter.isUnbounded()) { - var _c = this.getFgTranslationCoordinates_(), startPoint = _c.startPoint, endPoint = _c.endPoint; + var _c = this.getFgTranslationCoordinates(), startPoint = _c.startPoint, endPoint = _c.endPoint; translateStart = startPoint.x + "px, " + startPoint.y + "px"; translateEnd = endPoint.x + "px, " + endPoint.y + "px"; } this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart); this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd); // Cancel any ongoing activation/deactivation animations - clearTimeout(this.activationTimer_); - clearTimeout(this.fgDeactivationRemovalTimer_); - this.rmBoundedActivationClasses_(); + clearTimeout(this.activationTimer); + clearTimeout(this.fgDeactivationRemovalTimer); + this.rmBoundedActivationClasses(); this.adapter.removeClass(FG_DEACTIVATION); // Force layout in order to re-trigger the animation. this.adapter.computeBoundingRect(); this.adapter.addClass(FG_ACTIVATION); - this.activationTimer_ = setTimeout(function () { return _this.activationTimerCallback_(); }, DEACTIVATION_TIMEOUT_MS); + this.activationTimer = setTimeout(function () { + _this.activationTimerCallback(); + }, DEACTIVATION_TIMEOUT_MS); }; - MDCRippleFoundation.prototype.getFgTranslationCoordinates_ = function () { - var _a = this.activationState_, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; + MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () { + var _a = this.activationState, activationEvent = _a.activationEvent, wasActivatedByPointer = _a.wasActivatedByPointer; var startPoint; if (wasActivatedByPointer) { startPoint = getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect()); } else { startPoint = { - x: this.frame_.width / 2, - y: this.frame_.height / 2, + x: this.frame.width / 2, + y: this.frame.height / 2, }; } // Center the element around the start point. startPoint = { - x: startPoint.x - (this.initialSize_ / 2), - y: startPoint.y - (this.initialSize_ / 2), + x: startPoint.x - (this.initialSize / 2), + y: startPoint.y - (this.initialSize / 2), }; var endPoint = { - x: (this.frame_.width / 2) - (this.initialSize_ / 2), - y: (this.frame_.height / 2) - (this.initialSize_ / 2), + x: (this.frame.width / 2) - (this.initialSize / 2), + y: (this.frame.height / 2) - (this.initialSize / 2), }; return { startPoint: startPoint, endPoint: endPoint }; }; - MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady_ = function () { + MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () { var _this = this; // This method is called both when a pointing device is released, and when the activation animation ends. // The deactivation animation should only run after both of those occur. var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION; - var _a = this.activationState_, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; + var _a = this.activationState, hasDeactivationUXRun = _a.hasDeactivationUXRun, isActivated = _a.isActivated; var activationHasEnded = hasDeactivationUXRun || !isActivated; - if (activationHasEnded && this.activationAnimationHasEnded_) { - this.rmBoundedActivationClasses_(); + if (activationHasEnded && this.activationAnimationHasEnded) { + this.rmBoundedActivationClasses(); this.adapter.addClass(FG_DEACTIVATION); - this.fgDeactivationRemovalTimer_ = setTimeout(function () { + this.fgDeactivationRemovalTimer = setTimeout(function () { _this.adapter.removeClass(FG_DEACTIVATION); }, numbers.FG_DEACTIVATION_MS); } }; - MDCRippleFoundation.prototype.rmBoundedActivationClasses_ = function () { + MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () { var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION; this.adapter.removeClass(FG_ACTIVATION); - this.activationAnimationHasEnded_ = false; + this.activationAnimationHasEnded = false; this.adapter.computeBoundingRect(); }; - MDCRippleFoundation.prototype.resetActivationState_ = function () { + MDCRippleFoundation.prototype.resetActivationState = function () { var _this = this; - this.previousActivationEvent_ = this.activationState_.activationEvent; - this.activationState_ = this.defaultActivationState_(); + this.previousActivationEvent = this.activationState.activationEvent; + this.activationState = this.defaultActivationState(); // Touch devices may fire additional events for the same interaction within a short time. // Store the previous event until it's safe to assume that subsequent events are for new interactions. - setTimeout(function () { return _this.previousActivationEvent_ = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); + setTimeout(function () { return _this.previousActivationEvent = undefined; }, MDCRippleFoundation.numbers.TAP_DELAY_MS); }; - MDCRippleFoundation.prototype.deactivate_ = function () { + MDCRippleFoundation.prototype.deactivateImpl = function () { var _this = this; - var activationState = this.activationState_; + var activationState = this.activationState; // This can happen in scenarios such as when you have a keyup event that blurs the element. if (!activationState.isActivated) { return; } var state = __assign({}, activationState); if (activationState.isProgrammatic) { - requestAnimationFrame(function () { return _this.animateDeactivation_(state); }); - this.resetActivationState_(); + requestAnimationFrame(function () { + _this.animateDeactivation(state); + }); + this.resetActivationState(); } else { - this.deregisterDeactivationHandlers_(); + this.deregisterDeactivationHandlers(); requestAnimationFrame(function () { - _this.activationState_.hasDeactivationUXRun = true; - _this.animateDeactivation_(state); - _this.resetActivationState_(); + _this.activationState.hasDeactivationUXRun = true; + _this.animateDeactivation(state); + _this.resetActivationState(); }); } }; - MDCRippleFoundation.prototype.animateDeactivation_ = function (_a) { + MDCRippleFoundation.prototype.animateDeactivation = function (_a) { var wasActivatedByPointer = _a.wasActivatedByPointer, wasElementMadeActive = _a.wasElementMadeActive; if (wasActivatedByPointer || wasElementMadeActive) { - this.runDeactivationUXLogicIfReady_(); + this.runDeactivationUXLogicIfReady(); } }; - MDCRippleFoundation.prototype.layoutInternal_ = function () { + MDCRippleFoundation.prototype.layoutInternal = function () { var _this = this; - this.frame_ = this.adapter.computeBoundingRect(); - var maxDim = Math.max(this.frame_.height, this.frame_.width); + this.frame = this.adapter.computeBoundingRect(); + var maxDim = Math.max(this.frame.height, this.frame.width); // Surface diameter is treated differently for unbounded vs. bounded ripples. // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically @@ -431,33 +487,33 @@ // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via // `overflow: hidden`. var getBoundedRadius = function () { - var hypotenuse = Math.sqrt(Math.pow(_this.frame_.width, 2) + Math.pow(_this.frame_.height, 2)); + var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2)); return hypotenuse + MDCRippleFoundation.numbers.PADDING; }; - this.maxRadius_ = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); + this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius(); // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE); // Unbounded ripple size should always be even number to equally center align. if (this.adapter.isUnbounded() && initialSize % 2 !== 0) { - this.initialSize_ = initialSize - 1; + this.initialSize = initialSize - 1; } else { - this.initialSize_ = initialSize; + this.initialSize = initialSize; } - this.fgScale_ = "" + this.maxRadius_ / this.initialSize_; - this.updateLayoutCssVars_(); + this.fgScale = "" + this.maxRadius / this.initialSize; + this.updateLayoutCssVars(); }; - MDCRippleFoundation.prototype.updateLayoutCssVars_ = function () { + MDCRippleFoundation.prototype.updateLayoutCssVars = function () { var _a = MDCRippleFoundation.strings, VAR_FG_SIZE = _a.VAR_FG_SIZE, VAR_LEFT = _a.VAR_LEFT, VAR_TOP = _a.VAR_TOP, VAR_FG_SCALE = _a.VAR_FG_SCALE; - this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + "px"); - this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale_); + this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px"); + this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale); if (this.adapter.isUnbounded()) { - this.unboundedCoords_ = { - left: Math.round((this.frame_.width / 2) - (this.initialSize_ / 2)), - top: Math.round((this.frame_.height / 2) - (this.initialSize_ / 2)), + this.unboundedCoords = { + left: Math.round((this.frame.width / 2) - (this.initialSize / 2)), + top: Math.round((this.frame.height / 2) - (this.initialSize / 2)), }; - this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + "px"); - this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + "px"); + this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px"); + this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px"); } }; return MDCRippleFoundation;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/index.js index 18543fa..432e0f6 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/index.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/index.js
@@ -22,7 +22,9 @@ */ import * as util from './util.js'; export { util }; +export * from './adapter.js'; export * from './component.js'; export * from './constants.js'; export * from './foundation.js'; +export * from './types.js'; //# sourceMappingURL=index.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/CopyrightNotice.txt b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/CopyrightNotice.txt deleted file mode 100644 index 2e4a05c..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/CopyrightNotice.txt +++ /dev/null
@@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/LICENSE.txt b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/LICENSE.txt deleted file mode 100644 index fa7d1bd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/LICENSE.txt +++ /dev/null
@@ -1,12 +0,0 @@ -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/index.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/index.js deleted file mode 100644 index 506f5cc4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/index.js +++ /dev/null
@@ -1,51 +0,0 @@ -import tslib from '../tslib.es6.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/package.json deleted file mode 100644 index 96ae6e5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/modules/package.json +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/package.json deleted file mode 100644 index f8c2a53..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/package.json +++ /dev/null
@@ -1,37 +0,0 @@ -{ - "name": "tslib", - "author": "Microsoft Corp.", - "homepage": "https://www.typescriptlang.org/", - "version": "1.14.1", - "license": "0BSD", - "description": "Runtime library for TypeScript helper functions", - "keywords": [ - "TypeScript", - "Microsoft", - "compiler", - "language", - "javascript", - "tslib", - "runtime" - ], - "bugs": { - "url": "https://github.com/Microsoft/TypeScript/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/Microsoft/tslib.git" - }, - "main": "tslib.js", - "module": "tslib.es6.js", - "jsnext:main": "tslib.es6.js", - "typings": "tslib.d.ts", - "sideEffects": false, - "exports": { - ".": { - "module": "./tslib.es6.js", - "import": "./modules/index.js", - "default": "./tslib.js" - }, - "./": "./" - } -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.d.ts deleted file mode 100644 index 0756b28..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -export declare function __extends(d: Function, b: Function): void; -export declare function __assign(t: any, ...sources: any[]): any; -export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; -export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; -export declare function __param(paramIndex: number, decorator: Function): Function; -export declare function __metadata(metadataKey: any, metadataValue: any): Function; -export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; -export declare function __generator(thisArg: any, body: Function): any; -export declare function __exportStar(m: any, exports: any): void; -export declare function __values(o: any): any; -export declare function __read(o: any, n?: number): any[]; -export declare function __spread(...args: any[][]): any[]; -export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __await(v: any): any; -export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; -export declare function __asyncDelegator(o: any): any; -export declare function __asyncValues(o: any): any; -export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; -export declare function __importStar<T>(mod: T): T; -export declare function __importDefault<T>(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; -export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void; \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.html b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.html deleted file mode 100644 index b122e41..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.es6.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 7fdec02..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.es6.js +++ /dev/null
@@ -1,218 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export function __createBinding(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -} - -export function __exportStar(m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -}; - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result.default = mod; - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.html b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.html deleted file mode 100644 index 44c9ba51..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.html +++ /dev/null
@@ -1 +0,0 @@ -<script src="tslib.js"></script> \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.js deleted file mode 100644 index fbce018..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/node_modules/tslib/tslib.js +++ /dev/null
@@ -1,284 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ - -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - - __extends = function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - - __assign = Object.assign || function (t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - }; - - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } - }; - - __createBinding = function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }; - - __exportStar = function (m, exports) { - for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; - }; - - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; - - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; - result["default"] = mod; - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); -});
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/package.json index ec578a1..652d41c 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/package.json
@@ -1,7 +1,7 @@ { "name": "@material/ripple", "description": "The Material Components for the web Ink Ripple effect for web element interactions", - "version": "9.0.0-canary.1c156d69d.0", + "version": "14.0.0", "license": "MIT", "keywords": [ "material components", @@ -11,19 +11,19 @@ "main": "dist/mdc.ripple.js", "module": "index.js", "sideEffects": false, - "types": "dist/mdc.ripple.d.ts", "repository": { "type": "git", "url": "https://github.com/material-components/material-components-web.git", "directory": "packages/mdc-ripple" }, "dependencies": { - "@material/animation": "9.0.0-canary.1c156d69d.0", - "@material/base": "9.0.0-canary.1c156d69d.0", - "@material/dom": "9.0.0-canary.1c156d69d.0", - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "@material/theme": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/animation": "^14.0.0", + "@material/base": "^14.0.0", + "@material/dom": "^14.0.0", + "@material/feature-targeting": "^14.0.0", + "@material/rtl": "^14.0.0", + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/types.js b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/types.js index 347c73f5..1574469 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/types.js +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/types.js
@@ -20,4 +20,5 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ +export {}; //# sourceMappingURL=types.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/util.d.ts b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/util.d.ts index b3b56b4..a548bd97 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/ripple/util.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/@material/ripple/util.d.ts
@@ -22,4 +22,4 @@ */ import { MDCRipplePoint } from './types'; export declare function supportsCssVariables(windowObj: typeof globalThis, forceRefresh?: boolean): boolean; -export declare function getNormalizedEventCoords(evt: Event | undefined, pageOffset: MDCRipplePoint, clientRect: ClientRect): MDCRipplePoint; +export declare function getNormalizedEventCoords(evt: Event | undefined, pageOffset: MDCRipplePoint, clientRect: DOMRect): MDCRipplePoint;
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/animation/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@material/rtl/LICENSE similarity index 100% rename from third_party/material_web_components/components-chromium/node_modules/@material/animation/LICENSE rename to third_party/material_web_components/components-chromium/node_modules/@material/rtl/LICENSE
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/rtl/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/rtl/package.json new file mode 100644 index 0000000..7920bd7 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@material/rtl/package.json
@@ -0,0 +1,23 @@ +{ + "name": "@material/rtl", + "description": "Material Components for the web RTL Scss helpers", + "version": "14.0.0", + "license": "MIT", + "keywords": [ + "material components", + "material design", + "rtl", + "right to left" + ], + "sideEffects": false, + "repository": { + "type": "git", + "url": "https://github.com/material-components/material-components-web.git", + "directory": "packages/mdc-rtl" + }, + "dependencies": { + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" + }, + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.css b/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.css deleted file mode 100644 index d8bd09e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.css +++ /dev/null
@@ -1,191 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -:root { - --mdc-theme-primary: #6200ee; - --mdc-theme-secondary: #018786; - --mdc-theme-background: #fff; - --mdc-theme-surface: #fff; - --mdc-theme-error: #b00020; - --mdc-theme-on-primary: #fff; - --mdc-theme-on-secondary: #fff; - --mdc-theme-on-surface: #000; - --mdc-theme-on-error: #fff; - --mdc-theme-text-primary-on-background: rgba(0, 0, 0, 0.87); - --mdc-theme-text-secondary-on-background: rgba(0, 0, 0, 0.54); - --mdc-theme-text-hint-on-background: rgba(0, 0, 0, 0.38); - --mdc-theme-text-disabled-on-background: rgba(0, 0, 0, 0.38); - --mdc-theme-text-icon-on-background: rgba(0, 0, 0, 0.38); - --mdc-theme-text-primary-on-light: rgba(0, 0, 0, 0.87); - --mdc-theme-text-secondary-on-light: rgba(0, 0, 0, 0.54); - --mdc-theme-text-hint-on-light: rgba(0, 0, 0, 0.38); - --mdc-theme-text-disabled-on-light: rgba(0, 0, 0, 0.38); - --mdc-theme-text-icon-on-light: rgba(0, 0, 0, 0.38); - --mdc-theme-text-primary-on-dark: white; - --mdc-theme-text-secondary-on-dark: rgba(255, 255, 255, 0.7); - --mdc-theme-text-hint-on-dark: rgba(255, 255, 255, 0.5); - --mdc-theme-text-disabled-on-dark: rgba(255, 255, 255, 0.5); - --mdc-theme-text-icon-on-dark: rgba(255, 255, 255, 0.5); -} - -.mdc-theme--primary { - color: #6200ee !important; - /* @alternate */ - color: var(--mdc-theme-primary, #6200ee) !important; -} - -.mdc-theme--secondary { - color: #018786 !important; - /* @alternate */ - color: var(--mdc-theme-secondary, #018786) !important; -} - -.mdc-theme--background { - background-color: #fff; - /* @alternate */ - background-color: var(--mdc-theme-background, #fff); -} - -.mdc-theme--surface { - background-color: #fff; - /* @alternate */ - background-color: var(--mdc-theme-surface, #fff); -} - -.mdc-theme--error { - color: #b00020 !important; - /* @alternate */ - color: var(--mdc-theme-error, #b00020) !important; -} - -.mdc-theme--on-primary { - color: #fff !important; - /* @alternate */ - color: var(--mdc-theme-on-primary, #fff) !important; -} - -.mdc-theme--on-secondary { - color: #fff !important; - /* @alternate */ - color: var(--mdc-theme-on-secondary, #fff) !important; -} - -.mdc-theme--on-surface { - color: #000 !important; - /* @alternate */ - color: var(--mdc-theme-on-surface, #000) !important; -} - -.mdc-theme--on-error { - color: #fff !important; - /* @alternate */ - color: var(--mdc-theme-on-error, #fff) !important; -} - -.mdc-theme--text-primary-on-background { - color: rgba(0, 0, 0, 0.87) !important; - /* @alternate */ - color: var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87)) !important; -} - -.mdc-theme--text-secondary-on-background { - color: rgba(0, 0, 0, 0.54) !important; - /* @alternate */ - color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54)) !important; -} - -.mdc-theme--text-hint-on-background { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-hint-on-background, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-disabled-on-background { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-disabled-on-background, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-icon-on-background { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-primary-on-light { - color: rgba(0, 0, 0, 0.87) !important; - /* @alternate */ - color: var(--mdc-theme-text-primary-on-light, rgba(0, 0, 0, 0.87)) !important; -} - -.mdc-theme--text-secondary-on-light { - color: rgba(0, 0, 0, 0.54) !important; - /* @alternate */ - color: var(--mdc-theme-text-secondary-on-light, rgba(0, 0, 0, 0.54)) !important; -} - -.mdc-theme--text-hint-on-light { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-hint-on-light, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-disabled-on-light { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-icon-on-light { - color: rgba(0, 0, 0, 0.38) !important; - /* @alternate */ - color: var(--mdc-theme-text-icon-on-light, rgba(0, 0, 0, 0.38)) !important; -} - -.mdc-theme--text-primary-on-dark { - color: white !important; - /* @alternate */ - color: var(--mdc-theme-text-primary-on-dark, white) !important; -} - -.mdc-theme--text-secondary-on-dark { - color: rgba(255, 255, 255, 0.7) !important; - /* @alternate */ - color: var(--mdc-theme-text-secondary-on-dark, rgba(255, 255, 255, 0.7)) !important; -} - -.mdc-theme--text-hint-on-dark { - color: rgba(255, 255, 255, 0.5) !important; - /* @alternate */ - color: var(--mdc-theme-text-hint-on-dark, rgba(255, 255, 255, 0.5)) !important; -} - -.mdc-theme--text-disabled-on-dark { - color: rgba(255, 255, 255, 0.5) !important; - /* @alternate */ - color: var(--mdc-theme-text-disabled-on-dark, rgba(255, 255, 255, 0.5)) !important; -} - -.mdc-theme--text-icon-on-dark { - color: rgba(255, 255, 255, 0.5) !important; - /* @alternate */ - color: var(--mdc-theme-text-icon-on-dark, rgba(255, 255, 255, 0.5)) !important; -} - -.mdc-theme--primary-bg { - background-color: #6200ee !important; - /* @alternate */ - background-color: var(--mdc-theme-primary, #6200ee) !important; -} - -.mdc-theme--secondary-bg { - background-color: #018786 !important; - /* @alternate */ - background-color: var(--mdc-theme-secondary, #018786) !important; -} - -/*# sourceMappingURL=mdc.theme.css.map*/ \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.min.css b/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.min.css deleted file mode 100644 index 4452a02d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/@material/theme/dist/mdc.theme.min.css +++ /dev/null
@@ -1,10 +0,0 @@ -/** - * @license - * Copyright Google LLC All Rights Reserved. - * - * Use of this source code is governed by an MIT-style license that can be - * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE - */ -:root{--mdc-theme-primary: #6200ee;--mdc-theme-secondary: #018786;--mdc-theme-background: #fff;--mdc-theme-surface: #fff;--mdc-theme-error: #b00020;--mdc-theme-on-primary: #fff;--mdc-theme-on-secondary: #fff;--mdc-theme-on-surface: #000;--mdc-theme-on-error: #fff;--mdc-theme-text-primary-on-background: rgba(0, 0, 0, 0.87);--mdc-theme-text-secondary-on-background: rgba(0, 0, 0, 0.54);--mdc-theme-text-hint-on-background: rgba(0, 0, 0, 0.38);--mdc-theme-text-disabled-on-background: rgba(0, 0, 0, 0.38);--mdc-theme-text-icon-on-background: rgba(0, 0, 0, 0.38);--mdc-theme-text-primary-on-light: rgba(0, 0, 0, 0.87);--mdc-theme-text-secondary-on-light: rgba(0, 0, 0, 0.54);--mdc-theme-text-hint-on-light: rgba(0, 0, 0, 0.38);--mdc-theme-text-disabled-on-light: rgba(0, 0, 0, 0.38);--mdc-theme-text-icon-on-light: rgba(0, 0, 0, 0.38);--mdc-theme-text-primary-on-dark: white;--mdc-theme-text-secondary-on-dark: rgba(255, 255, 255, 0.7);--mdc-theme-text-hint-on-dark: rgba(255, 255, 255, 0.5);--mdc-theme-text-disabled-on-dark: rgba(255, 255, 255, 0.5);--mdc-theme-text-icon-on-dark: rgba(255, 255, 255, 0.5)}.mdc-theme--primary{color:#6200ee !important;color:var(--mdc-theme-primary, #6200ee) !important}.mdc-theme--secondary{color:#018786 !important;color:var(--mdc-theme-secondary, #018786) !important}.mdc-theme--background{background-color:#fff;background-color:var(--mdc-theme-background, #fff)}.mdc-theme--surface{background-color:#fff;background-color:var(--mdc-theme-surface, #fff)}.mdc-theme--error{color:#b00020 !important;color:var(--mdc-theme-error, #b00020) !important}.mdc-theme--on-primary{color:#fff !important;color:var(--mdc-theme-on-primary, #fff) !important}.mdc-theme--on-secondary{color:#fff !important;color:var(--mdc-theme-on-secondary, #fff) !important}.mdc-theme--on-surface{color:#000 !important;color:var(--mdc-theme-on-surface, #000) !important}.mdc-theme--on-error{color:#fff !important;color:var(--mdc-theme-on-error, #fff) !important}.mdc-theme--text-primary-on-background{color:rgba(0, 0, 0, 0.87) !important;color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87)) !important}.mdc-theme--text-secondary-on-background{color:rgba(0, 0, 0, 0.54) !important;color:var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, 0.54)) !important}.mdc-theme--text-hint-on-background{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-hint-on-background, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-disabled-on-background{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-disabled-on-background, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-icon-on-background{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-icon-on-background, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-primary-on-light{color:rgba(0, 0, 0, 0.87) !important;color:var(--mdc-theme-text-primary-on-light, rgba(0, 0, 0, 0.87)) !important}.mdc-theme--text-secondary-on-light{color:rgba(0, 0, 0, 0.54) !important;color:var(--mdc-theme-text-secondary-on-light, rgba(0, 0, 0, 0.54)) !important}.mdc-theme--text-hint-on-light{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-hint-on-light, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-disabled-on-light{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-disabled-on-light, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-icon-on-light{color:rgba(0, 0, 0, 0.38) !important;color:var(--mdc-theme-text-icon-on-light, rgba(0, 0, 0, 0.38)) !important}.mdc-theme--text-primary-on-dark{color:white !important;color:var(--mdc-theme-text-primary-on-dark, white) !important}.mdc-theme--text-secondary-on-dark{color:rgba(255, 255, 255, 0.7) !important;color:var(--mdc-theme-text-secondary-on-dark, rgba(255, 255, 255, 0.7)) !important}.mdc-theme--text-hint-on-dark{color:rgba(255, 255, 255, 0.5) !important;color:var(--mdc-theme-text-hint-on-dark, rgba(255, 255, 255, 0.5)) !important}.mdc-theme--text-disabled-on-dark{color:rgba(255, 255, 255, 0.5) !important;color:var(--mdc-theme-text-disabled-on-dark, rgba(255, 255, 255, 0.5)) !important}.mdc-theme--text-icon-on-dark{color:rgba(255, 255, 255, 0.5) !important;color:var(--mdc-theme-text-icon-on-dark, rgba(255, 255, 255, 0.5)) !important}.mdc-theme--primary-bg{background-color:#6200ee !important;background-color:var(--mdc-theme-primary, #6200ee) !important}.mdc-theme--secondary-bg{background-color:#018786 !important;background-color:var(--mdc-theme-secondary, #018786) !important} - -/*# sourceMappingURL=mdc.theme.min.css.map*/ \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/@material/theme/package.json b/third_party/material_web_components/components-chromium/node_modules/@material/theme/package.json index f57d4ab..35de66b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/@material/theme/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/@material/theme/package.json
@@ -1,7 +1,7 @@ { "name": "@material/theme", "description": "The Material Components for the web theming system", - "version": "9.0.0-canary.1c156d69d.0", + "version": "14.0.0", "license": "MIT", "keywords": [ "material components", @@ -15,7 +15,8 @@ }, "sideEffects": false, "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" }, - "gitHead": "2239befcb4baad98eef5bd67444b0f759e58a812" + "gitHead": "432c815e58d61a257742836f816cf95e271e6ea1" }
diff --git a/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/LICENSE b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/LICENSE
@@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE
diff --git a/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/index.d.ts b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/index.d.ts new file mode 100644 index 0000000..6c3d7ea --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/index.d.ts
@@ -0,0 +1,61 @@ +// Type definitions for trusted-types 2.0 +// Project: https://github.com/WICG/trusted-types +// Definitions by: Jakub Vrana <https://github.com/vrana> +// Damien Engels <https://github.com/engelsdamien> +// Emanuel Tesar <https://github.com/siegrift> +// Bjarki <https://github.com/bjarkler> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +import * as lib from './lib'; + +// Re-export the type definitions globally. +declare global { + const TrustedHTML: typeof lib.TrustedHTML; + type TrustedHTML = lib.TrustedHTML; + const TrustedScript: typeof lib.TrustedScript; + type TrustedScript = lib.TrustedScript; + const TrustedScriptURL: typeof lib.TrustedScriptURL; + type TrustedScriptURL = lib.TrustedScriptURL; + + const TrustedTypePolicy: typeof lib.TrustedTypePolicy; + type TrustedTypePolicy = lib.TrustedTypePolicy; + + const TrustedTypePolicyFactory: typeof lib.TrustedTypePolicyFactory; + type TrustedTypePolicyFactory = lib.TrustedTypePolicyFactory; + + type TrustedTypePolicyOptions = lib.TrustedTypePolicyOptions; + + // Attach the relevant Trusted Types properties to the Window object. + // tslint:disable-next-line no-empty-interface + interface Window extends lib.TrustedTypesWindow {} +} + +// These are the available exports when using the polyfill as npm package (e.g. in nodejs) +interface InternalTrustedTypePolicyFactory extends lib.TrustedTypePolicyFactory { + TrustedHTML: typeof lib.TrustedHTML; + TrustedScript: typeof lib.TrustedScript; + TrustedScriptURL: typeof lib.TrustedScriptURL; +} + +declare const trustedTypes: InternalTrustedTypePolicyFactory; + +declare class TrustedTypesEnforcer { + constructor(config: TrustedTypeConfig); + install: () => void; + uninstall: () => void; +} + +// tslint:disable-next-line no-unnecessary-class +declare class TrustedTypeConfig { + constructor( + isLoggingEnabled: boolean, + isEnforcementEnabled: boolean, + allowedPolicyNames: string[], + allowDuplicates: boolean, + cspString?: string | null, + windowObject?: Window, + ); +} + +export { trustedTypes, TrustedTypesEnforcer, TrustedTypeConfig, TrustedTypePolicy, TrustedTypePolicyFactory };
diff --git a/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/lib/index.d.ts b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/lib/index.d.ts new file mode 100644 index 0000000..27dbe5e7 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/lib/index.d.ts
@@ -0,0 +1,64 @@ +// The main type definitions. Packages that do not want to pollute the global +// scope with Trusted Types (e.g. libraries whose users may not be using Trusted +// Types) can import the types directly from 'trusted-types/lib'. + +export type FnNames = keyof TrustedTypePolicyOptions; +export type Args<Options extends TrustedTypePolicyOptions, K extends FnNames> = Parameters<NonNullable<Options[K]>>; + +export class TrustedHTML { + private constructor(); // To prevent instantiting with 'new'. + private brand: true; // To prevent structural typing. +} + +export class TrustedScript { + private constructor(); // To prevent instantiting with 'new'. + private brand: true; // To prevent structural typing. +} + +export class TrustedScriptURL { + private constructor(); // To prevent instantiting with 'new'. + private brand: true; // To prevent structural typing. +} + +export abstract class TrustedTypePolicyFactory { + createPolicy<Options extends TrustedTypePolicyOptions>( + policyName: string, + policyOptions?: Options, + ): Pick<TrustedTypePolicy<Options>, 'name' | Extract<keyof Options, FnNames>>; + isHTML(value: unknown): value is TrustedHTML; + isScript(value: unknown): value is TrustedScript; + isScriptURL(value: unknown): value is TrustedScriptURL; + readonly emptyHTML: TrustedHTML; + readonly emptyScript: TrustedScript; + getAttributeType(tagName: string, attribute: string, elementNs?: string, attrNs?: string): string | null; + getPropertyType(tagName: string, property: string, elementNs?: string): string | null; + readonly defaultPolicy: TrustedTypePolicy | null; +} + +export abstract class TrustedTypePolicy<Options extends TrustedTypePolicyOptions = TrustedTypePolicyOptions> { + readonly name: string; + createHTML(...args: Args<Options, 'createHTML'>): TrustedHTML; + createScript(...args: Args<Options, 'createScript'>): TrustedScript; + createScriptURL(...args: Args<Options, 'createScriptURL'>): TrustedScriptURL; +} + +export interface TrustedTypePolicyOptions { + createHTML?: ((input: string, ...arguments: any[]) => string) | undefined; + createScript?: ((input: string, ...arguments: any[]) => string) | undefined; + createScriptURL?: ((input: string, ...arguments: any[]) => string) | undefined; +} + +// The Window object is augmented with the following properties in browsers that +// support Trusted Types. Users of the 'trusted-types/lib' entrypoint can cast +// window as TrustedTypesWindow to access these properties. +export interface TrustedTypesWindow { + // `trustedTypes` is left intentionally optional to make sure that + // people handle the case when their code is running in a browser not + // supporting trustedTypes. + trustedTypes?: TrustedTypePolicyFactory | undefined; + TrustedHTML: typeof TrustedHTML; + TrustedScript: typeof TrustedScript; + TrustedScriptURL: typeof TrustedScriptURL; + TrustedTypePolicyFactory: typeof TrustedTypePolicyFactory; + TrustedTypePolicy: typeof TrustedTypePolicy; +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/package.json b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/package.json new file mode 100644 index 0000000..3c43f407 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/@types/trusted-types/package.json
@@ -0,0 +1,40 @@ +{ + "name": "@types/trusted-types", + "version": "2.0.2", + "description": "TypeScript definitions for trusted-types", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/trusted-types", + "license": "MIT", + "contributors": [ + { + "name": "Jakub Vrana", + "url": "https://github.com/vrana", + "githubUsername": "vrana" + }, + { + "name": "Damien Engels", + "url": "https://github.com/engelsdamien", + "githubUsername": "engelsdamien" + }, + { + "name": "Emanuel Tesar", + "url": "https://github.com/siegrift", + "githubUsername": "siegrift" + }, + { + "name": "Bjarki", + "url": "https://github.com/bjarkler", + "githubUsername": "bjarkler" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/trusted-types" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "99d8c3702ecfbc895e9827c063dcce01708c2011a667e0844c3d8a88259efece", + "typeScriptVersion": "3.6" +} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/LICENSE b/third_party/material_web_components/components-chromium/node_modules/lit-element/LICENSE index 39cfe443..be7a97b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/LICENSE
@@ -1,20 +1,20 @@ BSD 3-Clause License -Copyright (c) 2017, The Polymer Authors. All rights reserved. +Copyright (c) 2017 Google LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -25,4 +25,4 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.d.ts new file mode 100644 index 0000000..535eb25 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.d.ts
@@ -0,0 +1,16 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from '@lit/reactive-element/decorators/base.js'; +export * from '@lit/reactive-element/decorators/custom-element.js'; +export * from '@lit/reactive-element/decorators/property.js'; +export * from '@lit/reactive-element/decorators/state.js'; +export * from '@lit/reactive-element/decorators/event-options.js'; +export * from '@lit/reactive-element/decorators/query.js'; +export * from '@lit/reactive-element/decorators/query-all.js'; +export * from '@lit/reactive-element/decorators/query-async.js'; +export * from '@lit/reactive-element/decorators/query-assigned-elements.js'; +export * from '@lit/reactive-element/decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.js new file mode 100644 index 0000000..943149d --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/decorators.js
@@ -0,0 +1,2 @@ +export*from'../@lit/reactive-element/decorators/base.js';export*from'../@lit/reactive-element/decorators/custom-element.js';export*from'../@lit/reactive-element/decorators/property.js';export*from'../@lit/reactive-element/decorators/state.js';export*from'../@lit/reactive-element/decorators/event-options.js';export*from'../@lit/reactive-element/decorators/query.js';export*from'../@lit/reactive-element/decorators/query-all.js';export*from'../@lit/reactive-element/decorators/query-async.js';export*from'../@lit/reactive-element/decorators/query-assigned-elements.js';export*from'../@lit/reactive-element/decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/index.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/index.d.ts new file mode 100644 index 0000000..d978ddb --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/index.d.ts
@@ -0,0 +1,10 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from '@lit/reactive-element'; +export * from 'lit-html'; +export * from './lit-element.js'; +export * from './decorators.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/index.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/index.js new file mode 100644 index 0000000..ab7f6b8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/index.js
@@ -0,0 +1,7 @@ +export*from'../@lit/reactive-element/reactive-element.js';export*from'../lit-html/lit-html.js';export{LitElement,UpdatingElement,_$LE}from'./lit-element.js';export*from'../@lit/reactive-element/decorators/base.js';export*from'../@lit/reactive-element/decorators/custom-element.js';export*from'../@lit/reactive-element/decorators/property.js';export*from'../@lit/reactive-element/decorators/state.js';export*from'../@lit/reactive-element/decorators/event-options.js';export*from'../@lit/reactive-element/decorators/query.js';export*from'../@lit/reactive-element/decorators/query-all.js';export*from'../@lit/reactive-element/decorators/query-async.js';export*from'../@lit/reactive-element/decorators/query-assigned-elements.js';export*from'../@lit/reactive-element/decorators/query-assigned-nodes.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information."); +//# sourceMappingURL=index.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.d.ts deleted file mode 100644 index 80a3f754..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/** -@license -Copyright (c) 2019 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at -http://polymer.github.io/LICENSE.txt The complete set of authors may be found at -http://polymer.github.io/AUTHORS.txt The complete set of contributors may be -found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as -part of the polymer project is also subject to an additional IP rights grant -found at http://polymer.github.io/PATENTS.txt -*/ -/** - * Whether the current browser supports `adoptedStyleSheets`. - */ -export declare const supportsAdoptingStyleSheets: boolean; -export declare class CSSResult { - _styleSheet?: CSSStyleSheet | null; - readonly cssText: string; - constructor(cssText: string, safeToken: symbol); - get styleSheet(): CSSStyleSheet | null; - toString(): string; -} -/** - * Wrap a value for interpolation in a [[`css`]] tagged template literal. - * - * This is unsafe because untrusted CSS text can be used to phone home - * or exfiltrate data to an attacker controlled site. Take care to only use - * this with trusted input. - */ -export declare const unsafeCSS: (value: unknown) => CSSResult; -/** - * Template tag which which can be used with LitElement's [[LitElement.styles | - * `styles`]] property to set element styles. For security reasons, only literal - * string values may be used. To incorporate non-literal values [[`unsafeCSS`]] - * may be used inside a template string part. - */ -export declare const css: (strings: TemplateStringsArray, ...values: (number | CSSResult)[]) => CSSResult; -//# sourceMappingURL=css-tag.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.js deleted file mode 100644 index fca66b0..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/css-tag.js +++ /dev/null
@@ -1,78 +0,0 @@ -/** -@license -Copyright (c) 2019 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at -http://polymer.github.io/LICENSE.txt The complete set of authors may be found at -http://polymer.github.io/AUTHORS.txt The complete set of contributors may be -found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as -part of the polymer project is also subject to an additional IP rights grant -found at http://polymer.github.io/PATENTS.txt -*/ -/** - * Whether the current browser supports `adoptedStyleSheets`. - */ -export const supportsAdoptingStyleSheets = (window.ShadowRoot) && - (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) && - ('adoptedStyleSheets' in Document.prototype) && - ('replace' in CSSStyleSheet.prototype); -const constructionToken = Symbol(); -export class CSSResult { - constructor(cssText, safeToken) { - if (safeToken !== constructionToken) { - throw new Error('CSSResult is not constructable. Use `unsafeCSS` or `css` instead.'); - } - this.cssText = cssText; - } - // Note, this is a getter so that it's lazy. In practice, this means - // stylesheets are not created until the first element instance is made. - get styleSheet() { - if (this._styleSheet === undefined) { - // Note, if `supportsAdoptingStyleSheets` is true then we assume - // CSSStyleSheet is constructable. - if (supportsAdoptingStyleSheets) { - this._styleSheet = new CSSStyleSheet(); - this._styleSheet.replaceSync(this.cssText); - } - else { - this._styleSheet = null; - } - } - return this._styleSheet; - } - toString() { - return this.cssText; - } -} -/** - * Wrap a value for interpolation in a [[`css`]] tagged template literal. - * - * This is unsafe because untrusted CSS text can be used to phone home - * or exfiltrate data to an attacker controlled site. Take care to only use - * this with trusted input. - */ -export const unsafeCSS = (value) => { - return new CSSResult(String(value), constructionToken); -}; -const textFromCSSResult = (value) => { - if (value instanceof CSSResult) { - return value.cssText; - } - else if (typeof value === 'number') { - return value; - } - else { - throw new Error(`Value passed to 'css' function must be a 'css' function result: ${value}. Use 'unsafeCSS' to pass non-literal values, but - take care to ensure page security.`); - } -}; -/** - * Template tag which which can be used with LitElement's [[LitElement.styles | - * `styles`]] property to set element styles. For security reasons, only literal - * string values may be used. To incorporate non-literal values [[`unsafeCSS`]] - * may be used inside a template string part. - */ -export const css = (strings, ...values) => { - const cssText = values.reduce((acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1], strings[0]); - return new CSSResult(cssText, constructionToken); -}; -//# sourceMappingURL=css-tag.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.d.ts deleted file mode 100644 index 48068529..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.d.ts +++ /dev/null
@@ -1,233 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { PropertyDeclaration } from './updating-element.js'; -export declare type Constructor<T> = { - new (...args: any[]): T; -}; -interface ClassDescriptor { - kind: 'class'; - elements: ClassElement[]; - finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>; -} -interface ClassElement { - kind: 'field' | 'method'; - key: PropertyKey; - placement: 'static' | 'prototype' | 'own'; - initializer?: Function; - extras?: ClassElement[]; - finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>; - descriptor?: PropertyDescriptor; -} -/** - * Class decorator factory that defines the decorated class as a custom element. - * - * ``` - * @customElement('my-element') - * class MyElement { - * render() { - * return html``; - * } - * } - * ``` - * @category Decorator - * @param tagName The name of the custom element to define. - */ -export declare const customElement: (tagName: string) => (classOrDescriptor: ClassDescriptor | Constructor<HTMLElement>) => any; -/** - * A property decorator which creates a LitElement property which reflects a - * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be - * supplied to configure property features. - * - * This decorator should only be used for public fields. Private or protected - * fields should use the [[`internalProperty`]] decorator. - * - * @example - * ```ts - * class MyElement { - * @property({ type: Boolean }) - * clicked = false; - * } - * ``` - * @category Decorator - * @ExportDecoratedItems - */ -export declare function property(options?: PropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -export interface InternalPropertyDeclaration<Type = unknown> { - /** - * A function that indicates if a property should be considered changed when - * it is set. The function should take the `newValue` and `oldValue` and - * return `true` if an update should be requested. - */ - hasChanged?(value: Type, oldValue: Type): boolean; -} -/** - * Declares a private or protected property that still triggers updates to the - * element when it changes. - * - * Properties declared this way must not be used from HTML or HTML templating - * systems, they're solely for properties internal to the element. These - * properties may be renamed by optimization tools like closure compiler. - * @category Decorator - */ -export declare function internalProperty(options?: InternalPropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter that - * executes a querySelector on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * @param cache An optional boolean which when true performs the DOM query only - * once and caches the result. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * - * ```ts - * class MyElement { - * @query('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function query(selector: string, cache?: boolean): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter that - * returns a promise that resolves to the result of a querySelector on the - * element's renderRoot done after the element's `updateComplete` promise - * resolves. When the queried property may change with element state, this - * decorator can be used instead of requiring users to await the - * `updateComplete` before accessing the property. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * ```ts - * class MyElement { - * @queryAsync('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * - * // external usage - * async doSomethingWithFirst() { - * (await aMyElement.first).doSomething(); - * } - * ``` - * @category Decorator - */ -export declare function queryAsync(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter - * that executes a querySelectorAll on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: - * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll - * - * @example - * ```ts - * class MyElement { - * @queryAll('div') - * divs; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function queryAll(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * Adds event listener options to a method used as an event listener in a - * lit-html template. - * - * @param options An object that specifies event listener options as accepted by - * `EventTarget#addEventListener` and `EventTarget#removeEventListener`. - * - * Current browsers support the `capture`, `passive`, and `once` options. See: - * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters - * - * @example - * ```ts - * class MyElement { - * clicked = false; - * - * render() { - * return html` - * <div @click=${this._onClick}`> - * <button></button> - * </div> - * `; - * } - * - * @eventOptions({capture: true}) - * _onClick(e) { - * this.clicked = true; - * } - * } - * ``` - * @category Decorator - */ -export declare function eventOptions(options: AddEventListenerOptions): any; -/** - * A property decorator that converts a class property into a getter that - * returns the `assignedNodes` of the given named `slot`. Note, the type of - * this property should be annotated as `NodeListOf<HTMLElement>`. - * - * @param slotName A string name of the slot. - * @param flatten A boolean which when true flattens the assigned nodes, - * meaning any assigned nodes that are slot elements are replaced with their - * assigned nodes. - * @param selector A string which filters the results to elements that match - * the given css selector. - * - * * @example - * ```ts - * class MyElement { - * @queryAssignedNodes('list', true, '.item') - * listItems; - * - * render() { - * return html` - * <slot name="list"></slot> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function queryAssignedNodes(slotName?: string, flatten?: boolean, selector?: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -export {}; -//# sourceMappingURL=decorators.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.js deleted file mode 100644 index 2b6fa0b..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/decorators.js +++ /dev/null
@@ -1,396 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const legacyCustomElement = (tagName, clazz) => { - window.customElements.define(tagName, clazz); - // Cast as any because TS doesn't recognize the return type as being a - // subtype of the decorated class when clazz is typed as - // `Constructor<HTMLElement>` for some reason. - // `Constructor<HTMLElement>` is helpful to make sure the decorator is - // applied to elements however. - // tslint:disable-next-line:no-any - return clazz; -}; -const standardCustomElement = (tagName, descriptor) => { - const { kind, elements } = descriptor; - return { - kind, - elements, - // This callback is called once the class is otherwise fully defined - finisher(clazz) { - window.customElements.define(tagName, clazz); - } - }; -}; -/** - * Class decorator factory that defines the decorated class as a custom element. - * - * ``` - * @customElement('my-element') - * class MyElement { - * render() { - * return html``; - * } - * } - * ``` - * @category Decorator - * @param tagName The name of the custom element to define. - */ -export const customElement = (tagName) => (classOrDescriptor) => (typeof classOrDescriptor === 'function') ? - legacyCustomElement(tagName, classOrDescriptor) : - standardCustomElement(tagName, classOrDescriptor); -const standardProperty = (options, element) => { - // When decorating an accessor, pass it through and add property metadata. - // Note, the `hasOwnProperty` check in `createProperty` ensures we don't - // stomp over the user's accessor. - if (element.kind === 'method' && element.descriptor && - !('value' in element.descriptor)) { - return Object.assign(Object.assign({}, element), { finisher(clazz) { - clazz.createProperty(element.key, options); - } }); - } - else { - // createProperty() takes care of defining the property, but we still - // must return some kind of descriptor, so return a descriptor for an - // unused prototype field. The finisher calls createProperty(). - return { - kind: 'field', - key: Symbol(), - placement: 'own', - descriptor: {}, - // When @babel/plugin-proposal-decorators implements initializers, - // do this instead of the initializer below. See: - // https://github.com/babel/babel/issues/9260 extras: [ - // { - // kind: 'initializer', - // placement: 'own', - // initializer: descriptor.initializer, - // } - // ], - initializer() { - if (typeof element.initializer === 'function') { - this[element.key] = element.initializer.call(this); - } - }, - finisher(clazz) { - clazz.createProperty(element.key, options); - } - }; - } -}; -const legacyProperty = (options, proto, name) => { - proto.constructor - .createProperty(name, options); -}; -/** - * A property decorator which creates a LitElement property which reflects a - * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be - * supplied to configure property features. - * - * This decorator should only be used for public fields. Private or protected - * fields should use the [[`internalProperty`]] decorator. - * - * @example - * ```ts - * class MyElement { - * @property({ type: Boolean }) - * clicked = false; - * } - * ``` - * @category Decorator - * @ExportDecoratedItems - */ -export function property(options) { - // tslint:disable-next-line:no-any decorator - return (protoOrDescriptor, name) => (name !== undefined) ? - legacyProperty(options, protoOrDescriptor, name) : - standardProperty(options, protoOrDescriptor); -} -/** - * Declares a private or protected property that still triggers updates to the - * element when it changes. - * - * Properties declared this way must not be used from HTML or HTML templating - * systems, they're solely for properties internal to the element. These - * properties may be renamed by optimization tools like closure compiler. - * @category Decorator - */ -export function internalProperty(options) { - return property({ attribute: false, hasChanged: options === null || options === void 0 ? void 0 : options.hasChanged }); -} -/** - * A property decorator that converts a class property into a getter that - * executes a querySelector on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * @param cache An optional boolean which when true performs the DOM query only - * once and caches the result. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * - * ```ts - * class MyElement { - * @query('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export function query(selector, cache) { - return (protoOrDescriptor, - // tslint:disable-next-line:no-any decorator - name) => { - const descriptor = { - get() { - return this.renderRoot.querySelector(selector); - }, - enumerable: true, - configurable: true, - }; - if (cache) { - const key = typeof name === 'symbol' ? Symbol() : `__${name}`; - descriptor.get = function () { - if (this[key] === undefined) { - (this[key] = - this.renderRoot.querySelector(selector)); - } - return this[key]; - }; - } - return (name !== undefined) ? - legacyQuery(descriptor, protoOrDescriptor, name) : - standardQuery(descriptor, protoOrDescriptor); - }; -} -// Note, in the future, we may extend this decorator to support the use case -// where the queried element may need to do work to become ready to interact -// with (e.g. load some implementation code). If so, we might elect to -// add a second argument defining a function that can be run to make the -// queried element loaded/updated/ready. -/** - * A property decorator that converts a class property into a getter that - * returns a promise that resolves to the result of a querySelector on the - * element's renderRoot done after the element's `updateComplete` promise - * resolves. When the queried property may change with element state, this - * decorator can be used instead of requiring users to await the - * `updateComplete` before accessing the property. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * ```ts - * class MyElement { - * @queryAsync('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * - * // external usage - * async doSomethingWithFirst() { - * (await aMyElement.first).doSomething(); - * } - * ``` - * @category Decorator - */ -export function queryAsync(selector) { - return (protoOrDescriptor, - // tslint:disable-next-line:no-any decorator - name) => { - const descriptor = { - async get() { - await this.updateComplete; - return this.renderRoot.querySelector(selector); - }, - enumerable: true, - configurable: true, - }; - return (name !== undefined) ? - legacyQuery(descriptor, protoOrDescriptor, name) : - standardQuery(descriptor, protoOrDescriptor); - }; -} -/** - * A property decorator that converts a class property into a getter - * that executes a querySelectorAll on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: - * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll - * - * @example - * ```ts - * class MyElement { - * @queryAll('div') - * divs; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export function queryAll(selector) { - return (protoOrDescriptor, - // tslint:disable-next-line:no-any decorator - name) => { - const descriptor = { - get() { - return this.renderRoot.querySelectorAll(selector); - }, - enumerable: true, - configurable: true, - }; - return (name !== undefined) ? - legacyQuery(descriptor, protoOrDescriptor, name) : - standardQuery(descriptor, protoOrDescriptor); - }; -} -const legacyQuery = (descriptor, proto, name) => { - Object.defineProperty(proto, name, descriptor); -}; -const standardQuery = (descriptor, element) => ({ - kind: 'method', - placement: 'prototype', - key: element.key, - descriptor, -}); -const standardEventOptions = (options, element) => { - return Object.assign(Object.assign({}, element), { finisher(clazz) { - Object.assign(clazz.prototype[element.key], options); - } }); -}; -const legacyEventOptions = -// tslint:disable-next-line:no-any legacy decorator -(options, proto, name) => { - Object.assign(proto[name], options); -}; -/** - * Adds event listener options to a method used as an event listener in a - * lit-html template. - * - * @param options An object that specifies event listener options as accepted by - * `EventTarget#addEventListener` and `EventTarget#removeEventListener`. - * - * Current browsers support the `capture`, `passive`, and `once` options. See: - * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters - * - * @example - * ```ts - * class MyElement { - * clicked = false; - * - * render() { - * return html` - * <div @click=${this._onClick}`> - * <button></button> - * </div> - * `; - * } - * - * @eventOptions({capture: true}) - * _onClick(e) { - * this.clicked = true; - * } - * } - * ``` - * @category Decorator - */ -export function eventOptions(options) { - // Return value typed as any to prevent TypeScript from complaining that - // standard decorator function signature does not match TypeScript decorator - // signature - // TODO(kschaaf): unclear why it was only failing on this decorator and not - // the others - return ((protoOrDescriptor, name) => (name !== undefined) ? - legacyEventOptions(options, protoOrDescriptor, name) : - standardEventOptions(options, protoOrDescriptor)); -} -// x-browser support for matches -// tslint:disable-next-line:no-any -const ElementProto = Element.prototype; -const legacyMatches = ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector; -/** - * A property decorator that converts a class property into a getter that - * returns the `assignedNodes` of the given named `slot`. Note, the type of - * this property should be annotated as `NodeListOf<HTMLElement>`. - * - * @param slotName A string name of the slot. - * @param flatten A boolean which when true flattens the assigned nodes, - * meaning any assigned nodes that are slot elements are replaced with their - * assigned nodes. - * @param selector A string which filters the results to elements that match - * the given css selector. - * - * * @example - * ```ts - * class MyElement { - * @queryAssignedNodes('list', true, '.item') - * listItems; - * - * render() { - * return html` - * <slot name="list"></slot> - * `; - * } - * } - * ``` - * @category Decorator - */ -export function queryAssignedNodes(slotName = '', flatten = false, selector = '') { - return (protoOrDescriptor, - // tslint:disable-next-line:no-any decorator - name) => { - const descriptor = { - get() { - const slotSelector = `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`; - const slot = this.renderRoot.querySelector(slotSelector); - let nodes = slot && slot.assignedNodes({ flatten }); - if (nodes && selector) { - nodes = nodes.filter((node) => node.nodeType === Node.ELEMENT_NODE && - node.matches ? - node.matches(selector) : - legacyMatches.call(node, selector)); - } - return nodes; - }, - enumerable: true, - configurable: true, - }; - return (name !== undefined) ? - legacyQuery(descriptor, protoOrDescriptor, name) : - standardQuery(descriptor, protoOrDescriptor); - }; -} -//# sourceMappingURL=decorators.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.d.ts deleted file mode 100644 index 2ccef8d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.d.ts +++ /dev/null
@@ -1,428 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -declare global { - var JSCompiler_renameProperty: <P extends PropertyKey>(prop: P, _obj: unknown) => P; - interface Window { - JSCompiler_renameProperty: typeof JSCompiler_renameProperty; - } -} -/** - * Converts property values to and from attribute values. - */ -export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> { - /** - * Function called to convert an attribute value to a property - * value. - */ - fromAttribute?(value: string | null, type?: TypeHint): Type; - /** - * Function called to convert a property value to an attribute - * value. - * - * It returns unknown instead of string, to be compatible with - * https://github.com/WICG/trusted-types (and similar efforts). - */ - toAttribute?(value: Type, type?: TypeHint): unknown; -} -declare type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type); -/** - * Defines options for a property accessor. - */ -export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> { - /** - * Indicates how and whether the property becomes an observed attribute. - * If the value is `false`, the property is not added to `observedAttributes`. - * If true or absent, the lowercased property name is observed (e.g. `fooBar` - * becomes `foobar`). If a string, the string value is observed (e.g - * `attribute: 'foo-bar'`). - */ - readonly attribute?: boolean | string; - /** - * Indicates the type of the property. This is used only as a hint for the - * `converter` to determine how to convert the attribute - * to/from a property. - */ - readonly type?: TypeHint; - /** - * Indicates how to convert the attribute to/from a property. If this value - * is a function, it is used to convert the attribute value a the property - * value. If it's an object, it can have keys for `fromAttribute` and - * `toAttribute`. If no `toAttribute` function is provided and - * `reflect` is set to `true`, the property value is set directly to the - * attribute. A default `converter` is used if none is provided; it supports - * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note, - * when a property changes and the converter is used to update the attribute, - * the property is never updated again as a result of the attribute changing, - * and vice versa. - */ - readonly converter?: AttributeConverter<Type, TypeHint>; - /** - * Indicates if the property should reflect to an attribute. - * If `true`, when the property is set, the attribute is set using the - * attribute name determined according to the rules for the `attribute` - * property option and the value of the property converted using the rules - * from the `converter` property option. - */ - readonly reflect?: boolean; - /** - * A function that indicates if a property should be considered changed when - * it is set. The function should take the `newValue` and `oldValue` and - * return `true` if an update should be requested. - */ - hasChanged?(value: Type, oldValue: Type): boolean; - /** - * Indicates whether an accessor will be created for this property. By - * default, an accessor will be generated for this property that requests an - * update when set. If this flag is `true`, no accessor will be created, and - * it will be the user's responsibility to call - * `this.requestUpdate(propertyName, oldValue)` to request an update when - * the property changes. - */ - readonly noAccessor?: boolean; -} -/** - * Map of properties to PropertyDeclaration options. For each property an - * accessor is made, and the property is processed according to the - * PropertyDeclaration options. - */ -export interface PropertyDeclarations { - readonly [key: string]: PropertyDeclaration; -} -/** - * Map of changed properties with old values. Takes an optional generic - * interface corresponding to the declared element properties. - */ -export declare type PropertyValues<T = any> = keyof T extends PropertyKey ? Map<keyof T, unknown> : never; -export declare const defaultConverter: ComplexAttributeConverter; -export interface HasChanged { - (value: unknown, old: unknown): boolean; -} -/** - * Change function that returns true if `value` is different from `oldValue`. - * This method is used as the default for a property's `hasChanged` function. - */ -export declare const notEqual: HasChanged; -/** - * The Closure JS Compiler doesn't currently have good support for static - * property semantics where "this" is dynamic (e.g. - * https://github.com/google/closure-compiler/issues/3177 and others) so we use - * this hack to bypass any rewriting by the compiler. - */ -declare const finalized = "finalized"; -/** - * Base element class which manages element properties and attributes. When - * properties change, the `update` method is asynchronously called. This method - * should be supplied by subclassers to render updates as desired. - * @noInheritDoc - */ -export declare abstract class UpdatingElement extends HTMLElement { - /** - * Maps attribute names to properties; for example `foobar` attribute to - * `fooBar` property. Created lazily on user subclasses when finalizing the - * class. - */ - private static _attributeToPropertyMap; - /** - * Marks class as having finished creating properties. - */ - protected static [finalized]: boolean; - /** - * Memoized list of all class properties, including any superclass properties. - * Created lazily on user subclasses when finalizing the class. - */ - private static _classProperties?; - /** - * User-supplied object that maps property names to `PropertyDeclaration` - * objects containing options for configuring the property. - */ - static properties: PropertyDeclarations; - /** - * Returns a list of attributes corresponding to the registered properties. - * @nocollapse - */ - static get observedAttributes(): string[]; - /** - * Ensures the private `_classProperties` property metadata is created. - * In addition to `finalize` this is also called in `createProperty` to - * ensure the `@property` decorator can add property metadata. - */ - /** @nocollapse */ - private static _ensureClassProperties; - /** - * Creates a property accessor on the element prototype if one does not exist - * and stores a PropertyDeclaration for the property with the given options. - * The property setter calls the property's `hasChanged` property option - * or uses a strict identity check to determine whether or not to request - * an update. - * - * This method may be overridden to customize properties; however, - * when doing so, it's important to call `super.createProperty` to ensure - * the property is setup correctly. This method calls - * `getPropertyDescriptor` internally to get a descriptor to install. - * To customize what properties do when they are get or set, override - * `getPropertyDescriptor`. To customize the options for a property, - * implement `createProperty` like this: - * - * static createProperty(name, options) { - * options = Object.assign(options, {myOption: true}); - * super.createProperty(name, options); - * } - * - * @nocollapse - */ - static createProperty(name: PropertyKey, options?: PropertyDeclaration): void; - /** - * Returns a property descriptor to be defined on the given named property. - * If no descriptor is returned, the property will not become an accessor. - * For example, - * - * class MyElement extends LitElement { - * static getPropertyDescriptor(name, key, options) { - * const defaultDescriptor = - * super.getPropertyDescriptor(name, key, options); - * const setter = defaultDescriptor.set; - * return { - * get: defaultDescriptor.get, - * set(value) { - * setter.call(this, value); - * // custom action. - * }, - * configurable: true, - * enumerable: true - * } - * } - * } - * - * @nocollapse - */ - protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): { - get(): any; - set(this: UpdatingElement, value: unknown): void; - configurable: boolean; - enumerable: boolean; - }; - /** - * Returns the property options associated with the given property. - * These options are defined with a PropertyDeclaration via the `properties` - * object or the `@property` decorator and are registered in - * `createProperty(...)`. - * - * Note, this method should be considered "final" and not overridden. To - * customize the options for a given property, override `createProperty`. - * - * @nocollapse - * @final - */ - protected static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>; - /** - * Creates property accessors for registered properties and ensures - * any superclasses are also finalized. - * @nocollapse - */ - protected static finalize(): void; - /** - * Returns the property name for the given attribute `name`. - * @nocollapse - */ - private static _attributeNameForProperty; - /** - * Returns true if a property should request an update. - * Called when a property value is set and uses the `hasChanged` - * option for the property if present or a strict identity check. - * @nocollapse - */ - private static _valueHasChanged; - /** - * Returns the property value for the given attribute value. - * Called via the `attributeChangedCallback` and uses the property's - * `converter` or `converter.fromAttribute` property option. - * @nocollapse - */ - private static _propertyValueFromAttribute; - /** - * Returns the attribute value for the given property value. If this - * returns undefined, the property will *not* be reflected to an attribute. - * If this returns null, the attribute will be removed, otherwise the - * attribute will be set to the value. - * This uses the property's `reflect` and `type.toAttribute` property options. - * @nocollapse - */ - private static _propertyValueToAttribute; - private _updateState; - private _instanceProperties?; - private _updatePromise; - private _enableUpdatingResolver; - /** - * Map with keys for any properties that have changed since the last - * update cycle with previous values. - */ - private _changedProperties; - /** - * Map with keys of properties that should be reflected when updated. - */ - private _reflectingProperties?; - constructor(); - /** - * Performs element initialization. By default captures any pre-set values for - * registered properties. - */ - protected initialize(): void; - /** - * Fixes any properties set on the instance before upgrade time. - * Otherwise these would shadow the accessor and break these properties. - * The properties are stored in a Map which is played back after the - * constructor runs. Note, on very old versions of Safari (<=9) or Chrome - * (<=41), properties created for native platform properties like (`id` or - * `name`) may not have default values set in the element constructor. On - * these browsers native properties appear on instances and therefore their - * default value will overwrite any element default (e.g. if the element sets - * this.id = 'id' in the constructor, the 'id' will become '' since this is - * the native platform default). - */ - private _saveInstanceProperties; - /** - * Applies previously saved instance properties. - */ - private _applyInstanceProperties; - connectedCallback(): void; - protected enableUpdating(): void; - /** - * Allows for `super.disconnectedCallback()` in extensions while - * reserving the possibility of making non-breaking feature additions - * when disconnecting at some point in the future. - */ - disconnectedCallback(): void; - /** - * Synchronizes property values when attributes change. - */ - attributeChangedCallback(name: string, old: string | null, value: string | null): void; - private _propertyToAttribute; - private _attributeToProperty; - /** - * This protected version of `requestUpdate` does not access or return the - * `updateComplete` promise. This promise can be overridden and is therefore - * not free to access. - */ - protected requestUpdateInternal(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void; - /** - * Requests an update which is processed asynchronously. This should - * be called when an element should update based on some state not triggered - * by setting a property. In this case, pass no arguments. It should also be - * called when manually implementing a property setter. In this case, pass the - * property `name` and `oldValue` to ensure that any configured property - * options are honored. Returns the `updateComplete` Promise which is resolved - * when the update completes. - * - * @param name {PropertyKey} (optional) name of requesting property - * @param oldValue {any} (optional) old value of requesting property - * @returns {Promise} A Promise that is resolved when the update completes. - */ - requestUpdate(name?: PropertyKey, oldValue?: unknown): Promise<unknown>; - /** - * Sets up the element to asynchronously update. - */ - private _enqueueUpdate; - private get _hasRequestedUpdate(); - protected get hasUpdated(): number; - /** - * Performs an element update. Note, if an exception is thrown during the - * update, `firstUpdated` and `updated` will not be called. - * - * You can override this method to change the timing of updates. If this - * method is overridden, `super.performUpdate()` must be called. - * - * For instance, to schedule updates to occur just before the next frame: - * - * ``` - * protected async performUpdate(): Promise<unknown> { - * await new Promise((resolve) => requestAnimationFrame(() => resolve())); - * super.performUpdate(); - * } - * ``` - */ - protected performUpdate(): void | Promise<unknown>; - private _markUpdated; - /** - * Returns a Promise that resolves when the element has completed updating. - * The Promise value is a boolean that is `true` if the element completed the - * update without triggering another update. The Promise result is `false` if - * a property was set inside `updated()`. If the Promise is rejected, an - * exception was thrown during the update. - * - * To await additional asynchronous work, override the `_getUpdateComplete` - * method. For example, it is sometimes useful to await a rendered element - * before fulfilling this Promise. To do this, first await - * `super._getUpdateComplete()`, then any subsequent state. - * - * @returns {Promise} The Promise returns a boolean that indicates if the - * update resolved without triggering another update. - */ - get updateComplete(): Promise<unknown>; - /** - * Override point for the `updateComplete` promise. - * - * It is not safe to override the `updateComplete` getter directly due to a - * limitation in TypeScript which means it is not possible to call a - * superclass getter (e.g. `super.updateComplete.then(...)`) when the target - * language is ES5 (https://github.com/microsoft/TypeScript/issues/338). - * This method should be overridden instead. For example: - * - * class MyElement extends LitElement { - * async _getUpdateComplete() { - * await super._getUpdateComplete(); - * await this._myChild.updateComplete; - * } - * } - */ - protected _getUpdateComplete(): Promise<unknown>; - /** - * Controls whether or not `update` should be called when the element requests - * an update. By default, this method always returns `true`, but this can be - * customized to control when to update. - * - * @param _changedProperties Map of changed properties with old values - */ - protected shouldUpdate(_changedProperties: PropertyValues): boolean; - /** - * Updates the element. This method reflects property values to attributes. - * It can be overridden to render and keep updated element DOM. - * Setting properties inside this method will *not* trigger - * another update. - * - * @param _changedProperties Map of changed properties with old values - */ - protected update(_changedProperties: PropertyValues): void; - /** - * Invoked whenever the element is updated. Implement to perform - * post-updating tasks via DOM APIs, for example, focusing an element. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - protected updated(_changedProperties: PropertyValues): void; - /** - * Invoked when the element is first updated. Implement to perform one time - * work on the element after update. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - protected firstUpdated(_changedProperties: PropertyValues): void; -} -export {}; -//# sourceMappingURL=updating-element.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.js deleted file mode 100644 index 1bdc8f55..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lib/updating-element.js +++ /dev/null
@@ -1,673 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -var _a; -/** - * Use this module if you want to create your own base class extending - * [[UpdatingElement]]. - * @packageDocumentation - */ -/* - * When using Closure Compiler, JSCompiler_renameProperty(property, object) is - * replaced at compile time by the munged name for object[property]. We cannot - * alias this function, so we have to use a small shim that has the same - * behavior when not compiling. - */ -window.JSCompiler_renameProperty = - (prop, _obj) => prop; -export const defaultConverter = { - toAttribute(value, type) { - switch (type) { - case Boolean: - return value ? '' : null; - case Object: - case Array: - // if the value is `null` or `undefined` pass this through - // to allow removing/no change behavior. - return value == null ? value : JSON.stringify(value); - } - return value; - }, - fromAttribute(value, type) { - switch (type) { - case Boolean: - return value !== null; - case Number: - return value === null ? null : Number(value); - case Object: - case Array: - return JSON.parse(value); - } - return value; - } -}; -/** - * Change function that returns true if `value` is different from `oldValue`. - * This method is used as the default for a property's `hasChanged` function. - */ -export const notEqual = (value, old) => { - // This ensures (old==NaN, value==NaN) always returns false - return old !== value && (old === old || value === value); -}; -const defaultPropertyDeclaration = { - attribute: true, - type: String, - converter: defaultConverter, - reflect: false, - hasChanged: notEqual -}; -const STATE_HAS_UPDATED = 1; -const STATE_UPDATE_REQUESTED = 1 << 2; -const STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3; -const STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4; -/** - * The Closure JS Compiler doesn't currently have good support for static - * property semantics where "this" is dynamic (e.g. - * https://github.com/google/closure-compiler/issues/3177 and others) so we use - * this hack to bypass any rewriting by the compiler. - */ -const finalized = 'finalized'; -/** - * Base element class which manages element properties and attributes. When - * properties change, the `update` method is asynchronously called. This method - * should be supplied by subclassers to render updates as desired. - * @noInheritDoc - */ -export class UpdatingElement extends HTMLElement { - constructor() { - super(); - this.initialize(); - } - /** - * Returns a list of attributes corresponding to the registered properties. - * @nocollapse - */ - static get observedAttributes() { - // note: piggy backing on this to ensure we're finalized. - this.finalize(); - const attributes = []; - // Use forEach so this works even if for/of loops are compiled to for loops - // expecting arrays - this._classProperties.forEach((v, p) => { - const attr = this._attributeNameForProperty(p, v); - if (attr !== undefined) { - this._attributeToPropertyMap.set(attr, p); - attributes.push(attr); - } - }); - return attributes; - } - /** - * Ensures the private `_classProperties` property metadata is created. - * In addition to `finalize` this is also called in `createProperty` to - * ensure the `@property` decorator can add property metadata. - */ - /** @nocollapse */ - static _ensureClassProperties() { - // ensure private storage for property declarations. - if (!this.hasOwnProperty(JSCompiler_renameProperty('_classProperties', this))) { - this._classProperties = new Map(); - // NOTE: Workaround IE11 not supporting Map constructor argument. - const superProperties = Object.getPrototypeOf(this)._classProperties; - if (superProperties !== undefined) { - superProperties.forEach((v, k) => this._classProperties.set(k, v)); - } - } - } - /** - * Creates a property accessor on the element prototype if one does not exist - * and stores a PropertyDeclaration for the property with the given options. - * The property setter calls the property's `hasChanged` property option - * or uses a strict identity check to determine whether or not to request - * an update. - * - * This method may be overridden to customize properties; however, - * when doing so, it's important to call `super.createProperty` to ensure - * the property is setup correctly. This method calls - * `getPropertyDescriptor` internally to get a descriptor to install. - * To customize what properties do when they are get or set, override - * `getPropertyDescriptor`. To customize the options for a property, - * implement `createProperty` like this: - * - * static createProperty(name, options) { - * options = Object.assign(options, {myOption: true}); - * super.createProperty(name, options); - * } - * - * @nocollapse - */ - static createProperty(name, options = defaultPropertyDeclaration) { - // Note, since this can be called by the `@property` decorator which - // is called before `finalize`, we ensure storage exists for property - // metadata. - this._ensureClassProperties(); - this._classProperties.set(name, options); - // Do not generate an accessor if the prototype already has one, since - // it would be lost otherwise and that would never be the user's intention; - // Instead, we expect users to call `requestUpdate` themselves from - // user-defined accessors. Note that if the super has an accessor we will - // still overwrite it - if (options.noAccessor || this.prototype.hasOwnProperty(name)) { - return; - } - const key = typeof name === 'symbol' ? Symbol() : `__${name}`; - const descriptor = this.getPropertyDescriptor(name, key, options); - if (descriptor !== undefined) { - Object.defineProperty(this.prototype, name, descriptor); - } - } - /** - * Returns a property descriptor to be defined on the given named property. - * If no descriptor is returned, the property will not become an accessor. - * For example, - * - * class MyElement extends LitElement { - * static getPropertyDescriptor(name, key, options) { - * const defaultDescriptor = - * super.getPropertyDescriptor(name, key, options); - * const setter = defaultDescriptor.set; - * return { - * get: defaultDescriptor.get, - * set(value) { - * setter.call(this, value); - * // custom action. - * }, - * configurable: true, - * enumerable: true - * } - * } - * } - * - * @nocollapse - */ - static getPropertyDescriptor(name, key, options) { - return { - // tslint:disable-next-line:no-any no symbol in index - get() { - return this[key]; - }, - set(value) { - const oldValue = this[name]; - this[key] = value; - this - .requestUpdateInternal(name, oldValue, options); - }, - configurable: true, - enumerable: true - }; - } - /** - * Returns the property options associated with the given property. - * These options are defined with a PropertyDeclaration via the `properties` - * object or the `@property` decorator and are registered in - * `createProperty(...)`. - * - * Note, this method should be considered "final" and not overridden. To - * customize the options for a given property, override `createProperty`. - * - * @nocollapse - * @final - */ - static getPropertyOptions(name) { - return this._classProperties && this._classProperties.get(name) || - defaultPropertyDeclaration; - } - /** - * Creates property accessors for registered properties and ensures - * any superclasses are also finalized. - * @nocollapse - */ - static finalize() { - // finalize any superclasses - const superCtor = Object.getPrototypeOf(this); - if (!superCtor.hasOwnProperty(finalized)) { - superCtor.finalize(); - } - this[finalized] = true; - this._ensureClassProperties(); - // initialize Map populated in observedAttributes - this._attributeToPropertyMap = new Map(); - // make any properties - // Note, only process "own" properties since this element will inherit - // any properties defined on the superClass, and finalization ensures - // the entire prototype chain is finalized. - if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) { - const props = this.properties; - // support symbols in properties (IE11 does not support this) - const propKeys = [ - ...Object.getOwnPropertyNames(props), - ...(typeof Object.getOwnPropertySymbols === 'function') ? - Object.getOwnPropertySymbols(props) : - [] - ]; - // This for/of is ok because propKeys is an array - for (const p of propKeys) { - // note, use of `any` is due to TypeSript lack of support for symbol in - // index types - // tslint:disable-next-line:no-any no symbol in index - this.createProperty(p, props[p]); - } - } - } - /** - * Returns the property name for the given attribute `name`. - * @nocollapse - */ - static _attributeNameForProperty(name, options) { - const attribute = options.attribute; - return attribute === false ? - undefined : - (typeof attribute === 'string' ? - attribute : - (typeof name === 'string' ? name.toLowerCase() : undefined)); - } - /** - * Returns true if a property should request an update. - * Called when a property value is set and uses the `hasChanged` - * option for the property if present or a strict identity check. - * @nocollapse - */ - static _valueHasChanged(value, old, hasChanged = notEqual) { - return hasChanged(value, old); - } - /** - * Returns the property value for the given attribute value. - * Called via the `attributeChangedCallback` and uses the property's - * `converter` or `converter.fromAttribute` property option. - * @nocollapse - */ - static _propertyValueFromAttribute(value, options) { - const type = options.type; - const converter = options.converter || defaultConverter; - const fromAttribute = (typeof converter === 'function' ? converter : converter.fromAttribute); - return fromAttribute ? fromAttribute(value, type) : value; - } - /** - * Returns the attribute value for the given property value. If this - * returns undefined, the property will *not* be reflected to an attribute. - * If this returns null, the attribute will be removed, otherwise the - * attribute will be set to the value. - * This uses the property's `reflect` and `type.toAttribute` property options. - * @nocollapse - */ - static _propertyValueToAttribute(value, options) { - if (options.reflect === undefined) { - return; - } - const type = options.type; - const converter = options.converter; - const toAttribute = converter && converter.toAttribute || - defaultConverter.toAttribute; - return toAttribute(value, type); - } - /** - * Performs element initialization. By default captures any pre-set values for - * registered properties. - */ - initialize() { - this._updateState = 0; - this._updatePromise = - new Promise((res) => this._enableUpdatingResolver = res); - this._changedProperties = new Map(); - this._saveInstanceProperties(); - // ensures first update will be caught by an early access of - // `updateComplete` - this.requestUpdateInternal(); - } - /** - * Fixes any properties set on the instance before upgrade time. - * Otherwise these would shadow the accessor and break these properties. - * The properties are stored in a Map which is played back after the - * constructor runs. Note, on very old versions of Safari (<=9) or Chrome - * (<=41), properties created for native platform properties like (`id` or - * `name`) may not have default values set in the element constructor. On - * these browsers native properties appear on instances and therefore their - * default value will overwrite any element default (e.g. if the element sets - * this.id = 'id' in the constructor, the 'id' will become '' since this is - * the native platform default). - */ - _saveInstanceProperties() { - // Use forEach so this works even if for/of loops are compiled to for loops - // expecting arrays - this.constructor - ._classProperties.forEach((_v, p) => { - if (this.hasOwnProperty(p)) { - const value = this[p]; - delete this[p]; - if (!this._instanceProperties) { - this._instanceProperties = new Map(); - } - this._instanceProperties.set(p, value); - } - }); - } - /** - * Applies previously saved instance properties. - */ - _applyInstanceProperties() { - // Use forEach so this works even if for/of loops are compiled to for loops - // expecting arrays - // tslint:disable-next-line:no-any - this._instanceProperties.forEach((v, p) => this[p] = v); - this._instanceProperties = undefined; - } - connectedCallback() { - // Ensure first connection completes an update. Updates cannot complete - // before connection. - this.enableUpdating(); - } - enableUpdating() { - if (this._enableUpdatingResolver !== undefined) { - this._enableUpdatingResolver(); - this._enableUpdatingResolver = undefined; - } - } - /** - * Allows for `super.disconnectedCallback()` in extensions while - * reserving the possibility of making non-breaking feature additions - * when disconnecting at some point in the future. - */ - disconnectedCallback() { - } - /** - * Synchronizes property values when attributes change. - */ - attributeChangedCallback(name, old, value) { - if (old !== value) { - this._attributeToProperty(name, value); - } - } - _propertyToAttribute(name, value, options = defaultPropertyDeclaration) { - const ctor = this.constructor; - const attr = ctor._attributeNameForProperty(name, options); - if (attr !== undefined) { - const attrValue = ctor._propertyValueToAttribute(value, options); - // an undefined value does not change the attribute. - if (attrValue === undefined) { - return; - } - // Track if the property is being reflected to avoid - // setting the property again via `attributeChangedCallback`. Note: - // 1. this takes advantage of the fact that the callback is synchronous. - // 2. will behave incorrectly if multiple attributes are in the reaction - // stack at time of calling. However, since we process attributes - // in `update` this should not be possible (or an extreme corner case - // that we'd like to discover). - // mark state reflecting - this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE; - if (attrValue == null) { - this.removeAttribute(attr); - } - else { - this.setAttribute(attr, attrValue); - } - // mark state not reflecting - this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE; - } - } - _attributeToProperty(name, value) { - // Use tracking info to avoid deserializing attribute value if it was - // just set from a property setter. - if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) { - return; - } - const ctor = this.constructor; - // Note, hint this as an `AttributeMap` so closure clearly understands - // the type; it has issues with tracking types through statics - // tslint:disable-next-line:no-unnecessary-type-assertion - const propName = ctor._attributeToPropertyMap.get(name); - if (propName !== undefined) { - const options = ctor.getPropertyOptions(propName); - // mark state reflecting - this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY; - this[propName] = - // tslint:disable-next-line:no-any - ctor._propertyValueFromAttribute(value, options); - // mark state not reflecting - this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY; - } - } - /** - * This protected version of `requestUpdate` does not access or return the - * `updateComplete` promise. This promise can be overridden and is therefore - * not free to access. - */ - requestUpdateInternal(name, oldValue, options) { - let shouldRequestUpdate = true; - // If we have a property key, perform property update steps. - if (name !== undefined) { - const ctor = this.constructor; - options = options || ctor.getPropertyOptions(name); - if (ctor._valueHasChanged(this[name], oldValue, options.hasChanged)) { - if (!this._changedProperties.has(name)) { - this._changedProperties.set(name, oldValue); - } - // Add to reflecting properties set. - // Note, it's important that every change has a chance to add the - // property to `_reflectingProperties`. This ensures setting - // attribute + property reflects correctly. - if (options.reflect === true && - !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) { - if (this._reflectingProperties === undefined) { - this._reflectingProperties = new Map(); - } - this._reflectingProperties.set(name, options); - } - } - else { - // Abort the request if the property should not be considered changed. - shouldRequestUpdate = false; - } - } - if (!this._hasRequestedUpdate && shouldRequestUpdate) { - this._updatePromise = this._enqueueUpdate(); - } - } - /** - * Requests an update which is processed asynchronously. This should - * be called when an element should update based on some state not triggered - * by setting a property. In this case, pass no arguments. It should also be - * called when manually implementing a property setter. In this case, pass the - * property `name` and `oldValue` to ensure that any configured property - * options are honored. Returns the `updateComplete` Promise which is resolved - * when the update completes. - * - * @param name {PropertyKey} (optional) name of requesting property - * @param oldValue {any} (optional) old value of requesting property - * @returns {Promise} A Promise that is resolved when the update completes. - */ - requestUpdate(name, oldValue) { - this.requestUpdateInternal(name, oldValue); - return this.updateComplete; - } - /** - * Sets up the element to asynchronously update. - */ - async _enqueueUpdate() { - this._updateState = this._updateState | STATE_UPDATE_REQUESTED; - try { - // Ensure any previous update has resolved before updating. - // This `await` also ensures that property changes are batched. - await this._updatePromise; - } - catch (e) { - // Ignore any previous errors. We only care that the previous cycle is - // done. Any error should have been handled in the previous update. - } - const result = this.performUpdate(); - // If `performUpdate` returns a Promise, we await it. This is done to - // enable coordinating updates with a scheduler. Note, the result is - // checked to avoid delaying an additional microtask unless we need to. - if (result != null) { - await result; - } - return !this._hasRequestedUpdate; - } - get _hasRequestedUpdate() { - return (this._updateState & STATE_UPDATE_REQUESTED); - } - get hasUpdated() { - return (this._updateState & STATE_HAS_UPDATED); - } - /** - * Performs an element update. Note, if an exception is thrown during the - * update, `firstUpdated` and `updated` will not be called. - * - * You can override this method to change the timing of updates. If this - * method is overridden, `super.performUpdate()` must be called. - * - * For instance, to schedule updates to occur just before the next frame: - * - * ``` - * protected async performUpdate(): Promise<unknown> { - * await new Promise((resolve) => requestAnimationFrame(() => resolve())); - * super.performUpdate(); - * } - * ``` - */ - performUpdate() { - // Abort any update if one is not pending when this is called. - // This can happen if `performUpdate` is called early to "flush" - // the update. - if (!this._hasRequestedUpdate) { - return; - } - // Mixin instance properties once, if they exist. - if (this._instanceProperties) { - this._applyInstanceProperties(); - } - let shouldUpdate = false; - const changedProperties = this._changedProperties; - try { - shouldUpdate = this.shouldUpdate(changedProperties); - if (shouldUpdate) { - this.update(changedProperties); - } - else { - this._markUpdated(); - } - } - catch (e) { - // Prevent `firstUpdated` and `updated` from running when there's an - // update exception. - shouldUpdate = false; - // Ensure element can accept additional updates after an exception. - this._markUpdated(); - throw e; - } - if (shouldUpdate) { - if (!(this._updateState & STATE_HAS_UPDATED)) { - this._updateState = this._updateState | STATE_HAS_UPDATED; - this.firstUpdated(changedProperties); - } - this.updated(changedProperties); - } - } - _markUpdated() { - this._changedProperties = new Map(); - this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED; - } - /** - * Returns a Promise that resolves when the element has completed updating. - * The Promise value is a boolean that is `true` if the element completed the - * update without triggering another update. The Promise result is `false` if - * a property was set inside `updated()`. If the Promise is rejected, an - * exception was thrown during the update. - * - * To await additional asynchronous work, override the `_getUpdateComplete` - * method. For example, it is sometimes useful to await a rendered element - * before fulfilling this Promise. To do this, first await - * `super._getUpdateComplete()`, then any subsequent state. - * - * @returns {Promise} The Promise returns a boolean that indicates if the - * update resolved without triggering another update. - */ - get updateComplete() { - return this._getUpdateComplete(); - } - /** - * Override point for the `updateComplete` promise. - * - * It is not safe to override the `updateComplete` getter directly due to a - * limitation in TypeScript which means it is not possible to call a - * superclass getter (e.g. `super.updateComplete.then(...)`) when the target - * language is ES5 (https://github.com/microsoft/TypeScript/issues/338). - * This method should be overridden instead. For example: - * - * class MyElement extends LitElement { - * async _getUpdateComplete() { - * await super._getUpdateComplete(); - * await this._myChild.updateComplete; - * } - * } - */ - _getUpdateComplete() { - return this._updatePromise; - } - /** - * Controls whether or not `update` should be called when the element requests - * an update. By default, this method always returns `true`, but this can be - * customized to control when to update. - * - * @param _changedProperties Map of changed properties with old values - */ - shouldUpdate(_changedProperties) { - return true; - } - /** - * Updates the element. This method reflects property values to attributes. - * It can be overridden to render and keep updated element DOM. - * Setting properties inside this method will *not* trigger - * another update. - * - * @param _changedProperties Map of changed properties with old values - */ - update(_changedProperties) { - if (this._reflectingProperties !== undefined && - this._reflectingProperties.size > 0) { - // Use forEach so this works even if for/of loops are compiled to for - // loops expecting arrays - this._reflectingProperties.forEach((v, k) => this._propertyToAttribute(k, this[k], v)); - this._reflectingProperties = undefined; - } - this._markUpdated(); - } - /** - * Invoked whenever the element is updated. Implement to perform - * post-updating tasks via DOM APIs, for example, focusing an element. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - updated(_changedProperties) { - } - /** - * Invoked when the element is first updated. Implement to perform one time - * work on the element after update. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - firstUpdated(_changedProperties) { - } -} -_a = finalized; -/** - * Marks class as having finished creating properties. - */ -UpdatingElement[_a] = true; -//# sourceMappingURL=updating-element.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.d.ts index 62ae294..b836198 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.d.ts
@@ -1,26 +1,18 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ /** - * The main LitElement module, which defines the [[`LitElement`]] base class and - * related APIs. + * The main LitElement module, which defines the {@linkcode LitElement} base + * class and related APIs. * * LitElement components can define a template and a set of observed * properties. Changing an observed property triggers a re-render of the * element. * - * Import [[`LitElement`]] and [[`html`]] from this module to create a - * component: + * Import {@linkcode LitElement} and {@linkcode html} from this module to + * create a component: * * ```js * import {LitElement, html} from 'lit-element'; @@ -47,121 +39,145 @@ * customElements.define('my-element', MyElement); * ``` * - * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating. - * The `UpdatingElement` class is provided for users that want to build - * their own custom element base classes that don't use lit-html. + * `LitElement` extends {@linkcode ReactiveElement} and adds lit-html + * templating. The `ReactiveElement` class is provided for users that want to + * build their own custom element base classes that don't use lit-html. * * @packageDocumentation */ -import { ShadyRenderOptions } from 'lit-html/lib/shady-render.js'; -import { PropertyValues, UpdatingElement } from './lib/updating-element.js'; -export * from './lib/updating-element.js'; -export * from './lib/decorators.js'; -export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html.js'; -import { CSSResult } from './lib/css-tag.js'; -export * from './lib/css-tag.js'; -declare global { - interface Window { - litElementVersions: string[]; +import { PropertyValues, ReactiveElement } from '@lit/reactive-element'; +import { RenderOptions } from 'lit-html'; +export * from '@lit/reactive-element'; +export * from 'lit-html'; +import { LitUnstable } from 'lit-html'; +import { ReactiveUnstable } from '@lit/reactive-element'; +/** + * Contains types that are part of the unstable debug API. + * + * Everything in this API is not stable and may change or be removed in the future, + * even on patch releases. + */ +export declare namespace Unstable { + /** + * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true, + * we will emit 'lit-debug' events to window, with live details about the update and render + * lifecycle. These can be useful for writing debug tooling and visualizations. + * + * Please be aware that running with window.emitLitDebugLogEvents has performance overhead, + * making certain operations that are normally very cheap (like a no-op render) much slower, + * because we must copy data and dispatch events. + */ + namespace DebugLog { + type Entry = LitUnstable.DebugLog.Entry | ReactiveUnstable.DebugLog.Entry; } } -export declare type CSSResultOrNative = CSSResult | CSSStyleSheet; -export interface CSSResultArray extends Array<CSSResultOrNative | CSSResultArray> { -} +export declare const UpdatingElement: typeof ReactiveElement; /** * Base element class that manages element properties and attributes, and * renders a lit-html template. * * To define a component, subclass `LitElement` and implement a * `render` method to provide the component's template. Define properties - * using the [[`properties`]] property or the [[`property`]] decorator. + * using the {@linkcode LitElement.properties properties} property or the + * {@linkcode property} decorator. */ -export declare class LitElement extends UpdatingElement { +export declare class LitElement extends ReactiveElement { /** * Ensure this class is marked as `finalized` as an optimization ensuring * it will not needlessly try to `finalize`. * * Note this property name is a string to prevent breaking Closure JS Compiler - * optimizations. See updating-element.ts for more information. + * optimizations. See @lit/reactive-element for more information. */ protected static ['finalized']: boolean; + static ['_$litElement$']: boolean; /** - * Reference to the underlying library method used to render the element's - * DOM. By default, points to the `render` method from lit-html's shady-render - * module. - * - * **Most users will never need to touch this property.** - * - * This property should not be confused with the `render` instance method, - * which should be overridden to define a template for the element. - * - * Advanced users creating a new base class based on LitElement can override - * this property to point to a custom render method with a signature that - * matches [shady-render's `render` - * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render). - * - * @nocollapse + * @category rendering */ - static render: (result: unknown, container: Element | DocumentFragment, options: ShadyRenderOptions) => void; + readonly renderOptions: RenderOptions; + private __childPart; /** - * Array of styles to apply to the element. The styles should be defined - * using the [[`css`]] tag function or via constructible stylesheets. - */ - static styles?: CSSResultOrNative | CSSResultArray; - private static _styles; - /** - * Return the array of styles to apply to the element. - * Override this method to integrate into a style management system. - * - * @nocollapse - */ - static getStyles(): CSSResultOrNative | CSSResultArray | undefined; - /** @nocollapse */ - private static _getUniqueStyles; - private _needsShimAdoptedStyleSheets?; - /** - * Node or ShadowRoot into which element DOM should be rendered. Defaults - * to an open shadowRoot. - */ - readonly renderRoot: Element | DocumentFragment; - /** - * Performs element initialization. By default this calls - * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and - * captures any pre-set values for registered properties. - */ - protected initialize(): void; - /** - * Returns the node into which the element should render and by default - * creates and returns an open shadowRoot. Implement to customize where the - * element's DOM is rendered. For example, to render into the element's - * childNodes, return `this`. - * @returns {Element|DocumentFragment} Returns a node into which to render. + * @category rendering */ protected createRenderRoot(): Element | ShadowRoot; /** - * Applies styling to the element shadowRoot using the [[`styles`]] - * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where - * available and will fallback otherwise. When Shadow DOM is polyfilled, - * ShadyCSS scopes styles and adds them to the document. When Shadow DOM - * is available but `adoptedStyleSheets` is not, styles are appended to the - * end of the `shadowRoot` to [mimic spec - * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets). - */ - protected adoptStyles(): void; - connectedCallback(): void; - /** * Updates the element. This method reflects property values to attributes * and calls `render` to render DOM via lit-html. Setting properties inside * this method will *not* trigger another update. - * @param _changedProperties Map of changed properties with old values + * @param changedProperties Map of changed properties with old values + * @category updates */ protected update(changedProperties: PropertyValues): void; /** + * Invoked when the component is added to the document's DOM. + * + * In `connectedCallback()` you should setup tasks that should only occur when + * the element is connected to the document. The most common of these is + * adding event listeners to nodes external to the element, like a keydown + * event handler added to the window. + * + * ```ts + * connectedCallback() { + * super.connectedCallback(); + * addEventListener('keydown', this._handleKeydown); + * } + * ``` + * + * Typically, anything done in `connectedCallback()` should be undone when the + * element is disconnected, in `disconnectedCallback()`. + * + * @category lifecycle + */ + connectedCallback(): void; + /** + * Invoked when the component is removed from the document's DOM. + * + * This callback is the main signal to the element that it may no longer be + * used. `disconnectedCallback()` should ensure that nothing is holding a + * reference to the element (such as event listeners added to nodes external + * to the element), so that it is free to be garbage collected. + * + * ```ts + * disconnectedCallback() { + * super.disconnectedCallback(); + * window.removeEventListener('keydown', this._handleKeydown); + * } + * ``` + * + * An element may be re-connected after being disconnected. + * + * @category lifecycle + */ + disconnectedCallback(): void; + /** * Invoked on each update to perform rendering tasks. This method may return - * any value renderable by lit-html's `NodePart` - typically a + * any value renderable by lit-html's `ChildPart` - typically a * `TemplateResult`. Setting properties inside this method will *not* trigger * the element to update. + * @category rendering */ protected render(): unknown; } +/** + * END USERS SHOULD NOT RELY ON THIS OBJECT. + * + * Private exports for use by other Lit packages, not intended for use by + * external users. + * + * We currently do not make a mangled rollup build of the lit-ssr code. In order + * to keep a number of (otherwise private) top-level exports mangled in the + * client side code, we export a _$LE object containing those members (or + * helper methods for accessing private fields of those members), and then + * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the + * client-side code is being used in `dev` mode or `prod` mode. + * + * This has a unique name, to disambiguate it from private exports in + * lit-html, since this module re-exports all of lit-html. + * + * @private + */ +export declare const _$LE: { + _$attributeToProperty: (el: LitElement, name: string, value: string | null) => void; + _$changedProperties: (el: LitElement) => any; +}; //# sourceMappingURL=lit-element.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.js b/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.js index 85344ca..9db9b63f 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/lit-element.js
@@ -1,274 +1,7 @@ +import{ReactiveElement as t}from'../@lit/reactive-element/reactive-element.js';export*from'../@lit/reactive-element/reactive-element.js';import{render as e,noChange as i}from'../lit-html/lit-html.js';export*from'../lit-html/lit-html.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * The main LitElement module, which defines the [[`LitElement`]] base class and - * related APIs. - * - * LitElement components can define a template and a set of observed - * properties. Changing an observed property triggers a re-render of the - * element. - * - * Import [[`LitElement`]] and [[`html`]] from this module to create a - * component: - * - * ```js - * import {LitElement, html} from 'lit-element'; - * - * class MyElement extends LitElement { - * - * // Declare observed properties - * static get properties() { - * return { - * adjective: {} - * } - * } - * - * constructor() { - * this.adjective = 'awesome'; - * } - * - * // Define the element's template - * render() { - * return html`<p>your ${adjective} template here</p>`; - * } - * } - * - * customElements.define('my-element', MyElement); - * ``` - * - * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating. - * The `UpdatingElement` class is provided for users that want to build - * their own custom element base classes that don't use lit-html. - * - * @packageDocumentation - */ -import { render } from '../lit-html/lib/shady-render.js'; -import { UpdatingElement } from './lib/updating-element.js'; -export * from './lib/updating-element.js'; -export * from './lib/decorators.js'; -export { html, svg, TemplateResult, SVGTemplateResult } from '../lit-html/lit-html.js'; -import { supportsAdoptingStyleSheets, unsafeCSS } from './lib/css-tag.js'; -export * from './lib/css-tag.js'; -// IMPORTANT: do not change the property name or the assignment expression. -// This line will be used in regexes to search for LitElement usage. -// TODO(justinfagnani): inject version number at build time -(window['litElementVersions'] || (window['litElementVersions'] = [])) - .push('2.4.0'); -/** - * Sentinal value used to avoid calling lit-html's render function when - * subclasses do not implement `render` - */ -const renderNotImplemented = {}; -/** - * Base element class that manages element properties and attributes, and - * renders a lit-html template. - * - * To define a component, subclass `LitElement` and implement a - * `render` method to provide the component's template. Define properties - * using the [[`properties`]] property or the [[`property`]] decorator. - */ -export class LitElement extends UpdatingElement { - /** - * Return the array of styles to apply to the element. - * Override this method to integrate into a style management system. - * - * @nocollapse - */ - static getStyles() { - return this.styles; - } - /** @nocollapse */ - static _getUniqueStyles() { - // Only gather styles once per class - if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) { - return; - } - // Take care not to call `this.getStyles()` multiple times since this - // generates new CSSResults each time. - // TODO(sorvell): Since we do not cache CSSResults by input, any - // shared styles will generate new stylesheet objects, which is wasteful. - // This should be addressed when a browser ships constructable - // stylesheets. - const userStyles = this.getStyles(); - if (Array.isArray(userStyles)) { - // De-duplicate styles preserving the _last_ instance in the set. - // This is a performance optimization to avoid duplicated styles that can - // occur especially when composing via subclassing. - // The last item is kept to try to preserve the cascade order with the - // assumption that it's most important that last added styles override - // previous styles. - const addStyles = (styles, set) => styles.reduceRight((set, s) => - // Note: On IE set.add() does not return the set - Array.isArray(s) ? addStyles(s, set) : (set.add(s), set), set); - // Array.from does not work on Set in IE, otherwise return - // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse() - const set = addStyles(userStyles, new Set()); - const styles = []; - set.forEach((v) => styles.unshift(v)); - this._styles = styles; - } - else { - this._styles = userStyles === undefined ? [] : [userStyles]; - } - // Ensure that there are no invalid CSSStyleSheet instances here. They are - // invalid in two conditions. - // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but - // this is impossible to check except via .replaceSync or use - // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is - // false) - this._styles = this._styles.map((s) => { - if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) { - // Flatten the cssText from the passed constructible stylesheet (or - // undetectable non-constructible stylesheet). The user might have - // expected to update their stylesheets over time, but the alternative - // is a crash. - const cssText = Array.prototype.slice.call(s.cssRules) - .reduce((css, rule) => css + rule.cssText, ''); - return unsafeCSS(cssText); - } - return s; - }); - } - /** - * Performs element initialization. By default this calls - * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and - * captures any pre-set values for registered properties. - */ - initialize() { - super.initialize(); - this.constructor._getUniqueStyles(); - this.renderRoot = this.createRenderRoot(); - // Note, if renderRoot is not a shadowRoot, styles would/could apply to the - // element's getRootNode(). While this could be done, we're choosing not to - // support this now since it would require different logic around de-duping. - if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) { - this.adoptStyles(); - } - } - /** - * Returns the node into which the element should render and by default - * creates and returns an open shadowRoot. Implement to customize where the - * element's DOM is rendered. For example, to render into the element's - * childNodes, return `this`. - * @returns {Element|DocumentFragment} Returns a node into which to render. - */ - createRenderRoot() { - return this.attachShadow({ mode: 'open' }); - } - /** - * Applies styling to the element shadowRoot using the [[`styles`]] - * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where - * available and will fallback otherwise. When Shadow DOM is polyfilled, - * ShadyCSS scopes styles and adds them to the document. When Shadow DOM - * is available but `adoptedStyleSheets` is not, styles are appended to the - * end of the `shadowRoot` to [mimic spec - * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets). - */ - adoptStyles() { - const styles = this.constructor._styles; - if (styles.length === 0) { - return; - } - // There are three separate cases here based on Shadow DOM support. - // (1) shadowRoot polyfilled: use ShadyCSS - // (2) shadowRoot.adoptedStyleSheets available: use it - // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after - // rendering - if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) { - window.ShadyCSS.ScopingShim.prepareAdoptedCssText(styles.map((s) => s.cssText), this.localName); - } - else if (supportsAdoptingStyleSheets) { - this.renderRoot.adoptedStyleSheets = - styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet); - } - else { - // This must be done after rendering so the actual style insertion is done - // in `update`. - this._needsShimAdoptedStyleSheets = true; - } - } - connectedCallback() { - super.connectedCallback(); - // Note, first update/render handles styleElement so we only call this if - // connected after first update. - if (this.hasUpdated && window.ShadyCSS !== undefined) { - window.ShadyCSS.styleElement(this); - } - } - /** - * Updates the element. This method reflects property values to attributes - * and calls `render` to render DOM via lit-html. Setting properties inside - * this method will *not* trigger another update. - * @param _changedProperties Map of changed properties with old values - */ - update(changedProperties) { - // Setting properties in `render` should not trigger an update. Since - // updates are allowed after super.update, it's important to call `render` - // before that. - const templateResult = this.render(); - super.update(changedProperties); - // If render is not implemented by the component, don't call lit-html render - if (templateResult !== renderNotImplemented) { - this.constructor - .render(templateResult, this.renderRoot, { scopeName: this.localName, eventContext: this }); - } - // When native Shadow DOM is used but adoptedStyles are not supported, - // insert styling after rendering to ensure adoptedStyles have highest - // priority. - if (this._needsShimAdoptedStyleSheets) { - this._needsShimAdoptedStyleSheets = false; - this.constructor._styles.forEach((s) => { - const style = document.createElement('style'); - style.textContent = s.cssText; - this.renderRoot.appendChild(style); - }); - } - } - /** - * Invoked on each update to perform rendering tasks. This method may return - * any value renderable by lit-html's `NodePart` - typically a - * `TemplateResult`. Setting properties inside this method will *not* trigger - * the element to update. - */ - render() { - return renderNotImplemented; - } -} -/** - * Ensure this class is marked as `finalized` as an optimization ensuring - * it will not needlessly try to `finalize`. - * - * Note this property name is a string to prevent breaking Closure JS Compiler - * optimizations. See updating-element.ts for more information. - */ -LitElement['finalized'] = true; -/** - * Reference to the underlying library method used to render the element's - * DOM. By default, points to the `render` method from lit-html's shady-render - * module. - * - * **Most users will never need to touch this property.** - * - * This property should not be confused with the `render` instance method, - * which should be overridden to define a template for the element. - * - * Advanced users creating a new base class based on LitElement can override - * this property to point to a custom render method with a signature that - * matches [shady-render's `render` - * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render). - * - * @nocollapse - */ -LitElement.render = render; -//# sourceMappingURL=lit-element.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */var l,o;const r=t;class s extends t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=e(i,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return i}}s.finalized=!0,s._$litElement$=!0,null===(l=globalThis.litElementHydrateSupport)||void 0===l||l.call(globalThis,{LitElement:s});const n=globalThis.litElementPolyfillSupport;null==n||n({LitElement:s});const h={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("3.2.0");export{s as LitElement,r as UpdatingElement,h as _$LE}; +//# sourceMappingURL=lit-element.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/package.json b/third_party/material_web_components/components-chromium/node_modules/lit-element/package.json index 95e0a31..eb287b4 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/lit-element/package.json
@@ -1,83 +1,135 @@ { "name": "lit-element", - "version": "2.4.0", - "description": "A simple base class for creating fast, lightweight web components", - "license": "BSD-3-Clause", - "homepage": "https://lit-element.polymer-project.org/", - "repository": "Polymer/lit-element", - "type": "module", - "main": "lit-element.js", - "module": "lit-element.js", - "directories": { - "test": "test" - }, - "files": [ - "/lib/", - "/src/", - "!/src/demo/", - "!/src/test/", - "/lit-element.d.ts", - "/lit-element.d.ts.map", - "/lit-element.js", - "/lit-element.js.map", - "/ts3.4/" - ], - "scripts": { - "build": "tsc && rm -rf ./ts3.4 && downlevel-dts . ts3.4 && cp tsconfig.json ./ts3.4/", - "build:watch": "tsc --watch", - "build:babel-test": "babel src/test/lib/decorators_test.ts --out-file test/lib/decorators-babel_test.js", - "gen-docs": "typedoc src/lit-element.ts src/lib/updating-element.ts", - "test": "npm run build && npm run build:babel-test && wct", - "quicktest": "wct -l chrome -p", - "checksize": "rollup -c ; rm lit-element.bundled.js", - "format": "find src test | grep '\\.js$\\|\\.ts$' | xargs clang-format --style=file -i", - "lint": "tslint --project ./", - "prepublishOnly": "node check-version-tracker.cjs && npm run lint && npm test", - "prepare": "npm run build", - "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", - "publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev", - "release": "np --any-branch --yolo" - }, - "author": "The Polymer Authors", - "devDependencies": { - "@babel/cli": "^7.2.3", - "@babel/plugin-proposal-class-properties": "^7.2.3", - "@babel/plugin-proposal-decorators": "^7.2.3", - "@babel/plugin-transform-typescript": "^7.2.0", - "@types/chai": "^4.0.1", - "@types/mocha": "^5.2.4", - "@webcomponents/shadycss": "^1.8.0", - "@webcomponents/webcomponentsjs": "^2.2.3", - "chai": "^4.0.2", - "clang-format": "^1.2.4", - "downlevel-dts": "^0.6.0", - "lit-element-benchmarks": "^0.1.0", - "mocha": "^6.2.2", - "np": "^5.2.1", - "rollup": "^1.26.0", - "rollup-plugin-filesize": "^6.2.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-terser": "^5.1.0", - "tachometer": "^0.4.16", - "tslint": "^5.20.1", - "typedoc": "^0.17.0-3", - "typescript": "~3.8.2", - "uglify-es": "^3.3.9", - "wct-mocha": "^1.0.0", - "web-component-tester": "^6.9.2" - }, - "typings": "lit-element.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "ts3.4/*" - ] - } - }, - "dependencies": { - "lit-html": "^1.1.1" - }, + "version": "3.2.0", "publishConfig": { "access": "public" + }, + "description": "A simple base class for creating fast, lightweight web components", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "https://github.com/lit/lit.git", + "directory": "packages/lit-element" + }, + "author": "Google LLC", + "homepage": "https://lit.dev/", + "main": "index.js", + "module": "index.js", + "types": "index.d.ts", + "type": "module", + "exports": { + ".": { + "development": "./development/index.js", + "default": "./index.js" + }, + "./decorators.js": { + "development": "./development/decorators.js", + "default": "./decorators.js" + }, + "./decorators/custom-element.js": { + "development": "./development/decorators/custom-element.js", + "default": "./decorators/custom-element.js" + }, + "./decorators/event-options.js": { + "development": "./development/decorators/event-options.js", + "default": "./decorators/event-options.js" + }, + "./decorators/property.js": { + "development": "./development/decorators/property.js", + "default": "./decorators/property.js" + }, + "./decorators/query-all.js": { + "development": "./development/decorators/query-all.js", + "default": "./decorators/query-all.js" + }, + "./decorators/query-assigned-elements.js": { + "development": "./development/decorators/query-assigned-elements.js", + "default": "./decorators/query-assigned-elements.js" + }, + "./decorators/query-assigned-nodes.js": { + "development": "./development/decorators/query-assigned-nodes.js", + "default": "./decorators/query-assigned-nodes.js" + }, + "./decorators/query-async.js": { + "development": "./development/decorators/query-async.js", + "default": "./decorators/query-async.js" + }, + "./decorators/query.js": { + "development": "./development/decorators/query.js", + "default": "./decorators/query.js" + }, + "./decorators/state.js": { + "development": "./development/decorators/state.js", + "default": "./decorators/state.js" + }, + "./experimental-hydrate-support.js": { + "development": "./development/experimental-hydrate-support.js", + "default": "./experimental-hydrate-support.js" + }, + "./lit-element.js": { + "development": "./development/lit-element.js", + "default": "./lit-element.js" + }, + "./polyfill-support.js": { + "development": "./development/polyfill-support.js", + "default": "./polyfill-support.js" + }, + "./private-ssr-support.js": { + "development": "./development/private-ssr-support.js", + "default": "./private-ssr-support.js" + } + }, + "scripts": { + "build": "npm run clean && npm run build:ts && rollup -c", + "build:watch": "rollup -c --watch", + "build:bundle": "npm run clean:bundle && tsc --build && rollup -c rollup.bundle.config.js", + "build:ts": "tsc --build && treemirror development . '**/*.d.ts{,.map}'", + "build:ts:watch": "tsc --build --watch", + "check-version": "node scripts/check-version-tracker.js", + "checksize": "rollup -c --environment=CHECKSIZE", + "clean": "rm -rf {decorators,experimental-hydrate-support,index,lit-element,polyfill-support,private-ssr-support,lit.min}.{js,js.map,d.ts} test/ decorators/ development/ *.tsbuildinfo", + "dev": "scripts/dev.sh", + "prepublishOnly": "npm run check-version", + "publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev", + "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", + "release": "np --any-branch --yolo", + "test": "npm run test:dev && npm run test:prod", + "test:dev": "cd ../tests && npx wtr '../lit-element/development/**/*_test.(js|html)'", + "test:prod": "MODE=prod npm run test:dev", + "test:prod:watch": "MODE=prod npm run test:dev -- --watch", + "test:watch": "npm run test:dev -- --watch" + }, + "files": [ + "/decorators.{d.ts,d.ts.map,js,js.map}", + "/experimental-hydrate-support.{d.ts,d.ts.map,js,js.map}", + "/index.{d.ts,d.ts.map,js,js.map}", + "/lit-element.{d.ts,d.ts.map,js,js.map}", + "/polyfill-support.{d.ts,d.ts.map,js,js.map}", + "/private-ssr-support.{d.ts,d.ts.map,js,js.map}", + "/decorators/", + "/development/", + "!/development/test/" + ], + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.1.5", + "@types/chai": "^4.0.1", + "@types/mocha": "^9.0.0", + "@webcomponents/shadycss": "^1.8.0", + "@webcomponents/template": "^1.4.4", + "@webcomponents/webcomponentsjs": "^2.6.0", + "chokidar-cli": "^3.0.0", + "downlevel-dts": "^0.7.0", + "internal-scripts": "^1.0.0", + "mocha": "^9.1.1", + "rollup": "^2.26.4", + "tslib": "^2.0.3", + "typescript": "^4.3.5" + }, + "directories": { + "test": "test" } }
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/src/env.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/src/env.d.ts deleted file mode 100644 index b439ffda..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/src/env.d.ts +++ /dev/null
@@ -1,31 +0,0 @@ -interface ShadyCSS { - styleElement(host: Element, overrideProps?: {[key: string]: string}): void; - getComputedStyleValue(element: Element, property: string): string; - ScopingShim: undefined|{ - prepareAdoptedCssText(cssText: string[], name: string): void; - }; - nativeShadow: boolean; -} - -interface ShadyDOM { - inUse: boolean; - flush: () => void; -} - -interface Window { - ShadyCSS?: ShadyCSS; - ShadyDOM?: ShadyDOM; - ShadowRoot: typeof ShadowRoot; -} - -// Augment existing types with styling API -interface ShadowRoot { - adoptedStyleSheets: CSSStyleSheet[]; -} - -declare var ShadowRoot: {prototype: ShadowRoot; new (): ShadowRoot;} - -interface CSSStyleSheet { - replaceSync(cssText: string): void; - replace(cssText: string): Promise<unknown>; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/demo/ts-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/demo/ts-element.d.ts deleted file mode 100644 index a0a3f776..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/demo/ts-element.d.ts +++ /dev/null
@@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=ts-element.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/css-tag.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/css-tag.d.ts deleted file mode 100644 index 83bba75..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/css-tag.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/** -@license -Copyright (c) 2019 The Polymer Project Authors. All rights reserved. -This code may only be used under the BSD style license found at -http://polymer.github.io/LICENSE.txt The complete set of authors may be found at -http://polymer.github.io/AUTHORS.txt The complete set of contributors may be -found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as -part of the polymer project is also subject to an additional IP rights grant -found at http://polymer.github.io/PATENTS.txt -*/ -/** - * Whether the current browser supports `adoptedStyleSheets`. - */ -export declare const supportsAdoptingStyleSheets: boolean; -export declare class CSSResult { - _styleSheet?: CSSStyleSheet | null; - readonly cssText: string; - constructor(cssText: string, safeToken: symbol); - readonly styleSheet: CSSStyleSheet | null; - toString(): string; -} -/** - * Wrap a value for interpolation in a [[`css`]] tagged template literal. - * - * This is unsafe because untrusted CSS text can be used to phone home - * or exfiltrate data to an attacker controlled site. Take care to only use - * this with trusted input. - */ -export declare const unsafeCSS: (value: unknown) => CSSResult; -/** - * Template tag which which can be used with LitElement's [[LitElement.styles | - * `styles`]] property to set element styles. For security reasons, only literal - * string values may be used. To incorporate non-literal values [[`unsafeCSS`]] - * may be used inside a template string part. - */ -export declare const css: (strings: TemplateStringsArray, ...values: (number | CSSResult)[]) => CSSResult; -//# sourceMappingURL=css-tag.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/decorators.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/decorators.d.ts deleted file mode 100644 index 629a0b5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/decorators.d.ts +++ /dev/null
@@ -1,233 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { PropertyDeclaration } from './updating-element.js'; -export declare type Constructor<T> = { - new (...args: any[]): T; -}; -interface ClassDescriptor { - kind: 'class'; - elements: ClassElement[]; - finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>; -} -interface ClassElement { - kind: 'field' | 'method'; - key: PropertyKey; - placement: 'static' | 'prototype' | 'own'; - initializer?: Function; - extras?: ClassElement[]; - finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>; - descriptor?: PropertyDescriptor; -} -/** - * Class decorator factory that defines the decorated class as a custom element. - * - * ``` - * @customElement('my-element') - * class MyElement { - * render() { - * return html``; - * } - * } - * ``` - * @category Decorator - * @param tagName The name of the custom element to define. - */ -export declare const customElement: (tagName: string) => (classOrDescriptor: ClassDescriptor | Constructor<HTMLElement>) => any; -/** - * A property decorator which creates a LitElement property which reflects a - * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be - * supplied to configure property features. - * - * This decorator should only be used for public fields. Private or protected - * fields should use the [[`internalProperty`]] decorator. - * - * @example - * ```ts - * class MyElement { - * @property({ type: Boolean }) - * clicked = false; - * } - * ``` - * @category Decorator - * @ExportDecoratedItems - */ -export declare function property(options?: PropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -export interface InternalPropertyDeclaration<Type = unknown> { - /** - * A function that indicates if a property should be considered changed when - * it is set. The function should take the `newValue` and `oldValue` and - * return `true` if an update should be requested. - */ - hasChanged?(value: Type, oldValue: Type): boolean; -} -/** - * Declares a private or protected property that still triggers updates to the - * element when it changes. - * - * Properties declared this way must not be used from HTML or HTML templating - * systems, they're solely for properties internal to the element. These - * properties may be renamed by optimization tools like closure compiler. - * @category Decorator - */ -export declare function internalProperty(options?: InternalPropertyDeclaration): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter that - * executes a querySelector on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * @param cache An optional boolean which when true performs the DOM query only - * once and caches the result. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * - * ```ts - * class MyElement { - * @query('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function query(selector: string, cache?: boolean): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter that - * returns a promise that resolves to the result of a querySelector on the - * element's renderRoot done after the element's `updateComplete` promise - * resolves. When the queried property may change with element state, this - * decorator can be used instead of requiring users to await the - * `updateComplete` before accessing the property. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector - * - * @example - * ```ts - * class MyElement { - * @queryAsync('#first') - * first; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * - * // external usage - * async doSomethingWithFirst() { - * (await aMyElement.first).doSomething(); - * } - * ``` - * @category Decorator - */ -export declare function queryAsync(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * A property decorator that converts a class property into a getter - * that executes a querySelectorAll on the element's renderRoot. - * - * @param selector A DOMString containing one or more selectors to match. - * - * See: - * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll - * - * @example - * ```ts - * class MyElement { - * @queryAll('div') - * divs; - * - * render() { - * return html` - * <div id="first"></div> - * <div id="second"></div> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function queryAll(selector: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -/** - * Adds event listener options to a method used as an event listener in a - * lit-html template. - * - * @param options An object that specifies event listener options as accepted by - * `EventTarget#addEventListener` and `EventTarget#removeEventListener`. - * - * Current browsers support the `capture`, `passive`, and `once` options. See: - * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters - * - * @example - * ```ts - * class MyElement { - * clicked = false; - * - * render() { - * return html` - * <div @click=${this._onClick}`> - * <button></button> - * </div> - * `; - * } - * - * @eventOptions({capture: true}) - * _onClick(e) { - * this.clicked = true; - * } - * } - * ``` - * @category Decorator - */ -export declare function eventOptions(options: AddEventListenerOptions): any; -/** - * A property decorator that converts a class property into a getter that - * returns the `assignedNodes` of the given named `slot`. Note, the type of - * this property should be annotated as `NodeListOf<HTMLElement>`. - * - * @param slotName A string name of the slot. - * @param flatten A boolean which when true flattens the assigned nodes, - * meaning any assigned nodes that are slot elements are replaced with their - * assigned nodes. - * @param selector A string which filters the results to elements that match - * the given css selector. - * - * * @example - * ```ts - * class MyElement { - * @queryAssignedNodes('list', true, '.item') - * listItems; - * - * render() { - * return html` - * <slot name="list"></slot> - * `; - * } - * } - * ``` - * @category Decorator - */ -export declare function queryAssignedNodes(slotName?: string, flatten?: boolean, selector?: string): (protoOrDescriptor: Object | ClassElement, name?: string | number | symbol | undefined) => any; -export {}; -//# sourceMappingURL=decorators.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/updating-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/updating-element.d.ts deleted file mode 100644 index dc6781e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lib/updating-element.d.ts +++ /dev/null
@@ -1,428 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -declare global { - var JSCompiler_renameProperty: <P extends PropertyKey>(prop: P, _obj: unknown) => P; - interface Window { - JSCompiler_renameProperty: typeof JSCompiler_renameProperty; - } -} -/** - * Converts property values to and from attribute values. - */ -export interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> { - /** - * Function called to convert an attribute value to a property - * value. - */ - fromAttribute?(value: string | null, type?: TypeHint): Type; - /** - * Function called to convert a property value to an attribute - * value. - * - * It returns unknown instead of string, to be compatible with - * https://github.com/WICG/trusted-types (and similar efforts). - */ - toAttribute?(value: Type, type?: TypeHint): unknown; -} -declare type AttributeConverter<Type = unknown, TypeHint = unknown> = ComplexAttributeConverter<Type> | ((value: string | null, type?: TypeHint) => Type); -/** - * Defines options for a property accessor. - */ -export interface PropertyDeclaration<Type = unknown, TypeHint = unknown> { - /** - * Indicates how and whether the property becomes an observed attribute. - * If the value is `false`, the property is not added to `observedAttributes`. - * If true or absent, the lowercased property name is observed (e.g. `fooBar` - * becomes `foobar`). If a string, the string value is observed (e.g - * `attribute: 'foo-bar'`). - */ - readonly attribute?: boolean | string; - /** - * Indicates the type of the property. This is used only as a hint for the - * `converter` to determine how to convert the attribute - * to/from a property. - */ - readonly type?: TypeHint; - /** - * Indicates how to convert the attribute to/from a property. If this value - * is a function, it is used to convert the attribute value a the property - * value. If it's an object, it can have keys for `fromAttribute` and - * `toAttribute`. If no `toAttribute` function is provided and - * `reflect` is set to `true`, the property value is set directly to the - * attribute. A default `converter` is used if none is provided; it supports - * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note, - * when a property changes and the converter is used to update the attribute, - * the property is never updated again as a result of the attribute changing, - * and vice versa. - */ - readonly converter?: AttributeConverter<Type, TypeHint>; - /** - * Indicates if the property should reflect to an attribute. - * If `true`, when the property is set, the attribute is set using the - * attribute name determined according to the rules for the `attribute` - * property option and the value of the property converted using the rules - * from the `converter` property option. - */ - readonly reflect?: boolean; - /** - * A function that indicates if a property should be considered changed when - * it is set. The function should take the `newValue` and `oldValue` and - * return `true` if an update should be requested. - */ - hasChanged?(value: Type, oldValue: Type): boolean; - /** - * Indicates whether an accessor will be created for this property. By - * default, an accessor will be generated for this property that requests an - * update when set. If this flag is `true`, no accessor will be created, and - * it will be the user's responsibility to call - * `this.requestUpdate(propertyName, oldValue)` to request an update when - * the property changes. - */ - readonly noAccessor?: boolean; -} -/** - * Map of properties to PropertyDeclaration options. For each property an - * accessor is made, and the property is processed according to the - * PropertyDeclaration options. - */ -export interface PropertyDeclarations { - readonly [key: string]: PropertyDeclaration; -} -/** - * Map of changed properties with old values. Takes an optional generic - * interface corresponding to the declared element properties. - */ -export declare type PropertyValues<T = any> = keyof T extends PropertyKey ? Map<keyof T, unknown> : never; -export declare const defaultConverter: ComplexAttributeConverter; -export interface HasChanged { - (value: unknown, old: unknown): boolean; -} -/** - * Change function that returns true if `value` is different from `oldValue`. - * This method is used as the default for a property's `hasChanged` function. - */ -export declare const notEqual: HasChanged; -/** - * The Closure JS Compiler doesn't currently have good support for static - * property semantics where "this" is dynamic (e.g. - * https://github.com/google/closure-compiler/issues/3177 and others) so we use - * this hack to bypass any rewriting by the compiler. - */ -declare const finalized = "finalized"; -/** - * Base element class which manages element properties and attributes. When - * properties change, the `update` method is asynchronously called. This method - * should be supplied by subclassers to render updates as desired. - * @noInheritDoc - */ -export declare abstract class UpdatingElement extends HTMLElement { - /** - * Maps attribute names to properties; for example `foobar` attribute to - * `fooBar` property. Created lazily on user subclasses when finalizing the - * class. - */ - private static _attributeToPropertyMap; - /** - * Marks class as having finished creating properties. - */ - protected static [finalized]: boolean; - /** - * Memoized list of all class properties, including any superclass properties. - * Created lazily on user subclasses when finalizing the class. - */ - private static _classProperties?; - /** - * User-supplied object that maps property names to `PropertyDeclaration` - * objects containing options for configuring the property. - */ - static properties: PropertyDeclarations; - /* - * Returns a list of attributes corresponding to the registered properties. - * @nocollapse - */ - static readonly observedAttributes: string[]; - /** - * Ensures the private `_classProperties` property metadata is created. - * In addition to `finalize` this is also called in `createProperty` to - * ensure the `@property` decorator can add property metadata. - */ - /** @nocollapse */ - private static _ensureClassProperties; - /** - * Creates a property accessor on the element prototype if one does not exist - * and stores a PropertyDeclaration for the property with the given options. - * The property setter calls the property's `hasChanged` property option - * or uses a strict identity check to determine whether or not to request - * an update. - * - * This method may be overridden to customize properties; however, - * when doing so, it's important to call `super.createProperty` to ensure - * the property is setup correctly. This method calls - * `getPropertyDescriptor` internally to get a descriptor to install. - * To customize what properties do when they are get or set, override - * `getPropertyDescriptor`. To customize the options for a property, - * implement `createProperty` like this: - * - * static createProperty(name, options) { - * options = Object.assign(options, {myOption: true}); - * super.createProperty(name, options); - * } - * - * @nocollapse - */ - static createProperty(name: PropertyKey, options?: PropertyDeclaration): void; - /** - * Returns a property descriptor to be defined on the given named property. - * If no descriptor is returned, the property will not become an accessor. - * For example, - * - * class MyElement extends LitElement { - * static getPropertyDescriptor(name, key, options) { - * const defaultDescriptor = - * super.getPropertyDescriptor(name, key, options); - * const setter = defaultDescriptor.set; - * return { - * get: defaultDescriptor.get, - * set(value) { - * setter.call(this, value); - * // custom action. - * }, - * configurable: true, - * enumerable: true - * } - * } - * } - * - * @nocollapse - */ - protected static getPropertyDescriptor(name: PropertyKey, key: string | symbol, options: PropertyDeclaration): { - get(): any; - set(this: UpdatingElement, value: unknown): void; - configurable: boolean; - enumerable: boolean; - }; - /** - * Returns the property options associated with the given property. - * These options are defined with a PropertyDeclaration via the `properties` - * object or the `@property` decorator and are registered in - * `createProperty(...)`. - * - * Note, this method should be considered "final" and not overridden. To - * customize the options for a given property, override `createProperty`. - * - * @nocollapse - * @final - */ - protected static getPropertyOptions(name: PropertyKey): PropertyDeclaration<unknown, unknown>; - /** - * Creates property accessors for registered properties and ensures - * any superclasses are also finalized. - * @nocollapse - */ - protected static finalize(): void; - /** - * Returns the property name for the given attribute `name`. - * @nocollapse - */ - private static _attributeNameForProperty; - /** - * Returns true if a property should request an update. - * Called when a property value is set and uses the `hasChanged` - * option for the property if present or a strict identity check. - * @nocollapse - */ - private static _valueHasChanged; - /** - * Returns the property value for the given attribute value. - * Called via the `attributeChangedCallback` and uses the property's - * `converter` or `converter.fromAttribute` property option. - * @nocollapse - */ - private static _propertyValueFromAttribute; - /** - * Returns the attribute value for the given property value. If this - * returns undefined, the property will *not* be reflected to an attribute. - * If this returns null, the attribute will be removed, otherwise the - * attribute will be set to the value. - * This uses the property's `reflect` and `type.toAttribute` property options. - * @nocollapse - */ - private static _propertyValueToAttribute; - private _updateState; - private _instanceProperties?; - private _updatePromise; - private _enableUpdatingResolver; - /** - * Map with keys for any properties that have changed since the last - * update cycle with previous values. - */ - private _changedProperties; - /** - * Map with keys of properties that should be reflected when updated. - */ - private _reflectingProperties?; - constructor(); - /** - * Performs element initialization. By default captures any pre-set values for - * registered properties. - */ - protected initialize(): void; - /** - * Fixes any properties set on the instance before upgrade time. - * Otherwise these would shadow the accessor and break these properties. - * The properties are stored in a Map which is played back after the - * constructor runs. Note, on very old versions of Safari (<=9) or Chrome - * (<=41), properties created for native platform properties like (`id` or - * `name`) may not have default values set in the element constructor. On - * these browsers native properties appear on instances and therefore their - * default value will overwrite any element default (e.g. if the element sets - * this.id = 'id' in the constructor, the 'id' will become '' since this is - * the native platform default). - */ - private _saveInstanceProperties; - /** - * Applies previously saved instance properties. - */ - private _applyInstanceProperties; - connectedCallback(): void; - protected enableUpdating(): void; - /** - * Allows for `super.disconnectedCallback()` in extensions while - * reserving the possibility of making non-breaking feature additions - * when disconnecting at some point in the future. - */ - disconnectedCallback(): void; - /** - * Synchronizes property values when attributes change. - */ - attributeChangedCallback(name: string, old: string | null, value: string | null): void; - private _propertyToAttribute; - private _attributeToProperty; - /** - * This protected version of `requestUpdate` does not access or return the - * `updateComplete` promise. This promise can be overridden and is therefore - * not free to access. - */ - protected requestUpdateInternal(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void; - /** - * Requests an update which is processed asynchronously. This should - * be called when an element should update based on some state not triggered - * by setting a property. In this case, pass no arguments. It should also be - * called when manually implementing a property setter. In this case, pass the - * property `name` and `oldValue` to ensure that any configured property - * options are honored. Returns the `updateComplete` Promise which is resolved - * when the update completes. - * - * @param name {PropertyKey} (optional) name of requesting property - * @param oldValue {any} (optional) old value of requesting property - * @returns {Promise} A Promise that is resolved when the update completes. - */ - requestUpdate(name?: PropertyKey, oldValue?: unknown): Promise<unknown>; - /** - * Sets up the element to asynchronously update. - */ - private _enqueueUpdate; - private readonly _hasRequestedUpdate: any; - protected readonly hasUpdated: number; - /** - * Performs an element update. Note, if an exception is thrown during the - * update, `firstUpdated` and `updated` will not be called. - * - * You can override this method to change the timing of updates. If this - * method is overridden, `super.performUpdate()` must be called. - * - * For instance, to schedule updates to occur just before the next frame: - * - * ``` - * protected async performUpdate(): Promise<unknown> { - * await new Promise((resolve) => requestAnimationFrame(() => resolve())); - * super.performUpdate(); - * } - * ``` - */ - protected performUpdate(): void | Promise<unknown>; - private _markUpdated; - /* - * Returns a Promise that resolves when the element has completed updating. - * The Promise value is a boolean that is `true` if the element completed the - * update without triggering another update. The Promise result is `false` if - * a property was set inside `updated()`. If the Promise is rejected, an - * exception was thrown during the update. - * - * To await additional asynchronous work, override the `_getUpdateComplete` - * method. For example, it is sometimes useful to await a rendered element - * before fulfilling this Promise. To do this, first await - * `super._getUpdateComplete()`, then any subsequent state. - * - * @returns {Promise} The Promise returns a boolean that indicates if the - * update resolved without triggering another update. - */ - readonly updateComplete: Promise<unknown>; - /** - * Override point for the `updateComplete` promise. - * - * It is not safe to override the `updateComplete` getter directly due to a - * limitation in TypeScript which means it is not possible to call a - * superclass getter (e.g. `super.updateComplete.then(...)`) when the target - * language is ES5 (https://github.com/microsoft/TypeScript/issues/338). - * This method should be overridden instead. For example: - * - * class MyElement extends LitElement { - * async _getUpdateComplete() { - * await super._getUpdateComplete(); - * await this._myChild.updateComplete; - * } - * } - */ - protected _getUpdateComplete(): Promise<unknown>; - /** - * Controls whether or not `update` should be called when the element requests - * an update. By default, this method always returns `true`, but this can be - * customized to control when to update. - * - * @param _changedProperties Map of changed properties with old values - */ - protected shouldUpdate(_changedProperties: PropertyValues): boolean; - /** - * Updates the element. This method reflects property values to attributes. - * It can be overridden to render and keep updated element DOM. - * Setting properties inside this method will *not* trigger - * another update. - * - * @param _changedProperties Map of changed properties with old values - */ - protected update(_changedProperties: PropertyValues): void; - /** - * Invoked whenever the element is updated. Implement to perform - * post-updating tasks via DOM APIs, for example, focusing an element. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - protected updated(_changedProperties: PropertyValues): void; - /** - * Invoked when the element is first updated. Implement to perform one time - * work on the element after update. - * - * Setting properties inside this method will trigger the element to update - * again after this update cycle completes. - * - * @param _changedProperties Map of changed properties with old values - */ - protected firstUpdated(_changedProperties: PropertyValues): void; -} -export {}; -//# sourceMappingURL=updating-element.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lit-element.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lit-element.d.ts deleted file mode 100644 index 921b961..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/lit-element.d.ts +++ /dev/null
@@ -1,167 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * The main LitElement module, which defines the [[`LitElement`]] base class and - * related APIs. - * - * LitElement components can define a template and a set of observed - * properties. Changing an observed property triggers a re-render of the - * element. - * - * Import [[`LitElement`]] and [[`html`]] from this module to create a - * component: - * - * ```js - * import {LitElement, html} from 'lit-element'; - * - * class MyElement extends LitElement { - * - * // Declare observed properties - * static get properties() { - * return { - * adjective: {} - * } - * } - * - * constructor() { - * this.adjective = 'awesome'; - * } - * - * // Define the element's template - * render() { - * return html`<p>your ${adjective} template here</p>`; - * } - * } - * - * customElements.define('my-element', MyElement); - * ``` - * - * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating. - * The `UpdatingElement` class is provided for users that want to build - * their own custom element base classes that don't use lit-html. - * - * @packageDocumentation - */ -import { ShadyRenderOptions } from 'lit-html/lib/shady-render.js'; -import { PropertyValues, UpdatingElement } from './lib/updating-element.js'; -export * from './lib/updating-element.js'; -export * from './lib/decorators.js'; -export { html, svg, TemplateResult, SVGTemplateResult } from 'lit-html/lit-html.js'; -import { CSSResult } from './lib/css-tag.js'; -export * from './lib/css-tag.js'; -declare global { - interface Window { - litElementVersions: string[]; - } -} -export declare type CSSResultOrNative = CSSResult | CSSStyleSheet; -export interface CSSResultArray extends Array<CSSResultOrNative | CSSResultArray> { -} -/** - * Base element class that manages element properties and attributes, and - * renders a lit-html template. - * - * To define a component, subclass `LitElement` and implement a - * `render` method to provide the component's template. Define properties - * using the [[`properties`]] property or the [[`property`]] decorator. - */ -export declare class LitElement extends UpdatingElement { - /** - * Ensure this class is marked as `finalized` as an optimization ensuring - * it will not needlessly try to `finalize`. - * - * Note this property name is a string to prevent breaking Closure JS Compiler - * optimizations. See updating-element.ts for more information. - */ - protected static ['finalized']: boolean; - /** - * Reference to the underlying library method used to render the element's - * DOM. By default, points to the `render` method from lit-html's shady-render - * module. - * - * **Most users will never need to touch this property.** - * - * This property should not be confused with the `render` instance method, - * which should be overridden to define a template for the element. - * - * Advanced users creating a new base class based on LitElement can override - * this property to point to a custom render method with a signature that - * matches [shady-render's `render` - * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render). - * - * @nocollapse - */ - static render: (result: unknown, container: Element | DocumentFragment, options: ShadyRenderOptions) => void; - /** - * Array of styles to apply to the element. The styles should be defined - * using the [[`css`]] tag function or via constructible stylesheets. - */ - static styles?: CSSResultOrNative | CSSResultArray; - private static _styles; - /** - * Return the array of styles to apply to the element. - * Override this method to integrate into a style management system. - * - * @nocollapse - */ - static getStyles(): CSSResultOrNative | CSSResultArray | undefined; - /** @nocollapse */ - private static _getUniqueStyles; - private _needsShimAdoptedStyleSheets?; - /** - * Node or ShadowRoot into which element DOM should be rendered. Defaults - * to an open shadowRoot. - */ - readonly renderRoot: Element | DocumentFragment; - /** - * Performs element initialization. By default this calls - * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and - * captures any pre-set values for registered properties. - */ - protected initialize(): void; - /** - * Returns the node into which the element should render and by default - * creates and returns an open shadowRoot. Implement to customize where the - * element's DOM is rendered. For example, to render into the element's - * childNodes, return `this`. - * @returns {Element|DocumentFragment} Returns a node into which to render. - */ - protected createRenderRoot(): Element | ShadowRoot; - /** - * Applies styling to the element shadowRoot using the [[`styles`]] - * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where - * available and will fallback otherwise. When Shadow DOM is polyfilled, - * ShadyCSS scopes styles and adds them to the document. When Shadow DOM - * is available but `adoptedStyleSheets` is not, styles are appended to the - * end of the `shadowRoot` to [mimic spec - * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets). - */ - protected adoptStyles(): void; - connectedCallback(): void; - /** - * Updates the element. This method reflects property values to attributes - * and calls `render` to render DOM via lit-html. Setting properties inside - * this method will *not* trigger another update. - * @param _changedProperties Map of changed properties with old values - */ - protected update(changedProperties: PropertyValues): void; - /** - * Invoked on each update to perform rendering tasks. This method may return - * any value renderable by lit-html's `NodePart` - typically a - * `TemplateResult`. Setting properties inside this method will *not* trigger - * the element to update. - */ - protected render(): unknown; -} -//# sourceMappingURL=lit-element.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/src/env.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/src/env.d.ts deleted file mode 100644 index 10950029..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/src/env.d.ts +++ /dev/null
@@ -1,31 +0,0 @@ -interface ShadyCSS { - styleElement(host: Element, overrideProps?: { - [key: string]: string; - }): void; - getComputedStyleValue(element: Element, property: string): string; - ScopingShim: undefined | { - prepareAdoptedCssText(cssText: string[], name: string): void; - }; - nativeShadow: boolean; -} -interface ShadyDOM { - inUse: boolean; - flush: () => void; -} -interface Window { - ShadyCSS?: ShadyCSS; - ShadyDOM?: ShadyDOM; - ShadowRoot: typeof ShadowRoot; -} -// Augment existing types with styling API -interface ShadowRoot { - adoptedStyleSheets: CSSStyleSheet[]; -} -declare var ShadowRoot: { - prototype: ShadowRoot; - new (): ShadowRoot; -}; -interface CSSStyleSheet { - replaceSync(cssText: string): void; - replace(cssText: string): Promise<unknown>; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/tsconfig.json b/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/tsconfig.json deleted file mode 100644 index b904df4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-element/ts3.4/tsconfig.json +++ /dev/null
@@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "target": "es2017", - "module": "es2015", - "moduleResolution": "node", - "lib": ["esnext.array", "esnext", "es2017", "dom"], - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "inlineSources": true, - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitThis": true, - "outDir": "./", - // Only necessary because @types/uglify-js can't find types for source-map - "skipLibCheck": true, - "experimentalDecorators": true - }, - "include": [ - "custom_typings/**/*.ts", - "src/**/*.ts" - ], - "exclude": [] -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/LICENSE b/third_party/material_web_components/components-chromium/node_modules/lit-html/LICENSE index 39cfe443..c8ed226 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/LICENSE +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/LICENSE
@@ -1,20 +1,20 @@ BSD 3-Clause License -Copyright (c) 2017, The Polymer Authors. All rights reserved. +Copyright (c) 2017 Google LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -* Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.d.ts new file mode 100644 index 0000000..400da5b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.d.ts
@@ -0,0 +1,171 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Overview: + * + * This module is designed to add support for an async `setValue` API and + * `disconnected` callback to directives with the least impact on the core + * runtime or payload when that feature is not used. + * + * The strategy is to introduce a `AsyncDirective` subclass of + * `Directive` that climbs the "parent" tree in its constructor to note which + * branches of lit-html's "logical tree" of data structures contain such + * directives and thus need to be crawled when a subtree is being cleared (or + * manually disconnected) in order to run the `disconnected` callback. + * + * The "nodes" of the logical tree include Parts, TemplateInstances (for when a + * TemplateResult is committed to a value of a ChildPart), and Directives; these + * all implement a common interface called `DisconnectableChild`. Each has a + * `_$parent` reference which is set during construction in the core code, and a + * `_$disconnectableChildren` field which is initially undefined. + * + * The sparse tree created by means of the `AsyncDirective` constructor + * crawling up the `_$parent` tree and placing a `_$disconnectableChildren` Set + * on each parent that includes each child that contains a + * `AsyncDirective` directly or transitively via its children. In order to + * notify connection state changes and disconnect (or reconnect) a tree, the + * `_$notifyConnectionChanged` API is patched onto ChildParts as a directive + * climbs the parent tree, which is called by the core when clearing a part if + * it exists. When called, that method iterates over the sparse tree of + * Set<DisconnectableChildren> built up by AsyncDirectives, and calls + * `_$notifyDirectiveConnectionChanged` on any directives that are encountered + * in that tree, running the required callbacks. + * + * A given "logical tree" of lit-html data-structures might look like this: + * + * ChildPart(N1) _$dC=[D2,T3] + * ._directive + * AsyncDirective(D2) + * ._value // user value was TemplateResult + * TemplateInstance(T3) _$dC=[A4,A6,N10,N12] + * ._parts[] + * AttributePart(A4) _$dC=[D5] + * ._directives[] + * AsyncDirective(D5) + * AttributePart(A6) _$dC=[D7,D8] + * ._directives[] + * AsyncDirective(D7) + * Directive(D8) _$dC=[D9] + * ._directive + * AsyncDirective(D9) + * ChildPart(N10) _$dC=[D11] + * ._directive + * AsyncDirective(D11) + * ._value + * string + * ChildPart(N12) _$dC=[D13,N14,N16] + * ._directive + * AsyncDirective(D13) + * ._value // user value was iterable + * Array<ChildPart> + * ChildPart(N14) _$dC=[D15] + * ._value + * string + * ChildPart(N16) _$dC=[D17,T18] + * ._directive + * AsyncDirective(D17) + * ._value // user value was TemplateResult + * TemplateInstance(T18) _$dC=[A19,A21,N25] + * ._parts[] + * AttributePart(A19) _$dC=[D20] + * ._directives[] + * AsyncDirective(D20) + * AttributePart(A21) _$dC=[22,23] + * ._directives[] + * AsyncDirective(D22) + * Directive(D23) _$dC=[D24] + * ._directive + * AsyncDirective(D24) + * ChildPart(N25) _$dC=[D26] + * ._directive + * AsyncDirective(D26) + * ._value + * string + * + * Example 1: The directive in ChildPart(N12) updates and returns `nothing`. The + * ChildPart will _clear() itself, and so we need to disconnect the "value" of + * the ChildPart (but not its directive). In this case, when `_clear()` calls + * `_$notifyConnectionChanged()`, we don't iterate all of the + * _$disconnectableChildren, rather we do a value-specific disconnection: i.e. + * since the _value was an Array<ChildPart> (because an iterable had been + * committed), we iterate the array of ChildParts (N14, N16) and run + * `setConnected` on them (which does recurse down the full tree of + * `_$disconnectableChildren` below it, and also removes N14 and N16 from N12's + * `_$disconnectableChildren`). Once the values have been disconnected, we then + * check whether the ChildPart(N12)'s list of `_$disconnectableChildren` is empty + * (and would remove it from its parent TemplateInstance(T3) if so), but since + * it would still contain its directive D13, it stays in the disconnectable + * tree. + * + * Example 2: In the course of Example 1, `setConnected` will reach + * ChildPart(N16); in this case the entire part is being disconnected, so we + * simply iterate all of N16's `_$disconnectableChildren` (D17,T18) and + * recursively run `setConnected` on them. Note that we only remove children + * from `_$disconnectableChildren` for the top-level values being disconnected + * on a clear; doing this bookkeeping lower in the tree is wasteful since it's + * all being thrown away. + * + * Example 3: If the LitElement containing the entire tree above becomes + * disconnected, it will run `childPart.setConnected()` (which calls + * `childPart._$notifyConnectionChanged()` if it exists); in this case, we + * recursively run `setConnected()` over the entire tree, without removing any + * children from `_$disconnectableChildren`, since this tree is required to + * re-connect the tree, which does the same operation, simply passing + * `isConnected: true` down the tree, signaling which callback to run. + */ +import { Disconnectable, Part } from './lit-html.js'; +import { Directive } from './directive.js'; +export { directive } from './directive.js'; +/** + * An abstract `Directive` base class whose `disconnected` method will be + * called when the part containing the directive is cleared as a result of + * re-rendering, or when the user calls `part.setConnected(false)` on + * a part that was previously rendered containing the directive (as happens + * when e.g. a LitElement disconnects from the DOM). + * + * If `part.setConnected(true)` is subsequently called on a + * containing part, the directive's `reconnected` method will be called prior + * to its next `update`/`render` callbacks. When implementing `disconnected`, + * `reconnected` should also be implemented to be compatible with reconnection. + * + * Note that updates may occur while the directive is disconnected. As such, + * directives should generally check the `this.isConnected` flag during + * render/update to determine whether it is safe to subscribe to resources + * that may prevent garbage collection. + */ +export declare abstract class AsyncDirective extends Directive { + /** + * The connection state for this Directive. + */ + isConnected: boolean; + /** + * Initialize the part with internal fields + * @param part + * @param parent + * @param attributeIndex + */ + _$initialize(part: Part, parent: Disconnectable, attributeIndex: number | undefined): void; + /** + * Sets the value of the directive's Part outside the normal `update`/`render` + * lifecycle of a directive. + * + * This method should not be called synchronously from a directive's `update` + * or `render`. + * + * @param directive The directive to update + * @param value The value to set + */ + setValue(value: unknown): void; + /** + * User callbacks for implementing logic to release any resources/subscriptions + * that may have been retained by this directive. Since directives may also be + * re-connected, `reconnected` should also be implemented to restore the + * working state of the directive prior to the next render. + */ + protected disconnected(): void; + protected reconnected(): void; +} +//# sourceMappingURL=async-directive.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.js new file mode 100644 index 0000000..21aa29f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/async-directive.js
@@ -0,0 +1,7 @@ +import{isSingleExpression as i}from'./directive-helpers.js';import{Directive as t,PartType as s}from'./directive.js';export{directive}from'./directive.js'; +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const e=(i,t)=>{var s,o;const n=i._$AN;if(void 0===n)return!1;for(const i of n)null===(o=(s=i)._$AO)||void 0===o||o.call(s,t,!1),e(i,t);return!0},o=i=>{let t,s;do{if(void 0===(t=i._$AM))break;s=t._$AN,s.delete(i),i=t}while(0===(null==s?void 0:s.size))},n=i=>{for(let t;t=i._$AM;i=t){let s=t._$AN;if(void 0===s)t._$AN=s=new Set;else if(s.has(i))break;s.add(i),l(t)}};function r(i){void 0!==this._$AN?(o(this),this._$AM=i,n(this)):this._$AM=i}function h(i,t=!1,s=0){const n=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(t)if(Array.isArray(n))for(let i=s;i<n.length;i++)e(n[i],!1),o(n[i]);else null!=n&&(e(n,!1),o(n));else e(this,i)}const l=i=>{var t,e,o,n;i.type==s.CHILD&&(null!==(t=(o=i)._$AP)&&void 0!==t||(o._$AP=h),null!==(e=(n=i)._$AQ)&&void 0!==e||(n._$AQ=r))};class d extends t{constructor(){super(...arguments),this._$AN=void 0}_$AT(i,t,s){super._$AT(i,t,s),n(this),this.isConnected=i._$AU}_$AO(i,t=!0){var s,n;i!==this.isConnected&&(this.isConnected=i,i?null===(s=this.reconnected)||void 0===s||s.call(this):null===(n=this.disconnected)||void 0===n||n.call(this)),t&&(e(this,i),o(this))}setValue(t){if(i(this._$Ct))this._$Ct._$AI(t,this);else{const i=[...this._$Ct._$AH];i[this._$Ci]=t,this._$Ct._$AI(i,this,0)}}disconnected(){}reconnected(){}}export{d as AsyncDirective}; +//# sourceMappingURL=async-directive.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.d.ts new file mode 100644 index 0000000..8b633940 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.d.ts
@@ -0,0 +1,106 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { Part, DirectiveParent, TemplateResult } from './lit-html.js'; +import { DirectiveResult, DirectiveClass, PartInfo } from './directive.js'; +declare type Primitive = null | undefined | boolean | number | string | symbol | bigint; +/** + * Tests if a value is a primitive value. + * + * See https://tc39.github.io/ecma262/#sec-typeof-operator + */ +export declare const isPrimitive: (value: unknown) => value is Primitive; +export declare const TemplateResultType: { + readonly HTML: 1; + readonly SVG: 2; +}; +export declare type TemplateResultType = typeof TemplateResultType[keyof typeof TemplateResultType]; +/** + * Tests if a value is a TemplateResult. + */ +export declare const isTemplateResult: (value: unknown, type?: TemplateResultType | undefined) => value is TemplateResult<1 | 2>; +/** + * Tests if a value is a DirectiveResult. + */ +export declare const isDirectiveResult: (value: unknown) => value is DirectiveResult<DirectiveClass>; +/** + * Retrieves the Directive class for a DirectiveResult + */ +export declare const getDirectiveClass: (value: unknown) => DirectiveClass | undefined; +/** + * Tests whether a part has only a single-expression with no strings to + * interpolate between. + * + * Only AttributePart and PropertyPart can have multiple expressions. + * Multi-expression parts have a `strings` property and single-expression + * parts do not. + */ +export declare const isSingleExpression: (part: PartInfo) => boolean; +/** + * Inserts a ChildPart into the given container ChildPart's DOM, either at the + * end of the container ChildPart, or before the optional `refPart`. + * + * This does not add the part to the containerPart's committed value. That must + * be done by callers. + * + * @param containerPart Part within which to add the new ChildPart + * @param refPart Part before which to add the new ChildPart; when omitted the + * part added to the end of the `containerPart` + * @param part Part to insert, or undefined to create a new part + */ +export declare const insertPart: (containerPart: import("./lit-html.js").ChildPart, refPart?: import("./lit-html.js").ChildPart | undefined, part?: import("./lit-html.js").ChildPart | undefined) => import("./lit-html.js").ChildPart; +/** + * Sets the value of a Part. + * + * Note that this should only be used to set/update the value of user-created + * parts (i.e. those created using `insertPart`); it should not be used + * by directives to set the value of the directive's container part. Directives + * should return a value from `update`/`render` to update their part state. + * + * For directives that require setting their part value asynchronously, they + * should extend `AsyncDirective` and call `this.setValue()`. + * + * @param part Part to set + * @param value Value to set + * @param index For `AttributePart`s, the index to set + * @param directiveParent Used internally; should not be set by user + */ +export declare const setChildPartValue: <T extends import("./lit-html.js").ChildPart>(part: T, value: unknown, directiveParent?: DirectiveParent) => T; +/** + * Sets the committed value of a ChildPart directly without triggering the + * commit stage of the part. + * + * This is useful in cases where a directive needs to update the part such + * that the next update detects a value change or not. When value is omitted, + * the next update will be guaranteed to be detected as a change. + * + * @param part + * @param value + */ +export declare const setCommittedValue: (part: Part, value?: unknown) => unknown; +/** + * Returns the committed value of a ChildPart. + * + * The committed value is used for change detection and efficient updates of + * the part. It can differ from the value set by the template or directive in + * cases where the template value is transformed before being commited. + * + * - `TemplateResult`s are committed as a `TemplateInstance` + * - Iterables are committed as `Array<ChildPart>` + * - All other types are committed as the template value or value returned or + * set by a directive. + * + * @param part + */ +export declare const getCommittedValue: (part: import("./lit-html.js").ChildPart) => unknown; +/** + * Removes a ChildPart from the DOM, including any of its content. + * + * @param part The Part to remove + */ +export declare const removePart: (part: import("./lit-html.js").ChildPart) => void; +export declare const clearPart: (part: import("./lit-html.js").ChildPart) => void; +export {}; +//# sourceMappingURL=directive-helpers.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.js new file mode 100644 index 0000000..1e45832 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive-helpers.js
@@ -0,0 +1,7 @@ +import{_$LH as o}from'./lit-html.js'; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const{H:i}=o,t=o=>null===o||"object"!=typeof o&&"function"!=typeof o,n={HTML:1,SVG:2},v=(o,i)=>{var t,n;return void 0===i?void 0!==(null===(t=o)||void 0===t?void 0:t._$litType$):(null===(n=o)||void 0===n?void 0:n._$litType$)===i},l=o=>{var i;return void 0!==(null===(i=o)||void 0===i?void 0:i._$litDirective$)},d=o=>{var i;return null===(i=o)||void 0===i?void 0:i._$litDirective$},r=o=>void 0===o.strings,e=()=>document.createComment(""),u=(o,t,n)=>{var v;const l=o._$AA.parentNode,d=void 0===t?o._$AB:t._$AA;if(void 0===n){const t=l.insertBefore(e(),d),v=l.insertBefore(e(),d);n=new i(t,v,o,o.options)}else{const i=n._$AB.nextSibling,t=n._$AM,r=t!==o;if(r){let i;null===(v=n._$AQ)||void 0===v||v.call(n,o),n._$AM=o,void 0!==n._$AP&&(i=o._$AU)!==t._$AU&&n._$AP(i)}if(i!==d||r){let o=n._$AA;for(;o!==i;){const i=o.nextSibling;l.insertBefore(o,d),o=i}}}return n},c=(o,i,t=o)=>(o._$AI(i,t),o),f={},s=(o,i=f)=>o._$AH=i,a=o=>o._$AH,m=o=>{var i;null===(i=o._$AP)||void 0===i||i.call(o,!1,!0);let t=o._$AA;const n=o._$AB.nextSibling;for(;t!==n;){const o=t.nextSibling;t.remove(),t=o}},p=o=>{o._$AR()};export{n as TemplateResultType,p as clearPart,a as getCommittedValue,d as getDirectiveClass,u as insertPart,l as isDirectiveResult,t as isPrimitive,r as isSingleExpression,v as isTemplateResult,m as removePart,c as setChildPartValue,s as setCommittedValue}; +//# sourceMappingURL=directive-helpers.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.d.ts new file mode 100644 index 0000000..d631312 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.d.ts
@@ -0,0 +1,66 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { Disconnectable, Part } from './lit-html.js'; +export { AttributePart, BooleanAttributePart, ChildPart, ElementPart, EventPart, Part, PropertyPart, } from './lit-html.js'; +export interface DirectiveClass { + new (part: PartInfo): Directive; +} +/** + * This utility type extracts the signature of a directive class's render() + * method so we can use it for the type of the generated directive function. + */ +export declare type DirectiveParameters<C extends Directive> = Parameters<C['render']>; +/** + * A generated directive function doesn't evaluate the directive, but just + * returns a DirectiveResult object that captures the arguments. + */ +export interface DirectiveResult<C extends DirectiveClass = DirectiveClass> { +} +export declare const PartType: { + readonly ATTRIBUTE: 1; + readonly CHILD: 2; + readonly PROPERTY: 3; + readonly BOOLEAN_ATTRIBUTE: 4; + readonly EVENT: 5; + readonly ELEMENT: 6; +}; +export declare type PartType = typeof PartType[keyof typeof PartType]; +export interface ChildPartInfo { + readonly type: typeof PartType.CHILD; +} +export interface AttributePartInfo { + readonly type: typeof PartType.ATTRIBUTE | typeof PartType.PROPERTY | typeof PartType.BOOLEAN_ATTRIBUTE | typeof PartType.EVENT; + readonly strings?: ReadonlyArray<string>; + readonly name: string; + readonly tagName: string; +} +export interface ElementPartInfo { + readonly type: typeof PartType.ELEMENT; +} +/** + * Information about the part a directive is bound to. + * + * This is useful for checking that a directive is attached to a valid part, + * such as with directive that can only be used on attribute bindings. + */ +export declare type PartInfo = ChildPartInfo | AttributePartInfo | ElementPartInfo; +/** + * Creates a user-facing directive function from a Directive class. This + * function has the same parameters as the directive's render() method. + */ +export declare const directive: <C extends DirectiveClass>(c: C) => (...values: Parameters<InstanceType<C>["render"]>) => DirectiveResult<C>; +/** + * Base class for creating custom directives. Users should extend this class, + * implement `render` and/or `update`, and then pass their subclass to + * `directive`. + */ +export declare abstract class Directive implements Disconnectable { + constructor(_partInfo: PartInfo); + get _$isConnected(): boolean; + abstract render(...props: Array<unknown>): unknown; + update(_part: Part, props: Array<unknown>): unknown; +} +//# sourceMappingURL=directive.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.js new file mode 100644 index 0000000..55f5580 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directive.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}export{i as Directive,t as PartType,e as directive}; +//# sourceMappingURL=directive.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.d.ts index 082eab2b..34b0b18 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.d.ts
@@ -1,20 +1,21 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { ChildPart } from '../lit-html.js'; +import { DirectiveParameters, PartInfo } from '../directive.js'; +import { AsyncReplaceDirective } from './async-replace.js'; +declare class AsyncAppendDirective extends AsyncReplaceDirective { + private __childPart; + constructor(partInfo: PartInfo); + update(part: ChildPart, params: DirectiveParameters<this>): typeof import("../lit-html.js").noChange | undefined; + protected commitValue(value: unknown, index: number): void; +} /** * A directive that renders the items of an async iterable[1], appending new * values after previous values, similar to the built-in support for iterables. + * This directive is usable only in child expressions. * * Async iterables are objects with a [Symbol.asyncIterator] method, which * returns an iterator who's `next()` method returns a Promise. When a new @@ -23,11 +24,16 @@ * directive has been set on the Part, the iterable will no longer be listened * to and new values won't be written to the Part. * - * [1]: https://github.com/tc39/proposal-async-iteration + * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of * * @param value An async iterable * @param mapper An optional function that maps from (value, index) to another * value. Useful for generating templates for each item in the iterable. */ -export declare const asyncAppend: <T>(value: AsyncIterable<T>, mapper?: ((v: T, index?: number | undefined) => unknown) | undefined) => (part: Part) => Promise<void>; +export declare const asyncAppend: (value: AsyncIterable<unknown>, _mapper?: ((v: unknown, index?: number | undefined) => unknown) | undefined) => import("../directive.js").DirectiveResult<typeof AsyncAppendDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { AsyncAppendDirective }; //# sourceMappingURL=async-append.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.js index 9e81e25..60b85ef 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-append.js
@@ -1,108 +1,7 @@ +import{directive as r,PartType as e}from'../directive.js';import{AsyncReplaceDirective as s}from'./async-replace.js';import{clearPart as t,insertPart as o,setChildPartValue as i}from'../directive-helpers.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -var __asyncValues = (this && this.__asyncValues) || function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -}; -import { createMarker, directive, NodePart } from '../lit-html.js'; -/** - * A directive that renders the items of an async iterable[1], appending new - * values after previous values, similar to the built-in support for iterables. - * - * Async iterables are objects with a [Symbol.asyncIterator] method, which - * returns an iterator who's `next()` method returns a Promise. When a new - * value is available, the Promise resolves and the value is appended to the - * Part controlled by the directive. If another value other than this - * directive has been set on the Part, the iterable will no longer be listened - * to and new values won't be written to the Part. - * - * [1]: https://github.com/tc39/proposal-async-iteration - * - * @param value An async iterable - * @param mapper An optional function that maps from (value, index) to another - * value. Useful for generating templates for each item in the iterable. - */ -export const asyncAppend = directive((value, mapper) => async (part) => { - var e_1, _a; - if (!(part instanceof NodePart)) { - throw new Error('asyncAppend can only be used in text bindings'); - } - // If we've already set up this particular iterable, we don't need - // to do anything. - if (value === part.value) { - return; - } - part.value = value; - // We keep track of item Parts across iterations, so that we can - // share marker nodes between consecutive Parts. - let itemPart; - let i = 0; - try { - for (var value_1 = __asyncValues(value), value_1_1; value_1_1 = await value_1.next(), !value_1_1.done;) { - let v = value_1_1.value; - // Check to make sure that value is the still the current value of - // the part, and if not bail because a new value owns this part - if (part.value !== value) { - break; - } - // When we get the first value, clear the part. This lets the - // previous value display until we can replace it. - if (i === 0) { - part.clear(); - } - // As a convenience, because functional-programming-style - // transforms of iterables and async iterables requires a library, - // we accept a mapper function. This is especially convenient for - // rendering a template for each item. - if (mapper !== undefined) { - // This is safe because T must otherwise be treated as unknown by - // the rest of the system. - v = mapper(v, i); - } - // Like with sync iterables, each item induces a Part, so we need - // to keep track of start and end nodes for the Part. - // Note: Because these Parts are not updatable like with a sync - // iterable (if we render a new value, we always clear), it may - // be possible to optimize away the Parts and just re-use the - // Part.setValue() logic. - let itemStartNode = part.startNode; - // Check to see if we have a previous item and Part - if (itemPart !== undefined) { - // Create a new node to separate the previous and next Parts - itemStartNode = createMarker(); - // itemPart is currently the Part for the previous item. Set - // it's endNode to the node we'll use for the next Part's - // startNode. - itemPart.endNode = itemStartNode; - part.endNode.parentNode.insertBefore(itemStartNode, part.endNode); - } - itemPart = new NodePart(part.options); - itemPart.insertAfterNode(itemStartNode); - itemPart.setValue(v); - itemPart.commit(); - i++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (value_1_1 && !value_1_1.done && (_a = value_1.return)) await _a.call(value_1); - } - finally { if (e_1) throw e_1.error; } - } -}); -//# sourceMappingURL=async-append.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const c=r(class extends s{constructor(r){if(super(r),r.type!==e.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$CJ=r,super.update(r,e)}commitValue(r,e){0===e&&t(this._$CJ);const s=o(this._$CJ);i(s,r)}});export{c as asyncAppend}; +//# sourceMappingURL=async-append.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.d.ts index 187bfd6..8023644c8 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.d.ts
@@ -1,34 +1,40 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { ChildPart, noChange } from '../lit-html.js'; +import { DirectiveParameters } from '../directive.js'; +import { AsyncDirective } from '../async-directive.js'; +declare type Mapper<T> = (v: T, index?: number) => unknown; +export declare class AsyncReplaceDirective extends AsyncDirective { + private __value?; + private __weakThis; + private __pauser; + render<T>(value: AsyncIterable<T>, _mapper?: Mapper<T>): symbol; + update(_part: ChildPart, [value, mapper]: DirectiveParameters<this>): typeof noChange | undefined; + protected commitValue(value: unknown, _index: number): void; + disconnected(): void; + reconnected(): void; +} /** * A directive that renders the items of an async iterable[1], replacing * previous values with new values, so that only one value is ever rendered - * at a time. + * at a time. This directive may be used in any expression type. * - * Async iterables are objects with a [Symbol.asyncIterator] method, which + * Async iterables are objects with a `[Symbol.asyncIterator]` method, which * returns an iterator who's `next()` method returns a Promise. When a new * value is available, the Promise resolves and the value is rendered to the * Part controlled by the directive. If another value other than this * directive has been set on the Part, the iterable will no longer be listened * to and new values won't be written to the Part. * - * [1]: https://github.com/tc39/proposal-async-iteration + * [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of * * @param value An async iterable * @param mapper An optional function that maps from (value, index) to another * value. Useful for generating templates for each item in the iterable. */ -export declare const asyncReplace: <T>(value: AsyncIterable<T>, mapper?: ((v: T, index?: number | undefined) => unknown) | undefined) => (part: Part) => Promise<void>; +export declare const asyncReplace: (value: AsyncIterable<unknown>, _mapper?: Mapper<unknown> | undefined) => import("../directive.js").DirectiveResult<typeof AsyncReplaceDirective>; +export {}; //# sourceMappingURL=async-replace.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.js index a3437aa..e861eb0c 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/async-replace.js
@@ -1,91 +1,7 @@ +import{noChange as t}from'../lit-html.js';import{directive as i}from'../directive.js';import{AsyncDirective as s}from'../async-directive.js';import{PseudoWeakRef as r,Pauser as e,forAwaitOf as n}from'./private-async-helpers.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -var __asyncValues = (this && this.__asyncValues) || function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -}; -import { directive, NodePart } from '../lit-html.js'; -/** - * A directive that renders the items of an async iterable[1], replacing - * previous values with new values, so that only one value is ever rendered - * at a time. - * - * Async iterables are objects with a [Symbol.asyncIterator] method, which - * returns an iterator who's `next()` method returns a Promise. When a new - * value is available, the Promise resolves and the value is rendered to the - * Part controlled by the directive. If another value other than this - * directive has been set on the Part, the iterable will no longer be listened - * to and new values won't be written to the Part. - * - * [1]: https://github.com/tc39/proposal-async-iteration - * - * @param value An async iterable - * @param mapper An optional function that maps from (value, index) to another - * value. Useful for generating templates for each item in the iterable. - */ -export const asyncReplace = directive((value, mapper) => async (part) => { - var e_1, _a; - if (!(part instanceof NodePart)) { - throw new Error('asyncReplace can only be used in text bindings'); - } - // If we've already set up this particular iterable, we don't need - // to do anything. - if (value === part.value) { - return; - } - // We nest a new part to keep track of previous item values separately - // of the iterable as a value itself. - const itemPart = new NodePart(part.options); - part.value = value; - let i = 0; - try { - for (var value_1 = __asyncValues(value), value_1_1; value_1_1 = await value_1.next(), !value_1_1.done;) { - let v = value_1_1.value; - // Check to make sure that value is the still the current value of - // the part, and if not bail because a new value owns this part - if (part.value !== value) { - break; - } - // When we get the first value, clear the part. This let's the - // previous value display until we can replace it. - if (i === 0) { - part.clear(); - itemPart.appendIntoPart(part); - } - // As a convenience, because functional-programming-style - // transforms of iterables and async iterables requires a library, - // we accept a mapper function. This is especially convenient for - // rendering a template for each item. - if (mapper !== undefined) { - // This is safe because T must otherwise be treated as unknown by - // the rest of the system. - v = mapper(v, i); - } - itemPart.setValue(v); - itemPart.commit(); - i++; - } - } - catch (e_1_1) { e_1 = { error: e_1_1 }; } - finally { - try { - if (value_1_1 && !value_1_1.done && (_a = value_1.return)) await _a.call(value_1); - } - finally { if (e_1) throw e_1.error; } - } -}); -//# sourceMappingURL=async-replace.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */class o extends s{constructor(){super(...arguments),this._$CG=new r(this),this._$CK=new e}render(i,s){return t}update(i,[s,r]){if(this.isConnected||this.disconnected(),s===this._$CX)return;this._$CX=s;let e=0;const{_$CG:o,_$CK:h}=this;return n(s,(async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){if(i._$CX!==s)return!1;void 0!==r&&(t=r(t,e)),i.commitValue(t,e),e++}return!0})),t}commitValue(t,i){this.setValue(t)}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const h=i(o);export{o as AsyncReplaceDirective,h as asyncReplace}; +//# sourceMappingURL=async-replace.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.d.ts index 1a2da8f..a8f7c40 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.d.ts
@@ -1,24 +1,24 @@ /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { ChildPart } from '../lit-html.js'; +import { Directive, DirectiveParameters, PartInfo } from '../directive.js'; +declare class CacheDirective extends Directive { + private _templateCache; + private _value?; + constructor(partInfo: PartInfo); + render(v: unknown): unknown[]; + update(containerPart: ChildPart, [v]: DirectiveParameters<this>): unknown[]; +} /** * Enables fast switching between multiple templates by caching the DOM nodes * and TemplateInstances produced by the templates. * * Example: * - * ``` + * ```js * let checked = false; * * html` @@ -26,5 +26,10 @@ * ` * ``` */ -export declare const cache: (value: unknown) => (part: Part) => void; +export declare const cache: (v: unknown) => import("../directive.js").DirectiveResult<typeof CacheDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { CacheDirective }; //# sourceMappingURL=cache.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.js index 4737df4..df08e4c 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/cache.js
@@ -1,77 +1,7 @@ +import{render as t,nothing as i}from'../lit-html.js';import{directive as s,Directive as e}from'../directive.js';import{isTemplateResult as o,getCommittedValue as r,setCommittedValue as h,insertPart as n,clearPart as c}from'../directive-helpers.js'; /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateInstance } from '../lib/template-instance.js'; -import { directive, NodePart, reparentNodes, TemplateResult } from '../lit-html.js'; -const templateCaches = new WeakMap(); -/** - * Enables fast switching between multiple templates by caching the DOM nodes - * and TemplateInstances produced by the templates. - * - * Example: - * - * ``` - * let checked = false; - * - * html` - * ${cache(checked ? html`input is checked` : html`input is not checked`)} - * ` - * ``` - */ -export const cache = directive((value) => (part) => { - if (!(part instanceof NodePart)) { - throw new Error('cache can only be used in text bindings'); - } - let templateCache = templateCaches.get(part); - if (templateCache === undefined) { - templateCache = new WeakMap(); - templateCaches.set(part, templateCache); - } - const previousValue = part.value; - // First, can we update the current TemplateInstance, or do we need to move - // the current nodes into the cache? - if (previousValue instanceof TemplateInstance) { - if (value instanceof TemplateResult && - previousValue.template === part.options.templateFactory(value)) { - // Same Template, just trigger an update of the TemplateInstance - part.setValue(value); - return; - } - else { - // Not the same Template, move the nodes from the DOM into the cache. - let cachedTemplate = templateCache.get(previousValue.template); - if (cachedTemplate === undefined) { - cachedTemplate = { - instance: previousValue, - nodes: document.createDocumentFragment(), - }; - templateCache.set(previousValue.template, cachedTemplate); - } - reparentNodes(cachedTemplate.nodes, part.startNode.nextSibling, part.endNode); - } - } - // Next, can we reuse nodes from the cache? - if (value instanceof TemplateResult) { - const template = part.options.templateFactory(value); - const cachedTemplate = templateCache.get(template); - if (cachedTemplate !== undefined) { - // Move nodes out of cache - part.setValue(cachedTemplate.nodes); - part.commit(); - // Set the Part value to the TemplateInstance so it'll update it. - part.value = cachedTemplate.instance; - } - } - part.setValue(value); -}); -//# sourceMappingURL=cache.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const d=s(class extends e{constructor(t){super(t),this.tt=new WeakMap}render(t){return[t]}update(s,[e]){if(o(this.it)&&(!o(e)||this.it.strings!==e.strings)){const e=r(s).pop();let o=this.tt.get(this.it.strings);if(void 0===o){const s=document.createDocumentFragment();o=t(i,s),o.setConnected(!1),this.tt.set(this.it.strings,o)}h(o,[e]),n(o,void 0,e)}if(o(e)){if(!o(this.it)||this.it.strings!==e.strings){const t=this.tt.get(e.strings);if(void 0!==t){const i=r(t).pop();c(s),n(s,void 0,i),h(s,[i])}}this.it=e}else this.it=void 0;return this.render(e)}});export{d as cache}; +//# sourceMappingURL=cache.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.d.ts new file mode 100644 index 0000000..eab780e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.d.ts
@@ -0,0 +1,32 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Chooses and evaluates a template function from a list based on matching + * the given `value` to a case. + * + * Cases are structured as `[caseValue, func]`. `value` is matched to + * `caseValue` by strict equality. The first match is selected. Case values + * can be of any type including primitives, objects, and symbols. + * + * This is similar to a switch statement, but as an expression and without + * fallthrough. + * + * @example + * + * ```ts + * render() { + * return html` + * ${choose(this.section, [ + * ['home', () => html`<h1>Home</h1>`], + * ['about', () => html`<h1>About</h1>`] + * ], + * () => html`<h1>Error</h1>`)} + * `; + * } + * ``` + */ +export declare const choose: <T, V>(value: T, cases: [T, () => V][], defaultCase?: (() => V) | undefined) => V | undefined; +//# sourceMappingURL=choose.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.js new file mode 100644 index 0000000..7d07c33 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/choose.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const o=(o,r,n)=>{for(const n of r)if(n[0]===o)return(0,n[1])();return null==n?void 0:n()};export{o as choose}; +//# sourceMappingURL=choose.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.d.ts index b0f6c3e7..d3c2d8a 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.d.ts
@@ -1,28 +1,45 @@ /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { AttributePart, noChange } from '../lit-html.js'; +import { Directive, DirectiveParameters, PartInfo } from '../directive.js'; +/** + * A key-value set of class names to truthy values. + */ export interface ClassInfo { readonly [name: string]: string | boolean | number; } +declare class ClassMapDirective extends Directive { + /** + * Stores the ClassInfo object applied to a given AttributePart. + * Used to unset existing values when a new ClassInfo object is applied. + */ + private _previousClasses?; + private _staticClasses?; + constructor(partInfo: PartInfo); + render(classInfo: ClassInfo): string; + update(part: AttributePart, [classInfo]: DirectiveParameters<this>): string | typeof noChange; +} /** - * A directive that applies CSS classes. This must be used in the `class` - * attribute and must be the only part used in the attribute. It takes each - * property in the `classInfo` argument and adds the property name to the - * element's `class` if the property value is truthy; if the property value is - * falsey, the property name is removed from the element's `class`. For example - * `{foo: bar}` applies the class `foo` if the value of `bar` is truthy. - * @param classInfo {ClassInfo} + * A directive that applies dynamic CSS classes. + * + * This must be used in the `class` attribute and must be the only part used in + * the attribute. It takes each property in the `classInfo` argument and adds + * the property name to the element's `classList` if the property value is + * truthy; if the property value is falsey, the property name is removed from + * the element's `class`. + * + * For example `{foo: bar}` applies the class `foo` if the value of `bar` is + * truthy. + * + * @param classInfo */ -export declare const classMap: (classInfo: ClassInfo) => (part: Part) => void; +export declare const classMap: (classInfo: ClassInfo) => import("../directive.js").DirectiveResult<typeof ClassMapDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { ClassMapDirective }; //# sourceMappingURL=class-map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.js index 352975a..d0e370e 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/class-map.js
@@ -1,101 +1,7 @@ +import{noChange as t}from'../lit-html.js';import{directive as i,Directive as s,PartType as r}from'../directive.js'; /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributePart, directive, PropertyPart } from '../lit-html.js'; -// IE11 doesn't support classList on SVG elements, so we emulate it with a Set -class ClassList { - constructor(element) { - this.classes = new Set(); - this.changed = false; - this.element = element; - const classList = (element.getAttribute('class') || '').split(/\s+/); - for (const cls of classList) { - this.classes.add(cls); - } - } - add(cls) { - this.classes.add(cls); - this.changed = true; - } - remove(cls) { - this.classes.delete(cls); - this.changed = true; - } - commit() { - if (this.changed) { - let classString = ''; - this.classes.forEach((cls) => classString += cls + ' '); - this.element.setAttribute('class', classString); - } - } -} -/** - * Stores the ClassInfo object applied to a given AttributePart. - * Used to unset existing values when a new ClassInfo object is applied. - */ -const previousClassesCache = new WeakMap(); -/** - * A directive that applies CSS classes. This must be used in the `class` - * attribute and must be the only part used in the attribute. It takes each - * property in the `classInfo` argument and adds the property name to the - * element's `class` if the property value is truthy; if the property value is - * falsey, the property name is removed from the element's `class`. For example - * `{foo: bar}` applies the class `foo` if the value of `bar` is truthy. - * @param classInfo {ClassInfo} - */ -export const classMap = directive((classInfo) => (part) => { - if (!(part instanceof AttributePart) || (part instanceof PropertyPart) || - part.committer.name !== 'class' || part.committer.parts.length > 1) { - throw new Error('The `classMap` directive must be used in the `class` attribute ' + - 'and must be the only part in the attribute.'); - } - const { committer } = part; - const { element } = committer; - let previousClasses = previousClassesCache.get(part); - if (previousClasses === undefined) { - // Write static classes once - // Use setAttribute() because className isn't a string on SVG elements - element.setAttribute('class', committer.strings.join(' ')); - previousClassesCache.set(part, previousClasses = new Set()); - } - const classList = (element.classList || new ClassList(element)); - // Remove old classes that no longer apply - // We use forEach() instead of for-of so that re don't require down-level - // iteration. - previousClasses.forEach((name) => { - if (!(name in classInfo)) { - classList.remove(name); - previousClasses.delete(name); - } - }); - // Add or remove classes based on their classMap value - for (const name in classInfo) { - const value = classInfo[name]; - if (value != previousClasses.has(name)) { - // We explicitly want a loose truthy check of `value` because it seems - // more convenient that '' and 0 are skipped. - if (value) { - classList.add(name); - previousClasses.add(name); - } - else { - classList.remove(name); - previousClasses.delete(name); - } - } - } - if (typeof classList.commit === 'function') { - classList.commit(); - } -}); -//# sourceMappingURL=class-map.js.map \ No newline at end of file + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const o=i(class extends s{constructor(t){var i;if(super(t),t.type!==r.ATTRIBUTE||"class"!==t.name||(null===(i=t.strings)||void 0===i?void 0:i.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((i=>t[i])).join(" ")+" "}update(i,[s]){var r,o;if(void 0===this.et){this.et=new Set,void 0!==i.strings&&(this.st=new Set(i.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in s)s[t]&&!(null===(r=this.st)||void 0===r?void 0:r.has(t))&&this.et.add(t);return this.render(s)}const e=i.element.classList;this.et.forEach((t=>{t in s||(e.remove(t),this.et.delete(t))}));for(const t in s){const i=!!s[t];i===this.et.has(t)||(null===(o=this.st)||void 0===o?void 0:o.has(t))||(i?(e.add(t),this.et.add(t)):(e.remove(t),this.et.delete(t)))}return t}});export{o as classMap}; +//# sourceMappingURL=class-map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.d.ts index 886ebb3..d571cbc 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.d.ts
@@ -1,21 +1,25 @@ /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ import { Part } from '../lit-html.js'; +import { Directive, DirectiveParameters } from '../directive.js'; +declare class GuardDirective extends Directive { + private _previousValue; + render(_value: unknown, f: () => unknown): unknown; + update(_part: Part, [value, f]: DirectiveParameters<this>): unknown; +} /** * Prevents re-render of a template function until a single value or an array of * values changes. * + * Values are checked against previous values with strict equality (`===`), and + * so the check won't detect nested property changes inside objects or arrays. + * Arrays values have each item checked against the previous value at the same + * index with strict equality. Nested arrays are also checked only by strict + * equality. + * * Example: * * ```js @@ -23,9 +27,10 @@ * <div> * ${guard([user.id, company.id], () => html`...`)} * </div> + * ` * ``` * - * In this case, the template only renders if either `user.id` or `company.id` + * In this case, the template only rerenders if either `user.id` or `company.id` * changes. * * guard() is useful with immutable data patterns, by preventing expensive work @@ -38,6 +43,7 @@ * <div> * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))} * </div> + * ` * ``` * * In this case, items are mapped over only when the array reference changes. @@ -45,5 +51,10 @@ * @param value the value to check before re-rendering * @param f the template function */ -export declare const guard: (value: unknown, f: () => unknown) => (part: Part) => void; +export declare const guard: (_value: unknown, f: () => unknown) => import("../directive.js").DirectiveResult<typeof GuardDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { GuardDirective }; //# sourceMappingURL=guard.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.js index 7263e10..0014a02 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/guard.js
@@ -1,69 +1,8 @@ +import{noChange as r}from'../lit-html.js';import{directive as t,Directive as s}from'../directive.js'; /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { directive } from '../lit-html.js'; -const previousValues = new WeakMap(); -/** - * Prevents re-render of a template function until a single value or an array of - * values changes. - * - * Example: - * - * ```js - * html` - * <div> - * ${guard([user.id, company.id], () => html`...`)} - * </div> - * ``` - * - * In this case, the template only renders if either `user.id` or `company.id` - * changes. - * - * guard() is useful with immutable data patterns, by preventing expensive work - * until data updates. - * - * Example: - * - * ```js - * html` - * <div> - * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))} - * </div> - * ``` - * - * In this case, items are mapped over only when the array reference changes. - * - * @param value the value to check before re-rendering - * @param f the template function - */ -export const guard = directive((value, f) => (part) => { - const previousValue = previousValues.get(part); - if (Array.isArray(value)) { - // Dirty-check arrays by item - if (Array.isArray(previousValue) && - previousValue.length === value.length && - value.every((v, i) => v === previousValue[i])) { - return; - } - } - else if (previousValue === value && - (value !== undefined || previousValues.has(part))) { - // Dirty-check non-arrays by identity - return; - } - part.setValue(f()); - // Copy the value if it's an array so that if it's mutated we don't forget - // what the previous values were. - previousValues.set(part, Array.isArray(value) ? Array.from(value) : value); -}); -//# sourceMappingURL=guard.js.map \ No newline at end of file +const e={},i=t(class extends s{constructor(){super(...arguments),this.nt=e}render(r,t){return t()}update(t,[s,e]){if(Array.isArray(s)){if(Array.isArray(this.nt)&&this.nt.length===s.length&&s.every(((r,t)=>r===this.nt[t])))return r}else if(this.nt===s)return r;return this.nt=Array.isArray(s)?Array.from(s):s,this.render(s,e)}});export{i as guard}; +//# sourceMappingURL=guard.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.d.ts index 2c4075d8..6f169e8 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.d.ts
@@ -1,22 +1,14 @@ /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { nothing } from '../lit-html.js'; /** * For AttributeParts, sets the attribute if the value is defined and removes * the attribute if the value is undefined. * * For other part types, this directive is a no-op. */ -export declare const ifDefined: (value: unknown) => (part: Part) => void; +export declare const ifDefined: <T>(value: T) => typeof nothing | NonNullable<T>; //# sourceMappingURL=if-defined.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.js index 2146435..0b10701 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/if-defined.js
@@ -1,37 +1,7 @@ +import{nothing as t}from'../lit-html.js'; /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributePart, directive } from '../lit-html.js'; -const previousValues = new WeakMap(); -/** - * For AttributeParts, sets the attribute if the value is defined and removes - * the attribute if the value is undefined. - * - * For other part types, this directive is a no-op. - */ -export const ifDefined = directive((value) => (part) => { - const previousValue = previousValues.get(part); - if (value === undefined && part instanceof AttributePart) { - // If the value is undefined, remove the attribute, but only if the value - // was previously defined. - if (previousValue !== undefined || !previousValues.has(part)) { - const name = part.committer.name; - part.committer.element.removeAttribute(name); - } - } - else if (value !== previousValue) { - part.setValue(value); - } - previousValues.set(part, value); -}); -//# sourceMappingURL=if-defined.js.map \ No newline at end of file + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const l=l=>null!=l?l:t;export{l as ifDefined}; +//# sourceMappingURL=if-defined.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.d.ts new file mode 100644 index 0000000..682fc603 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.d.ts
@@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Returns an iterable containing the values in `items` interleaved with the + * `joiner` value. + * + * @example + * + * ```ts + * render() { + * return html` + * ${join(items, html`<span class="separator">|</span>`)} + * `; + * } + */ +export declare function join<I, J>(items: Iterable<I> | undefined, joiner: (index: number) => J): Iterable<I | J>; +export declare function join<I, J>(items: Iterable<I> | undefined, joiner: J): Iterable<I | J>; +//# sourceMappingURL=join.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.js new file mode 100644 index 0000000..6428f2d --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/join.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function*o(o,t){const f="function"==typeof t;if(void 0!==o){let i=-1;for(const n of o)i>-1&&(yield f?t(i):t),i++,yield n}}export{o as join}; +//# sourceMappingURL=join.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.d.ts new file mode 100644 index 0000000..b1c0cb83 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.d.ts
@@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { Directive, ChildPart, DirectiveParameters } from '../directive.js'; +declare class Keyed extends Directive { + key: unknown; + render(k: unknown, v: unknown): unknown; + update(part: ChildPart, [k, v]: DirectiveParameters<this>): unknown; +} +/** + * Associates a renderable value with a unique key. When the key changes, the + * previous DOM is removed and disposed before rendering the next value, even + * if the value - such as a template - is the same. + * + * This is useful for forcing re-renders of stateful components, or working + * with code that expects new data to generate new HTML elements, such as some + * animation techniques. + */ +export declare const keyed: (k: unknown, v: unknown) => import("../directive.js").DirectiveResult<typeof Keyed>; +export {}; +//# sourceMappingURL=keyed.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.js new file mode 100644 index 0000000..5c99586 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/keyed.js
@@ -0,0 +1,7 @@ +import{nothing as r}from'../lit-html.js';import{directive as t,Directive as e}from'../directive.js';import{setCommittedValue as s}from'../directive-helpers.js'; +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const i=t(class extends e{constructor(){super(...arguments),this.key=r}render(r,t){return this.key=r,t}update(r,[t,e]){return t!==this.key&&(s(r),this.key=t),e}});export{i as keyed}; +//# sourceMappingURL=keyed.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.d.ts index b87aef8..23d46f2 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.d.ts
@@ -1,17 +1,15 @@ /** * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { AttributePart, BooleanAttributePart, PropertyPart } from '../lit-html.js'; +import { AttributePart } from '../lit-html.js'; +import { Directive, DirectiveParameters, PartInfo } from '../directive.js'; +declare class LiveDirective extends Directive { + constructor(partInfo: PartInfo); + render(value: unknown): unknown; + update(part: AttributePart, [value]: DirectiveParameters<this>): unknown; +} /** * Checks binding values against live DOM values, instead of previously bound * values, when determining whether to update the value. @@ -23,10 +21,12 @@ * * In these cases if the DOM value changes, but the value set through lit-html * bindings hasn't, lit-html won't know to update the DOM value and will leave - * it alone. If this is not what you want—if you want to overwrite the DOM - * value with the bound value no matter what—use the `live()` directive: + * it alone. If this is not what you want--if you want to overwrite the DOM + * value with the bound value no matter what--use the `live()` directive: * - * html`<input .value=${live(x)}>` + * ```js + * html`<input .value=${live(x)}>` + * ``` * * `live()` performs a strict equality check agains the live DOM value, and if * the new value is equal to the live value, does nothing. This means that @@ -34,5 +34,10 @@ * you use `live()` with an attribute binding, make sure that only strings are * passed in, or the binding will update every render. */ -export declare const live: (value: unknown) => (part: AttributePart | BooleanAttributePart | PropertyPart) => void; +export declare const live: (value: unknown) => import("../directive.js").DirectiveResult<typeof LiveDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { LiveDirective }; //# sourceMappingURL=live.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.js index 8d442cc..b37bbf73 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/live.js
@@ -1,73 +1,7 @@ +import{noChange as r,nothing as e}from'../lit-html.js';import{directive as i,Directive as t,PartType as n}from'../directive.js';import{isSingleExpression as o,setCommittedValue as s}from'../directive-helpers.js'; /** * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributePart, BooleanAttributePart, directive, EventPart, NodePart, PropertyPart } from '../lit-html.js'; -/** - * Checks binding values against live DOM values, instead of previously bound - * values, when determining whether to update the value. - * - * This is useful for cases where the DOM value may change from outside of - * lit-html, such as with a binding to an `<input>` element's `value` property, - * a content editable elements text, or to a custom element that changes it's - * own properties or attributes. - * - * In these cases if the DOM value changes, but the value set through lit-html - * bindings hasn't, lit-html won't know to update the DOM value and will leave - * it alone. If this is not what you want—if you want to overwrite the DOM - * value with the bound value no matter what—use the `live()` directive: - * - * html`<input .value=${live(x)}>` - * - * `live()` performs a strict equality check agains the live DOM value, and if - * the new value is equal to the live value, does nothing. This means that - * `live()` should not be used when the binding will cause a type conversion. If - * you use `live()` with an attribute binding, make sure that only strings are - * passed in, or the binding will update every render. - */ -export const live = directive((value) => (part) => { - let previousValue; - if (part instanceof EventPart || part instanceof NodePart) { - throw new Error('The `live` directive is not allowed on text or event bindings'); - } - if (part instanceof BooleanAttributePart) { - checkStrings(part.strings); - previousValue = part.element.hasAttribute(part.name); - // This is a hack needed because BooleanAttributePart doesn't have a - // committer and does its own dirty checking after directives - part.value = previousValue; - } - else { - const { element, name, strings } = part.committer; - checkStrings(strings); - if (part instanceof PropertyPart) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - previousValue = element[name]; - if (previousValue === value) { - return; - } - } - else if (part instanceof AttributePart) { - previousValue = element.getAttribute(name); - } - if (previousValue === String(value)) { - return; - } - } - part.setValue(value); -}); -const checkStrings = (strings) => { - if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') { - throw new Error('`live` bindings can only contain a single expression'); - } -}; -//# sourceMappingURL=live.js.map \ No newline at end of file + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const l=i(class extends t{constructor(r){if(super(r),r.type!==n.PROPERTY&&r.type!==n.ATTRIBUTE&&r.type!==n.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!o(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t]){if(t===r||t===e)return t;const o=i.element,l=i.name;if(i.type===n.PROPERTY){if(t===o[l])return r}else if(i.type===n.BOOLEAN_ATTRIBUTE){if(!!t===o.hasAttribute(l))return r}else if(i.type===n.ATTRIBUTE&&o.getAttribute(l)===t+"")return r;return s(i),t}});export{l as live}; +//# sourceMappingURL=live.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.d.ts new file mode 100644 index 0000000..0ebaf3e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.d.ts
@@ -0,0 +1,23 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Returns an iterable containing the result of calling `f(value)` on each + * value in `items`. + * + * @example + * + * ```ts + * render() { + * return html` + * <ul> + * ${map(items, (i) => html`<li>${i}</li>`)} + * </ul> + * `; + * } + * ``` + */ +export declare function map<T>(items: Iterable<T> | undefined, f: (value: T, index: number) => unknown): Generator<unknown, void, unknown>; +//# sourceMappingURL=map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.js new file mode 100644 index 0000000..1f1ae5f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/map.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function*o(o,f){if(void 0!==o){let i=0;for(const t of o)yield f(t,i++)}}export{o as map}; +//# sourceMappingURL=map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.d.ts new file mode 100644 index 0000000..1090d68 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.d.ts
@@ -0,0 +1,58 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Helper to iterate an AsyncIterable in its own closure. + * @param iterable The iterable to iterate + * @param callback The callback to call for each value. If the callback returns + * `false`, the loop will be broken. + */ +export declare const forAwaitOf: <T>(iterable: AsyncIterable<T>, callback: (value: T) => Promise<boolean>) => Promise<void>; +/** + * Holds a reference to an instance that can be disconnected and reconnected, + * so that a closure over the ref (e.g. in a then function to a promise) does + * not strongly hold a ref to the instance. Approximates a WeakRef but must + * be manually connected & disconnected to the backing instance. + */ +export declare class PseudoWeakRef<T> { + private _ref?; + constructor(ref: T); + /** + * Disassociates the ref with the backing instance. + */ + disconnect(): void; + /** + * Reassociates the ref with the backing instance. + */ + reconnect(ref: T): void; + /** + * Retrieves the backing instance (will be undefined when disconnected) + */ + deref(): T | undefined; +} +/** + * A helper to pause and resume waiting on a condition in an async function + */ +export declare class Pauser { + private _promise?; + private _resolve?; + /** + * When paused, returns a promise to be awaited; when unpaused, returns + * undefined. Note that in the microtask between the pauser being resumed + * an an await of this promise resolving, the pauser could be paused again, + * hence callers should check the promise in a loop when awaiting. + * @returns A promise to be awaited when paused or undefined + */ + get(): Promise<void> | undefined; + /** + * Creates a promise to be awaited + */ + pause(): void; + /** + * Resolves the promise which may be awaited + */ + resume(): void; +} +//# sourceMappingURL=private-async-helpers.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.js new file mode 100644 index 0000000..56a4e786 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/private-async-helpers.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t=async(t,s)=>{for await(const i of t)if(!1===await s(i))return};class s{constructor(t){this.U=t}disconnect(){this.U=void 0}reconnect(t){this.U=t}deref(){return this.U}}class i{constructor(){this.Y=void 0,this.q=void 0}get(){return this.Y}pause(){var t;null!==(t=this.Y)&&void 0!==t||(this.Y=new Promise((t=>this.q=t)))}resume(){var t;null===(t=this.q)||void 0===t||t.call(this),this.Y=this.q=void 0}}export{i as Pauser,s as PseudoWeakRef,t as forAwaitOf}; +//# sourceMappingURL=private-async-helpers.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.d.ts new file mode 100644 index 0000000..03e567f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.d.ts
@@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * Returns an iterable of integers from `start` to `end` (exclusive) + * incrementing by `step`. + * + * If `start` is omitted, the range starts at `0`. `step` defaults to `1`. + * + * @example + * + * ```ts + * render() { + * return html` + * ${map(range(8), () => html`<div class="cell"></div>`)} + * `; + * } + * ``` + */ +export declare function range(end: number): Iterable<number>; +export declare function range(start: number, end: number, step?: number): Iterable<number>; +//# sourceMappingURL=range.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.js new file mode 100644 index 0000000..58ccb02 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/range.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function*o(o,l,n=1){const t=void 0===l?0:o;null!=l||(l=o);for(let o=t;n>0?o<l:l<o;o+=n)yield o}export{o as range}; +//# sourceMappingURL=range.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.d.ts new file mode 100644 index 0000000..f31fb09 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.d.ts
@@ -0,0 +1,66 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { ElementPart } from '../lit-html.js'; +import { AsyncDirective } from '../async-directive.js'; +/** + * Creates a new Ref object, which is container for a reference to an element. + */ +export declare const createRef: <T = Element>() => Ref<T>; +/** + * An object that holds a ref value. + */ +declare class Ref<T = Element> { + /** + * The current Element value of the ref, or else `undefined` if the ref is no + * longer rendered. + */ + readonly value?: T; +} +export type { Ref }; +export declare type RefOrCallback = Ref | ((el: Element | undefined) => void); +declare class RefDirective extends AsyncDirective { + private _element?; + private _ref?; + private _context?; + render(_ref: RefOrCallback): symbol; + update(part: ElementPart, [ref]: Parameters<this['render']>): symbol; + private _updateRefValue; + private get _lastElementForRef(); + disconnected(): void; + reconnected(): void; +} +/** + * Sets the value of a Ref object or calls a ref callback with the element it's + * bound to. + * + * A Ref object acts as a container for a reference to an element. A ref + * callback is a function that takes an element as its only argument. + * + * The ref directive sets the value of the Ref object or calls the ref callback + * during rendering, if the referenced element changed. + * + * Note: If a ref callback is rendered to a different element position or is + * removed in a subsequent render, it will first be called with `undefined`, + * followed by another call with the new element it was rendered to (if any). + * + * ```js + * // Using Ref object + * const inputRef = createRef(); + * render(html`<input ${ref(inputRef)}>`, container); + * inputRef.value.focus(); + * + * // Using callback + * const callback = (inputElement) => inputElement.focus(); + * render(html`<input ${ref(callback)}>`, container); + * ``` + */ +export declare const ref: (_ref: RefOrCallback) => import("../directive.js").DirectiveResult<typeof RefDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { RefDirective }; +//# sourceMappingURL=ref.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.js new file mode 100644 index 0000000..1f5e0c1 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/ref.js
@@ -0,0 +1,7 @@ +import{nothing as i}from'../lit-html.js';import{AsyncDirective as t}from'../async-directive.js';import{directive as s}from'../directive.js'; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const e=()=>new o;class o{}const h=new WeakMap,n=s(class extends t{render(t){return i}update(t,[s]){var e;const o=s!==this.U;return o&&void 0!==this.U&&this.ot(void 0),(o||this.rt!==this.lt)&&(this.U=s,this.ht=null===(e=t.options)||void 0===e?void 0:e.host,this.ot(this.lt=t.element)),i}ot(i){var t;if("function"==typeof this.U){const s=null!==(t=this.ht)&&void 0!==t?t:globalThis;let e=h.get(s);void 0===e&&(e=new WeakMap,h.set(s,e)),void 0!==e.get(this.U)&&this.U.call(this.ht,void 0),e.set(this.U,i),void 0!==i&&this.U.call(this.ht,i)}else this.U.value=i}get rt(){var i,t,s;return"function"==typeof this.U?null===(t=h.get(null!==(i=this.ht)&&void 0!==i?i:globalThis))||void 0===t?void 0:t.get(this.U):null===(s=this.U)||void 0===s?void 0:s.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});export{e as createRef,n as ref}; +//# sourceMappingURL=ref.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.d.ts index 5b38cf1..cfa168f3 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.d.ts
@@ -1,19 +1,29 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { DirectiveFn } from '../lib/directive.js'; +import { ChildPart, noChange } from '../lit-html.js'; +import { Directive, PartInfo } from '../directive.js'; export declare type KeyFn<T> = (item: T, index: number) => unknown; export declare type ItemTemplate<T> = (item: T, index: number) => unknown; +declare class RepeatDirective extends Directive { + private _itemKeys?; + constructor(partInfo: PartInfo); + private _getValuesAndKeys; + render<T>(items: Iterable<T>, template: ItemTemplate<T>): Array<unknown>; + render<T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): Array<unknown>; + update<T>(containerPart: ChildPart, [items, keyFnOrTemplate, template]: [ + Iterable<T>, + KeyFn<T> | ItemTemplate<T>, + ItemTemplate<T> + ]): unknown[] | typeof noChange; +} +export interface RepeatDirectiveFn { + <T>(items: Iterable<T>, keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>, template?: ItemTemplate<T>): unknown; + <T>(items: Iterable<T>, template: ItemTemplate<T>): unknown; + <T>(items: Iterable<T>, keyFn: KeyFn<T> | ItemTemplate<T>, template: ItemTemplate<T>): unknown; +} /** * A directive that repeats a series of values (usually `TemplateResults`) * generated from an iterable, and updates those items efficiently when the @@ -26,12 +36,29 @@ * way to use `repeat` since it performs minimum unnecessary work for insertions * and removals. * - * IMPORTANT: If providing a `keyFn`, keys *must* be unique for all items in a + * The `keyFn` takes two parameters, the item and its index, and returns a unique key value. + * + * ```js + * html` + * <ol> + * ${repeat(this.items, (item) => item.id, (item, index) => { + * return html`<li>${index}: ${item.name}</li>`; + * })} + * </ol> + * ` + * ``` + * + * **Important**: If providing a `keyFn`, keys *must* be unique for all items in a * given call to `repeat`. The behavior when two or more items have the same key * is undefined. * * If no `keyFn` is provided, this directive will perform similar to mapping * items to values, and DOM will be reused against potentially different items. */ -export declare const repeat: <T>(items: Iterable<T>, keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>, template?: ItemTemplate<T> | undefined) => DirectiveFn; +export declare const repeat: RepeatDirectiveFn; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { RepeatDirective }; //# sourceMappingURL=repeat.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.js index 35d405d4..bbf2bee 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/repeat.js
@@ -1,415 +1,8 @@ +import{noChange as e}from'../lit-html.js';import{directive as s,Directive as t,PartType as r}from'../directive.js';import{getCommittedValue as l,setChildPartValue as o,insertPart as i,removePart as n,setCommittedValue as f}from'../directive-helpers.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { createMarker, directive, NodePart, removeNodes, reparentNodes } from '../lit-html.js'; -// Helper functions for manipulating parts -// TODO(kschaaf): Refactor into Part API? -const createAndInsertPart = (containerPart, beforePart) => { - const container = containerPart.startNode.parentNode; - const beforeNode = beforePart === undefined ? containerPart.endNode : - beforePart.startNode; - const startNode = container.insertBefore(createMarker(), beforeNode); - container.insertBefore(createMarker(), beforeNode); - const newPart = new NodePart(containerPart.options); - newPart.insertAfterNode(startNode); - return newPart; -}; -const updatePart = (part, value) => { - part.setValue(value); - part.commit(); - return part; -}; -const insertPartBefore = (containerPart, part, ref) => { - const container = containerPart.startNode.parentNode; - const beforeNode = ref ? ref.startNode : containerPart.endNode; - const endNode = part.endNode.nextSibling; - if (endNode !== beforeNode) { - reparentNodes(container, part.startNode, endNode, beforeNode); - } -}; -const removePart = (part) => { - removeNodes(part.startNode.parentNode, part.startNode, part.endNode.nextSibling); -}; -// Helper for generating a map of array item to its index over a subset -// of an array (used to lazily generate `newKeyToIndexMap` and -// `oldKeyToIndexMap`) -const generateMap = (list, start, end) => { - const map = new Map(); - for (let i = start; i <= end; i++) { - map.set(list[i], i); - } - return map; -}; -// Stores previous ordered list of parts and map of key to index -const partListCache = new WeakMap(); -const keyListCache = new WeakMap(); -/** - * A directive that repeats a series of values (usually `TemplateResults`) - * generated from an iterable, and updates those items efficiently when the - * iterable changes based on user-provided `keys` associated with each item. - * - * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained, - * meaning previous DOM for a given key is moved into the new position if - * needed, and DOM will never be reused with values for different keys (new DOM - * will always be created for new keys). This is generally the most efficient - * way to use `repeat` since it performs minimum unnecessary work for insertions - * and removals. - * - * IMPORTANT: If providing a `keyFn`, keys *must* be unique for all items in a - * given call to `repeat`. The behavior when two or more items have the same key - * is undefined. - * - * If no `keyFn` is provided, this directive will perform similar to mapping - * items to values, and DOM will be reused against potentially different items. - */ -export const repeat = directive((items, keyFnOrTemplate, template) => { - let keyFn; - if (template === undefined) { - template = keyFnOrTemplate; - } - else if (keyFnOrTemplate !== undefined) { - keyFn = keyFnOrTemplate; - } - return (containerPart) => { - if (!(containerPart instanceof NodePart)) { - throw new Error('repeat can only be used in text bindings'); - } - // Old part & key lists are retrieved from the last update - // (associated with the part for this instance of the directive) - const oldParts = partListCache.get(containerPart) || []; - const oldKeys = keyListCache.get(containerPart) || []; - // New part list will be built up as we go (either reused from - // old parts or created for new keys in this update). This is - // saved in the above cache at the end of the update. - const newParts = []; - // New value list is eagerly generated from items along with a - // parallel array indicating its key. - const newValues = []; - const newKeys = []; - let index = 0; - for (const item of items) { - newKeys[index] = keyFn ? keyFn(item, index) : index; - newValues[index] = template(item, index); - index++; - } - // Maps from key to index for current and previous update; these - // are generated lazily only when needed as a performance - // optimization, since they are only required for multiple - // non-contiguous changes in the list, which are less common. - let newKeyToIndexMap; - let oldKeyToIndexMap; - // Head and tail pointers to old parts and new values - let oldHead = 0; - let oldTail = oldParts.length - 1; - let newHead = 0; - let newTail = newValues.length - 1; - // Overview of O(n) reconciliation algorithm (general approach - // based on ideas found in ivi, vue, snabbdom, etc.): - // - // * We start with the list of old parts and new values (and - // arrays of their respective keys), head/tail pointers into - // each, and we build up the new list of parts by updating - // (and when needed, moving) old parts or creating new ones. - // The initial scenario might look like this (for brevity of - // the diagrams, the numbers in the array reflect keys - // associated with the old parts or new values, although keys - // and parts/values are actually stored in parallel arrays - // indexed using the same head/tail pointers): - // - // oldHead v v oldTail - // oldKeys: [0, 1, 2, 3, 4, 5, 6] - // newParts: [ , , , , , , ] - // newKeys: [0, 2, 1, 4, 3, 7, 6] <- reflects the user's new - // item order - // newHead ^ ^ newTail - // - // * Iterate old & new lists from both sides, updating, - // swapping, or removing parts at the head/tail locations - // until neither head nor tail can move. - // - // * Example below: keys at head pointers match, so update old - // part 0 in-place (no need to move it) and record part 0 in - // the `newParts` list. The last thing we do is advance the - // `oldHead` and `newHead` pointers (will be reflected in the - // next diagram). - // - // oldHead v v oldTail - // oldKeys: [0, 1, 2, 3, 4, 5, 6] - // newParts: [0, , , , , , ] <- heads matched: update 0 - // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead - // & newHead - // newHead ^ ^ newTail - // - // * Example below: head pointers don't match, but tail - // pointers do, so update part 6 in place (no need to move - // it), and record part 6 in the `newParts` list. Last, - // advance the `oldTail` and `oldHead` pointers. - // - // oldHead v v oldTail - // oldKeys: [0, 1, 2, 3, 4, 5, 6] - // newParts: [0, , , , , , 6] <- tails matched: update 6 - // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldTail - // & newTail - // newHead ^ ^ newTail - // - // * If neither head nor tail match; next check if one of the - // old head/tail items was removed. We first need to generate - // the reverse map of new keys to index (`newKeyToIndexMap`), - // which is done once lazily as a performance optimization, - // since we only hit this case if multiple non-contiguous - // changes were made. Note that for contiguous removal - // anywhere in the list, the head and tails would advance - // from either end and pass each other before we get to this - // case and removals would be handled in the final while loop - // without needing to generate the map. - // - // * Example below: The key at `oldTail` was removed (no longer - // in the `newKeyToIndexMap`), so remove that part from the - // DOM and advance just the `oldTail` pointer. - // - // oldHead v v oldTail - // oldKeys: [0, 1, 2, 3, 4, 5, 6] - // newParts: [0, , , , , , 6] <- 5 not in new map: remove - // newKeys: [0, 2, 1, 4, 3, 7, 6] 5 and advance oldTail - // newHead ^ ^ newTail - // - // * Once head and tail cannot move, any mismatches are due to - // either new or moved items; if a new key is in the previous - // "old key to old index" map, move the old part to the new - // location, otherwise create and insert a new part. Note - // that when moving an old part we null its position in the - // oldParts array if it lies between the head and tail so we - // know to skip it when the pointers get there. - // - // * Example below: neither head nor tail match, and neither - // were removed; so find the `newHead` key in the - // `oldKeyToIndexMap`, and move that old part's DOM into the - // next head position (before `oldParts[oldHead]`). Last, - // null the part in the `oldPart` array since it was - // somewhere in the remaining oldParts still to be scanned - // (between the head and tail pointers) so that we know to - // skip that old part on future iterations. - // - // oldHead v v oldTail - // oldKeys: [0, 1, -, 3, 4, 5, 6] - // newParts: [0, 2, , , , , 6] <- stuck: update & move 2 - // newKeys: [0, 2, 1, 4, 3, 7, 6] into place and advance - // newHead - // newHead ^ ^ newTail - // - // * Note that for moves/insertions like the one above, a part - // inserted at the head pointer is inserted before the - // current `oldParts[oldHead]`, and a part inserted at the - // tail pointer is inserted before `newParts[newTail+1]`. The - // seeming asymmetry lies in the fact that new parts are - // moved into place outside in, so to the right of the head - // pointer are old parts, and to the right of the tail - // pointer are new parts. - // - // * We always restart back from the top of the algorithm, - // allowing matching and simple updates in place to - // continue... - // - // * Example below: the head pointers once again match, so - // simply update part 1 and record it in the `newParts` - // array. Last, advance both head pointers. - // - // oldHead v v oldTail - // oldKeys: [0, 1, -, 3, 4, 5, 6] - // newParts: [0, 2, 1, , , , 6] <- heads matched: update 1 - // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance both oldHead - // & newHead - // newHead ^ ^ newTail - // - // * As mentioned above, items that were moved as a result of - // being stuck (the final else clause in the code below) are - // marked with null, so we always advance old pointers over - // these so we're comparing the next actual old value on - // either end. - // - // * Example below: `oldHead` is null (already placed in - // newParts), so advance `oldHead`. - // - // oldHead v v oldTail - // oldKeys: [0, 1, -, 3, 4, 5, 6] <- old head already used: - // newParts: [0, 2, 1, , , , 6] advance oldHead - // newKeys: [0, 2, 1, 4, 3, 7, 6] - // newHead ^ ^ newTail - // - // * Note it's not critical to mark old parts as null when they - // are moved from head to tail or tail to head, since they - // will be outside the pointer range and never visited again. - // - // * Example below: Here the old tail key matches the new head - // key, so the part at the `oldTail` position and move its - // DOM to the new head position (before `oldParts[oldHead]`). - // Last, advance `oldTail` and `newHead` pointers. - // - // oldHead v v oldTail - // oldKeys: [0, 1, -, 3, 4, 5, 6] - // newParts: [0, 2, 1, 4, , , 6] <- old tail matches new - // newKeys: [0, 2, 1, 4, 3, 7, 6] head: update & move 4, - // advance oldTail & newHead - // newHead ^ ^ newTail - // - // * Example below: Old and new head keys match, so update the - // old head part in place, and advance the `oldHead` and - // `newHead` pointers. - // - // oldHead v oldTail - // oldKeys: [0, 1, -, 3, 4, 5, 6] - // newParts: [0, 2, 1, 4, 3, ,6] <- heads match: update 3 - // newKeys: [0, 2, 1, 4, 3, 7, 6] and advance oldHead & - // newHead - // newHead ^ ^ newTail - // - // * Once the new or old pointers move past each other then all - // we have left is additions (if old list exhausted) or - // removals (if new list exhausted). Those are handled in the - // final while loops at the end. - // - // * Example below: `oldHead` exceeded `oldTail`, so we're done - // with the main loop. Create the remaining part and insert - // it at the new head position, and the update is complete. - // - // (oldHead > oldTail) - // oldKeys: [0, 1, -, 3, 4, 5, 6] - // newParts: [0, 2, 1, 4, 3, 7 ,6] <- create and insert 7 - // newKeys: [0, 2, 1, 4, 3, 7, 6] - // newHead ^ newTail - // - // * Note that the order of the if/else clauses is not - // important to the algorithm, as long as the null checks - // come first (to ensure we're always working on valid old - // parts) and that the final else clause comes last (since - // that's where the expensive moves occur). The order of - // remaining clauses is is just a simple guess at which cases - // will be most common. - // - // * TODO(kschaaf) Note, we could calculate the longest - // increasing subsequence (LIS) of old items in new position, - // and only move those not in the LIS set. However that costs - // O(nlogn) time and adds a bit more code, and only helps - // make rare types of mutations require fewer moves. The - // above handles removes, adds, reversal, swaps, and single - // moves of contiguous items in linear time, in the minimum - // number of moves. As the number of multiple moves where LIS - // might help approaches a random shuffle, the LIS - // optimization becomes less helpful, so it seems not worth - // the code at this point. Could reconsider if a compelling - // case arises. - while (oldHead <= oldTail && newHead <= newTail) { - if (oldParts[oldHead] === null) { - // `null` means old part at head has already been used - // below; skip - oldHead++; - } - else if (oldParts[oldTail] === null) { - // `null` means old part at tail has already been used - // below; skip - oldTail--; - } - else if (oldKeys[oldHead] === newKeys[newHead]) { - // Old head matches new head; update in place - newParts[newHead] = - updatePart(oldParts[oldHead], newValues[newHead]); - oldHead++; - newHead++; - } - else if (oldKeys[oldTail] === newKeys[newTail]) { - // Old tail matches new tail; update in place - newParts[newTail] = - updatePart(oldParts[oldTail], newValues[newTail]); - oldTail--; - newTail--; - } - else if (oldKeys[oldHead] === newKeys[newTail]) { - // Old head matches new tail; update and move to new tail - newParts[newTail] = - updatePart(oldParts[oldHead], newValues[newTail]); - insertPartBefore(containerPart, oldParts[oldHead], newParts[newTail + 1]); - oldHead++; - newTail--; - } - else if (oldKeys[oldTail] === newKeys[newHead]) { - // Old tail matches new head; update and move to new head - newParts[newHead] = - updatePart(oldParts[oldTail], newValues[newHead]); - insertPartBefore(containerPart, oldParts[oldTail], oldParts[oldHead]); - oldTail--; - newHead++; - } - else { - if (newKeyToIndexMap === undefined) { - // Lazily generate key-to-index maps, used for removals & - // moves below - newKeyToIndexMap = generateMap(newKeys, newHead, newTail); - oldKeyToIndexMap = generateMap(oldKeys, oldHead, oldTail); - } - if (!newKeyToIndexMap.has(oldKeys[oldHead])) { - // Old head is no longer in new list; remove - removePart(oldParts[oldHead]); - oldHead++; - } - else if (!newKeyToIndexMap.has(oldKeys[oldTail])) { - // Old tail is no longer in new list; remove - removePart(oldParts[oldTail]); - oldTail--; - } - else { - // Any mismatches at this point are due to additions or - // moves; see if we have an old part we can reuse and move - // into place - const oldIndex = oldKeyToIndexMap.get(newKeys[newHead]); - const oldPart = oldIndex !== undefined ? oldParts[oldIndex] : null; - if (oldPart === null) { - // No old part for this value; create a new one and - // insert it - const newPart = createAndInsertPart(containerPart, oldParts[oldHead]); - updatePart(newPart, newValues[newHead]); - newParts[newHead] = newPart; - } - else { - // Reuse old part - newParts[newHead] = - updatePart(oldPart, newValues[newHead]); - insertPartBefore(containerPart, oldPart, oldParts[oldHead]); - // This marks the old part as having been used, so that - // it will be skipped in the first two checks above - oldParts[oldIndex] = null; - } - newHead++; - } - } - } - // Add parts for any remaining new values - while (newHead <= newTail) { - // For all remaining additions, we insert before last new - // tail, since old pointers are no longer valid - const newPart = createAndInsertPart(containerPart, newParts[newTail + 1]); - updatePart(newPart, newValues[newHead]); - newParts[newHead++] = newPart; - } - // Remove any remaining unused old parts - while (oldHead <= oldTail) { - const oldPart = oldParts[oldHead++]; - if (oldPart !== null) { - removePart(oldPart); - } - } - // Save order of new parts for next round - partListCache.set(containerPart, newParts); - keyListCache.set(containerPart, newKeys); - }; -}); -//# sourceMappingURL=repeat.js.map \ No newline at end of file +const u=(e,s,t)=>{const r=new Map;for(let l=s;l<=t;l++)r.set(e[l],l);return r},c=s(class extends t{constructor(e){if(super(e),e.type!==r.CHILD)throw Error("repeat() can only be used in text expressions")}dt(e,s,t){let r;void 0===t?t=s:void 0!==s&&(r=s);const l=[],o=[];let i=0;for(const s of e)l[i]=r?r(s,i):i,o[i]=t(s,i),i++;return{values:o,keys:l}}render(e,s,t){return this.dt(e,s,t).values}update(s,[t,r,c]){var d;const a=l(s),{values:p,keys:v}=this.dt(t,r,c);if(!Array.isArray(a))return this.ut=v,p;const h=null!==(d=this.ut)&&void 0!==d?d:this.ut=[],m=[];let y,x,j=0,k=a.length-1,w=0,A=p.length-1;for(;j<=k&&w<=A;)if(null===a[j])j++;else if(null===a[k])k--;else if(h[j]===v[w])m[w]=o(a[j],p[w]),j++,w++;else if(h[k]===v[A])m[A]=o(a[k],p[A]),k--,A--;else if(h[j]===v[A])m[A]=o(a[j],p[A]),i(s,m[A+1],a[j]),j++,A--;else if(h[k]===v[w])m[w]=o(a[k],p[w]),i(s,a[j],a[k]),k--,w++;else if(void 0===y&&(y=u(v,w,A),x=u(h,j,k)),y.has(h[j]))if(y.has(h[k])){const e=x.get(v[w]),t=void 0!==e?a[e]:null;if(null===t){const e=i(s,a[j]);o(e,p[w]),m[w]=e}else m[w]=o(t,p[w]),i(s,a[j],t),a[e]=null;w++}else n(a[k]),k--;else n(a[j]),j++;for(;w<=A;){const e=i(s,m[A+1]);o(e,p[w]),m[w++]=e}for(;j<=k;){const e=a[j++];null!==e&&n(e)}return this.ut=v,f(s,m),e}});export{c as repeat}; +//# sourceMappingURL=repeat.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.d.ts index 6a3636e2..dd74eced 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.d.ts
@@ -1,36 +1,48 @@ /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { AttributePart, noChange } from '../lit-html.js'; +import { Directive, DirectiveParameters, PartInfo } from '../directive.js'; +/** + * A key-value set of CSS properties and values. + * + * The key should be either a valid CSS property name string, like + * `'background-color'`, or a valid JavaScript camel case property name + * for CSSStyleDeclaration like `backgroundColor`. + */ export interface StyleInfo { - readonly [name: string]: string; + [name: string]: string | undefined | null; +} +declare class StyleMapDirective extends Directive { + _previousStyleProperties?: Set<string>; + constructor(partInfo: PartInfo); + render(styleInfo: Readonly<StyleInfo>): string; + update(part: AttributePart, [styleInfo]: DirectiveParameters<this>): string | typeof noChange; } /** * A directive that applies CSS properties to an element. * * `styleMap` can only be used in the `style` attribute and must be the only - * expression in the attribute. It takes the property names in the `styleInfo` - * object and adds the property values as CSS properties. Property names with - * dashes (`-`) are assumed to be valid CSS property names and set on the - * element's style object using `setProperty()`. Names without dashes are - * assumed to be camelCased JavaScript property names and set on the element's - * style object using property assignment, allowing the style object to - * translate JavaScript-style names to CSS property names. + * expression in the attribute. It takes the property names in the + * {@link StyleInfo styleInfo} object and adds the property values as CSS + * properties. Property names with dashes (`-`) are assumed to be valid CSS + * property names and set on the element's style object using `setProperty()`. + * Names without dashes are assumed to be camelCased JavaScript property names + * and set on the element's style object using property assignment, allowing the + * style object to translate JavaScript-style names to CSS property names. * * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size': * '0'})` sets the `background-color`, `border-top` and `--size` properties. * - * @param styleInfo {StyleInfo} + * @param styleInfo + * @see {@link https://lit.dev/docs/templates/directives/#stylemap styleMap code samples on Lit.dev} */ -export declare const styleMap: (styleInfo: StyleInfo) => (part: Part) => void; +export declare const styleMap: (styleInfo: Readonly<StyleInfo>) => import("../directive.js").DirectiveResult<typeof StyleMapDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { StyleMapDirective }; //# sourceMappingURL=style-map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.js index 4d2197a3..9651a13 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/style-map.js
@@ -1,78 +1,7 @@ +import{noChange as t}from'../lit-html.js';import{directive as e,Directive as r,PartType as s}from'../directive.js'; /** * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributePart, directive, PropertyPart } from '../lit-html.js'; -/** - * Stores the StyleInfo object applied to a given AttributePart. - * Used to unset existing values when a new StyleInfo object is applied. - */ -const previousStylePropertyCache = new WeakMap(); -/** - * A directive that applies CSS properties to an element. - * - * `styleMap` can only be used in the `style` attribute and must be the only - * expression in the attribute. It takes the property names in the `styleInfo` - * object and adds the property values as CSS properties. Property names with - * dashes (`-`) are assumed to be valid CSS property names and set on the - * element's style object using `setProperty()`. Names without dashes are - * assumed to be camelCased JavaScript property names and set on the element's - * style object using property assignment, allowing the style object to - * translate JavaScript-style names to CSS property names. - * - * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size': - * '0'})` sets the `background-color`, `border-top` and `--size` properties. - * - * @param styleInfo {StyleInfo} - */ -export const styleMap = directive((styleInfo) => (part) => { - if (!(part instanceof AttributePart) || (part instanceof PropertyPart) || - part.committer.name !== 'style' || part.committer.parts.length > 1) { - throw new Error('The `styleMap` directive must be used in the style attribute ' + - 'and must be the only part in the attribute.'); - } - const { committer } = part; - const { style } = committer.element; - let previousStyleProperties = previousStylePropertyCache.get(part); - if (previousStyleProperties === undefined) { - // Write static styles once - style.cssText = committer.strings.join(' '); - previousStylePropertyCache.set(part, previousStyleProperties = new Set()); - } - // Remove old properties that no longer exist in styleInfo - // We use forEach() instead of for-of so that re don't require down-level - // iteration. - previousStyleProperties.forEach((name) => { - if (!(name in styleInfo)) { - previousStyleProperties.delete(name); - if (name.indexOf('-') === -1) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - style[name] = null; - } - else { - style.removeProperty(name); - } - } - }); - // Add or update properties - for (const name in styleInfo) { - previousStyleProperties.add(name); - if (name.indexOf('-') === -1) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - style[name] = styleInfo[name]; - } - else { - style.setProperty(name, styleInfo[name]); - } - } -}); -//# sourceMappingURL=style-map.js.map \ No newline at end of file + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const i=e(class extends r{constructor(t){var e;if(super(t),t.type!==s.ATTRIBUTE||"style"!==t.name||(null===(e=t.strings)||void 0===e?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,r)=>{const s=t[r];return null==s?e:e+`${r=r.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(e,[r]){const{style:s}=e.element;if(void 0===this.ct){this.ct=new Set;for(const t in r)this.ct.add(t);return this.render(r)}this.ct.forEach((t=>{null==r[t]&&(this.ct.delete(t),t.includes("-")?s.removeProperty(t):s[t]="")}));for(const t in r){const e=r[t];null!=e&&(this.ct.add(t),t.includes("-")?s.setProperty(t,e):s[t]=e)}return t}});export{i as styleMap}; +//# sourceMappingURL=style-map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.d.ts index 20d0ee9..f28bd20 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.d.ts
@@ -1,17 +1,15 @@ /** * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { noChange } from '../lit-html.js'; +import { Directive, PartInfo } from '../directive.js'; +declare class TemplateContentDirective extends Directive { + private _previousTemplate?; + constructor(partInfo: PartInfo); + render(template: HTMLTemplateElement): DocumentFragment | typeof noChange; +} /** * Renders the content of a template element as HTML. * @@ -19,5 +17,10 @@ * Rendering a user-controlled template with this directive * could lead to cross-site-scripting vulnerabilities. */ -export declare const templateContent: (template: HTMLTemplateElement) => (part: Part) => void; +export declare const templateContent: (template: HTMLTemplateElement) => import("../directive.js").DirectiveResult<typeof TemplateContentDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { TemplateContentDirective }; //# sourceMappingURL=template-content.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.js index 78d81e7..0a835dd 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/template-content.js
@@ -1,41 +1,7 @@ +import{noChange as t}from'../lit-html.js';import{directive as r,Directive as e,PartType as n}from'../directive.js'; /** * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { directive, NodePart } from '../lit-html.js'; -// For each part, remember the value that was last rendered to the part by the -// templateContent directive, and the DocumentFragment that was last set as a -// value. The DocumentFragment is used as a unique key to check if the last -// value rendered to the part was with templateContent. If not, we'll always -// re-render the value passed to templateContent. -const previousValues = new WeakMap(); -/** - * Renders the content of a template element as HTML. - * - * Note, the template should be developer controlled and not user controlled. - * Rendering a user-controlled template with this directive - * could lead to cross-site-scripting vulnerabilities. - */ -export const templateContent = directive((template) => (part) => { - if (!(part instanceof NodePart)) { - throw new Error('templateContent can only be used in text bindings'); - } - const previousValue = previousValues.get(part); - if (previousValue !== undefined && template === previousValue.template && - part.value === previousValue.fragment) { - return; - } - const fragment = document.importNode(template.content, true); - part.setValue(fragment); - previousValues.set(part, { template, fragment }); -}); -//# sourceMappingURL=template-content.js.map \ No newline at end of file + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const o=r(class extends e{constructor(t){if(super(t),t.type!==n.CHILD)throw Error("templateContent can only be used in child bindings")}render(r){return this.vt===r?t:(this.vt=r,document.importNode(r.content,!0))}});export{o as templateContent}; +//# sourceMappingURL=template-content.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.d.ts index e7525fd..e07f719 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.d.ts
@@ -1,23 +1,27 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { nothing, TemplateResult, noChange } from '../lit-html.js'; +import { Directive, PartInfo } from '../directive.js'; +export declare class UnsafeHTMLDirective extends Directive { + static directiveName: string; + static resultType: number; + private _value; + private _templateResult?; + constructor(partInfo: PartInfo); + render(value: string | typeof nothing | typeof noChange | undefined | null): typeof noChange | typeof nothing | TemplateResult<1 | 2> | null | undefined; +} /** * Renders the result as HTML, rather than text. * + * The values `undefined`, `null`, and `nothing`, will all result in no content + * (empty string) being rendered. + * * Note, this is unsafe to use with any user-provided input that hasn't been * sanitized or escaped, as it may lead to cross-site-scripting * vulnerabilities. */ -export declare const unsafeHTML: (value: unknown) => (part: Part) => void; +export declare const unsafeHTML: (value: string | typeof noChange | typeof nothing | null | undefined) => import("../directive.js").DirectiveResult<typeof UnsafeHTMLDirective>; //# sourceMappingURL=unsafe-html.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.js index 238097a..aae4b18 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-html.js
@@ -1,44 +1,7 @@ +import{nothing as t,noChange as i}from'../lit-html.js';import{Directive as r,PartType as s,directive as n}from'../directive.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { isPrimitive } from '../lib/parts.js'; -import { directive, NodePart } from '../lit-html.js'; -// For each part, remember the value that was last rendered to the part by the -// unsafeHTML directive, and the DocumentFragment that was last set as a value. -// The DocumentFragment is used as a unique key to check if the last value -// rendered to the part was with unsafeHTML. If not, we'll always re-render the -// value passed to unsafeHTML. -const previousValues = new WeakMap(); -/** - * Renders the result as HTML, rather than text. - * - * Note, this is unsafe to use with any user-provided input that hasn't been - * sanitized or escaped, as it may lead to cross-site-scripting - * vulnerabilities. - */ -export const unsafeHTML = directive((value) => (part) => { - if (!(part instanceof NodePart)) { - throw new Error('unsafeHTML can only be used in text bindings'); - } - const previousValue = previousValues.get(part); - if (previousValue !== undefined && isPrimitive(value) && - value === previousValue.value && part.value === previousValue.fragment) { - return; - } - const template = document.createElement('template'); - template.innerHTML = value; // innerHTML casts to string internally - const fragment = document.importNode(template.content, true); - part.setValue(fragment); - previousValues.set(part, { value, fragment }); -}); -//# sourceMappingURL=unsafe-html.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */class e extends r{constructor(i){if(super(i),this.it=t,i.type!==s.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===t||null==r)return this.ft=void 0,this.it=r;if(r===i)return r;if("string"!=typeof r)throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this.ft;this.it=r;const s=[r];return s.raw=s,this.ft={_$litType$:this.constructor.resultType,strings:s,values:[]}}}e.directiveName="unsafeHTML",e.resultType=1;const o=n(e);export{e as UnsafeHTMLDirective,o as unsafeHTML}; +//# sourceMappingURL=unsafe-html.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.d.ts index 2b23371..82f45cb0 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.d.ts
@@ -1,23 +1,27 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { Part } from '../lit-html.js'; +import { UnsafeHTMLDirective } from './unsafe-html.js'; +declare class UnsafeSVGDirective extends UnsafeHTMLDirective { + static directiveName: string; + static resultType: number; +} /** * Renders the result as SVG, rather than text. * + * The values `undefined`, `null`, and `nothing`, will all result in no content + * (empty string) being rendered. + * * Note, this is unsafe to use with any user-provided input that hasn't been * sanitized or escaped, as it may lead to cross-site-scripting * vulnerabilities. */ -export declare const unsafeSVG: (value: unknown) => (part: Part) => void; +export declare const unsafeSVG: (value: string | typeof import("../lit-html.js").noChange | typeof import("../lit-html.js").nothing | null | undefined) => import("../directive.js").DirectiveResult<typeof UnsafeSVGDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ +export type { UnsafeSVGDirective }; //# sourceMappingURL=unsafe-svg.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.js index 1ded06d..fe184c3 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/unsafe-svg.js
@@ -1,61 +1,7 @@ +import{directive as s}from'../directive.js';import{UnsafeHTMLDirective as e}from'./unsafe-html.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { reparentNodes } from '../lib/dom.js'; -import { isPrimitive } from '../lib/parts.js'; -import { directive, NodePart } from '../lit-html.js'; -// For each part, remember the value that was last rendered to the part by the -// unsafeSVG directive, and the DocumentFragment that was last set as a value. -// The DocumentFragment is used as a unique key to check if the last value -// rendered to the part was with unsafeSVG. If not, we'll always re-render the -// value passed to unsafeSVG. -const previousValues = new WeakMap(); -const isIe = window.navigator.userAgent.indexOf('Trident/') > 0; -/** - * Renders the result as SVG, rather than text. - * - * Note, this is unsafe to use with any user-provided input that hasn't been - * sanitized or escaped, as it may lead to cross-site-scripting - * vulnerabilities. - */ -export const unsafeSVG = directive((value) => (part) => { - if (!(part instanceof NodePart)) { - throw new Error('unsafeSVG can only be used in text bindings'); - } - const previousValue = previousValues.get(part); - if (previousValue !== undefined && isPrimitive(value) && - value === previousValue.value && part.value === previousValue.fragment) { - return; - } - const template = document.createElement('template'); - const content = template.content; - let svgElement; - if (isIe) { - // IE can't set innerHTML of an svg element. However, it also doesn't - // support Trusted Types, so it's ok for us to use a string when setting - // innerHTML. - template.innerHTML = `<svg>${value}</svg>`; - svgElement = content.firstChild; - } - else { - svgElement = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - content.appendChild(svgElement); - svgElement.innerHTML = value; - } - content.removeChild(svgElement); - reparentNodes(content, svgElement.firstChild); - const fragment = document.importNode(content, true); - part.setValue(fragment); - previousValues.set(part, { value, fragment }); -}); -//# sourceMappingURL=unsafe-svg.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */class t extends e{}t.directiveName="unsafeSVG",t.resultType=2;const o=s(t);export{o as unsafeSVG}; +//# sourceMappingURL=unsafe-svg.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.d.ts index 5c6540f..6319be2 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.d.ts
@@ -1,17 +1,20 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ import { Part } from '../lit-html.js'; +import { AsyncDirective } from '../async-directive.js'; +export declare class UntilDirective extends AsyncDirective { + private __lastRenderedIndex; + private __values; + private __weakThis; + private __pauser; + render(...args: Array<unknown>): unknown; + update(_part: Part, args: Array<unknown>): unknown; + disconnected(): void; + reconnected(): void; +} /** * Renders one of a series of values, including Promises, to a Part. * @@ -28,8 +31,14 @@ * * Example: * - * const content = fetch('./content.txt').then(r => r.text()); - * html`${until(content, html`<span>Loading...</span>`)}` + * ```js + * const content = fetch('./content.txt').then(r => r.text()); + * html`${until(content, html`<span>Loading...</span>`)}` + * ``` */ -export declare const until: (...args: unknown[]) => (part: Part) => void; +export declare const until: (...values: unknown[]) => import("../directive.js").DirectiveResult<typeof UntilDirective>; +/** + * The type of the class that powers this directive. Necessary for naming the + * directive's return type. + */ //# sourceMappingURL=until.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.js index fa612c9d..cd5bf6e 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/until.js
@@ -1,86 +1,7 @@ +import{noChange as t}from'../lit-html.js';import{directive as s}from'../directive.js';import{isPrimitive as i}from'../directive-helpers.js';import{AsyncDirective as r}from'../async-directive.js';import{PseudoWeakRef as e,Pauser as o}from'./private-async-helpers.js'; /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { isPrimitive } from '../lib/parts.js'; -import { directive } from '../lit-html.js'; -const _state = new WeakMap(); -// Effectively infinity, but a SMI. -const _infinity = 0x7fffffff; -/** - * Renders one of a series of values, including Promises, to a Part. - * - * Values are rendered in priority order, with the first argument having the - * highest priority and the last argument having the lowest priority. If a - * value is a Promise, low-priority values will be rendered until it resolves. - * - * The priority of values can be used to create placeholder content for async - * data. For example, a Promise with pending content can be the first, - * highest-priority, argument, and a non_promise loading indicator template can - * be used as the second, lower-priority, argument. The loading indicator will - * render immediately, and the primary content will render when the Promise - * resolves. - * - * Example: - * - * const content = fetch('./content.txt').then(r => r.text()); - * html`${until(content, html`<span>Loading...</span>`)}` - */ -export const until = directive((...args) => (part) => { - let state = _state.get(part); - if (state === undefined) { - state = { - lastRenderedIndex: _infinity, - values: [], - }; - _state.set(part, state); - } - const previousValues = state.values; - let previousLength = previousValues.length; - state.values = args; - for (let i = 0; i < args.length; i++) { - // If we've rendered a higher-priority value already, stop. - if (i > state.lastRenderedIndex) { - break; - } - const value = args[i]; - // Render non-Promise values immediately - if (isPrimitive(value) || - typeof value.then !== 'function') { - part.setValue(value); - state.lastRenderedIndex = i; - // Since a lower-priority value will never overwrite a higher-priority - // synchronous value, we can stop processing now. - break; - } - // If this is a Promise we've already handled, skip it. - if (i < previousLength && value === previousValues[i]) { - continue; - } - // We have a Promise that we haven't seen before, so priorities may have - // changed. Forget what we rendered before. - state.lastRenderedIndex = _infinity; - previousLength = 0; - Promise.resolve(value).then((resolvedValue) => { - const index = state.values.indexOf(value); - // If state.values doesn't contain the value, we've re-rendered without - // the value, so don't render it. Then, only render if the value is - // higher-priority than what's already been rendered. - if (index > -1 && index < state.lastRenderedIndex) { - state.lastRenderedIndex = index; - part.setValue(resolvedValue); - part.commit(); - } - }); - } -}); -//# sourceMappingURL=until.js.map \ No newline at end of file + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const n=t=>!i(t)&&"function"==typeof t.then;class h extends r{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CG=new e(this),this._$CK=new o}render(...s){var i;return null!==(i=s.find((t=>!n(t))))&&void 0!==i?i:t}update(s,i){const r=this._$Cyt;let e=r.length;this._$Cyt=i;const o=this._$CG,h=this._$CK;this.isConnected||this.disconnected();for(let t=0;t<i.length&&!(t>this._$Cwt);t++){const s=i[t];if(!n(s))return this._$Cwt=t,s;t<e&&s===r[t]||(this._$Cwt=1073741823,e=0,Promise.resolve(s).then((async t=>{for(;h.get();)await h.get();const i=o.deref();if(void 0!==i){const r=i._$Cyt.indexOf(s);r>-1&&r<i._$Cwt&&(i._$Cwt=r,i.setValue(t))}})))}return t}disconnected(){this._$CG.disconnect(),this._$CK.pause()}reconnected(){this._$CG.reconnect(this),this._$CK.resume()}}const c=s(h);export{h as UntilDirective,c as until}; +//# sourceMappingURL=until.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.d.ts new file mode 100644 index 0000000..403f528 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.d.ts
@@ -0,0 +1,26 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +/** + * When `condition` is true, returns the result of calling `trueCase()`, else + * returns the result of calling `falseCase()` if `falseCase` is defined. + * + * This is a convenience wrapper around a ternary expression that makes it a + * little nicer to write an inline conditional without an else. + * + * @example + * + * ```ts + * render() { + * return html` + * ${when(this.user, () => html`User: ${this.user.username}`, () => html`Sign In...`)} + * `; + * } + * ``` + */ +export declare function when<T, F>(condition: true, trueCase: () => T, falseCase?: () => F): T; +export declare function when<T, F = undefined>(condition: false, trueCase: () => T, falseCase?: () => F): F; +export declare function when<T, F = undefined>(condition: unknown, trueCase: () => T, falseCase?: () => F): T | F; +//# sourceMappingURL=when.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.js new file mode 100644 index 0000000..70a4b67 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/directives/when.js
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +function n(n,o,r){return n?o():null==r?void 0:r()}export{n as when}; +//# sourceMappingURL=when.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.d.ts deleted file mode 100644 index dc6ea8b..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.d.ts +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -import { TemplateProcessor } from './template-processor.js'; -/** - * Creates Parts when a template is instantiated. - */ -export declare class DefaultTemplateProcessor implements TemplateProcessor { - /** - * Create parts for an attribute-position binding, given the event, attribute - * name, and string literals. - * - * @param element The element containing the binding - * @param name The attribute name - * @param strings The string literals. There are always at least two strings, - * event for fully-controlled bindings with a single expression. - */ - handleAttributeExpressions(element: Element, name: string, strings: string[], options: RenderOptions): ReadonlyArray<Part>; - /** - * Create parts for a text-position binding. - * @param templateFactory - */ - handleTextExpression(options: RenderOptions): NodePart; -} -export declare const defaultTemplateProcessor: DefaultTemplateProcessor; -//# sourceMappingURL=default-template-processor.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.js deleted file mode 100644 index e123dae..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/default-template-processor.js +++ /dev/null
@@ -1,52 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter } from './parts.js'; -/** - * Creates Parts when a template is instantiated. - */ -export class DefaultTemplateProcessor { - /** - * Create parts for an attribute-position binding, given the event, attribute - * name, and string literals. - * - * @param element The element containing the binding - * @param name The attribute name - * @param strings The string literals. There are always at least two strings, - * event for fully-controlled bindings with a single expression. - */ - handleAttributeExpressions(element, name, strings, options) { - const prefix = name[0]; - if (prefix === '.') { - const committer = new PropertyCommitter(element, name.slice(1), strings); - return committer.parts; - } - if (prefix === '@') { - return [new EventPart(element, name.slice(1), options.eventContext)]; - } - if (prefix === '?') { - return [new BooleanAttributePart(element, name.slice(1), strings)]; - } - const committer = new AttributeCommitter(element, name, strings); - return committer.parts; - } - /** - * Create parts for a text-position binding. - * @param templateFactory - */ - handleTextExpression(options) { - return new NodePart(options); - } -} -export const defaultTemplateProcessor = new DefaultTemplateProcessor(); -//# sourceMappingURL=default-template-processor.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.d.ts deleted file mode 100644 index 03a06bb..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.d.ts +++ /dev/null
@@ -1,59 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -export declare type DirectiveFactory = (...args: any[]) => object; -export declare type DirectiveFn = (part: Part) => void; -/** - * Brands a function as a directive factory function so that lit-html will call - * the function during template rendering, rather than passing as a value. - * - * A _directive_ is a function that takes a Part as an argument. It has the - * signature: `(part: Part) => void`. - * - * A directive _factory_ is a function that takes arguments for data and - * configuration and returns a directive. Users of directive usually refer to - * the directive factory as the directive. For example, "The repeat directive". - * - * Usually a template author will invoke a directive factory in their template - * with relevant arguments, which will then return a directive function. - * - * Here's an example of using the `repeat()` directive factory that takes an - * array and a function to render an item: - * - * ```js - * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>` - * ``` - * - * When `repeat` is invoked, it returns a directive function that closes over - * `items` and the template function. When the outer template is rendered, the - * return directive function is called with the Part for the expression. - * `repeat` then performs it's custom logic to render multiple items. - * - * @param f The directive factory function. Must be a function that returns a - * function of the signature `(part: Part) => void`. The returned function will - * be called with the part object. - * - * @example - * - * import {directive, html} from 'lit-html'; - * - * const immutable = directive((v) => (part) => { - * if (part.value !== v) { - * part.setValue(v) - * } - * }); - */ -export declare const directive: <F extends DirectiveFactory>(f: F) => F; -export declare const isDirective: (o: unknown) => o is DirectiveFn; -//# sourceMappingURL=directive.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.js deleted file mode 100644 index 6258029..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/directive.js +++ /dev/null
@@ -1,63 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -const directives = new WeakMap(); -/** - * Brands a function as a directive factory function so that lit-html will call - * the function during template rendering, rather than passing as a value. - * - * A _directive_ is a function that takes a Part as an argument. It has the - * signature: `(part: Part) => void`. - * - * A directive _factory_ is a function that takes arguments for data and - * configuration and returns a directive. Users of directive usually refer to - * the directive factory as the directive. For example, "The repeat directive". - * - * Usually a template author will invoke a directive factory in their template - * with relevant arguments, which will then return a directive function. - * - * Here's an example of using the `repeat()` directive factory that takes an - * array and a function to render an item: - * - * ```js - * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>` - * ``` - * - * When `repeat` is invoked, it returns a directive function that closes over - * `items` and the template function. When the outer template is rendered, the - * return directive function is called with the Part for the expression. - * `repeat` then performs it's custom logic to render multiple items. - * - * @param f The directive factory function. Must be a function that returns a - * function of the signature `(part: Part) => void`. The returned function will - * be called with the part object. - * - * @example - * - * import {directive, html} from 'lit-html'; - * - * const immutable = directive((v) => (part) => { - * if (part.value !== v) { - * part.setValue(v) - * } - * }); - */ -export const directive = (f) => ((...args) => { - const d = f(...args); - directives.set(d, true); - return d; -}); -export const isDirective = (o) => { - return typeof o === 'function' && directives.has(o); -}; -//# sourceMappingURL=directive.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.d.ts deleted file mode 100644 index 811e3da..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.d.ts +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * True if the custom elements polyfill is in use. - */ -export declare const isCEPolyfill: boolean; -/** - * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive), - * into another container (could be the same container), before `before`. If - * `before` is null, it appends the nodes to the container. - */ -export declare const reparentNodes: (container: Node, start: Node | null, end?: Node | null, before?: Node | null) => void; -/** - * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from - * `container`. - */ -export declare const removeNodes: (container: Node, start: Node | null, end?: Node | null) => void; -//# sourceMappingURL=dom.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.js deleted file mode 100644 index 98183bd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/dom.js +++ /dev/null
@@ -1,44 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * True if the custom elements polyfill is in use. - */ -export const isCEPolyfill = typeof window !== 'undefined' && - window.customElements != null && - window.customElements.polyfillWrapFlushCallback !== - undefined; -/** - * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive), - * into another container (could be the same container), before `before`. If - * `before` is null, it appends the nodes to the container. - */ -export const reparentNodes = (container, start, end = null, before = null) => { - while (start !== end) { - const n = start.nextSibling; - container.insertBefore(start, before); - start = n; - } -}; -/** - * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from - * `container`. - */ -export const removeNodes = (container, start, end = null) => { - while (start !== end) { - const n = start.nextSibling; - container.removeChild(start); - start = n; - } -}; -//# sourceMappingURL=dom.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.d.ts deleted file mode 100644 index a98132f..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.d.ts +++ /dev/null
@@ -1,38 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Template } from './template.js'; -/** - * Removes the list of nodes from a Template safely. In addition to removing - * nodes from the Template, the Template part indices are updated to match - * the mutated Template DOM. - * - * As the template is walked the removal state is tracked and - * part indices are adjusted as needed. - * - * div - * div#1 (remove) <-- start removing (removing node is div#1) - * div - * div#2 (remove) <-- continue removing (removing node is still div#1) - * div - * div <-- stop removing since previous sibling is the removing node (div#1, - * removed 4 nodes) - */ -export declare function removeNodesFromTemplate(template: Template, nodesToRemove: Set<Node>): void; -/** - * Inserts the given node into the Template, optionally before the given - * refNode. In addition to inserting the node into the Template, the Template - * part indices are updated to match the mutated Template DOM. - */ -export declare function insertNodeIntoTemplate(template: Template, node: Node, refNode?: Node | null): void; -//# sourceMappingURL=modify-template.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.js deleted file mode 100644 index 7498bfb..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/modify-template.js +++ /dev/null
@@ -1,125 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { isTemplatePartActive } from './template.js'; -const walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */; -/** - * Removes the list of nodes from a Template safely. In addition to removing - * nodes from the Template, the Template part indices are updated to match - * the mutated Template DOM. - * - * As the template is walked the removal state is tracked and - * part indices are adjusted as needed. - * - * div - * div#1 (remove) <-- start removing (removing node is div#1) - * div - * div#2 (remove) <-- continue removing (removing node is still div#1) - * div - * div <-- stop removing since previous sibling is the removing node (div#1, - * removed 4 nodes) - */ -export function removeNodesFromTemplate(template, nodesToRemove) { - const { element: { content }, parts } = template; - const walker = document.createTreeWalker(content, walkerNodeFilter, null, false); - let partIndex = nextActiveIndexInTemplateParts(parts); - let part = parts[partIndex]; - let nodeIndex = -1; - let removeCount = 0; - const nodesToRemoveInTemplate = []; - let currentRemovingNode = null; - while (walker.nextNode()) { - nodeIndex++; - const node = walker.currentNode; - // End removal if stepped past the removing node - if (node.previousSibling === currentRemovingNode) { - currentRemovingNode = null; - } - // A node to remove was found in the template - if (nodesToRemove.has(node)) { - nodesToRemoveInTemplate.push(node); - // Track node we're removing - if (currentRemovingNode === null) { - currentRemovingNode = node; - } - } - // When removing, increment count by which to adjust subsequent part indices - if (currentRemovingNode !== null) { - removeCount++; - } - while (part !== undefined && part.index === nodeIndex) { - // If part is in a removed node deactivate it by setting index to -1 or - // adjust the index as needed. - part.index = currentRemovingNode !== null ? -1 : part.index - removeCount; - // go to the next active part. - partIndex = nextActiveIndexInTemplateParts(parts, partIndex); - part = parts[partIndex]; - } - } - nodesToRemoveInTemplate.forEach((n) => n.parentNode.removeChild(n)); -} -const countNodes = (node) => { - let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1; - const walker = document.createTreeWalker(node, walkerNodeFilter, null, false); - while (walker.nextNode()) { - count++; - } - return count; -}; -const nextActiveIndexInTemplateParts = (parts, startIndex = -1) => { - for (let i = startIndex + 1; i < parts.length; i++) { - const part = parts[i]; - if (isTemplatePartActive(part)) { - return i; - } - } - return -1; -}; -/** - * Inserts the given node into the Template, optionally before the given - * refNode. In addition to inserting the node into the Template, the Template - * part indices are updated to match the mutated Template DOM. - */ -export function insertNodeIntoTemplate(template, node, refNode = null) { - const { element: { content }, parts } = template; - // If there's no refNode, then put node at end of template. - // No part indices need to be shifted in this case. - if (refNode === null || refNode === undefined) { - content.appendChild(node); - return; - } - const walker = document.createTreeWalker(content, walkerNodeFilter, null, false); - let partIndex = nextActiveIndexInTemplateParts(parts); - let insertCount = 0; - let walkerIndex = -1; - while (walker.nextNode()) { - walkerIndex++; - const walkerNode = walker.currentNode; - if (walkerNode === refNode) { - insertCount = countNodes(node); - refNode.parentNode.insertBefore(node, refNode); - } - while (partIndex !== -1 && parts[partIndex].index === walkerIndex) { - // If we've inserted the node, simply adjust all subsequent parts - if (insertCount > 0) { - while (partIndex !== -1) { - parts[partIndex].index += insertCount; - partIndex = nextActiveIndexInTemplateParts(parts, partIndex); - } - return; - } - partIndex = nextActiveIndexInTemplateParts(parts, partIndex); - } - } -} -//# sourceMappingURL=modify-template.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.d.ts deleted file mode 100644 index 4f347f4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.d.ts +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * The Part interface represents a dynamic part of a template instance rendered - * by lit-html. - */ -export interface Part { - readonly value: unknown; - /** - * Sets the current part value, but does not write it to the DOM. - * @param value The value that will be committed. - */ - setValue(value: unknown): void; - /** - * Commits the current part value, causing it to actually be written to the - * DOM. - * - * Directives are run at the start of `commit`, so that if they call - * `part.setValue(...)` synchronously that value will be used in the current - * commit, and there's no need to call `part.commit()` within the directive. - * If directives set a part value asynchronously, then they must call - * `part.commit()` manually. - */ - commit(): void; -} -/** - * A sentinel value that signals that a value was handled by a directive and - * should not be written to the DOM. - */ -export declare const noChange: {}; -/** - * A sentinel value that signals a NodePart to fully clear its content. - */ -export declare const nothing: {}; -//# sourceMappingURL=part.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.js deleted file mode 100644 index a228b22..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/part.js +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * A sentinel value that signals that a value was handled by a directive and - * should not be written to the DOM. - */ -export const noChange = {}; -/** - * A sentinel value that signals a NodePart to fully clear its content. - */ -export const nothing = {}; -//# sourceMappingURL=part.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.d.ts deleted file mode 100644 index ad5a113..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.d.ts +++ /dev/null
@@ -1,148 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -import { RenderOptions } from './render-options.js'; -export declare type Primitive = null | undefined | boolean | number | string | symbol | bigint; -export declare const isPrimitive: (value: unknown) => value is Primitive; -export declare const isIterable: (value: unknown) => value is Iterable<unknown>; -/** - * Writes attribute values to the DOM for a group of AttributeParts bound to a - * single attribute. The value is only set once even if there are multiple parts - * for an attribute. - */ -export declare class AttributeCommitter { - readonly element: Element; - readonly name: string; - readonly strings: ReadonlyArray<string>; - readonly parts: ReadonlyArray<AttributePart>; - dirty: boolean; - constructor(element: Element, name: string, strings: ReadonlyArray<string>); - /** - * Creates a single part. Override this to create a differnt type of part. - */ - protected _createPart(): AttributePart; - protected _getValue(): unknown; - commit(): void; -} -/** - * A Part that controls all or part of an attribute value. - */ -export declare class AttributePart implements Part { - readonly committer: AttributeCommitter; - value: unknown; - constructor(committer: AttributeCommitter); - setValue(value: unknown): void; - commit(): void; -} -/** - * A Part that controls a location within a Node tree. Like a Range, NodePart - * has start and end locations and can set and update the Nodes between those - * locations. - * - * NodeParts support several value types: primitives, Nodes, TemplateResults, - * as well as arrays and iterables of those types. - */ -export declare class NodePart implements Part { - readonly options: RenderOptions; - startNode: Node; - endNode: Node; - value: unknown; - private __pendingValue; - constructor(options: RenderOptions); - /** - * Appends this part into a container. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendInto(container: Node): void; - /** - * Inserts this part after the `ref` node (between `ref` and `ref`'s next - * sibling). Both `ref` and its next sibling must be static, unchanging nodes - * such as those that appear in a literal section of a template. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterNode(ref: Node): void; - /** - * Appends this part into a parent part. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendIntoPart(part: NodePart): void; - /** - * Inserts this part after the `ref` part. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterPart(ref: NodePart): void; - setValue(value: unknown): void; - commit(): void; - private __insert; - private __commitNode; - private __commitText; - private __commitTemplateResult; - private __commitIterable; - clear(startNode?: Node): void; -} -/** - * Implements a boolean attribute, roughly as defined in the HTML - * specification. - * - * If the value is truthy, then the attribute is present with a value of - * ''. If the value is falsey, the attribute is removed. - */ -export declare class BooleanAttributePart implements Part { - readonly element: Element; - readonly name: string; - readonly strings: readonly string[]; - value: unknown; - private __pendingValue; - constructor(element: Element, name: string, strings: readonly string[]); - setValue(value: unknown): void; - commit(): void; -} -/** - * Sets attribute values for PropertyParts, so that the value is only set once - * even if there are multiple parts for a property. - * - * If an expression controls the whole property value, then the value is simply - * assigned to the property under control. If there are string literals or - * multiple expressions, then the strings are expressions are interpolated into - * a string first. - */ -export declare class PropertyCommitter extends AttributeCommitter { - readonly single: boolean; - constructor(element: Element, name: string, strings: ReadonlyArray<string>); - protected _createPart(): PropertyPart; - protected _getValue(): unknown; - commit(): void; -} -export declare class PropertyPart extends AttributePart { -} -declare type EventHandlerWithOptions = EventListenerOrEventListenerObject & Partial<AddEventListenerOptions>; -export declare class EventPart implements Part { - readonly element: Element; - readonly eventName: string; - readonly eventContext?: EventTarget; - value: undefined | EventHandlerWithOptions; - private __options?; - private __pendingValue; - private readonly __boundHandleEvent; - constructor(element: Element, eventName: string, eventContext?: EventTarget); - setValue(value: undefined | EventHandlerWithOptions): void; - commit(): void; - handleEvent(event: Event): void; -} -export {}; -//# sourceMappingURL=parts.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.js deleted file mode 100644 index 03d7613..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/parts.js +++ /dev/null
@@ -1,476 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { isDirective } from './directive.js'; -import { removeNodes } from './dom.js'; -import { noChange, nothing } from './part.js'; -import { TemplateInstance } from './template-instance.js'; -import { TemplateResult } from './template-result.js'; -import { createMarker } from './template.js'; -export const isPrimitive = (value) => { - return (value === null || - !(typeof value === 'object' || typeof value === 'function')); -}; -export const isIterable = (value) => { - return Array.isArray(value) || - // eslint-disable-next-line @typescript-eslint/no-explicit-any - !!(value && value[Symbol.iterator]); -}; -/** - * Writes attribute values to the DOM for a group of AttributeParts bound to a - * single attribute. The value is only set once even if there are multiple parts - * for an attribute. - */ -export class AttributeCommitter { - constructor(element, name, strings) { - this.dirty = true; - this.element = element; - this.name = name; - this.strings = strings; - this.parts = []; - for (let i = 0; i < strings.length - 1; i++) { - this.parts[i] = this._createPart(); - } - } - /** - * Creates a single part. Override this to create a differnt type of part. - */ - _createPart() { - return new AttributePart(this); - } - _getValue() { - const strings = this.strings; - const l = strings.length - 1; - const parts = this.parts; - // If we're assigning an attribute via syntax like: - // attr="${foo}" or attr=${foo} - // but not - // attr="${foo} ${bar}" or attr="${foo} baz" - // then we don't want to coerce the attribute value into one long - // string. Instead we want to just return the value itself directly, - // so that sanitizeDOMValue can get the actual value rather than - // String(value) - // The exception is if v is an array, in which case we do want to smash - // it together into a string without calling String() on the array. - // - // This also allows trusted values (when using TrustedTypes) being - // assigned to DOM sinks without being stringified in the process. - if (l === 1 && strings[0] === '' && strings[1] === '') { - const v = parts[0].value; - if (typeof v === 'symbol') { - return String(v); - } - if (typeof v === 'string' || !isIterable(v)) { - return v; - } - } - let text = ''; - for (let i = 0; i < l; i++) { - text += strings[i]; - const part = parts[i]; - if (part !== undefined) { - const v = part.value; - if (isPrimitive(v) || !isIterable(v)) { - text += typeof v === 'string' ? v : String(v); - } - else { - for (const t of v) { - text += typeof t === 'string' ? t : String(t); - } - } - } - } - text += strings[l]; - return text; - } - commit() { - if (this.dirty) { - this.dirty = false; - this.element.setAttribute(this.name, this._getValue()); - } - } -} -/** - * A Part that controls all or part of an attribute value. - */ -export class AttributePart { - constructor(committer) { - this.value = undefined; - this.committer = committer; - } - setValue(value) { - if (value !== noChange && (!isPrimitive(value) || value !== this.value)) { - this.value = value; - // If the value is a not a directive, dirty the committer so that it'll - // call setAttribute. If the value is a directive, it'll dirty the - // committer if it calls setValue(). - if (!isDirective(value)) { - this.committer.dirty = true; - } - } - } - commit() { - while (isDirective(this.value)) { - const directive = this.value; - this.value = noChange; - directive(this); - } - if (this.value === noChange) { - return; - } - this.committer.commit(); - } -} -/** - * A Part that controls a location within a Node tree. Like a Range, NodePart - * has start and end locations and can set and update the Nodes between those - * locations. - * - * NodeParts support several value types: primitives, Nodes, TemplateResults, - * as well as arrays and iterables of those types. - */ -export class NodePart { - constructor(options) { - this.value = undefined; - this.__pendingValue = undefined; - this.options = options; - } - /** - * Appends this part into a container. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendInto(container) { - this.startNode = container.appendChild(createMarker()); - this.endNode = container.appendChild(createMarker()); - } - /** - * Inserts this part after the `ref` node (between `ref` and `ref`'s next - * sibling). Both `ref` and its next sibling must be static, unchanging nodes - * such as those that appear in a literal section of a template. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterNode(ref) { - this.startNode = ref; - this.endNode = ref.nextSibling; - } - /** - * Appends this part into a parent part. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendIntoPart(part) { - part.__insert(this.startNode = createMarker()); - part.__insert(this.endNode = createMarker()); - } - /** - * Inserts this part after the `ref` part. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterPart(ref) { - ref.__insert(this.startNode = createMarker()); - this.endNode = ref.endNode; - ref.endNode = this.startNode; - } - setValue(value) { - this.__pendingValue = value; - } - commit() { - if (this.startNode.parentNode === null) { - return; - } - while (isDirective(this.__pendingValue)) { - const directive = this.__pendingValue; - this.__pendingValue = noChange; - directive(this); - } - const value = this.__pendingValue; - if (value === noChange) { - return; - } - if (isPrimitive(value)) { - if (value !== this.value) { - this.__commitText(value); - } - } - else if (value instanceof TemplateResult) { - this.__commitTemplateResult(value); - } - else if (value instanceof Node) { - this.__commitNode(value); - } - else if (isIterable(value)) { - this.__commitIterable(value); - } - else if (value === nothing) { - this.value = nothing; - this.clear(); - } - else { - // Fallback, will render the string representation - this.__commitText(value); - } - } - __insert(node) { - this.endNode.parentNode.insertBefore(node, this.endNode); - } - __commitNode(value) { - if (this.value === value) { - return; - } - this.clear(); - this.__insert(value); - this.value = value; - } - __commitText(value) { - const node = this.startNode.nextSibling; - value = value == null ? '' : value; - // If `value` isn't already a string, we explicitly convert it here in case - // it can't be implicitly converted - i.e. it's a symbol. - const valueAsString = typeof value === 'string' ? value : String(value); - if (node === this.endNode.previousSibling && - node.nodeType === 3 /* Node.TEXT_NODE */) { - // If we only have a single text node between the markers, we can just - // set its value, rather than replacing it. - // TODO(justinfagnani): Can we just check if this.value is primitive? - node.data = valueAsString; - } - else { - this.__commitNode(document.createTextNode(valueAsString)); - } - this.value = value; - } - __commitTemplateResult(value) { - const template = this.options.templateFactory(value); - if (this.value instanceof TemplateInstance && - this.value.template === template) { - this.value.update(value.values); - } - else { - // Make sure we propagate the template processor from the TemplateResult - // so that we use its syntax extension, etc. The template factory comes - // from the render function options so that it can control template - // caching and preprocessing. - const instance = new TemplateInstance(template, value.processor, this.options); - const fragment = instance._clone(); - instance.update(value.values); - this.__commitNode(fragment); - this.value = instance; - } - } - __commitIterable(value) { - // For an Iterable, we create a new InstancePart per item, then set its - // value to the item. This is a little bit of overhead for every item in - // an Iterable, but it lets us recurse easily and efficiently update Arrays - // of TemplateResults that will be commonly returned from expressions like: - // array.map((i) => html`${i}`), by reusing existing TemplateInstances. - // If _value is an array, then the previous render was of an - // iterable and _value will contain the NodeParts from the previous - // render. If _value is not an array, clear this part and make a new - // array for NodeParts. - if (!Array.isArray(this.value)) { - this.value = []; - this.clear(); - } - // Lets us keep track of how many items we stamped so we can clear leftover - // items from a previous render - const itemParts = this.value; - let partIndex = 0; - let itemPart; - for (const item of value) { - // Try to reuse an existing part - itemPart = itemParts[partIndex]; - // If no existing part, create a new one - if (itemPart === undefined) { - itemPart = new NodePart(this.options); - itemParts.push(itemPart); - if (partIndex === 0) { - itemPart.appendIntoPart(this); - } - else { - itemPart.insertAfterPart(itemParts[partIndex - 1]); - } - } - itemPart.setValue(item); - itemPart.commit(); - partIndex++; - } - if (partIndex < itemParts.length) { - // Truncate the parts array so _value reflects the current state - itemParts.length = partIndex; - this.clear(itemPart && itemPart.endNode); - } - } - clear(startNode = this.startNode) { - removeNodes(this.startNode.parentNode, startNode.nextSibling, this.endNode); - } -} -/** - * Implements a boolean attribute, roughly as defined in the HTML - * specification. - * - * If the value is truthy, then the attribute is present with a value of - * ''. If the value is falsey, the attribute is removed. - */ -export class BooleanAttributePart { - constructor(element, name, strings) { - this.value = undefined; - this.__pendingValue = undefined; - if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') { - throw new Error('Boolean attributes can only contain a single expression'); - } - this.element = element; - this.name = name; - this.strings = strings; - } - setValue(value) { - this.__pendingValue = value; - } - commit() { - while (isDirective(this.__pendingValue)) { - const directive = this.__pendingValue; - this.__pendingValue = noChange; - directive(this); - } - if (this.__pendingValue === noChange) { - return; - } - const value = !!this.__pendingValue; - if (this.value !== value) { - if (value) { - this.element.setAttribute(this.name, ''); - } - else { - this.element.removeAttribute(this.name); - } - this.value = value; - } - this.__pendingValue = noChange; - } -} -/** - * Sets attribute values for PropertyParts, so that the value is only set once - * even if there are multiple parts for a property. - * - * If an expression controls the whole property value, then the value is simply - * assigned to the property under control. If there are string literals or - * multiple expressions, then the strings are expressions are interpolated into - * a string first. - */ -export class PropertyCommitter extends AttributeCommitter { - constructor(element, name, strings) { - super(element, name, strings); - this.single = - (strings.length === 2 && strings[0] === '' && strings[1] === ''); - } - _createPart() { - return new PropertyPart(this); - } - _getValue() { - if (this.single) { - return this.parts[0].value; - } - return super._getValue(); - } - commit() { - if (this.dirty) { - this.dirty = false; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - this.element[this.name] = this._getValue(); - } - } -} -export class PropertyPart extends AttributePart { -} -// Detect event listener options support. If the `capture` property is read -// from the options object, then options are supported. If not, then the third -// argument to add/removeEventListener is interpreted as the boolean capture -// value so we should only pass the `capture` property. -let eventOptionsSupported = false; -// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch -// blocks right into the body of a module -(() => { - try { - const options = { - get capture() { - eventOptionsSupported = true; - return false; - } - }; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - window.addEventListener('test', options, options); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - window.removeEventListener('test', options, options); - } - catch (_e) { - // event options not supported - } -})(); -export class EventPart { - constructor(element, eventName, eventContext) { - this.value = undefined; - this.__pendingValue = undefined; - this.element = element; - this.eventName = eventName; - this.eventContext = eventContext; - this.__boundHandleEvent = (e) => this.handleEvent(e); - } - setValue(value) { - this.__pendingValue = value; - } - commit() { - while (isDirective(this.__pendingValue)) { - const directive = this.__pendingValue; - this.__pendingValue = noChange; - directive(this); - } - if (this.__pendingValue === noChange) { - return; - } - const newListener = this.__pendingValue; - const oldListener = this.value; - const shouldRemoveListener = newListener == null || - oldListener != null && - (newListener.capture !== oldListener.capture || - newListener.once !== oldListener.once || - newListener.passive !== oldListener.passive); - const shouldAddListener = newListener != null && (oldListener == null || shouldRemoveListener); - if (shouldRemoveListener) { - this.element.removeEventListener(this.eventName, this.__boundHandleEvent, this.__options); - } - if (shouldAddListener) { - this.__options = getOptions(newListener); - this.element.addEventListener(this.eventName, this.__boundHandleEvent, this.__options); - } - this.value = newListener; - this.__pendingValue = noChange; - } - handleEvent(event) { - if (typeof this.value === 'function') { - this.value.call(this.eventContext || this.element, event); - } - else { - this.value.handleEvent(event); - } - } -} -// We copy options because of the inconsistent behavior of browsers when reading -// the third argument of add/removeEventListener. IE11 doesn't support options -// at all. Chrome 41 only reads `capture` if the argument is an object. -const getOptions = (o) => o && - (eventOptionsSupported ? - { capture: o.capture, passive: o.passive, once: o.once } : - o.capture); -//# sourceMappingURL=parts.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.d.ts deleted file mode 100644 index 40dcd6db..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.d.ts +++ /dev/null
@@ -1,19 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateFactory } from './template-factory.js'; -export interface RenderOptions { - readonly templateFactory: TemplateFactory; - readonly eventContext?: EventTarget; -} -//# sourceMappingURL=render-options.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.js deleted file mode 100644 index 4eec2aa9..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render-options.js +++ /dev/null
@@ -1,14 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -//# sourceMappingURL=render-options.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.d.ts deleted file mode 100644 index ae64fe5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.d.ts +++ /dev/null
@@ -1,33 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -export declare const parts: WeakMap<Node, NodePart>; -/** - * Renders a template result or other value to a container. - * - * To update a container with new values, reevaluate the template literal and - * call `render` with the new result. - * - * @param result Any value renderable by NodePart - typically a TemplateResult - * created by evaluating a template tag like `html` or `svg`. - * @param container A DOM parent to render to. The entire contents are either - * replaced, or efficiently updated if the same result type was previous - * rendered there. - * @param options RenderOptions for the entire render tree rendered to this - * container. Render options must *not* change between renders to the same - * container, as those changes will not effect previously rendered DOM. - */ -export declare const render: (result: unknown, container: Element | DocumentFragment, options?: Partial<RenderOptions> | undefined) => void; -//# sourceMappingURL=render.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.js deleted file mode 100644 index 912204fb7..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/render.js +++ /dev/null
@@ -1,43 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { removeNodes } from './dom.js'; -import { NodePart } from './parts.js'; -import { templateFactory } from './template-factory.js'; -export const parts = new WeakMap(); -/** - * Renders a template result or other value to a container. - * - * To update a container with new values, reevaluate the template literal and - * call `render` with the new result. - * - * @param result Any value renderable by NodePart - typically a TemplateResult - * created by evaluating a template tag like `html` or `svg`. - * @param container A DOM parent to render to. The entire contents are either - * replaced, or efficiently updated if the same result type was previous - * rendered there. - * @param options RenderOptions for the entire render tree rendered to this - * container. Render options must *not* change between renders to the same - * container, as those changes will not effect previously rendered DOM. - */ -export const render = (result, container, options) => { - let part = parts.get(container); - if (part === undefined) { - removeNodes(container, container.firstChild); - parts.set(container, part = new NodePart(Object.assign({ templateFactory }, options))); - part.appendInto(container); - } - part.setValue(result); - part.commit(); -}; -//# sourceMappingURL=render.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.d.ts deleted file mode 100644 index f15e992e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.d.ts +++ /dev/null
@@ -1,83 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { RenderOptions } from './render-options.js'; -import { TemplateResult } from './template-result.js'; -import { Template } from './template.js'; -export { html, svg, TemplateResult } from '../lit-html.js'; -/** - * Template factory which scopes template DOM using ShadyCSS. - * @param scopeName {string} - */ -export declare const shadyTemplateFactory: (scopeName: string) => (result: TemplateResult) => Template; -export interface ShadyRenderOptions extends Partial<RenderOptions> { - scopeName: string; -} -/** - * Extension to the standard `render` method which supports rendering - * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom) - * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used - * or when the webcomponentsjs - * (https://github.com/webcomponents/webcomponentsjs) polyfill is used. - * - * Adds a `scopeName` option which is used to scope element DOM and stylesheets - * when native ShadowDOM is unavailable. The `scopeName` will be added to - * the class attribute of all rendered DOM. In addition, any style elements will - * be automatically re-written with this `scopeName` selector and moved out - * of the rendered DOM and into the document `<head>`. - * - * It is common to use this render method in conjunction with a custom element - * which renders a shadowRoot. When this is done, typically the element's - * `localName` should be used as the `scopeName`. - * - * In addition to DOM scoping, ShadyCSS also supports a basic shim for css - * custom properties (needed only on older browsers like IE11) and a shim for - * a deprecated feature called `@apply` that supports applying a set of css - * custom properties to a given location. - * - * Usage considerations: - * - * * Part values in `<style>` elements are only applied the first time a given - * `scopeName` renders. Subsequent changes to parts in style elements will have - * no effect. Because of this, parts in style elements should only be used for - * values that will never change, for example parts that set scope-wide theme - * values or parts which render shared style elements. - * - * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a - * custom element's `constructor` is not supported. Instead rendering should - * either done asynchronously, for example at microtask timing (for example - * `Promise.resolve()`), or be deferred until the first time the element's - * `connectedCallback` runs. - * - * Usage considerations when using shimmed custom properties or `@apply`: - * - * * Whenever any dynamic changes are made which affect - * css custom properties, `ShadyCSS.styleElement(element)` must be called - * to update the element. There are two cases when this is needed: - * (1) the element is connected to a new parent, (2) a class is added to the - * element that causes it to match different custom properties. - * To address the first case when rendering a custom element, `styleElement` - * should be called in the element's `connectedCallback`. - * - * * Shimmed custom properties may only be defined either for an entire - * shadowRoot (for example, in a `:host` rule) or via a rule that directly - * matches an element with a shadowRoot. In other words, instead of flowing from - * parent to child as do native css custom properties, shimmed custom properties - * flow only from shadowRoots to nested shadowRoots. - * - * * When using `@apply` mixing css shorthand property names with - * non-shorthand names (for example `border` and `border-width`) is not - * supported. - */ -export declare const render: (result: unknown, container: Element | DocumentFragment | ShadowRoot, options: ShadyRenderOptions) => void; -//# sourceMappingURL=shady-render.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.js deleted file mode 100644 index a5b853f3..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/shady-render.js +++ /dev/null
@@ -1,286 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * Module to add shady DOM/shady CSS polyfill support to lit-html template - * rendering. See the [[render]] method for details. - * - * @packageDocumentation - */ -/** - * Do not remove this comment; it keeps typedoc from misplacing the module - * docs. - */ -import { removeNodes } from './dom.js'; -import { insertNodeIntoTemplate, removeNodesFromTemplate } from './modify-template.js'; -import { parts, render as litRender } from './render.js'; -import { templateCaches } from './template-factory.js'; -import { TemplateInstance } from './template-instance.js'; -import { marker, Template } from './template.js'; -export { html, svg, TemplateResult } from '../lit-html.js'; -// Get a key to lookup in `templateCaches`. -const getTemplateCacheKey = (type, scopeName) => `${type}--${scopeName}`; -let compatibleShadyCSSVersion = true; -if (typeof window.ShadyCSS === 'undefined') { - compatibleShadyCSSVersion = false; -} -else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') { - console.warn(`Incompatible ShadyCSS version detected. ` + - `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` + - `@webcomponents/shadycss@1.3.1.`); - compatibleShadyCSSVersion = false; -} -/** - * Template factory which scopes template DOM using ShadyCSS. - * @param scopeName {string} - */ -export const shadyTemplateFactory = (scopeName) => (result) => { - const cacheKey = getTemplateCacheKey(result.type, scopeName); - let templateCache = templateCaches.get(cacheKey); - if (templateCache === undefined) { - templateCache = { - stringsArray: new WeakMap(), - keyString: new Map() - }; - templateCaches.set(cacheKey, templateCache); - } - let template = templateCache.stringsArray.get(result.strings); - if (template !== undefined) { - return template; - } - const key = result.strings.join(marker); - template = templateCache.keyString.get(key); - if (template === undefined) { - const element = result.getTemplateElement(); - if (compatibleShadyCSSVersion) { - window.ShadyCSS.prepareTemplateDom(element, scopeName); - } - template = new Template(result, element); - templateCache.keyString.set(key, template); - } - templateCache.stringsArray.set(result.strings, template); - return template; -}; -const TEMPLATE_TYPES = ['html', 'svg']; -/** - * Removes all style elements from Templates for the given scopeName. - */ -const removeStylesFromLitTemplates = (scopeName) => { - TEMPLATE_TYPES.forEach((type) => { - const templates = templateCaches.get(getTemplateCacheKey(type, scopeName)); - if (templates !== undefined) { - templates.keyString.forEach((template) => { - const { element: { content } } = template; - // IE 11 doesn't support the iterable param Set constructor - const styles = new Set(); - Array.from(content.querySelectorAll('style')).forEach((s) => { - styles.add(s); - }); - removeNodesFromTemplate(template, styles); - }); - } - }); -}; -const shadyRenderSet = new Set(); -/** - * For the given scope name, ensures that ShadyCSS style scoping is performed. - * This is done just once per scope name so the fragment and template cannot - * be modified. - * (1) extracts styles from the rendered fragment and hands them to ShadyCSS - * to be scoped and appended to the document - * (2) removes style elements from all lit-html Templates for this scope name. - * - * Note, <style> elements can only be placed into templates for the - * initial rendering of the scope. If <style> elements are included in templates - * dynamically rendered to the scope (after the first scope render), they will - * not be scoped and the <style> will be left in the template and rendered - * output. - */ -const prepareTemplateStyles = (scopeName, renderedDOM, template) => { - shadyRenderSet.add(scopeName); - // If `renderedDOM` is stamped from a Template, then we need to edit that - // Template's underlying template element. Otherwise, we create one here - // to give to ShadyCSS, which still requires one while scoping. - const templateElement = !!template ? template.element : document.createElement('template'); - // Move styles out of rendered DOM and store. - const styles = renderedDOM.querySelectorAll('style'); - const { length } = styles; - // If there are no styles, skip unnecessary work - if (length === 0) { - // Ensure prepareTemplateStyles is called to support adding - // styles via `prepareAdoptedCssText` since that requires that - // `prepareTemplateStyles` is called. - // - // ShadyCSS will only update styles containing @apply in the template - // given to `prepareTemplateStyles`. If no lit Template was given, - // ShadyCSS will not be able to update uses of @apply in any relevant - // template. However, this is not a problem because we only create the - // template for the purpose of supporting `prepareAdoptedCssText`, - // which doesn't support @apply at all. - window.ShadyCSS.prepareTemplateStyles(templateElement, scopeName); - return; - } - const condensedStyle = document.createElement('style'); - // Collect styles into a single style. This helps us make sure ShadyCSS - // manipulations will not prevent us from being able to fix up template - // part indices. - // NOTE: collecting styles is inefficient for browsers but ShadyCSS - // currently does this anyway. When it does not, this should be changed. - for (let i = 0; i < length; i++) { - const style = styles[i]; - style.parentNode.removeChild(style); - condensedStyle.textContent += style.textContent; - } - // Remove styles from nested templates in this scope. - removeStylesFromLitTemplates(scopeName); - // And then put the condensed style into the "root" template passed in as - // `template`. - const content = templateElement.content; - if (!!template) { - insertNodeIntoTemplate(template, condensedStyle, content.firstChild); - } - else { - content.insertBefore(condensedStyle, content.firstChild); - } - // Note, it's important that ShadyCSS gets the template that `lit-html` - // will actually render so that it can update the style inside when - // needed (e.g. @apply native Shadow DOM case). - window.ShadyCSS.prepareTemplateStyles(templateElement, scopeName); - const style = content.querySelector('style'); - if (window.ShadyCSS.nativeShadow && style !== null) { - // When in native Shadow DOM, ensure the style created by ShadyCSS is - // included in initially rendered output (`renderedDOM`). - renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild); - } - else if (!!template) { - // When no style is left in the template, parts will be broken as a - // result. To fix this, we put back the style node ShadyCSS removed - // and then tell lit to remove that node from the template. - // There can be no style in the template in 2 cases (1) when Shady DOM - // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM - // is in use ShadyCSS removes the style if it contains no content. - // NOTE, ShadyCSS creates its own style so we can safely add/remove - // `condensedStyle` here. - content.insertBefore(condensedStyle, content.firstChild); - const removes = new Set(); - removes.add(condensedStyle); - removeNodesFromTemplate(template, removes); - } -}; -/** - * Extension to the standard `render` method which supports rendering - * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom) - * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used - * or when the webcomponentsjs - * (https://github.com/webcomponents/webcomponentsjs) polyfill is used. - * - * Adds a `scopeName` option which is used to scope element DOM and stylesheets - * when native ShadowDOM is unavailable. The `scopeName` will be added to - * the class attribute of all rendered DOM. In addition, any style elements will - * be automatically re-written with this `scopeName` selector and moved out - * of the rendered DOM and into the document `<head>`. - * - * It is common to use this render method in conjunction with a custom element - * which renders a shadowRoot. When this is done, typically the element's - * `localName` should be used as the `scopeName`. - * - * In addition to DOM scoping, ShadyCSS also supports a basic shim for css - * custom properties (needed only on older browsers like IE11) and a shim for - * a deprecated feature called `@apply` that supports applying a set of css - * custom properties to a given location. - * - * Usage considerations: - * - * * Part values in `<style>` elements are only applied the first time a given - * `scopeName` renders. Subsequent changes to parts in style elements will have - * no effect. Because of this, parts in style elements should only be used for - * values that will never change, for example parts that set scope-wide theme - * values or parts which render shared style elements. - * - * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a - * custom element's `constructor` is not supported. Instead rendering should - * either done asynchronously, for example at microtask timing (for example - * `Promise.resolve()`), or be deferred until the first time the element's - * `connectedCallback` runs. - * - * Usage considerations when using shimmed custom properties or `@apply`: - * - * * Whenever any dynamic changes are made which affect - * css custom properties, `ShadyCSS.styleElement(element)` must be called - * to update the element. There are two cases when this is needed: - * (1) the element is connected to a new parent, (2) a class is added to the - * element that causes it to match different custom properties. - * To address the first case when rendering a custom element, `styleElement` - * should be called in the element's `connectedCallback`. - * - * * Shimmed custom properties may only be defined either for an entire - * shadowRoot (for example, in a `:host` rule) or via a rule that directly - * matches an element with a shadowRoot. In other words, instead of flowing from - * parent to child as do native css custom properties, shimmed custom properties - * flow only from shadowRoots to nested shadowRoots. - * - * * When using `@apply` mixing css shorthand property names with - * non-shorthand names (for example `border` and `border-width`) is not - * supported. - */ -export const render = (result, container, options) => { - if (!options || typeof options !== 'object' || !options.scopeName) { - throw new Error('The `scopeName` option is required.'); - } - const scopeName = options.scopeName; - const hasRendered = parts.has(container); - const needsScoping = compatibleShadyCSSVersion && - container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ && - !!container.host; - // Handle first render to a scope specially... - const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName); - // On first scope render, render into a fragment; this cannot be a single - // fragment that is reused since nested renders can occur synchronously. - const renderContainer = firstScopeRender ? document.createDocumentFragment() : container; - litRender(result, renderContainer, Object.assign({ templateFactory: shadyTemplateFactory(scopeName) }, options)); - // When performing first scope render, - // (1) We've rendered into a fragment so that there's a chance to - // `prepareTemplateStyles` before sub-elements hit the DOM - // (which might cause them to render based on a common pattern of - // rendering in a custom element's `connectedCallback`); - // (2) Scope the template with ShadyCSS one time only for this scope. - // (3) Render the fragment into the container and make sure the - // container knows its `part` is the one we just rendered. This ensures - // DOM will be re-used on subsequent renders. - if (firstScopeRender) { - const part = parts.get(renderContainer); - parts.delete(renderContainer); - // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`) - // that should apply to `renderContainer` even if the rendered value is - // not a TemplateInstance. However, it will only insert scoped styles - // into the document if `prepareTemplateStyles` has already been called - // for the given scope name. - const template = part.value instanceof TemplateInstance ? - part.value.template : - undefined; - prepareTemplateStyles(scopeName, renderContainer, template); - removeNodes(container, container.firstChild); - container.appendChild(renderContainer); - parts.set(container, part); - } - // After elements have hit the DOM, update styling if this is the - // initial render to this container. - // This is needed whenever dynamic changes are made so it would be - // safest to do every render; however, this would regress performance - // so we leave it up to the user to call `ShadyCSS.styleElement` - // for dynamic changes. - if (!hasRendered && needsScoping) { - window.ShadyCSS.styleElement(container.host); - } -}; -//# sourceMappingURL=shady-render.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.d.ts deleted file mode 100644 index 98777cb..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.d.ts +++ /dev/null
@@ -1,57 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateResult } from './template-result.js'; -import { Template } from './template.js'; -/** - * A function type that creates a Template from a TemplateResult. - * - * This is a hook into the template-creation process for rendering that - * requires some modification of templates before they're used, like ShadyCSS, - * which must add classes to elements and remove styles. - * - * Templates should be cached as aggressively as possible, so that many - * TemplateResults produced from the same expression only do the work of - * creating the Template the first time. - * - * Templates are usually cached by TemplateResult.strings and - * TemplateResult.type, but may be cached by other keys if this function - * modifies the template. - * - * Note that currently TemplateFactories must not add, remove, or reorder - * expressions, because there is no way to describe such a modification - * to render() so that values are interpolated to the correct place in the - * template instances. - */ -export declare type TemplateFactory = (result: TemplateResult) => Template; -/** - * The default TemplateFactory which caches Templates keyed on - * result.type and result.strings. - */ -export declare function templateFactory(result: TemplateResult): Template; -/** - * The first argument to JS template tags retain identity across multiple - * calls to a tag for the same literal, so we can cache work done per literal - * in a Map. - * - * Safari currently has a bug which occasionally breaks this behavior, so we - * need to cache the Template at two levels. We first cache the - * TemplateStringsArray, and if that fails, we cache a key constructed by - * joining the strings array. - */ -export interface TemplateCache { - readonly stringsArray: WeakMap<TemplateStringsArray, Template>; - readonly keyString: Map<string, Template>; -} -export declare const templateCaches: Map<string, TemplateCache>; -//# sourceMappingURL=template-factory.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.js deleted file mode 100644 index 2f1d0b7..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-factory.js +++ /dev/null
@@ -1,48 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { marker, Template } from './template.js'; -/** - * The default TemplateFactory which caches Templates keyed on - * result.type and result.strings. - */ -export function templateFactory(result) { - let templateCache = templateCaches.get(result.type); - if (templateCache === undefined) { - templateCache = { - stringsArray: new WeakMap(), - keyString: new Map() - }; - templateCaches.set(result.type, templateCache); - } - let template = templateCache.stringsArray.get(result.strings); - if (template !== undefined) { - return template; - } - // If the TemplateStringsArray is new, generate a key from the strings - // This key is shared between all templates with identical content - const key = result.strings.join(marker); - // Check if we already have a Template for this key - template = templateCache.keyString.get(key); - if (template === undefined) { - // If we have not seen this key before, create a new Template - template = new Template(result, result.getTemplateElement()); - // Cache the Template for this key - templateCache.keyString.set(key, template); - } - // Cache all future queries for this TemplateStringsArray - templateCache.stringsArray.set(result.strings, template); - return template; -} -export const templateCaches = new Map(); -//# sourceMappingURL=template-factory.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.d.ts deleted file mode 100644 index 422a721..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.d.ts +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { RenderOptions } from './render-options.js'; -import { TemplateProcessor } from './template-processor.js'; -import { Template } from './template.js'; -/** - * An instance of a `Template` that can be attached to the DOM and updated - * with new values. - */ -export declare class TemplateInstance { - private readonly __parts; - readonly processor: TemplateProcessor; - readonly options: RenderOptions; - readonly template: Template; - constructor(template: Template, processor: TemplateProcessor, options: RenderOptions); - update(values: readonly unknown[]): void; - _clone(): DocumentFragment; -} -//# sourceMappingURL=template-instance.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.js deleted file mode 100644 index f8eeb24..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-instance.js +++ /dev/null
@@ -1,134 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { isCEPolyfill } from './dom.js'; -import { isTemplatePartActive } from './template.js'; -/** - * An instance of a `Template` that can be attached to the DOM and updated - * with new values. - */ -export class TemplateInstance { - constructor(template, processor, options) { - this.__parts = []; - this.template = template; - this.processor = processor; - this.options = options; - } - update(values) { - let i = 0; - for (const part of this.__parts) { - if (part !== undefined) { - part.setValue(values[i]); - } - i++; - } - for (const part of this.__parts) { - if (part !== undefined) { - part.commit(); - } - } - } - _clone() { - // There are a number of steps in the lifecycle of a template instance's - // DOM fragment: - // 1. Clone - create the instance fragment - // 2. Adopt - adopt into the main document - // 3. Process - find part markers and create parts - // 4. Upgrade - upgrade custom elements - // 5. Update - set node, attribute, property, etc., values - // 6. Connect - connect to the document. Optional and outside of this - // method. - // - // We have a few constraints on the ordering of these steps: - // * We need to upgrade before updating, so that property values will pass - // through any property setters. - // * We would like to process before upgrading so that we're sure that the - // cloned fragment is inert and not disturbed by self-modifying DOM. - // * We want custom elements to upgrade even in disconnected fragments. - // - // Given these constraints, with full custom elements support we would - // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect - // - // But Safari does not implement CustomElementRegistry#upgrade, so we - // can not implement that order and still have upgrade-before-update and - // upgrade disconnected fragments. So we instead sacrifice the - // process-before-upgrade constraint, since in Custom Elements v1 elements - // must not modify their light DOM in the constructor. We still have issues - // when co-existing with CEv0 elements like Polymer 1, and with polyfills - // that don't strictly adhere to the no-modification rule because shadow - // DOM, which may be created in the constructor, is emulated by being placed - // in the light DOM. - // - // The resulting order is on native is: Clone, Adopt, Upgrade, Process, - // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade - // in one step. - // - // The Custom Elements v1 polyfill supports upgrade(), so the order when - // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update, - // Connect. - const fragment = isCEPolyfill ? - this.template.element.content.cloneNode(true) : - document.importNode(this.template.element.content, true); - const stack = []; - const parts = this.template.parts; - // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null - const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false); - let partIndex = 0; - let nodeIndex = 0; - let part; - let node = walker.nextNode(); - // Loop through all the nodes and parts of a template - while (partIndex < parts.length) { - part = parts[partIndex]; - if (!isTemplatePartActive(part)) { - this.__parts.push(undefined); - partIndex++; - continue; - } - // Progress the tree walker until we find our next part's node. - // Note that multiple parts may share the same node (attribute parts - // on a single element), so this loop may not run at all. - while (nodeIndex < part.index) { - nodeIndex++; - if (node.nodeName === 'TEMPLATE') { - stack.push(node); - walker.currentNode = node.content; - } - if ((node = walker.nextNode()) === null) { - // We've exhausted the content inside a nested template element. - // Because we still have parts (the outer for-loop), we know: - // - There is a template in the stack - // - The walker will find a nextNode outside the template - walker.currentNode = stack.pop(); - node = walker.nextNode(); - } - } - // We've arrived at our part's node. - if (part.type === 'node') { - const part = this.processor.handleTextExpression(this.options); - part.insertAfterNode(node.previousSibling); - this.__parts.push(part); - } - else { - this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options)); - } - partIndex++; - } - if (isCEPolyfill) { - document.adoptNode(fragment); - customElements.upgrade(fragment); - } - return fragment; - } -} -//# sourceMappingURL=template-instance.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.d.ts deleted file mode 100644 index 2e82268..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.d.ts +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * @module lit-html - */ -import { Part } from './part.js'; -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -export interface TemplateProcessor { - /** - * Create parts for an attribute-position binding, given the element, - * attribute name, and string literals. - * - * @param element The element containing the binding - * @param name The attribute name, including a possible prefix. The name may - * be prefixed by `.` (for a property binding), `@` (for an event binding) - * or - * `?` (for a boolean attribute binding). - * @param strings The array of literal strings that form the static part of - * the - * attribute value. There are always at least two strings, - * even for fully-controlled bindings with a single expression. For example, - * for the binding `attr="${e1}-${e2}"`, the `strings` array includes three - * strings (`['', '-', '']`)—the text _before_ the first expression (the - * empty string), the text between the two expressions (`'-'`), and the text - * after the last expression (another empty string). - */ - handleAttributeExpressions(element: Element, name: string, strings: ReadonlyArray<string>, options: RenderOptions): ReadonlyArray<Part>; - /** - * Create parts for a text-position binding. - * @param partOptions - */ - handleTextExpression(options: RenderOptions): NodePart; -} -//# sourceMappingURL=template-processor.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.js deleted file mode 100644 index 2a54e8d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-processor.js +++ /dev/null
@@ -1,14 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -//# sourceMappingURL=template-processor.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.d.ts deleted file mode 100644 index c31d890..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.d.ts +++ /dev/null
@@ -1,42 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateProcessor } from './template-processor.js'; -/** - * The return type of `html`, which holds a Template and the values from - * interpolated expressions. - */ -export declare class TemplateResult { - readonly strings: TemplateStringsArray; - readonly values: readonly unknown[]; - readonly type: string; - readonly processor: TemplateProcessor; - constructor(strings: TemplateStringsArray, values: readonly unknown[], type: string, processor: TemplateProcessor); - /** - * Returns a string of HTML used to create a `<template>` element. - */ - getHTML(): string; - getTemplateElement(): HTMLTemplateElement; -} -/** - * A TemplateResult for SVG fragments. - * - * This class wraps HTML in an `<svg>` tag in order to parse its contents in the - * SVG namespace, then modifies the template to remove the `<svg>` tag so that - * clones only container the original fragment. - */ -export declare class SVGTemplateResult extends TemplateResult { - getHTML(): string; - getTemplateElement(): HTMLTemplateElement; -} -//# sourceMappingURL=template-result.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.js deleted file mode 100644 index 0baf98025..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template-result.js +++ /dev/null
@@ -1,131 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * @module lit-html - */ -import { reparentNodes } from './dom.js'; -import { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js'; -/** - * Our TrustedTypePolicy for HTML which is declared using the html template - * tag function. - * - * That HTML is a developer-authored constant, and is parsed with innerHTML - * before any untrusted expressions have been mixed in. Therefor it is - * considered safe by construction. - */ -const policy = window.trustedTypes && - trustedTypes.createPolicy('lit-html', { createHTML: (s) => s }); -const commentMarker = ` ${marker} `; -/** - * The return type of `html`, which holds a Template and the values from - * interpolated expressions. - */ -export class TemplateResult { - constructor(strings, values, type, processor) { - this.strings = strings; - this.values = values; - this.type = type; - this.processor = processor; - } - /** - * Returns a string of HTML used to create a `<template>` element. - */ - getHTML() { - const l = this.strings.length - 1; - let html = ''; - let isCommentBinding = false; - for (let i = 0; i < l; i++) { - const s = this.strings[i]; - // For each binding we want to determine the kind of marker to insert - // into the template source before it's parsed by the browser's HTML - // parser. The marker type is based on whether the expression is in an - // attribute, text, or comment position. - // * For node-position bindings we insert a comment with the marker - // sentinel as its text content, like <!--{{lit-guid}}-->. - // * For attribute bindings we insert just the marker sentinel for the - // first binding, so that we support unquoted attribute bindings. - // Subsequent bindings can use a comment marker because multi-binding - // attributes must be quoted. - // * For comment bindings we insert just the marker sentinel so we don't - // close the comment. - // - // The following code scans the template source, but is *not* an HTML - // parser. We don't need to track the tree structure of the HTML, only - // whether a binding is inside a comment, and if not, if it appears to be - // the first binding in an attribute. - const commentOpen = s.lastIndexOf('<!--'); - // We're in comment position if we have a comment open with no following - // comment close. Because <-- can appear in an attribute value there can - // be false positives. - isCommentBinding = (commentOpen > -1 || isCommentBinding) && - s.indexOf('-->', commentOpen + 1) === -1; - // Check to see if we have an attribute-like sequence preceding the - // expression. This can match "name=value" like structures in text, - // comments, and attribute values, so there can be false-positives. - const attributeMatch = lastAttributeNameRegex.exec(s); - if (attributeMatch === null) { - // We're only in this branch if we don't have a attribute-like - // preceding sequence. For comments, this guards against unusual - // attribute values like <div foo="<!--${'bar'}">. Cases like - // <!-- foo=${'bar'}--> are handled correctly in the attribute branch - // below. - html += s + (isCommentBinding ? commentMarker : nodeMarker); - } - else { - // For attributes we use just a marker sentinel, and also append a - // $lit$ suffix to the name to opt-out of attribute-specific parsing - // that IE and Edge do for style and certain SVG attributes. - html += s.substr(0, attributeMatch.index) + attributeMatch[1] + - attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] + - marker; - } - } - html += this.strings[l]; - return html; - } - getTemplateElement() { - const template = document.createElement('template'); - let value = this.getHTML(); - if (policy !== undefined) { - // this is secure because `this.strings` is a TemplateStringsArray. - // TODO: validate this when - // https://github.com/tc39/proposal-array-is-template-object is - // implemented. - value = policy.createHTML(value); - } - template.innerHTML = value; - return template; - } -} -/** - * A TemplateResult for SVG fragments. - * - * This class wraps HTML in an `<svg>` tag in order to parse its contents in the - * SVG namespace, then modifies the template to remove the `<svg>` tag so that - * clones only container the original fragment. - */ -export class SVGTemplateResult extends TemplateResult { - getHTML() { - return `<svg>${super.getHTML()}</svg>`; - } - getTemplateElement() { - const template = super.getTemplateElement(); - const content = template.content; - const svgElement = content.firstChild; - content.removeChild(svgElement); - reparentNodes(content, svgElement.firstChild); - return template; - } -} -//# sourceMappingURL=template-result.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.d.ts deleted file mode 100644 index 4f52b91..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.d.ts +++ /dev/null
@@ -1,92 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateResult } from './template-result.js'; -/** - * An expression marker with embedded unique key to avoid collision with - * possible text in templates. - */ -export declare const marker: string; -/** - * An expression marker used text-positions, multi-binding attributes, and - * attributes with markup-like text values. - */ -export declare const nodeMarker: string; -export declare const markerRegex: RegExp; -/** - * Suffix appended to all bound attribute names. - */ -export declare const boundAttributeSuffix = "$lit$"; -/** - * An updatable Template that tracks the location of dynamic parts. - */ -export declare class Template { - readonly parts: TemplatePart[]; - readonly element: HTMLTemplateElement; - constructor(result: TemplateResult, element: HTMLTemplateElement); -} -/** - * A placeholder for a dynamic expression in an HTML template. - * - * There are two built-in part types: AttributePart and NodePart. NodeParts - * always represent a single dynamic expression, while AttributeParts may - * represent as many expressions are contained in the attribute. - * - * A Template's parts are mutable, so parts can be replaced or modified - * (possibly to implement different template semantics). The contract is that - * parts can only be replaced, not removed, added or reordered, and parts must - * always consume the correct number of values in their `update()` method. - * - * TODO(justinfagnani): That requirement is a little fragile. A - * TemplateInstance could instead be more careful about which values it gives - * to Part.update(). - */ -export declare type TemplatePart = { - readonly type: 'node'; - index: number; -} | { - readonly type: 'attribute'; - index: number; - readonly name: string; - readonly strings: ReadonlyArray<string>; -}; -export declare const isTemplatePartActive: (part: TemplatePart) => boolean; -export declare const createMarker: () => Comment; -/** - * This regex extracts the attribute name preceding an attribute-position - * expression. It does this by matching the syntax allowed for attributes - * against the string literal directly preceding the expression, assuming that - * the expression is in an attribute-value position. - * - * See attributes in the HTML spec: - * https://www.w3.org/TR/html5/syntax.html#elements-attributes - * - * " \x09\x0a\x0c\x0d" are HTML space characters: - * https://www.w3.org/TR/html5/infrastructure.html#space-characters - * - * "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every - * space character except " ". - * - * So an attribute is: - * * The name: any character except a control character, space character, ('), - * ("), ">", "=", or "/" - * * Followed by zero or more space characters - * * Followed by "=" - * * Followed by zero or more space characters - * * Followed by: - * * Any character except space, ('), ("), "<", ">", "=", (`), or - * * (") then any non-("), or - * * (') then any non-(') - */ -export declare const lastAttributeNameRegex: RegExp; -//# sourceMappingURL=template.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.js deleted file mode 100644 index c670b8fbc..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lib/template.js +++ /dev/null
@@ -1,215 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * An expression marker with embedded unique key to avoid collision with - * possible text in templates. - */ -export const marker = `{{lit-${String(Math.random()).slice(2)}}}`; -/** - * An expression marker used text-positions, multi-binding attributes, and - * attributes with markup-like text values. - */ -export const nodeMarker = `<!--${marker}-->`; -export const markerRegex = new RegExp(`${marker}|${nodeMarker}`); -/** - * Suffix appended to all bound attribute names. - */ -export const boundAttributeSuffix = '$lit$'; -/** - * An updatable Template that tracks the location of dynamic parts. - */ -export class Template { - constructor(result, element) { - this.parts = []; - this.element = element; - const nodesToRemove = []; - const stack = []; - // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null - const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false); - // Keeps track of the last index associated with a part. We try to delete - // unnecessary nodes, but we never want to associate two different parts - // to the same index. They must have a constant node between. - let lastPartIndex = 0; - let index = -1; - let partIndex = 0; - const { strings, values: { length } } = result; - while (partIndex < length) { - const node = walker.nextNode(); - if (node === null) { - // We've exhausted the content inside a nested template element. - // Because we still have parts (the outer for-loop), we know: - // - There is a template in the stack - // - The walker will find a nextNode outside the template - walker.currentNode = stack.pop(); - continue; - } - index++; - if (node.nodeType === 1 /* Node.ELEMENT_NODE */) { - if (node.hasAttributes()) { - const attributes = node.attributes; - const { length } = attributes; - // Per - // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap, - // attributes are not guaranteed to be returned in document order. - // In particular, Edge/IE can return them out of order, so we cannot - // assume a correspondence between part index and attribute index. - let count = 0; - for (let i = 0; i < length; i++) { - if (endsWith(attributes[i].name, boundAttributeSuffix)) { - count++; - } - } - while (count-- > 0) { - // Get the template literal section leading up to the first - // expression in this attribute - const stringForPart = strings[partIndex]; - // Find the attribute name - const name = lastAttributeNameRegex.exec(stringForPart)[2]; - // Find the corresponding attribute - // All bound attributes have had a suffix added in - // TemplateResult#getHTML to opt out of special attribute - // handling. To look up the attribute value we also need to add - // the suffix. - const attributeLookupName = name.toLowerCase() + boundAttributeSuffix; - const attributeValue = node.getAttribute(attributeLookupName); - node.removeAttribute(attributeLookupName); - const statics = attributeValue.split(markerRegex); - this.parts.push({ type: 'attribute', index, name, strings: statics }); - partIndex += statics.length - 1; - } - } - if (node.tagName === 'TEMPLATE') { - stack.push(node); - walker.currentNode = node.content; - } - } - else if (node.nodeType === 3 /* Node.TEXT_NODE */) { - const data = node.data; - if (data.indexOf(marker) >= 0) { - const parent = node.parentNode; - const strings = data.split(markerRegex); - const lastIndex = strings.length - 1; - // Generate a new text node for each literal section - // These nodes are also used as the markers for node parts - for (let i = 0; i < lastIndex; i++) { - let insert; - let s = strings[i]; - if (s === '') { - insert = createMarker(); - } - else { - const match = lastAttributeNameRegex.exec(s); - if (match !== null && endsWith(match[2], boundAttributeSuffix)) { - s = s.slice(0, match.index) + match[1] + - match[2].slice(0, -boundAttributeSuffix.length) + match[3]; - } - insert = document.createTextNode(s); - } - parent.insertBefore(insert, node); - this.parts.push({ type: 'node', index: ++index }); - } - // If there's no text, we must insert a comment to mark our place. - // Else, we can trust it will stick around after cloning. - if (strings[lastIndex] === '') { - parent.insertBefore(createMarker(), node); - nodesToRemove.push(node); - } - else { - node.data = strings[lastIndex]; - } - // We have a part for each match found - partIndex += lastIndex; - } - } - else if (node.nodeType === 8 /* Node.COMMENT_NODE */) { - if (node.data === marker) { - const parent = node.parentNode; - // Add a new marker node to be the startNode of the Part if any of - // the following are true: - // * We don't have a previousSibling - // * The previousSibling is already the start of a previous part - if (node.previousSibling === null || index === lastPartIndex) { - index++; - parent.insertBefore(createMarker(), node); - } - lastPartIndex = index; - this.parts.push({ type: 'node', index }); - // If we don't have a nextSibling, keep this node so we have an end. - // Else, we can remove it to save future costs. - if (node.nextSibling === null) { - node.data = ''; - } - else { - nodesToRemove.push(node); - index--; - } - partIndex++; - } - else { - let i = -1; - while ((i = node.data.indexOf(marker, i + 1)) !== -1) { - // Comment node has a binding marker inside, make an inactive part - // The binding won't work, but subsequent bindings will - // TODO (justinfagnani): consider whether it's even worth it to - // make bindings in comments work - this.parts.push({ type: 'node', index: -1 }); - partIndex++; - } - } - } - } - // Remove text binding nodes after the walk to not disturb the TreeWalker - for (const n of nodesToRemove) { - n.parentNode.removeChild(n); - } - } -} -const endsWith = (str, suffix) => { - const index = str.length - suffix.length; - return index >= 0 && str.slice(index) === suffix; -}; -export const isTemplatePartActive = (part) => part.index !== -1; -// Allows `document.createComment('')` to be renamed for a -// small manual size-savings. -export const createMarker = () => document.createComment(''); -/** - * This regex extracts the attribute name preceding an attribute-position - * expression. It does this by matching the syntax allowed for attributes - * against the string literal directly preceding the expression, assuming that - * the expression is in an attribute-value position. - * - * See attributes in the HTML spec: - * https://www.w3.org/TR/html5/syntax.html#elements-attributes - * - * " \x09\x0a\x0c\x0d" are HTML space characters: - * https://www.w3.org/TR/html5/infrastructure.html#space-characters - * - * "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every - * space character except " ". - * - * So an attribute is: - * * The name: any character except a control character, space character, ('), - * ("), ">", "=", or "/" - * * Followed by zero or more space characters - * * Followed by "=" - * * Followed by zero or more space characters - * * Followed by: - * * Any character except space, ('), ("), "<", ">", "=", (`), or - * * (") then any non-("), or - * * (') then any non-(') - */ -export const lastAttributeNameRegex = -// eslint-disable-next-line no-control-regex -/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/; -//# sourceMappingURL=template.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.d.ts index 7651517..b5cd5867 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.d.ts
@@ -1,42 +1,518 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -import { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { DefaultTemplateProcessor, defaultTemplateProcessor } from './lib/default-template-processor.js'; -export { directive, DirectiveFn, isDirective } from './lib/directive.js'; -export { removeNodes, reparentNodes } from './lib/dom.js'; -export { noChange, nothing, Part } from './lib/part.js'; -export { AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart } from './lib/parts.js'; -export { RenderOptions } from './lib/render-options.js'; -export { parts, render } from './lib/render.js'; -export { templateCaches, templateFactory } from './lib/template-factory.js'; -export { TemplateInstance } from './lib/template-instance.js'; -export { TemplateProcessor } from './lib/template-processor.js'; -export { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { createMarker, isTemplatePartActive, Template } from './lib/template.js'; -declare global { - interface Window { - litHtmlVersions: string[]; +/// <reference types="trusted-types" /> +import type { Directive } from './directive.js'; +/** + * Contains types that are part of the unstable debug API. + * + * Everything in this API is not stable and may change or be removed in the future, + * even on patch releases. + */ +export declare namespace LitUnstable { + /** + * When Lit is running in dev mode and `window.emitLitDebugLogEvents` is true, + * we will emit 'lit-debug' events to window, with live details about the update and render + * lifecycle. These can be useful for writing debug tooling and visualizations. + * + * Please be aware that running with window.emitLitDebugLogEvents has performance overhead, + * making certain operations that are normally very cheap (like a no-op render) much slower, + * because we must copy data and dispatch events. + */ + namespace DebugLog { + type Entry = TemplatePrep | TemplateInstantiated | TemplateInstantiatedAndUpdated | TemplateUpdating | BeginRender | EndRender | CommitPartEntry | SetPartValue; + interface TemplatePrep { + kind: 'template prep'; + template: Template; + strings: TemplateStringsArray; + clonableTemplate: HTMLTemplateElement; + parts: TemplatePart[]; + } + interface BeginRender { + kind: 'begin render'; + id: number; + value: unknown; + container: HTMLElement | DocumentFragment; + options: RenderOptions | undefined; + part: ChildPart | undefined; + } + interface EndRender { + kind: 'end render'; + id: number; + value: unknown; + container: HTMLElement | DocumentFragment; + options: RenderOptions | undefined; + part: ChildPart; + } + interface TemplateInstantiated { + kind: 'template instantiated'; + template: Template | CompiledTemplate; + instance: TemplateInstance; + options: RenderOptions | undefined; + fragment: Node; + parts: Array<Part | undefined>; + values: unknown[]; + } + interface TemplateInstantiatedAndUpdated { + kind: 'template instantiated and updated'; + template: Template | CompiledTemplate; + instance: TemplateInstance; + options: RenderOptions | undefined; + fragment: Node; + parts: Array<Part | undefined>; + values: unknown[]; + } + interface TemplateUpdating { + kind: 'template updating'; + template: Template | CompiledTemplate; + instance: TemplateInstance; + options: RenderOptions | undefined; + parts: Array<Part | undefined>; + values: unknown[]; + } + interface SetPartValue { + kind: 'set part'; + part: Part; + value: unknown; + valueIndex: number; + values: unknown[]; + templateInstance: TemplateInstance; + } + type CommitPartEntry = CommitNothingToChildEntry | CommitText | CommitNode | CommitAttribute | CommitProperty | CommitBooleanAttribute | CommitEventListener | CommitToElementBinding; + interface CommitNothingToChildEntry { + kind: 'commit nothing to child'; + start: ChildNode; + end: ChildNode | null; + parent: Disconnectable | undefined; + options: RenderOptions | undefined; + } + interface CommitText { + kind: 'commit text'; + node: Text; + value: unknown; + options: RenderOptions | undefined; + } + interface CommitNode { + kind: 'commit node'; + start: Node; + parent: Disconnectable | undefined; + value: Node; + options: RenderOptions | undefined; + } + interface CommitAttribute { + kind: 'commit attribute'; + element: Element; + name: string; + value: unknown; + options: RenderOptions | undefined; + } + interface CommitProperty { + kind: 'commit property'; + element: Element; + name: string; + value: unknown; + options: RenderOptions | undefined; + } + interface CommitBooleanAttribute { + kind: 'commit boolean attribute'; + element: Element; + name: string; + value: boolean; + options: RenderOptions | undefined; + } + interface CommitEventListener { + kind: 'commit event listener'; + element: Element; + name: string; + value: unknown; + oldListener: unknown; + options: RenderOptions | undefined; + removeListener: boolean; + addListener: boolean; + } + interface CommitToElementBinding { + kind: 'commit to element binding'; + element: Element; + value: unknown; + options: RenderOptions | undefined; + } } } /** + * Used to sanitize any value before it is written into the DOM. This can be + * used to implement a security policy of allowed and disallowed values in + * order to prevent XSS attacks. + * + * One way of using this callback would be to check attributes and properties + * against a list of high risk fields, and require that values written to such + * fields be instances of a class which is safe by construction. Closure's Safe + * HTML Types is one implementation of this technique ( + * https://github.com/google/safe-html-types/blob/master/doc/safehtml-types.md). + * The TrustedTypes polyfill in API-only mode could also be used as a basis + * for this technique (https://github.com/WICG/trusted-types). + * + * @param node The HTML node (usually either a #text node or an Element) that + * is being written to. Note that this is just an exemplar node, the write + * may take place against another instance of the same class of node. + * @param name The name of an attribute or property (for example, 'href'). + * @param type Indicates whether the write that's about to be performed will + * be to a property or a node. + * @return A function that will sanitize this class of writes. + */ +export declare type SanitizerFactory = (node: Node, name: string, type: 'property' | 'attribute') => ValueSanitizer; +/** + * A function which can sanitize values that will be written to a specific kind + * of DOM sink. + * + * See SanitizerFactory. + * + * @param value The value to sanitize. Will be the actual value passed into + * the lit-html template literal, so this could be of any type. + * @return The value to write to the DOM. Usually the same as the input value, + * unless sanitization is needed. + */ +export declare type ValueSanitizer = (value: unknown) => unknown; +/** TemplateResult types */ +declare const HTML_RESULT = 1; +declare const SVG_RESULT = 2; +declare type ResultType = typeof HTML_RESULT | typeof SVG_RESULT; +declare const ATTRIBUTE_PART = 1; +declare const CHILD_PART = 2; +declare const ELEMENT_PART = 6; +declare const COMMENT_PART = 7; +/** + * The return type of the template tag functions. + */ +export declare type TemplateResult<T extends ResultType = ResultType> = { + ['_$litType$']: T; + strings: TemplateStringsArray; + values: unknown[]; +}; +export declare type HTMLTemplateResult = TemplateResult<typeof HTML_RESULT>; +export declare type SVGTemplateResult = TemplateResult<typeof SVG_RESULT>; +export interface CompiledTemplateResult { + ['_$litType$']: CompiledTemplate; + values: unknown[]; +} +export interface CompiledTemplate extends Omit<Template, 'el'> { + el?: HTMLTemplateElement; + h: TrustedHTML; +} +/** * Interprets a template literal as an HTML template that can efficiently * render to and update a container. + * + * ```ts + * const header = (title: string) => html`<h1>${title}</h1>`; + * ``` + * + * The `html` tag returns a description of the DOM to render as a value. It is + * lazy, meaning no work is done until the template is rendered. When rendering, + * if a template comes from the same expression as a previously rendered result, + * it's efficiently updated instead of replaced. */ -export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult; +export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult<1>; /** - * Interprets a template literal as an SVG template that can efficiently + * Interprets a template literal as an SVG fragment that can efficiently * render to and update a container. + * + * ```ts + * const rect = svg`<rect width="10" height="10"></rect>`; + * + * const myImage = html` + * <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> + * ${rect} + * </svg>`; + * ``` + * + * The `svg` *tag function* should only be used for SVG fragments, or elements + * that would be contained **inside** an `<svg>` HTML element. A common error is + * placing an `<svg>` *element* in a template tagged with the `svg` tag + * function. The `<svg>` element is an HTML element and should be used within a + * template tagged with the {@linkcode html} tag function. + * + * In LitElement usage, it's invalid to return an SVG fragment from the + * `render()` method, as the SVG fragment will be contained within the element's + * shadow root and thus cannot be used within an `<svg>` HTML element. */ -export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => SVGTemplateResult; +export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult<2>; +/** + * A sentinel value that signals that a value was handled by a directive and + * should not be written to the DOM. + */ +export declare const noChange: unique symbol; +/** + * A sentinel value that signals a ChildPart to fully clear its content. + * + * ```ts + * const button = html`${ + * user.isAdmin + * ? html`<button>DELETE</button>` + * : nothing + * }`; + * ``` + * + * Prefer using `nothing` over other falsy values as it provides a consistent + * behavior between various expression binding contexts. + * + * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the + * same and render no nodes. In attribute expressions, `nothing` _removes_ the + * attribute, while `undefined` and `null` will render an empty string. In + * property expressions `nothing` becomes `undefined`. + */ +export declare const nothing: unique symbol; +/** + * Object specifying options for controlling lit-html rendering. Note that + * while `render` may be called multiple times on the same `container` (and + * `renderBefore` reference node) to efficiently update the rendered content, + * only the options passed in during the first render are respected during + * the lifetime of renders to that unique `container` + `renderBefore` + * combination. + */ +export interface RenderOptions { + /** + * An object to use as the `this` value for event listeners. It's often + * useful to set this to the host component rendering a template. + */ + host?: object; + /** + * A DOM node before which to render content in the container. + */ + renderBefore?: ChildNode | null; + /** + * Node used for cloning the template (`importNode` will be called on this + * node). This controls the `ownerDocument` of the rendered DOM, along with + * any inherited context. Defaults to the global `document`. + */ + creationScope?: { + importNode(node: Node, deep?: boolean): Node; + }; + /** + * The initial connected state for the top-level part being rendered. If no + * `isConnected` option is set, `AsyncDirective`s will be connected by + * default. Set to `false` if the initial render occurs in a disconnected tree + * and `AsyncDirective`s should see `isConnected === false` for their initial + * render. The `part.setConnected()` method must be used subsequent to initial + * render to change the connected state of the part. + */ + isConnected?: boolean; +} +/** + * Renders a value, usually a lit-html TemplateResult, to the container. + * @param value + * @param container + * @param options + */ +export declare const render: { + (value: unknown, container: HTMLElement | DocumentFragment, options?: RenderOptions | undefined): RootPart; + setSanitizer: (newSanitizer: SanitizerFactory) => void; + createSanitizer: SanitizerFactory; + _testOnlyClearSanitizerFactoryDoNotCallOrElse: () => void; +}; +export interface DirectiveParent { + _$parent?: DirectiveParent; + _$isConnected: boolean; + __directive?: Directive; + __directives?: Array<Directive | undefined>; +} +declare class Template { + constructor({ strings, ['_$litType$']: type }: TemplateResult, options?: RenderOptions); + /** @nocollapse */ + static createElement(html: TrustedHTML, _options?: RenderOptions): HTMLTemplateElement; +} +export interface Disconnectable { + _$parent?: Disconnectable; + _$disconnectableChildren?: Set<Disconnectable>; + _$isConnected: boolean; +} +declare function resolveDirective(part: ChildPart | AttributePart | ElementPart, value: unknown, parent?: DirectiveParent, attributeIndex?: number): unknown; +/** + * An updateable instance of a Template. Holds references to the Parts used to + * update the template instance. + */ +declare class TemplateInstance implements Disconnectable { + constructor(template: Template, parent: ChildPart); + get parentNode(): Node; + get _$isConnected(): boolean; + _clone(options: RenderOptions | undefined): Node; + _update(values: Array<unknown>): void; +} +declare type AttributeTemplatePart = { + readonly type: typeof ATTRIBUTE_PART; + readonly index: number; + readonly name: string; +}; +declare type NodeTemplatePart = { + readonly type: typeof CHILD_PART; + readonly index: number; +}; +declare type ElementTemplatePart = { + readonly type: typeof ELEMENT_PART; + readonly index: number; +}; +declare type CommentTemplatePart = { + readonly type: typeof COMMENT_PART; + readonly index: number; +}; +/** + * A TemplatePart represents a dynamic part in a template, before the template + * is instantiated. When a template is instantiated Parts are created from + * TemplateParts. + */ +declare type TemplatePart = NodeTemplatePart | AttributeTemplatePart | ElementTemplatePart | CommentTemplatePart; +export declare type Part = ChildPart | AttributePart | PropertyPart | BooleanAttributePart | ElementPart | EventPart; +export type { ChildPart }; +declare class ChildPart implements Disconnectable { + readonly type = 2; + readonly options: RenderOptions | undefined; + _$committedValue: unknown; + private _textSanitizer; + get _$isConnected(): boolean; + constructor(startNode: ChildNode, endNode: ChildNode | null, parent: TemplateInstance | ChildPart | undefined, options: RenderOptions | undefined); + /** + * The parent node into which the part renders its content. + * + * A ChildPart's content consists of a range of adjacent child nodes of + * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and + * `.endNode`). + * + * - If both `.startNode` and `.endNode` are non-null, then the part's content + * consists of all siblings between `.startNode` and `.endNode`, exclusively. + * + * - If `.startNode` is non-null but `.endNode` is null, then the part's + * content consists of all siblings following `.startNode`, up to and + * including the last child of `.parentNode`. If `.endNode` is non-null, then + * `.startNode` will always be non-null. + * + * - If both `.endNode` and `.startNode` are null, then the part's content + * consists of all child nodes of `.parentNode`. + */ + get parentNode(): Node; + /** + * The part's leading marker node, if any. See `.parentNode` for more + * information. + */ + get startNode(): Node | null; + /** + * The part's trailing marker node, if any. See `.parentNode` for more + * information. + */ + get endNode(): Node | null; + _$setValue(value: unknown, directiveParent?: DirectiveParent): void; + private _insert; + private _commitNode; + private _commitText; + private _commitTemplateResult; + private _commitIterable; +} +/** + * A top-level `ChildPart` returned from `render` that manages the connected + * state of `AsyncDirective`s created throughout the tree below it. + */ +export interface RootPart extends ChildPart { + /** + * Sets the connection state for `AsyncDirective`s contained within this root + * ChildPart. + * + * lit-html does not automatically monitor the connectedness of DOM rendered; + * as such, it is the responsibility of the caller to `render` to ensure that + * `part.setConnected(false)` is called before the part object is potentially + * discarded, to ensure that `AsyncDirective`s have a chance to dispose of + * any resources being held. If a `RootPart` that was prevously + * disconnected is subsequently re-connected (and its `AsyncDirective`s should + * re-connect), `setConnected(true)` should be called. + * + * @param isConnected Whether directives within this tree should be connected + * or not + */ + setConnected(isConnected: boolean): void; +} +export type { AttributePart }; +declare class AttributePart implements Disconnectable { + readonly type: 1 | 3 | 4 | 5; + readonly element: HTMLElement; + readonly name: string; + readonly options: RenderOptions | undefined; + /** + * If this attribute part represents an interpolation, this contains the + * static strings of the interpolation. For single-value, complete bindings, + * this is undefined. + */ + readonly strings?: ReadonlyArray<string>; + protected _sanitizer: ValueSanitizer | undefined; + get tagName(): string; + get _$isConnected(): boolean; + constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined); +} +export type { PropertyPart }; +declare class PropertyPart extends AttributePart { + readonly type = 3; +} +export type { BooleanAttributePart }; +declare class BooleanAttributePart extends AttributePart { + readonly type = 4; +} +/** + * An AttributePart that manages an event listener via add/removeEventListener. + * + * This part works by adding itself as the event listener on an element, then + * delegating to the value passed to it. This reduces the number of calls to + * add/removeEventListener if the listener changes frequently, such as when an + * inline function is used as a listener. + * + * Because event options are passed when adding listeners, we must take case + * to add and remove the part as a listener when the event options change. + */ +export type { EventPart }; +declare class EventPart extends AttributePart { + readonly type = 5; + constructor(element: HTMLElement, name: string, strings: ReadonlyArray<string>, parent: Disconnectable, options: RenderOptions | undefined); + handleEvent(event: Event): void; +} +export type { ElementPart }; +declare class ElementPart implements Disconnectable { + element: Element; + readonly type = 6; + _$committedValue: undefined; + options: RenderOptions | undefined; + constructor(element: Element, parent: Disconnectable, options: RenderOptions | undefined); + get _$isConnected(): boolean; + _$setValue(value: unknown): void; +} +/** + * END USERS SHOULD NOT RELY ON THIS OBJECT. + * + * Private exports for use by other Lit packages, not intended for use by + * external users. + * + * We currently do not make a mangled rollup build of the lit-ssr code. In order + * to keep a number of (otherwise private) top-level exports mangled in the + * client side code, we export a _$LH object containing those members (or + * helper methods for accessing private fields of those members), and then + * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the + * client-side code is being used in `dev` mode or `prod` mode. + * + * This has a unique name, to disambiguate it from private exports in + * lit-element, which re-exports all of lit-html. + * + * @private + */ +export declare const _$LH: { + _boundAttributeSuffix: string; + _marker: string; + _markerMatch: string; + _HTML_RESULT: number; + _getTemplateHtml: (strings: TemplateStringsArray, type: ResultType) => [TrustedHTML, Array<string | undefined>]; + _TemplateInstance: typeof TemplateInstance; + _isIterable: (value: unknown) => value is Iterable<unknown>; + _resolveDirective: typeof resolveDirective; + _ChildPart: typeof ChildPart; + _AttributePart: typeof AttributePart; + _BooleanAttributePart: typeof BooleanAttributePart; + _EventPart: typeof EventPart; + _PropertyPart: typeof PropertyPart; + _ElementPart: typeof ElementPart; +}; //# sourceMappingURL=lit-html.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.js index f7413cf..9d7b94b 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.js +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/lit-html.js
@@ -1,59 +1,7 @@ /** * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause */ -/** - * - * Main lit-html module. - * - * Main exports: - * - * - [[html]] - * - [[svg]] - * - [[render]] - * - * @packageDocumentation - */ -/** - * Do not remove this comment; it keeps typedoc from misplacing the module - * docs. - */ -import { defaultTemplateProcessor } from './lib/default-template-processor.js'; -import { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { DefaultTemplateProcessor, defaultTemplateProcessor } from './lib/default-template-processor.js'; -export { directive, isDirective } from './lib/directive.js'; -// TODO(justinfagnani): remove line when we get NodePart moving methods -export { removeNodes, reparentNodes } from './lib/dom.js'; -export { noChange, nothing } from './lib/part.js'; -export { AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart } from './lib/parts.js'; -export { parts, render } from './lib/render.js'; -export { templateCaches, templateFactory } from './lib/template-factory.js'; -export { TemplateInstance } from './lib/template-instance.js'; -export { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { createMarker, isTemplatePartActive, Template } from './lib/template.js'; -// IMPORTANT: do not change the property name or the assignment expression. -// This line will be used in regexes to search for lit-html usage. -// TODO(justinfagnani): inject version number at build time -if (typeof window !== 'undefined') { - (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0'); -} -/** - * Interprets a template literal as an HTML template that can efficiently - * render to and update a container. - */ -export const html = (strings, ...values) => new TemplateResult(strings, values, 'html', defaultTemplateProcessor); -/** - * Interprets a template literal as an SVG template that can efficiently - * render to and update a container. - */ -export const svg = (strings, ...values) => new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor); -//# sourceMappingURL=lit-html.js.map \ No newline at end of file +var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea|title)$/i,p=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),$=p(1),y=p(2),b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T=new WeakMap,x=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,p=-1,$=0;for(;$<s.length&&(d.lastIndex=$,u=d.exec(s),null!==u);)$=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,p=-1):void 0===u[1]?p=-2:(p=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:p>=0?(l.push(o),s.slice(0,p)+"$lit$"+s.slice(p)+e+y):s+e+(-2===p?(l.push(void 0),i):y)}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==s?s.createHTML(u):u,l]};class E{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=E.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?H:"@"===i[1]?I:S})}else c.push({type:6,index:r})}for(const i of t)l.removeAttribute(i)}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h())}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else{let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1}r++}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return(null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=P(t,d._$AS(t,i.values),d,e)),i}class V{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new L(n,this,t)),this.v.push(i),d=e[++r]}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),r(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.k(t):u(t)?this.S(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}k(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==w&&r(this._$AH)?this._$AA.nextSibling.data=t:this.k(l.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=E.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new V(o,this),i=t.p(this.options);t.m(s),this.k(i),this._$AH=t}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new E(t)),i}S(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.M(h()),this.M(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===w?t=w:t!==w&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}n&&!e&&this.C(t)}C(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class M extends S{constructor(){super(...arguments),this.type=3}C(t){this.element[this.name]=t===w?void 0:t}}const k=i?i.emptyScript:"";class H extends S{constructor(){super(...arguments),this.type=4}C(t){t&&t!==w?this.element.setAttribute(this.name,k):this.element.removeAttribute(this.name)}}class I extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:w)===b)return;const e=this._$AH,o=t===w&&e!==w||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==w&&(e===w||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const R={L:"$lit$",P:e,V:o,I:1,N:C,R:V,j:u,D:P,H:N,F:S,O:H,W:I,B:M,Z:L},z=window.litHtmlPolyfillSupport;null==z||z(E,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.2.3");export{R as _$LH,$ as html,b as noChange,w as nothing,x as render,y as svg}; +//# sourceMappingURL=lit-html.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/package.json b/third_party/material_web_components/components-chromium/node_modules/lit-html/package.json index 9a55779..c84b29d 100644 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/package.json
@@ -1,84 +1,180 @@ { "name": "lit-html", - "version": "1.3.0", - "description": "HTML template literals in JavaScript", + "version": "2.2.3", + "description": "HTML templates literals in JavaScript", "license": "BSD-3-Clause", - "homepage": "https://lit-html.polymer-project.org/", - "repository": "Polymer/lit-html", - "type": "module", + "repository": { + "type": "git", + "url": "https://github.com/lit/lit.git", + "directory": "packages/lit-html" + }, + "author": "Google LLC", + "homepage": "https://lit.dev/", "main": "lit-html.js", - "module": "lit-html.js", - "typings": "lit-html.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "ts3.4/*" - ] + "type": "module", + "exports": { + ".": { + "development": "./development/lit-html.js", + "default": "./lit-html.js" + }, + "./async-directive.js": { + "development": "./development/async-directive.js", + "default": "./async-directive.js" + }, + "./directive-helpers.js": { + "development": "./development/directive-helpers.js", + "default": "./directive-helpers.js" + }, + "./directive.js": { + "development": "./development/directive.js", + "default": "./directive.js" + }, + "./directives/async-append.js": { + "development": "./development/directives/async-append.js", + "default": "./directives/async-append.js" + }, + "./directives/async-replace.js": { + "development": "./development/directives/async-replace.js", + "default": "./directives/async-replace.js" + }, + "./directives/cache.js": { + "development": "./development/directives/cache.js", + "default": "./directives/cache.js" + }, + "./directives/choose.js": { + "development": "./development/directives/choose.js", + "default": "./directives/choose.js" + }, + "./directives/class-map.js": { + "development": "./development/directives/class-map.js", + "default": "./directives/class-map.js" + }, + "./directives/guard.js": { + "development": "./development/directives/guard.js", + "default": "./directives/guard.js" + }, + "./directives/if-defined.js": { + "development": "./development/directives/if-defined.js", + "default": "./directives/if-defined.js" + }, + "./directives/join.js": { + "development": "./development/directives/join.js", + "default": "./directives/join.js" + }, + "./directives/keyed.js": { + "development": "./development/directives/keyed.js", + "default": "./directives/keyed.js" + }, + "./directives/live.js": { + "development": "./development/directives/live.js", + "default": "./directives/live.js" + }, + "./directives/map.js": { + "development": "./development/directives/map.js", + "default": "./directives/map.js" + }, + "./directives/range.js": { + "development": "./development/directives/range.js", + "default": "./directives/range.js" + }, + "./directives/ref.js": { + "development": "./development/directives/ref.js", + "default": "./directives/ref.js" + }, + "./directives/repeat.js": { + "development": "./development/directives/repeat.js", + "default": "./directives/repeat.js" + }, + "./directives/style-map.js": { + "development": "./development/directives/style-map.js", + "default": "./directives/style-map.js" + }, + "./directives/template-content.js": { + "development": "./development/directives/template-content.js", + "default": "./directives/template-content.js" + }, + "./directives/unsafe-html.js": { + "development": "./development/directives/unsafe-html.js", + "default": "./directives/unsafe-html.js" + }, + "./directives/unsafe-svg.js": { + "development": "./development/directives/unsafe-svg.js", + "default": "./directives/unsafe-svg.js" + }, + "./directives/until.js": { + "development": "./development/directives/until.js", + "default": "./directives/until.js" + }, + "./directives/when.js": { + "development": "./development/directives/when.js", + "default": "./directives/when.js" + }, + "./experimental-hydrate.js": { + "development": "./development/experimental-hydrate.js", + "default": "./experimental-hydrate.js" + }, + "./polyfill-support.js": { + "development": "./development/polyfill-support.js", + "default": "./polyfill-support.js" + }, + "./private-ssr-support.js": { + "development": "./development/private-ssr-support.js", + "default": "./private-ssr-support.js" + }, + "./static.js": { + "development": "./development/static.js", + "default": "./static.js" } }, - "directories": { - "test": "test" + "scripts": { + "build": "npm run clean && npm run build:ts && npm run build:version-stability-test && rollup -c", + "build:watch": "rollup -c --watch", + "build:ts": "tsc --build && treemirror development . '**/*.d.ts{,.map}'", + "build:ts:watch": "tsc --build --watch", + "build:version-stability-test": "rollup -c rollup-version-stability-test.config.js", + "check-version": "node scripts/check-version-tracker.js", + "checksize": "rollup -c --environment=CHECKSIZE", + "clean": "rm -rf {async-directive,directive-helpers,directive,experimental-hydrate,lit-html,polyfill-support,private-ssr-support,static}.{js,js.map,d.ts} test/ directives/ development/ version-stability-test/ *.tsbuildinfo", + "dev": "scripts/dev.sh", + "prepublishOnly": "npm run check-version", + "test": "npm run test:dev && npm run test:prod", + "test:dev": "cd ../tests && npx wtr '../lit-html/development/**/*_test.(js|html)'", + "test:prod": "MODE=prod npm run test:dev -- '../lit-html/src/test/version-stability_test.js'", + "test:watch": "npm run test:dev -- --watch" }, "files": [ - "/lit-html.js", - "/lit-html.js.map", - "/lit-html.d.ts", - "/lit-html.d.ts.map", - "/lib/", - "/directives/", - "/polyfills", - "/src/", - "/ts3.4/", - "!/src/test/" + "/async-directive.{d.ts,d.ts.map,js,js.map}", + "/directive-helpers.{d.ts,d.ts.map,js,js.map}", + "/directive.{d.ts,d.ts.map,js,js.map}", + "/experimental-hydrate.{d.ts,d.ts.map,js,js.map}", + "/lit-html.{d.ts,d.ts.map,js,js.map}", + "/polyfill-support.{d.ts,d.ts.map,js,js.map}", + "/private-ssr-support.{d.ts,d.ts.map,js,js.map}", + "/static.{d.ts,d.ts.map,js,js.map}", + "/development/", + "!/development/test/", + "/directives/" ], - "scripts": { - "build": "tsc && rm -rf ./ts3.4 && downlevel-dts . ts3.4 && cp tsconfig.json ./ts3.4/", - "checksize": "rollup -c ; cat lit-html.bundled.js | gzip -9 | wc -c ; rm lit-html.bundled.js", - "test": "npm run build && npm run lint && wct --npm", - "quicktest": "wct -l chrome -p --npm", - "format": "clang-format --version; find src test | grep '\\.js$\\|\\.ts$' | xargs clang-format --style=file -i", - "lint": "npm run lint:eslint", - "lint:eslint": "eslint 'src/**/*.{js,ts}'", - "prepublishOnly": "node check-version-tracker.cjs && npm run lint && npm test", - "prepare": "npm run build", - "publish-dev": "npm test && VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev" + "dependencies": { + "@types/trusted-types": "^2.0.2" }, - "author": "The Polymer Authors", - "dependencies": {}, "devDependencies": { - "@types/chai": "^4.1.0", - "@types/mocha": "^7.0.1", - "@types/trusted-types": "^1.0.1", - "@typescript-eslint/eslint-plugin": "^2.26.0", - "@typescript-eslint/parser": "^2.26.0", + "@esm-bundle/chai": "^4.1.5", + "@types/mocha": "^9.0.0", + "@types/web-ie11": "^0.0.0", + "@web/test-runner-mocha": "^0.7.4", "@webcomponents/shadycss": "^1.8.0", - "@webcomponents/webcomponentsjs": "^2.4.2", - "chai": "^4.1.2", - "chromedriver": "^84.0.1", - "clang-format": "~1.2.4", - "downlevel-dts": "^0.4.0", - "eslint": "^6.8.0", - "husky": "^4.2.0", - "lint-staged": "^10.1.0", - "lit-html-benchmarks": "^0.2.1", - "mocha": "^7.0.1", - "rollup": "^1.19.0", - "rollup-plugin-filesize": "^6.2.0", - "rollup-plugin-terser": "^5.2.0", - "tachometer": "^0.5.0", - "typescript": "~3.8.0", - "uglify-es": "^3.3.5", - "wct-mocha": "^1.1.0", - "web-component-tester": "^6.9.0" + "@webcomponents/template": "^1.4.4", + "@webcomponents/webcomponentsjs": "^2.6.0", + "chokidar-cli": "^3.0.0", + "concurrently": "^6.2.1", + "internal-scripts": "^1.0.0", + "mocha": "^9.1.1", + "rollup": "^2.70.2", + "typescript": "^4.3.5" }, - "husky": { - "hooks": { - "pre-commit": "lint-staged" - } - }, - "lint-staged": { - "src/**/*.{js,ts}": [ - "eslint --fix" - ] + "typings": "lit-html.d.ts", + "directories": { + "test": "test" } }
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.d.ts deleted file mode 100644 index 435bce6..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.d.ts +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * A lightweight <template> polyfill that supports minimum features to cover - * lit-html use cases. It provides an alternate route in case <template> is not - * natively supported. - * Please note that nested template, cloning template node and innerHTML getter - * do NOT work with this polyfill. - * If it can not fulfill your requirement, please consider using the full - * polyfill: https://github.com/webcomponents/template - */ -export declare const initTemplatePolyfill: (forced?: boolean) => void; -//# sourceMappingURL=template_polyfill.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.js deleted file mode 100644 index 76d5da9..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/polyfills/template_polyfill.js +++ /dev/null
@@ -1,60 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { removeNodes, reparentNodes } from '../lib/dom.js'; -/** - * A lightweight <template> polyfill that supports minimum features to cover - * lit-html use cases. It provides an alternate route in case <template> is not - * natively supported. - * Please note that nested template, cloning template node and innerHTML getter - * do NOT work with this polyfill. - * If it can not fulfill your requirement, please consider using the full - * polyfill: https://github.com/webcomponents/template - */ -export const initTemplatePolyfill = (forced = false) => { - // Minimal polyfills (like this one) may provide only a subset of Template's - // functionality. So, we explicitly check that at least content is present to - // prevent installing patching with multiple polyfills, which might happen if - // multiple versions of lit-html were included on a page. - if (!forced && 'content' in document.createElement('template')) { - return; - } - const contentDoc = document.implementation.createHTMLDocument('template'); - const body = contentDoc.body; - const descriptor = { - enumerable: true, - configurable: true, - }; - const upgrade = (template) => { - const content = contentDoc.createDocumentFragment(); - Object.defineProperties(template, { - content: Object.assign(Object.assign({}, descriptor), { get() { - return content; - } }), - innerHTML: Object.assign(Object.assign({}, descriptor), { set: function (text) { - body.innerHTML = text; - removeNodes(content, content.firstChild); - reparentNodes(content, body.firstChild); - } }), - }); - }; - const capturedCreateElement = Document.prototype.createElement; - Document.prototype.createElement = function createElement(tagName, options) { - const el = capturedCreateElement.call(this, tagName, options); - if (el.tagName === 'TEMPLATE') { - upgrade(el); - } - return el; - }; -}; -//# sourceMappingURL=template_polyfill.js.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/src/env.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/src/env.d.ts deleted file mode 100644 index b2cfd84..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/src/env.d.ts +++ /dev/null
@@ -1,20 +0,0 @@ -interface ShadyCSS { - nativeCss: boolean; - nativeShadow: boolean; - styleElement(host: Element, overrideProps?: {[key: string]: string}): void; - prepareTemplateDom(template: Element, elementName: string): void; - prepareTemplateStyles( - template: Element, elementName: string, typeExtension?: string): void; - ScopingShim: undefined|{ - prepareAdoptedCssText(cssTextArray: string[], elementName: string): void; - }; -} - -interface ShadyDOM { - inUse: boolean; -} - -interface Window { - ShadyCSS?: ShadyCSS; - ShadyDOM?: ShadyDOM; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/static.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/static.d.ts new file mode 100644 index 0000000..d07a7d96 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/static.d.ts
@@ -0,0 +1,82 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import { html as coreHtml, svg as coreSvg, TemplateResult } from './lit-html.js'; +interface StaticValue { + /** The value to interpolate as-is into the template. */ + _$litStatic$: string; + /** + * A value that can't be decoded from ordinary JSON, make it harder for + * a attacker-controlled data that goes through JSON.parse to produce a valid + * StaticValue. + */ + r: typeof brand; +} +/** + * Prevents JSON injection attacks. + * + * The goals of this brand: + * 1) fast to check + * 2) code is small on the wire + * 3) multiple versions of Lit in a single page will all produce mutually + * interoperable StaticValues + * 4) normal JSON.parse (without an unusual reviver) can not produce a + * StaticValue + * + * Symbols satisfy (1), (2), and (4). We use Symbol.for to satisfy (3), but + * we don't care about the key, so we break ties via (2) and use the empty + * string. + */ +declare const brand: unique symbol; +/** + * Wraps a string so that it behaves like part of the static template + * strings instead of a dynamic value. + * + * Users must take care to ensure that adding the static string to the template + * results in well-formed HTML, or else templates may break unexpectedly. + * + * Note that this function is unsafe to use on untrusted content, as it will be + * directly parsed into HTML. Do not pass user input to this function + * without sanitizing it. + * + * Static values can be changed, but they will cause a complete re-render + * since they effectively create a new template. + */ +export declare const unsafeStatic: (value: string) => StaticValue; +/** + * Tags a string literal so that it behaves like part of the static template + * strings instead of a dynamic value. + * + * The only values that may be used in template expressions are other tagged + * `literal` results or `unsafeStatic` values (note that untrusted content + * should never be passed to `unsafeStatic`). + * + * Users must take care to ensure that adding the static string to the template + * results in well-formed HTML, or else templates may break unexpectedly. + * + * Static values can be changed, but they will cause a complete re-render since + * they effectively create a new template. + */ +export declare const literal: (strings: TemplateStringsArray, ...values: unknown[]) => StaticValue; +/** + * Wraps a lit-html template tag (`html` or `svg`) to add static value support. + */ +export declare const withStatic: (coreTag: typeof coreHtml | typeof coreSvg) => (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult; +/** + * Interprets a template literal as an HTML template that can efficiently + * render to and update a container. + * + * Includes static value support from `lit-html/static.js`. + */ +export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult; +/** + * Interprets a template literal as an SVG template that can efficiently + * render to and update a container. + * + * Includes static value support from `lit-html/static.js`. + */ +export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult; +export {}; +//# sourceMappingURL=static.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/static.js b/third_party/material_web_components/components-chromium/node_modules/lit-html/static.js new file mode 100644 index 0000000..2d0bd45 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit-html/static.js
@@ -0,0 +1,7 @@ +import{html as t,svg as r}from'./lit-html.js'; +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const o=Symbol.for(""),e=t=>{var r,e;if((null===(r=t)||void 0===r?void 0:r.r)===o)return null===(e=t)||void 0===e?void 0:e._$litStatic$},i=t=>({_$litStatic$:t,r:o}),l=(t,...r)=>({_$litStatic$:r.reduce(((r,o,e)=>r+(t=>{if(void 0!==t._$litStatic$)return t._$litStatic$;throw Error(`Value passed to 'literal' function must be a 'literal' result: ${t}. Use 'unsafeStatic' to pass non-literal values, but\n take care to ensure page security.`)})(o)+t[e+1]),t[0]),r:o}),a=new Map,s=t=>(r,...o)=>{const i=o.length;let l,s;const n=[],u=[];let c,v=0,$=!1;for(;v<i;){for(c=r[v];v<i&&void 0!==(s=o[v],l=e(s));)c+=l+r[++v],$=!0;u.push(s),n.push(c),v++}if(v===i&&n.push(r[i]),$){const t=n.join("$$lit$$");void 0===(r=a.get(t))&&(n.raw=n,a.set(t,r=n)),o=u}return t(r,...o)},n=s(t),u=s(r);export{n as html,l as literal,u as svg,i as unsafeStatic,s as withStatic}; +//# sourceMappingURL=static.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-append.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-append.d.ts deleted file mode 100644 index a6091dd..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-append.d.ts +++ /dev/null
@@ -1,33 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * A directive that renders the items of an async iterable[1], appending new - * values after previous values, similar to the built-in support for iterables. - * - * Async iterables are objects with a [Symbol.asyncIterator] method, which - * returns an iterator who's `next()` method returns a Promise. When a new - * value is available, the Promise resolves and the value is appended to the - * Part controlled by the directive. If another value other than this - * directive has been set on the Part, the iterable will no longer be listened - * to and new values won't be written to the Part. - * - * [1]: https://github.com/tc39/proposal-async-iteration - * - * @param value An async iterable - * @param mapper An optional function that maps from (value, index) to another - * value. Useful for generating templates for each item in the iterable. - */ -export declare const asyncAppend: <T>(value: AsyncIterable<T>, mapper?: ((v: T, index?: number | undefined) => unknown) | undefined) => (part: Part) => Promise<void>; -//# sourceMappingURL=async-append.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-replace.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-replace.d.ts deleted file mode 100644 index 6027122..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/async-replace.d.ts +++ /dev/null
@@ -1,34 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * A directive that renders the items of an async iterable[1], replacing - * previous values with new values, so that only one value is ever rendered - * at a time. - * - * Async iterables are objects with a [Symbol.asyncIterator] method, which - * returns an iterator who's `next()` method returns a Promise. When a new - * value is available, the Promise resolves and the value is rendered to the - * Part controlled by the directive. If another value other than this - * directive has been set on the Part, the iterable will no longer be listened - * to and new values won't be written to the Part. - * - * [1]: https://github.com/tc39/proposal-async-iteration - * - * @param value An async iterable - * @param mapper An optional function that maps from (value, index) to another - * value. Useful for generating templates for each item in the iterable. - */ -export declare const asyncReplace: <T>(value: AsyncIterable<T>, mapper?: ((v: T, index?: number | undefined) => unknown) | undefined) => (part: Part) => Promise<void>; -//# sourceMappingURL=async-replace.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/cache.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/cache.d.ts deleted file mode 100644 index 299c040..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/cache.d.ts +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Enables fast switching between multiple templates by caching the DOM nodes - * and TemplateInstances produced by the templates. - * - * Example: - * - * ``` - * let checked = false; - * - * html` - * ${cache(checked ? html`input is checked` : html`input is not checked`)} - * ` - * ``` - */ -export declare const cache: (value: unknown) => (part: Part) => void; -//# sourceMappingURL=cache.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/class-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/class-map.d.ts deleted file mode 100644 index 2536852..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/class-map.d.ts +++ /dev/null
@@ -1,28 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -export interface ClassInfo { - readonly [name: string]: string | boolean | number; -} -/** - * A directive that applies CSS classes. This must be used in the `class` - * attribute and must be the only part used in the attribute. It takes each - * property in the `classInfo` argument and adds the property name to the - * element's `class` if the property value is truthy; if the property value is - * falsey, the property name is removed from the element's `class`. For example - * `{foo: bar}` applies the class `foo` if the value of `bar` is truthy. - * @param classInfo {ClassInfo} - */ -export declare const classMap: (classInfo: ClassInfo) => (part: Part) => void; -//# sourceMappingURL=class-map.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/guard.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/guard.d.ts deleted file mode 100644 index 0db5ff8..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/guard.d.ts +++ /dev/null
@@ -1,49 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Prevents re-render of a template function until a single value or an array of - * values changes. - * - * Example: - * - * ```js - * html` - * <div> - * ${guard([user.id, company.id], () => html`...`)} - * </div> - * ``` - * - * In this case, the template only renders if either `user.id` or `company.id` - * changes. - * - * guard() is useful with immutable data patterns, by preventing expensive work - * until data updates. - * - * Example: - * - * ```js - * html` - * <div> - * ${guard([immutableItems], () => immutableItems.map(i => html`${i}`))} - * </div> - * ``` - * - * In this case, items are mapped over only when the array reference changes. - * - * @param value the value to check before re-rendering - * @param f the template function - */ -export declare const guard: (value: unknown, f: () => unknown) => (part: Part) => void; -//# sourceMappingURL=guard.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/if-defined.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/if-defined.d.ts deleted file mode 100644 index 58b5fe8..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/if-defined.d.ts +++ /dev/null
@@ -1,22 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * For AttributeParts, sets the attribute if the value is defined and removes - * the attribute if the value is undefined. - * - * For other part types, this directive is a no-op. - */ -export declare const ifDefined: (value: unknown) => (part: Part) => void; -//# sourceMappingURL=if-defined.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/live.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/live.d.ts deleted file mode 100644 index 5fe2e8b6..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/live.d.ts +++ /dev/null
@@ -1,38 +0,0 @@ -/** - * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { AttributePart, BooleanAttributePart, PropertyPart } from '../lit-html.js'; -/** - * Checks binding values against live DOM values, instead of previously bound - * values, when determining whether to update the value. - * - * This is useful for cases where the DOM value may change from outside of - * lit-html, such as with a binding to an `<input>` element's `value` property, - * a content editable elements text, or to a custom element that changes it's - * own properties or attributes. - * - * In these cases if the DOM value changes, but the value set through lit-html - * bindings hasn't, lit-html won't know to update the DOM value and will leave - * it alone. If this is not what you want—if you want to overwrite the DOM - * value with the bound value no matter what—use the `live()` directive: - * - * html`<input .value=${live(x)}>` - * - * `live()` performs a strict equality check agains the live DOM value, and if - * the new value is equal to the live value, does nothing. This means that - * `live()` should not be used when the binding will cause a type conversion. If - * you use `live()` with an attribute binding, make sure that only strings are - * passed in, or the binding will update every render. - */ -export declare const live: (value: unknown) => (part: AttributePart | BooleanAttributePart | PropertyPart) => void; -//# sourceMappingURL=live.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/repeat.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/repeat.d.ts deleted file mode 100644 index ac7c1be..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/repeat.d.ts +++ /dev/null
@@ -1,37 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { DirectiveFn } from '../lib/directive.js'; -export declare type KeyFn<T> = (item: T, index: number) => unknown; -export declare type ItemTemplate<T> = (item: T, index: number) => unknown; -/** - * A directive that repeats a series of values (usually `TemplateResults`) - * generated from an iterable, and updates those items efficiently when the - * iterable changes based on user-provided `keys` associated with each item. - * - * Note that if a `keyFn` is provided, strict key-to-DOM mapping is maintained, - * meaning previous DOM for a given key is moved into the new position if - * needed, and DOM will never be reused with values for different keys (new DOM - * will always be created for new keys). This is generally the most efficient - * way to use `repeat` since it performs minimum unnecessary work for insertions - * and removals. - * - * IMPORTANT: If providing a `keyFn`, keys *must* be unique for all items in a - * given call to `repeat`. The behavior when two or more items have the same key - * is undefined. - * - * If no `keyFn` is provided, this directive will perform similar to mapping - * items to values, and DOM will be reused against potentially different items. - */ -export declare const repeat: <T>(items: Iterable<T>, keyFnOrTemplate: KeyFn<T> | ItemTemplate<T>, template?: ItemTemplate<T> | undefined) => DirectiveFn; -//# sourceMappingURL=repeat.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/style-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/style-map.d.ts deleted file mode 100644 index a4ac5b2..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/style-map.d.ts +++ /dev/null
@@ -1,36 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -export interface StyleInfo { - readonly [name: string]: string; -} -/** - * A directive that applies CSS properties to an element. - * - * `styleMap` can only be used in the `style` attribute and must be the only - * expression in the attribute. It takes the property names in the `styleInfo` - * object and adds the property values as CSS properties. Property names with - * dashes (`-`) are assumed to be valid CSS property names and set on the - * element's style object using `setProperty()`. Names without dashes are - * assumed to be camelCased JavaScript property names and set on the element's - * style object using property assignment, allowing the style object to - * translate JavaScript-style names to CSS property names. - * - * For example `styleMap({backgroundColor: 'red', 'border-top': '5px', '--size': - * '0'})` sets the `background-color`, `border-top` and `--size` properties. - * - * @param styleInfo {StyleInfo} - */ -export declare const styleMap: (styleInfo: StyleInfo) => (part: Part) => void; -//# sourceMappingURL=style-map.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/template-content.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/template-content.d.ts deleted file mode 100644 index 4124076..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/template-content.d.ts +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * @license - * Copyright (c) 2020 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Renders the content of a template element as HTML. - * - * Note, the template should be developer controlled and not user controlled. - * Rendering a user-controlled template with this directive - * could lead to cross-site-scripting vulnerabilities. - */ -export declare const templateContent: (template: HTMLTemplateElement) => (part: Part) => void; -//# sourceMappingURL=template-content.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-html.d.ts deleted file mode 100644 index 2a2723b..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-html.d.ts +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Renders the result as HTML, rather than text. - * - * Note, this is unsafe to use with any user-provided input that hasn't been - * sanitized or escaped, as it may lead to cross-site-scripting - * vulnerabilities. - */ -export declare const unsafeHTML: (value: unknown) => (part: Part) => void; -//# sourceMappingURL=unsafe-html.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-svg.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-svg.d.ts deleted file mode 100644 index 812904e4..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/unsafe-svg.d.ts +++ /dev/null
@@ -1,23 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Renders the result as SVG, rather than text. - * - * Note, this is unsafe to use with any user-provided input that hasn't been - * sanitized or escaped, as it may lead to cross-site-scripting - * vulnerabilities. - */ -export declare const unsafeSVG: (value: unknown) => (part: Part) => void; -//# sourceMappingURL=unsafe-svg.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/until.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/until.d.ts deleted file mode 100644 index a361576..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/directives/until.d.ts +++ /dev/null
@@ -1,35 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from '../lit-html.js'; -/** - * Renders one of a series of values, including Promises, to a Part. - * - * Values are rendered in priority order, with the first argument having the - * highest priority and the last argument having the lowest priority. If a - * value is a Promise, low-priority values will be rendered until it resolves. - * - * The priority of values can be used to create placeholder content for async - * data. For example, a Promise with pending content can be the first, - * highest-priority, argument, and a non_promise loading indicator template can - * be used as the second, lower-priority, argument. The loading indicator will - * render immediately, and the primary content will render when the Promise - * resolves. - * - * Example: - * - * const content = fetch('./content.txt').then(r => r.text()); - * html`${until(content, html`<span>Loading...</span>`)}` - */ -export declare const until: (...args: unknown[]) => (part: Part) => void; -//# sourceMappingURL=until.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/default-template-processor.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/default-template-processor.d.ts deleted file mode 100644 index 18e9ce1..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/default-template-processor.d.ts +++ /dev/null
@@ -1,39 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -import { TemplateProcessor } from './template-processor.js'; -/** - * Creates Parts when a template is instantiated. - */ -export declare class DefaultTemplateProcessor implements TemplateProcessor { - /** - * Create parts for an attribute-position binding, given the event, attribute - * name, and string literals. - * - * @param element The element containing the binding - * @param name The attribute name - * @param strings The string literals. There are always at least two strings, - * event for fully-controlled bindings with a single expression. - */ - handleAttributeExpressions(element: Element, name: string, strings: string[], options: RenderOptions): ReadonlyArray<Part>; - /** - * Create parts for a text-position binding. - * @param templateFactory - */ - handleTextExpression(options: RenderOptions): NodePart; -} -export declare const defaultTemplateProcessor: DefaultTemplateProcessor; -//# sourceMappingURL=default-template-processor.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/directive.d.ts deleted file mode 100644 index 7fa8a66..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/directive.d.ts +++ /dev/null
@@ -1,59 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -export declare type DirectiveFactory = (...args: any[]) => object; -export declare type DirectiveFn = (part: Part) => void; -/** - * Brands a function as a directive factory function so that lit-html will call - * the function during template rendering, rather than passing as a value. - * - * A _directive_ is a function that takes a Part as an argument. It has the - * signature: `(part: Part) => void`. - * - * A directive _factory_ is a function that takes arguments for data and - * configuration and returns a directive. Users of directive usually refer to - * the directive factory as the directive. For example, "The repeat directive". - * - * Usually a template author will invoke a directive factory in their template - * with relevant arguments, which will then return a directive function. - * - * Here's an example of using the `repeat()` directive factory that takes an - * array and a function to render an item: - * - * ```js - * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>` - * ``` - * - * When `repeat` is invoked, it returns a directive function that closes over - * `items` and the template function. When the outer template is rendered, the - * return directive function is called with the Part for the expression. - * `repeat` then performs it's custom logic to render multiple items. - * - * @param f The directive factory function. Must be a function that returns a - * function of the signature `(part: Part) => void`. The returned function will - * be called with the part object. - * - * @example - * - * import {directive, html} from 'lit-html'; - * - * const immutable = directive((v) => (part) => { - * if (part.value !== v) { - * part.setValue(v) - * } - * }); - */ -export declare const directive: <F extends DirectiveFactory>(f: F) => F; -export declare const isDirective: (o: unknown) => o is DirectiveFn; -//# sourceMappingURL=directive.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/dom.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/dom.d.ts deleted file mode 100644 index a0903cc9..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/dom.d.ts +++ /dev/null
@@ -1,29 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * True if the custom elements polyfill is in use. - */ -export declare const isCEPolyfill: boolean; -/** - * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive), - * into another container (could be the same container), before `before`. If - * `before` is null, it appends the nodes to the container. - */ -export declare const reparentNodes: (container: Node, start: Node | null, end?: Node | null, before?: Node | null) => void; -/** - * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from - * `container`. - */ -export declare const removeNodes: (container: Node, start: Node | null, end?: Node | null) => void; -//# sourceMappingURL=dom.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/modify-template.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/modify-template.d.ts deleted file mode 100644 index 5509b6e..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/modify-template.d.ts +++ /dev/null
@@ -1,38 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Template } from './template.js'; -/** - * Removes the list of nodes from a Template safely. In addition to removing - * nodes from the Template, the Template part indices are updated to match - * the mutated Template DOM. - * - * As the template is walked the removal state is tracked and - * part indices are adjusted as needed. - * - * div - * div#1 (remove) <-- start removing (removing node is div#1) - * div - * div#2 (remove) <-- continue removing (removing node is still div#1) - * div - * div <-- stop removing since previous sibling is the removing node (div#1, - * removed 4 nodes) - */ -export declare function removeNodesFromTemplate(template: Template, nodesToRemove: Set<Node>): void; -/** - * Inserts the given node into the Template, optionally before the given - * refNode. In addition to inserting the node into the Template, the Template - * part indices are updated to match the mutated Template DOM. - */ -export declare function insertNodeIntoTemplate(template: Template, node: Node, refNode?: Node | null): void; -//# sourceMappingURL=modify-template.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/part.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/part.d.ts deleted file mode 100644 index fd426e84..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/part.d.ts +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * The Part interface represents a dynamic part of a template instance rendered - * by lit-html. - */ -export interface Part { - readonly value: unknown; - /** - * Sets the current part value, but does not write it to the DOM. - * @param value The value that will be committed. - */ - setValue(value: unknown): void; - /** - * Commits the current part value, causing it to actually be written to the - * DOM. - * - * Directives are run at the start of `commit`, so that if they call - * `part.setValue(...)` synchronously that value will be used in the current - * commit, and there's no need to call `part.commit()` within the directive. - * If directives set a part value asynchronously, then they must call - * `part.commit()` manually. - */ - commit(): void; -} -/** - * A sentinel value that signals that a value was handled by a directive and - * should not be written to the DOM. - */ -export declare const noChange: {}; -/** - * A sentinel value that signals a NodePart to fully clear its content. - */ -export declare const nothing: {}; -//# sourceMappingURL=part.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/parts.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/parts.d.ts deleted file mode 100644 index 487f356..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/parts.d.ts +++ /dev/null
@@ -1,148 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { Part } from './part.js'; -import { RenderOptions } from './render-options.js'; -export declare type Primitive = null | undefined | boolean | number | string | symbol | bigint; -export declare const isPrimitive: (value: unknown) => value is Primitive; -export declare const isIterable: (value: unknown) => value is Iterable<unknown>; -/** - * Writes attribute values to the DOM for a group of AttributeParts bound to a - * single attribute. The value is only set once even if there are multiple parts - * for an attribute. - */ -export declare class AttributeCommitter { - readonly element: Element; - readonly name: string; - readonly strings: ReadonlyArray<string>; - readonly parts: ReadonlyArray<AttributePart>; - dirty: boolean; - constructor(element: Element, name: string, strings: ReadonlyArray<string>); - /** - * Creates a single part. Override this to create a differnt type of part. - */ - protected _createPart(): AttributePart; - protected _getValue(): unknown; - commit(): void; -} -/** - * A Part that controls all or part of an attribute value. - */ -export declare class AttributePart implements Part { - readonly committer: AttributeCommitter; - value: unknown; - constructor(committer: AttributeCommitter); - setValue(value: unknown): void; - commit(): void; -} -/** - * A Part that controls a location within a Node tree. Like a Range, NodePart - * has start and end locations and can set and update the Nodes between those - * locations. - * - * NodeParts support several value types: primitives, Nodes, TemplateResults, - * as well as arrays and iterables of those types. - */ -export declare class NodePart implements Part { - readonly options: RenderOptions; - startNode: Node; - endNode: Node; - value: unknown; - private __pendingValue; - constructor(options: RenderOptions); - /** - * Appends this part into a container. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendInto(container: Node): void; - /** - * Inserts this part after the `ref` node (between `ref` and `ref`'s next - * sibling). Both `ref` and its next sibling must be static, unchanging nodes - * such as those that appear in a literal section of a template. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterNode(ref: Node): void; - /** - * Appends this part into a parent part. - * - * This part must be empty, as its contents are not automatically moved. - */ - appendIntoPart(part: NodePart): void; - /** - * Inserts this part after the `ref` part. - * - * This part must be empty, as its contents are not automatically moved. - */ - insertAfterPart(ref: NodePart): void; - setValue(value: unknown): void; - commit(): void; - private __insert; - private __commitNode; - private __commitText; - private __commitTemplateResult; - private __commitIterable; - clear(startNode?: Node): void; -} -/** - * Implements a boolean attribute, roughly as defined in the HTML - * specification. - * - * If the value is truthy, then the attribute is present with a value of - * ''. If the value is falsey, the attribute is removed. - */ -export declare class BooleanAttributePart implements Part { - readonly element: Element; - readonly name: string; - readonly strings: readonly string[]; - value: unknown; - private __pendingValue; - constructor(element: Element, name: string, strings: readonly string[]); - setValue(value: unknown): void; - commit(): void; -} -/** - * Sets attribute values for PropertyParts, so that the value is only set once - * even if there are multiple parts for a property. - * - * If an expression controls the whole property value, then the value is simply - * assigned to the property under control. If there are string literals or - * multiple expressions, then the strings are expressions are interpolated into - * a string first. - */ -export declare class PropertyCommitter extends AttributeCommitter { - readonly single: boolean; - constructor(element: Element, name: string, strings: ReadonlyArray<string>); - protected _createPart(): PropertyPart; - protected _getValue(): unknown; - commit(): void; -} -export declare class PropertyPart extends AttributePart { -} -declare type EventHandlerWithOptions = EventListenerOrEventListenerObject & Partial<AddEventListenerOptions>; -export declare class EventPart implements Part { - readonly element: Element; - readonly eventName: string; - readonly eventContext?: EventTarget; - value: undefined | EventHandlerWithOptions; - private __options?; - private __pendingValue; - private readonly __boundHandleEvent; - constructor(element: Element, eventName: string, eventContext?: EventTarget); - setValue(value: undefined | EventHandlerWithOptions): void; - commit(): void; - handleEvent(event: Event): void; -} -export {}; -//# sourceMappingURL=parts.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render-options.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render-options.d.ts deleted file mode 100644 index 4ab48928..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render-options.d.ts +++ /dev/null
@@ -1,19 +0,0 @@ -/** - * @license - * Copyright (c) 2018 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateFactory } from './template-factory.js'; -export interface RenderOptions { - readonly templateFactory: TemplateFactory; - readonly eventContext?: EventTarget; -} -//# sourceMappingURL=render-options.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render.d.ts deleted file mode 100644 index 2364971..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/render.d.ts +++ /dev/null
@@ -1,33 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -export declare const parts: WeakMap<Node, NodePart>; -/** - * Renders a template result or other value to a container. - * - * To update a container with new values, reevaluate the template literal and - * call `render` with the new result. - * - * @param result Any value renderable by NodePart - typically a TemplateResult - * created by evaluating a template tag like `html` or `svg`. - * @param container A DOM parent to render to. The entire contents are either - * replaced, or efficiently updated if the same result type was previous - * rendered there. - * @param options RenderOptions for the entire render tree rendered to this - * container. Render options must *not* change between renders to the same - * container, as those changes will not effect previously rendered DOM. - */ -export declare const render: (result: unknown, container: Element | DocumentFragment, options?: Partial<RenderOptions> | undefined) => void; -//# sourceMappingURL=render.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/shady-render.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/shady-render.d.ts deleted file mode 100644 index 76ec13ee..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/shady-render.d.ts +++ /dev/null
@@ -1,83 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { RenderOptions } from './render-options.js'; -import { TemplateResult } from './template-result.js'; -import { Template } from './template.js'; -export { html, svg, TemplateResult } from '../lit-html.js'; -/** - * Template factory which scopes template DOM using ShadyCSS. - * @param scopeName {string} - */ -export declare const shadyTemplateFactory: (scopeName: string) => (result: TemplateResult) => Template; -export interface ShadyRenderOptions extends Partial<RenderOptions> { - scopeName: string; -} -/** - * Extension to the standard `render` method which supports rendering - * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom) - * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used - * or when the webcomponentsjs - * (https://github.com/webcomponents/webcomponentsjs) polyfill is used. - * - * Adds a `scopeName` option which is used to scope element DOM and stylesheets - * when native ShadowDOM is unavailable. The `scopeName` will be added to - * the class attribute of all rendered DOM. In addition, any style elements will - * be automatically re-written with this `scopeName` selector and moved out - * of the rendered DOM and into the document `<head>`. - * - * It is common to use this render method in conjunction with a custom element - * which renders a shadowRoot. When this is done, typically the element's - * `localName` should be used as the `scopeName`. - * - * In addition to DOM scoping, ShadyCSS also supports a basic shim for css - * custom properties (needed only on older browsers like IE11) and a shim for - * a deprecated feature called `@apply` that supports applying a set of css - * custom properties to a given location. - * - * Usage considerations: - * - * * Part values in `<style>` elements are only applied the first time a given - * `scopeName` renders. Subsequent changes to parts in style elements will have - * no effect. Because of this, parts in style elements should only be used for - * values that will never change, for example parts that set scope-wide theme - * values or parts which render shared style elements. - * - * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a - * custom element's `constructor` is not supported. Instead rendering should - * either done asynchronously, for example at microtask timing (for example - * `Promise.resolve()`), or be deferred until the first time the element's - * `connectedCallback` runs. - * - * Usage considerations when using shimmed custom properties or `@apply`: - * - * * Whenever any dynamic changes are made which affect - * css custom properties, `ShadyCSS.styleElement(element)` must be called - * to update the element. There are two cases when this is needed: - * (1) the element is connected to a new parent, (2) a class is added to the - * element that causes it to match different custom properties. - * To address the first case when rendering a custom element, `styleElement` - * should be called in the element's `connectedCallback`. - * - * * Shimmed custom properties may only be defined either for an entire - * shadowRoot (for example, in a `:host` rule) or via a rule that directly - * matches an element with a shadowRoot. In other words, instead of flowing from - * parent to child as do native css custom properties, shimmed custom properties - * flow only from shadowRoots to nested shadowRoots. - * - * * When using `@apply` mixing css shorthand property names with - * non-shorthand names (for example `border` and `border-width`) is not - * supported. - */ -export declare const render: (result: unknown, container: Element | DocumentFragment | ShadowRoot, options: ShadyRenderOptions) => void; -//# sourceMappingURL=shady-render.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-factory.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-factory.d.ts deleted file mode 100644 index 85edad3a..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-factory.d.ts +++ /dev/null
@@ -1,57 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateResult } from './template-result.js'; -import { Template } from './template.js'; -/** - * A function type that creates a Template from a TemplateResult. - * - * This is a hook into the template-creation process for rendering that - * requires some modification of templates before they're used, like ShadyCSS, - * which must add classes to elements and remove styles. - * - * Templates should be cached as aggressively as possible, so that many - * TemplateResults produced from the same expression only do the work of - * creating the Template the first time. - * - * Templates are usually cached by TemplateResult.strings and - * TemplateResult.type, but may be cached by other keys if this function - * modifies the template. - * - * Note that currently TemplateFactories must not add, remove, or reorder - * expressions, because there is no way to describe such a modification - * to render() so that values are interpolated to the correct place in the - * template instances. - */ -export declare type TemplateFactory = (result: TemplateResult) => Template; -/** - * The default TemplateFactory which caches Templates keyed on - * result.type and result.strings. - */ -export declare function templateFactory(result: TemplateResult): Template; -/** - * The first argument to JS template tags retain identity across multiple - * calls to a tag for the same literal, so we can cache work done per literal - * in a Map. - * - * Safari currently has a bug which occasionally breaks this behavior, so we - * need to cache the Template at two levels. We first cache the - * TemplateStringsArray, and if that fails, we cache a key constructed by - * joining the strings array. - */ -export interface TemplateCache { - readonly stringsArray: WeakMap<TemplateStringsArray, Template>; - readonly keyString: Map<string, Template>; -} -export declare const templateCaches: Map<string, TemplateCache>; -//# sourceMappingURL=template-factory.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-instance.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-instance.d.ts deleted file mode 100644 index 5f8c60f6..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-instance.d.ts +++ /dev/null
@@ -1,30 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { RenderOptions } from './render-options.js'; -import { TemplateProcessor } from './template-processor.js'; -import { Template } from './template.js'; -/** - * An instance of a `Template` that can be attached to the DOM and updated - * with new values. - */ -export declare class TemplateInstance { - private readonly __parts; - readonly processor: TemplateProcessor; - readonly options: RenderOptions; - readonly template: Template; - constructor(template: Template, processor: TemplateProcessor, options: RenderOptions); - update(values: readonly unknown[]): void; - _clone(): DocumentFragment; -} -//# sourceMappingURL=template-instance.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-processor.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-processor.d.ts deleted file mode 100644 index 85bab88..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-processor.d.ts +++ /dev/null
@@ -1,46 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * @module lit-html - */ -import { Part } from './part.js'; -import { NodePart } from './parts.js'; -import { RenderOptions } from './render-options.js'; -export interface TemplateProcessor { - /** - * Create parts for an attribute-position binding, given the element, - * attribute name, and string literals. - * - * @param element The element containing the binding - * @param name The attribute name, including a possible prefix. The name may - * be prefixed by `.` (for a property binding), `@` (for an event binding) - * or - * `?` (for a boolean attribute binding). - * @param strings The array of literal strings that form the static part of - * the - * attribute value. There are always at least two strings, - * even for fully-controlled bindings with a single expression. For example, - * for the binding `attr="${e1}-${e2}"`, the `strings` array includes three - * strings (`['', '-', '']`)—the text _before_ the first expression (the - * empty string), the text between the two expressions (`'-'`), and the text - * after the last expression (another empty string). - */ - handleAttributeExpressions(element: Element, name: string, strings: ReadonlyArray<string>, options: RenderOptions): ReadonlyArray<Part>; - /** - * Create parts for a text-position binding. - * @param partOptions - */ - handleTextExpression(options: RenderOptions): NodePart; -} -//# sourceMappingURL=template-processor.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-result.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-result.d.ts deleted file mode 100644 index 7c15b5d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template-result.d.ts +++ /dev/null
@@ -1,42 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateProcessor } from './template-processor.js'; -/** - * The return type of `html`, which holds a Template and the values from - * interpolated expressions. - */ -export declare class TemplateResult { - readonly strings: TemplateStringsArray; - readonly values: readonly unknown[]; - readonly type: string; - readonly processor: TemplateProcessor; - constructor(strings: TemplateStringsArray, values: readonly unknown[], type: string, processor: TemplateProcessor); - /** - * Returns a string of HTML used to create a `<template>` element. - */ - getHTML(): string; - getTemplateElement(): HTMLTemplateElement; -} -/** - * A TemplateResult for SVG fragments. - * - * This class wraps HTML in an `<svg>` tag in order to parse its contents in the - * SVG namespace, then modifies the template to remove the `<svg>` tag so that - * clones only container the original fragment. - */ -export declare class SVGTemplateResult extends TemplateResult { - getHTML(): string; - getTemplateElement(): HTMLTemplateElement; -} -//# sourceMappingURL=template-result.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template.d.ts deleted file mode 100644 index d21a2de5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lib/template.d.ts +++ /dev/null
@@ -1,92 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { TemplateResult } from './template-result.js'; -/** - * An expression marker with embedded unique key to avoid collision with - * possible text in templates. - */ -export declare const marker: string; -/** - * An expression marker used text-positions, multi-binding attributes, and - * attributes with markup-like text values. - */ -export declare const nodeMarker: string; -export declare const markerRegex: RegExp; -/** - * Suffix appended to all bound attribute names. - */ -export declare const boundAttributeSuffix = "$lit$"; -/** - * An updatable Template that tracks the location of dynamic parts. - */ -export declare class Template { - readonly parts: TemplatePart[]; - readonly element: HTMLTemplateElement; - constructor(result: TemplateResult, element: HTMLTemplateElement); -} -/** - * A placeholder for a dynamic expression in an HTML template. - * - * There are two built-in part types: AttributePart and NodePart. NodeParts - * always represent a single dynamic expression, while AttributeParts may - * represent as many expressions are contained in the attribute. - * - * A Template's parts are mutable, so parts can be replaced or modified - * (possibly to implement different template semantics). The contract is that - * parts can only be replaced, not removed, added or reordered, and parts must - * always consume the correct number of values in their `update()` method. - * - * TODO(justinfagnani): That requirement is a little fragile. A - * TemplateInstance could instead be more careful about which values it gives - * to Part.update(). - */ -export declare type TemplatePart = { - readonly type: 'node'; - index: number; -} | { - readonly type: 'attribute'; - index: number; - readonly name: string; - readonly strings: ReadonlyArray<string>; -}; -export declare const isTemplatePartActive: (part: TemplatePart) => boolean; -export declare const createMarker: () => Comment; -/** - * This regex extracts the attribute name preceding an attribute-position - * expression. It does this by matching the syntax allowed for attributes - * against the string literal directly preceding the expression, assuming that - * the expression is in an attribute-value position. - * - * See attributes in the HTML spec: - * https://www.w3.org/TR/html5/syntax.html#elements-attributes - * - * " \x09\x0a\x0c\x0d" are HTML space characters: - * https://www.w3.org/TR/html5/infrastructure.html#space-characters - * - * "\0-\x1F\x7F-\x9F" are Unicode control characters, which includes every - * space character except " ". - * - * So an attribute is: - * * The name: any character except a control character, space character, ('), - * ("), ">", "=", or "/" - * * Followed by zero or more space characters - * * Followed by "=" - * * Followed by zero or more space characters - * * Followed by: - * * Any character except space, ('), ("), "<", ">", "=", (`), or - * * (") then any non-("), or - * * (') then any non-(') - */ -export declare const lastAttributeNameRegex: RegExp; -//# sourceMappingURL=template.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lit-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lit-html.d.ts deleted file mode 100644 index f289b1d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/lit-html.d.ts +++ /dev/null
@@ -1,42 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -import { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { DefaultTemplateProcessor, defaultTemplateProcessor } from './lib/default-template-processor.js'; -export { directive, DirectiveFn, isDirective } from './lib/directive.js'; -export { removeNodes, reparentNodes } from './lib/dom.js'; -export { noChange, nothing, Part } from './lib/part.js'; -export { AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart } from './lib/parts.js'; -export { RenderOptions } from './lib/render-options.js'; -export { parts, render } from './lib/render.js'; -export { templateCaches, templateFactory } from './lib/template-factory.js'; -export { TemplateInstance } from './lib/template-instance.js'; -export { TemplateProcessor } from './lib/template-processor.js'; -export { SVGTemplateResult, TemplateResult } from './lib/template-result.js'; -export { createMarker, isTemplatePartActive, Template } from './lib/template.js'; -declare global { - interface Window { - litHtmlVersions: string[]; - } -} -/** - * Interprets a template literal as an HTML template that can efficiently - * render to and update a container. - */ -export declare const html: (strings: TemplateStringsArray, ...values: unknown[]) => TemplateResult; -/** - * Interprets a template literal as an SVG template that can efficiently - * render to and update a container. - */ -export declare const svg: (strings: TemplateStringsArray, ...values: unknown[]) => SVGTemplateResult; -//# sourceMappingURL=lit-html.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/polyfills/template_polyfill.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/polyfills/template_polyfill.d.ts deleted file mode 100644 index 70834e8..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/polyfills/template_polyfill.d.ts +++ /dev/null
@@ -1,24 +0,0 @@ -/** - * @license - * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. - * This code may only be used under the BSD style license found at - * http://polymer.github.io/LICENSE.txt - * The complete set of authors may be found at - * http://polymer.github.io/AUTHORS.txt - * The complete set of contributors may be found at - * http://polymer.github.io/CONTRIBUTORS.txt - * Code distributed by Google as part of the polymer project is also - * subject to an additional IP rights grant found at - * http://polymer.github.io/PATENTS.txt - */ -/** - * A lightweight <template> polyfill that supports minimum features to cover - * lit-html use cases. It provides an alternate route in case <template> is not - * natively supported. - * Please note that nested template, cloning template node and innerHTML getter - * do NOT work with this polyfill. - * If it can not fulfill your requirement, please consider using the full - * polyfill: https://github.com/webcomponents/template - */ -export declare const initTemplatePolyfill: (forced?: boolean) => void; -//# sourceMappingURL=template_polyfill.d.ts.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/src/env.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/src/env.d.ts deleted file mode 100644 index 0626297..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/src/env.d.ts +++ /dev/null
@@ -1,19 +0,0 @@ -interface ShadyCSS { - nativeCss: boolean; - nativeShadow: boolean; - styleElement(host: Element, overrideProps?: { - [key: string]: string; - }): void; - prepareTemplateDom(template: Element, elementName: string): void; - prepareTemplateStyles(template: Element, elementName: string, typeExtension?: string): void; - ScopingShim: undefined | { - prepareAdoptedCssText(cssTextArray: string[], elementName: string): void; - }; -} -interface ShadyDOM { - inUse: boolean; -} -interface Window { - ShadyCSS?: ShadyCSS; - ShadyDOM?: ShadyDOM; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/tsconfig.json b/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/tsconfig.json deleted file mode 100644 index b1c49fb2..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/lit-html/ts3.4/tsconfig.json +++ /dev/null
@@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "es2017", - "module": "es2015", - "lib": ["es2017", "esnext.asynciterable", "dom"], - "types": ["chai", "mocha", "trusted-types"], - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "inlineSources": true, - "outDir": "./", - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitThis": true - }, - "include": [ - "src/**/*.ts" - ], - "exclude": [] -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/LICENSE b/third_party/material_web_components/components-chromium/node_modules/lit/LICENSE new file mode 100644 index 0000000..be7a97b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/LICENSE
@@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2017 Google LLC. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.d.ts new file mode 100644 index 0000000..a73d627 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/async-directive.js'; +//# sourceMappingURL=async-directive.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.js b/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.js new file mode 100644 index 0000000..6cc3b88c --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/async-directive.js
@@ -0,0 +1,2 @@ +export*from'../lit-html/async-directive.js'; +//# sourceMappingURL=async-directive.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/decorators.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/decorators.d.ts new file mode 100644 index 0000000..685de40 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/decorators.d.ts
@@ -0,0 +1,15 @@ +/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from '@lit/reactive-element/decorators/custom-element.js'; +export * from '@lit/reactive-element/decorators/property.js'; +export * from '@lit/reactive-element/decorators/state.js'; +export * from '@lit/reactive-element/decorators/event-options.js'; +export * from '@lit/reactive-element/decorators/query.js'; +export * from '@lit/reactive-element/decorators/query-all.js'; +export * from '@lit/reactive-element/decorators/query-async.js'; +export * from '@lit/reactive-element/decorators/query-assigned-elements.js'; +export * from '@lit/reactive-element/decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/decorators.js b/third_party/material_web_components/components-chromium/node_modules/lit/decorators.js new file mode 100644 index 0000000..98dc27a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/decorators.js
@@ -0,0 +1,2 @@ +export*from'../@lit/reactive-element/decorators/custom-element.js';export*from'../@lit/reactive-element/decorators/property.js';export*from'../@lit/reactive-element/decorators/state.js';export*from'../@lit/reactive-element/decorators/event-options.js';export*from'../@lit/reactive-element/decorators/query.js';export*from'../@lit/reactive-element/decorators/query-all.js';export*from'../@lit/reactive-element/decorators/query-async.js';export*from'../@lit/reactive-element/decorators/query-assigned-elements.js';export*from'../@lit/reactive-element/decorators/query-assigned-nodes.js'; +//# sourceMappingURL=decorators.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.d.ts new file mode 100644 index 0000000..58c1e0674 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directive-helpers.js'; +//# sourceMappingURL=directive-helpers.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.js b/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.js new file mode 100644 index 0000000..926f9d4 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directive-helpers.js
@@ -0,0 +1,2 @@ +export*from'../lit-html/directive-helpers.js'; +//# sourceMappingURL=directive-helpers.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directive.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directive.d.ts new file mode 100644 index 0000000..463d477 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directive.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directive.js'; +//# sourceMappingURL=directive.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directive.js b/third_party/material_web_components/components-chromium/node_modules/lit/directive.js new file mode 100644 index 0000000..bf36e5d --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directive.js
@@ -0,0 +1,2 @@ +export*from'../lit-html/directive.js'; +//# sourceMappingURL=directive.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.d.ts new file mode 100644 index 0000000..529b312 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/async-append.js'; +//# sourceMappingURL=async-append.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.js new file mode 100644 index 0000000..fc3f217f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-append.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/async-append.js'; +//# sourceMappingURL=async-append.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.d.ts new file mode 100644 index 0000000..71361d8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/async-replace.js'; +//# sourceMappingURL=async-replace.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.js new file mode 100644 index 0000000..c3ccd95 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/async-replace.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/async-replace.js'; +//# sourceMappingURL=async-replace.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.d.ts new file mode 100644 index 0000000..fdc2c74 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/cache.js'; +//# sourceMappingURL=cache.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.js new file mode 100644 index 0000000..062e68c8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/cache.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/cache.js'; +//# sourceMappingURL=cache.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.d.ts new file mode 100644 index 0000000..7a88e70c --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/choose.js'; +//# sourceMappingURL=choose.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.js new file mode 100644 index 0000000..f56fb00 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/choose.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/choose.js'; +//# sourceMappingURL=choose.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.d.ts new file mode 100644 index 0000000..a0561c6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/class-map.js'; +//# sourceMappingURL=class-map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.js new file mode 100644 index 0000000..bb84f4a --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/class-map.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/class-map.js'; +//# sourceMappingURL=class-map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.d.ts new file mode 100644 index 0000000..80abe98 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/guard.js'; +//# sourceMappingURL=guard.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.js new file mode 100644 index 0000000..b342608d --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/guard.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/guard.js'; +//# sourceMappingURL=guard.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.d.ts new file mode 100644 index 0000000..089cef0e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/if-defined.js'; +//# sourceMappingURL=if-defined.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.js new file mode 100644 index 0000000..d72baa6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/if-defined.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/if-defined.js'; +//# sourceMappingURL=if-defined.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.d.ts new file mode 100644 index 0000000..244bd8afe --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/join.js'; +//# sourceMappingURL=join.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.js new file mode 100644 index 0000000..7436fa1 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/join.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/join.js'; +//# sourceMappingURL=join.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.d.ts new file mode 100644 index 0000000..e6ae1ad --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/keyed.js'; +//# sourceMappingURL=keyed.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.js new file mode 100644 index 0000000..0a3612e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/keyed.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/keyed.js'; +//# sourceMappingURL=keyed.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.d.ts new file mode 100644 index 0000000..aae6024 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/live.js'; +//# sourceMappingURL=live.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.js new file mode 100644 index 0000000..50be4ed6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/live.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/live.js'; +//# sourceMappingURL=live.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.d.ts new file mode 100644 index 0000000..28f094e6 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/map.js'; +//# sourceMappingURL=map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.js new file mode 100644 index 0000000..1ff16e31 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/map.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/map.js'; +//# sourceMappingURL=map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.d.ts new file mode 100644 index 0000000..1d7a9cacd --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/range.js'; +//# sourceMappingURL=range.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.js new file mode 100644 index 0000000..ae52eafc --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/range.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/range.js'; +//# sourceMappingURL=range.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.d.ts new file mode 100644 index 0000000..fb2b33e --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/ref.js'; +//# sourceMappingURL=ref.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.js new file mode 100644 index 0000000..25ff48c --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/ref.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/ref.js'; +//# sourceMappingURL=ref.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.d.ts new file mode 100644 index 0000000..8e91a0e8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/repeat.js'; +//# sourceMappingURL=repeat.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.js new file mode 100644 index 0000000..912b0b56 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/repeat.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/repeat.js'; +//# sourceMappingURL=repeat.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.d.ts new file mode 100644 index 0000000..da4aa25 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/style-map.js'; +//# sourceMappingURL=style-map.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.js new file mode 100644 index 0000000..d59a04f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/style-map.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/style-map.js'; +//# sourceMappingURL=style-map.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.d.ts new file mode 100644 index 0000000..3e3af1ba --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/template-content.js'; +//# sourceMappingURL=template-content.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.js new file mode 100644 index 0000000..5734c840 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/template-content.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/template-content.js'; +//# sourceMappingURL=template-content.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.d.ts new file mode 100644 index 0000000..5c51191 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/unsafe-html.js'; +//# sourceMappingURL=unsafe-html.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.js new file mode 100644 index 0000000..c87f127 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-html.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/unsafe-html.js'; +//# sourceMappingURL=unsafe-html.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.d.ts new file mode 100644 index 0000000..14af030 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/unsafe-svg.js'; +//# sourceMappingURL=unsafe-svg.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.js new file mode 100644 index 0000000..652b7246 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/unsafe-svg.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/unsafe-svg.js'; +//# sourceMappingURL=unsafe-svg.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.d.ts new file mode 100644 index 0000000..a8856bf --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/until.js'; +//# sourceMappingURL=until.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.js new file mode 100644 index 0000000..f4b276b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/until.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/until.js'; +//# sourceMappingURL=until.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.d.ts new file mode 100644 index 0000000..dbfffda7 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/directives/when.js'; +//# sourceMappingURL=when.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.js b/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.js new file mode 100644 index 0000000..78e209b --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/directives/when.js
@@ -0,0 +1,2 @@ +export*from'../../lit-html/directives/when.js'; +//# sourceMappingURL=when.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/html.d.ts new file mode 100644 index 0000000..b9ba1f8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/html.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html'; +//# sourceMappingURL=html.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/html.js b/third_party/material_web_components/components-chromium/node_modules/lit/html.js new file mode 100644 index 0000000..e609c9f --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/html.js
@@ -0,0 +1,2 @@ +export*from'../lit-html/lit-html.js'; +//# sourceMappingURL=html.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/index.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/index.d.ts new file mode 100644 index 0000000..42230b5 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/index.d.ts
@@ -0,0 +1,9 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +import '@lit/reactive-element'; +import 'lit-html'; +export * from 'lit-element/lit-element.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/index.js b/third_party/material_web_components/components-chromium/node_modules/lit/index.js new file mode 100644 index 0000000..370ad00 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/index.js
@@ -0,0 +1,2 @@ +import'../@lit/reactive-element/reactive-element.js';import'../lit-html/lit-html.js';export*from'../lit-element/lit-element.js'; +//# sourceMappingURL=index.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/logo.svg b/third_party/material_web_components/components-chromium/node_modules/lit/logo.svg new file mode 100644 index 0000000..a09b15c --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/logo.svg
@@ -0,0 +1,18 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 425 200"> + <view id="flame" viewBox="0 0 160 200" /> + <view id="name" viewBox="240 78 185 122" /> + + <path d="M394.5 78v28.8H425v15.6h-30.5V158c0 3.6.1 7.2.5 10.3.8 5.3 4 10.5 8.4 12.5 5.7 2.6 9.7 2.1 21.6 1.7l-2.9 17.2c-.8.4-4 .3-7 .3-7 0-33.4 2.5-38.8-24.7-.9-4.7-.7-9.5-.7-16.9v-35.8H362l.2-15.9h13.4V78zm-51.7 28.7v91.5H324v-91.5zm0-28.7v16.3h-19V78zm-83.6 102.2h48.2l-18 18H240V78h19.2z"/> + + <path fill="#324fff" d="M0 80v80a70.3 70.3 0 0040-40z"/> + <path fill="#283198" d="M40 120c5.7 27.3 5.3 47 0 80L0 160z"/> + <path fill="#0ff" d="M40 120v80l40-40a149.9 149.9 0 00-40-40z"/> + <path fill="#324fff" d="M80 0v80S48.3 55.7 40 40z"/> + <path fill="#324fff" d="M40 40v80a84.8 84.8 0 0040-40z"/> + <path fill="#00e8ff" d="M80 80a182 182 0 010 80l-40-40z"/> + <path fill="#283198" d="M80 80v80c17-7.5 31.5-19 40-40-5.9-17-18.1-30.9-40-40z"/> + <path fill="#283198" d="M120 40v80L80 80z"/> + <path fill="#00e8ff" d="M120 120c6.1 27 4.9 53.6 0 80l-40-40z"/> + <path fill="#324fff" d="M120 120v80l40-40c-5.4-15-18.3-27.9-40-40z"/> + <path fill="#324fff" d="M160 80v80l-40-40z"/> +</svg>
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/package.json b/third_party/material_web_components/components-chromium/node_modules/lit/package.json new file mode 100644 index 0000000..ada34bf --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/package.json
@@ -0,0 +1,184 @@ +{ + "name": "lit", + "version": "2.2.3", + "publishConfig": { + "access": "public" + }, + "description": "A library for building fast, lightweight web components", + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "https://github.com/lit/lit.git", + "directory": "packages/lit" + }, + "author": "Google LLC", + "homepage": "https://lit.dev/", + "main": "index.js", + "module": "index.js", + "type": "module", + "exports": { + ".": { + "default": "./index.js" + }, + "./async-directive.js": { + "default": "./async-directive.js" + }, + "./decorators.js": { + "default": "./decorators.js" + }, + "./decorators/custom-element.js": { + "default": "./decorators/custom-element.js" + }, + "./decorators/event-options.js": { + "default": "./decorators/event-options.js" + }, + "./decorators/property.js": { + "default": "./decorators/property.js" + }, + "./decorators/query-all.js": { + "default": "./decorators/query-all.js" + }, + "./decorators/query-assigned-elements.js": { + "default": "./decorators/query-assigned-elements.js" + }, + "./decorators/query-assigned-nodes.js": { + "default": "./decorators/query-assigned-nodes.js" + }, + "./decorators/query-async.js": { + "default": "./decorators/query-async.js" + }, + "./decorators/query.js": { + "default": "./decorators/query.js" + }, + "./decorators/state.js": { + "default": "./decorators/state.js" + }, + "./directive-helpers.js": { + "default": "./directive-helpers.js" + }, + "./directive.js": { + "default": "./directive.js" + }, + "./directives/async-append.js": { + "default": "./directives/async-append.js" + }, + "./directives/async-replace.js": { + "default": "./directives/async-replace.js" + }, + "./directives/cache.js": { + "default": "./directives/cache.js" + }, + "./directives/choose.js": { + "default": "./directives/choose.js" + }, + "./directives/class-map.js": { + "default": "./directives/class-map.js" + }, + "./directives/guard.js": { + "default": "./directives/guard.js" + }, + "./directives/if-defined.js": { + "default": "./directives/if-defined.js" + }, + "./directives/join.js": { + "default": "./directives/join.js" + }, + "./directives/keyed.js": { + "default": "./directives/keyed.js" + }, + "./directives/live.js": { + "default": "./directives/live.js" + }, + "./directives/map.js": { + "default": "./directives/map.js" + }, + "./directives/range.js": { + "default": "./directives/range.js" + }, + "./directives/ref.js": { + "default": "./directives/ref.js" + }, + "./directives/repeat.js": { + "default": "./directives/repeat.js" + }, + "./directives/style-map.js": { + "default": "./directives/style-map.js" + }, + "./directives/template-content.js": { + "default": "./directives/template-content.js" + }, + "./directives/unsafe-html.js": { + "default": "./directives/unsafe-html.js" + }, + "./directives/unsafe-svg.js": { + "default": "./directives/unsafe-svg.js" + }, + "./directives/until.js": { + "default": "./directives/until.js" + }, + "./directives/when.js": { + "default": "./directives/when.js" + }, + "./experimental-hydrate-support.js": { + "default": "./experimental-hydrate-support.js" + }, + "./experimental-hydrate.js": { + "default": "./experimental-hydrate.js" + }, + "./html.js": { + "default": "./html.js" + }, + "./polyfill-support.js": { + "default": "./polyfill-support.js" + }, + "./static-html.js": { + "default": "./static-html.js" + } + }, + "scripts": { + "build": "npm run clean && npm run build:ts && rollup -c", + "build:watch": "rollup -c --watch", + "build:ts": "tsc --build && treemirror development . '**/*.d.ts{,.map}'", + "build:ts:watch": "tsc --build --watch", + "clean": "rm -rf {async-directive,decorators,directive-helpers,directive,html,experimental-hydrate-support,experimental-hydrate,index,polyfill-support,static-html}.{d.ts.map,d.ts,js.map,js} test/ decorators/ directives/ development/ *.tsbuildinfo", + "publish-dev": "VERSION=${npm_package_version%-*}-dev.`git rev-parse --short HEAD` && npm version --no-git-tag-version $VERSION && npm publish --tag dev", + "regen-package-lock": "rm -rf node_modules package-lock.json; npm install", + "test": "MODE=prod cd ../tests && npx wtr '../lit/test/**/*_test.(js|html)'" + }, + "files": [ + "/async-directive.{d.ts.map,d.ts,js.map,js}", + "/decorators.{d.ts.map,d.ts,js.map,js}", + "/directive-helpers.{d.ts.map,d.ts,js.map,js}", + "/directive.{d.ts.map,d.ts,js.map,js}", + "/html.{d.ts.map,d.ts,js.map,js}", + "/experimental-hydrate-support.{d.ts.map,d.ts,js.map,js}", + "/experimental-hydrate.{d.ts.map,d.ts,js.map,js}", + "/index.{d.ts.map,d.ts,js.map,js}", + "/polyfill-support.{d.ts.map,d.ts,js.map,js}", + "/static-html.{d.ts.map,d.ts,js.map,js}", + "/decorators/", + "/directives/", + "/logo.svg" + ], + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.1.5", + "@types/chai": "^4.0.1", + "@types/mocha": "^9.0.0", + "@webcomponents/shadycss": "^1.8.0", + "@webcomponents/template": "^1.4.4", + "@webcomponents/webcomponentsjs": "^2.6.0", + "chokidar-cli": "^3.0.0", + "downlevel-dts": "^0.7.0", + "internal-scripts": "^1.0.0", + "mocha": "^9.1.1", + "rollup": "^2.70.2", + "tslib": "^2.0.3", + "typescript": "^4.3.5" + }, + "typings": "index.d.ts" +}
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/static-html.d.ts b/third_party/material_web_components/components-chromium/node_modules/lit/static-html.d.ts new file mode 100644 index 0000000..210c5b0 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/static-html.d.ts
@@ -0,0 +1,7 @@ +/** + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +export * from 'lit-html/static.js'; +//# sourceMappingURL=static-html.d.ts.map \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/lit/static-html.js b/third_party/material_web_components/components-chromium/node_modules/lit/static-html.js new file mode 100644 index 0000000..2957a2a8 --- /dev/null +++ b/third_party/material_web_components/components-chromium/node_modules/lit/static-html.js
@@ -0,0 +1,2 @@ +export*from'../lit-html/static.js'; +//# sourceMappingURL=static-html.js.map
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/CopyrightNotice.txt b/third_party/material_web_components/components-chromium/node_modules/tslib/CopyrightNotice.txt index 2e4a05c..5d7d2d9 100644 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/CopyrightNotice.txt +++ b/third_party/material_web_components/components-chromium/node_modules/tslib/CopyrightNotice.txt
@@ -1,4 +1,4 @@ -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/modules/index.js b/third_party/material_web_components/components-chromium/node_modules/tslib/modules/index.js deleted file mode 100644 index 23d00c56..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/modules/index.js +++ /dev/null
@@ -1,53 +0,0 @@ -import tslib from '../tslib.es6.js'; -const { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -} = tslib; -export { - __extends, - __assign, - __rest, - __decorate, - __param, - __metadata, - __awaiter, - __generator, - __exportStar, - __createBinding, - __values, - __read, - __spread, - __spreadArrays, - __spreadArray, - __await, - __asyncGenerator, - __asyncDelegator, - __asyncValues, - __makeTemplateObject, - __importStar, - __importDefault, - __classPrivateFieldGet, - __classPrivateFieldSet, -};
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/modules/package.json b/third_party/material_web_components/components-chromium/node_modules/tslib/modules/package.json deleted file mode 100644 index 96ae6e5..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/modules/package.json +++ /dev/null
@@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/package.json b/third_party/material_web_components/components-chromium/node_modules/tslib/package.json index 9259a85..0ec2c63 100644 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/package.json +++ b/third_party/material_web_components/components-chromium/node_modules/tslib/package.json
@@ -2,7 +2,7 @@ "name": "tslib", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "2.1.0", + "version": "2.4.0", "license": "0BSD", "description": "Runtime library for TypeScript helper functions", "keywords": [ @@ -32,6 +32,7 @@ "import": "./modules/index.js", "default": "./tslib.js" }, + "./*": "./*", "./": "./" } }
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.d.ts b/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.d.ts index 3ad370a..b8e49f0 100644 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.d.ts +++ b/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.d.ts
@@ -1,4 +1,4 @@ -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -12,29 +12,387 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ + +/** + * Used to shim class extends. + * + * @param d The derived class. + * @param b The base class. + */ export declare function __extends(d: Function, b: Function): void; + +/** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * + * @param t The target object to copy to. + * @param sources One or more source objects from which to copy properties + */ export declare function __assign(t: any, ...sources: any[]): any; + +/** + * Performs a rest spread on an object. + * + * @param t The source value. + * @param propertyNames The property names excluded from the rest spread. + */ export declare function __rest(t: any, propertyNames: (string | symbol)[]): any; + +/** + * Applies decorators to a target object + * + * @param decorators The set of decorators to apply. + * @param target The target object. + * @param key If specified, the own property to apply the decorators to. + * @param desc The property descriptor, defaults to fetching the descriptor from the target object. + * @experimental + */ export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any; + +/** + * Creates an observing function decorator from a parameter decorator. + * + * @param paramIndex The parameter index to apply the decorator to. + * @param decorator The parameter decorator to apply. Note that the return value is ignored. + * @experimental + */ export declare function __param(paramIndex: number, decorator: Function): Function; + +/** + * Creates a decorator that sets metadata. + * + * @param metadataKey The metadata key + * @param metadataValue The metadata value + * @experimental + */ export declare function __metadata(metadataKey: any, metadataValue: any): Function; + +/** + * Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param P The optional promise constructor argument, defaults to the `Promise` property of the global object. + * @param generator The generator function + */ export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any; + +/** + * Creates an Iterator object using the body as the implementation. + * + * @param thisArg The reference to use as the `this` value in the function + * @param body The generator state-machine based implementation. + * + * @see [./docs/generator.md] + */ export declare function __generator(thisArg: any, body: Function): any; + +/** + * Creates bindings for all enumerable properties of `m` on `exports` + * + * @param m The source object + * @param exports The `exports` object. + */ export declare function __exportStar(m: any, o: any): void; + +/** + * Creates a value iterator from an `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`. + */ export declare function __values(o: any): any; + +/** + * Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array. + * + * @param o The object to read from. + * @param n The maximum number of arguments to read, defaults to `Infinity`. + */ export declare function __read(o: any, n?: number): any[]; -/** @deprecated since TypeScript 4.2 */ + +/** + * Creates an array from iterable spread. + * + * @param args The Iterable objects to spread. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ export declare function __spread(...args: any[][]): any[]; -/** @deprecated since TypeScript 4.2 */ + +/** + * Creates an array from array spread. + * + * @param args The ArrayLikes to spread into the resulting array. + * @deprecated since TypeScript 4.2 - Use `__spreadArray` + */ export declare function __spreadArrays(...args: any[][]): any[]; -export declare function __spreadArray(to: any[], from: any[]): any[]; + +/** + * Spreads the `from` array into the `to` array. + * + * @param pack Replace empty elements with `undefined`. + */ +export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[]; + +/** + * Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded, + * and instead should be awaited and the resulting value passed back to the generator. + * + * @param v The value to await. + */ export declare function __await(v: any): any; + +/** + * Converts a generator function into an async generator function, by using `yield __await` + * in place of normal `await`. + * + * @param thisArg The reference to use as the `this` value in the generator function + * @param _arguments The optional arguments array + * @param generator The generator function + */ export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any; + +/** + * Used to wrap a potentially async iterator in such a way so that it wraps the result + * of calling iterator methods of `o` in `__await` instances, and then yields the awaited values. + * + * @param o The potentially async iterator. + * @returns A synchronous iterator yielding `__await` instances on every odd invocation + * and returning the awaited `IteratorResult` passed to `next` every even invocation. + */ export declare function __asyncDelegator(o: any): any; + +/** + * Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object. + * + * @param o The object. + * @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`. + */ export declare function __asyncValues(o: any): any; + +/** + * Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays. + * + * @param cooked The cooked possibly-sparse array. + * @param raw The raw string content. + */ export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray; + +/** + * Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default, { Named, Other } from "mod"; + * // or + * import { default as Default, Named, Other } from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ export declare function __importStar<T>(mod: T): T; + +/** + * Used to shim default imports in ECMAScript Modules transpiled to CommonJS. + * + * ```js + * import Default from "mod"; + * ``` + * + * @param mod The CommonJS module exports object. + */ export declare function __importDefault<T>(mod: T): T | { default: T }; -export declare function __classPrivateFieldGet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, get(o: T): V | undefined }): V; -export declare function __classPrivateFieldSet<T extends object, V>(receiver: T, privateMap: { has(o: T): boolean, set(o: T, value: V): any }, value: V): V; + +/** + * Emulates reading a private instance field. + * + * @param receiver The instance from which to read the private field. + * @param state A WeakMap containing the private field value for an instance. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet<T extends object, V>( + receiver: T, + state: { has(o: T): boolean, get(o: T): V | undefined }, + kind?: "f" +): V; + +/** + * Emulates reading a private static field. + * + * @param receiver The object from which to read the private static field. + * @param state The class constructor containing the definition of the static field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>( + receiver: T, + state: T, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates evaluating a private instance "get" accessor. + * + * @param receiver The instance on which to evaluate the private "get" accessor. + * @param state A WeakSet used to verify an instance supports the private "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet<T extends object, V>( + receiver: T, + state: { has(o: T): boolean }, + kind: "a", + f: () => V +): V; + +/** + * Emulates evaluating a private static "get" accessor. + * + * @param receiver The object on which to evaluate the private static "get" accessor. + * @param state The class constructor containing the definition of the static "get" accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "get" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>( + receiver: T, + state: T, + kind: "a", + f: () => V +): V; + +/** + * Emulates reading a private instance method. + * + * @param receiver The instance from which to read a private method. + * @param state A WeakSet used to verify an instance supports the private method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private instance method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>( + receiver: T, + state: { has(o: T): boolean }, + kind: "m", + f: V +): V; + +/** + * Emulates reading a private static method. + * + * @param receiver The object from which to read the private static method. + * @param state The class constructor containing the definition of the static method. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The function to return as the private static method. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>( + receiver: T, + state: T, + kind: "m", + f: V +): V; + +/** + * Emulates writing to a private instance field. + * + * @param receiver The instance on which to set a private field value. + * @param state A WeakMap used to store the private field value for an instance. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet<T extends object, V>( + receiver: T, + state: { has(o: T): boolean, set(o: T, value: V): unknown }, + value: V, + kind?: "f" +): V; + +/** + * Emulates writing to a private static field. + * + * @param receiver The object on which to set the private static field. + * @param state The class constructor containing the definition of the private static field. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The descriptor that holds the static field value. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>( + receiver: T, + state: T, + value: V, + kind: "f", + f: { value: V } +): V; + +/** + * Emulates writing to a private instance "set" accessor. + * + * @param receiver The instance on which to evaluate the private instance "set" accessor. + * @param state A WeakSet used to verify an instance supports the private "set" accessor. + * @param value The value to store in the private accessor. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `state` doesn't have an entry for `receiver`. + */ +export declare function __classPrivateFieldSet<T extends object, V>( + receiver: T, + state: { has(o: T): boolean }, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Emulates writing to a private static "set" accessor. + * + * @param receiver The object on which to evaluate the private static "set" accessor. + * @param state The class constructor containing the definition of the static "set" accessor. + * @param value The value to store in the private field. + * @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method. + * @param f The "set" accessor function to evaluate. + * + * @throws {TypeError} If `receiver` is not `state`. + */ +export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>( + receiver: T, + state: T, + value: V, + kind: "a", + f: (v: V) => void +): V; + +/** + * Checks for the existence of a private field/method/accessor. + * + * @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member. + * @param receiver The object for which to test the presence of the private member. + */ +export declare function __classPrivateFieldIn( + state: (new (...args: any[]) => unknown) | { has(o: any): boolean }, + receiver: unknown, +): boolean; + +/** + * Creates a re-export binding on `object` with key `objectKey` that references `target[key]`. + * + * @param object The local `exports` object. + * @param target The object to re-export from. + * @param key The property key of `target` to re-export. + * @param objectKey The property key to re-export as. Defaults to `key`. + */ export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.es6.js b/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.es6.js deleted file mode 100644 index 2a28e5d..0000000 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.es6.js +++ /dev/null
@@ -1,237 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -export function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -/** @deprecated */ -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -/** @deprecated */ -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} - -export function __spreadArray(to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; -} - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); -} - -export function __classPrivateFieldSet(receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; -}
diff --git a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.js b/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.js index 79f2f7d..91514ec0 100644 --- a/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.js +++ b/third_party/material_web_components/components-chromium/node_modules/tslib/tslib.js
@@ -1,4 +1,4 @@ -/*! ***************************************************************************** +/****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -12,293 +12,237 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -/* global global, define, System, Reflect, Promise */ -var __extends; -var __assign; -var __rest; -var __decorate; -var __param; -var __metadata; -var __awaiter; -var __generator; -var __exportStar; -var __values; -var __read; -var __spread; -var __spreadArrays; -var __spreadArray; -var __await; -var __asyncGenerator; -var __asyncDelegator; -var __asyncValues; -var __makeTemplateObject; -var __importStar; -var __importDefault; -var __classPrivateFieldGet; -var __classPrivateFieldSet; -var __createBinding; -(function (factory) { - var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; - if (typeof define === "function" && define.amd) { - define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); - } - else if (typeof module === "object" && typeof module.exports === "object") { - factory(createExporter(root, createExporter(module.exports))); - } - else { - factory(createExporter(root)); - } - function createExporter(exports, previous) { - if (exports !== root) { - if (typeof Object.create === "function") { - Object.defineProperty(exports, "__esModule", { value: true }); - } - else { - exports.__esModule = true; - } - } - return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; - } -}) -(function (exporter) { - var extendStatics = Object.setPrototypeOf || +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; - __extends = function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} - __assign = Object.assign || function (t) { +export var __assign = function() { + __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; - }; + } + return __assign.apply(this, arguments); +} - __rest = function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; - }; - - __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - __param = function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } - }; - - __metadata = function (metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); - }; - - __awaiter = function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - - __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; } - }; + return t; +} - __exportStar = function(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); - }; +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} - __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); - }) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); }); +} - __values = function (o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); - }; + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} - __read = function (o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; - }; - - /** @deprecated */ - __spread = function () { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; - }; - - /** @deprecated */ - __spreadArrays = function () { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; - }; - - __spreadArray = function (to, from) { - for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) - to[j] = from[i]; - return to; - }; - - __await = function (v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - - __asyncGenerator = function (thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } - }; - - __asyncDelegator = function (o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } - }; - - __asyncValues = function (o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } - }; - - __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; - }; - - var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }; - - __importStar = function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; - - __importDefault = function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; - }; - - __classPrivateFieldGet = function (receiver, privateMap) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return privateMap.get(receiver); - }; - - __classPrivateFieldSet = function (receiver, privateMap, value) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to set private field on non-instance"); - } - privateMap.set(receiver, value); - return value; - }; - - exporter("__extends", __extends); - exporter("__assign", __assign); - exporter("__rest", __rest); - exporter("__decorate", __decorate); - exporter("__param", __param); - exporter("__metadata", __metadata); - exporter("__awaiter", __awaiter); - exporter("__generator", __generator); - exporter("__exportStar", __exportStar); - exporter("__createBinding", __createBinding); - exporter("__values", __values); - exporter("__read", __read); - exporter("__spread", __spread); - exporter("__spreadArrays", __spreadArrays); - exporter("__spreadArray", __spreadArray); - exporter("__await", __await); - exporter("__asyncGenerator", __asyncGenerator); - exporter("__asyncDelegator", __asyncDelegator); - exporter("__asyncValues", __asyncValues); - exporter("__makeTemplateObject", __makeTemplateObject); - exporter("__importStar", __importStar); - exporter("__importDefault", __importDefault); - exporter("__classPrivateFieldGet", __classPrivateFieldGet); - exporter("__classPrivateFieldSet", __classPrivateFieldSet); +export var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; }); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +}
diff --git a/third_party/material_web_components/package-lock.json b/third_party/material_web_components/package-lock.json index b50426b..651604f1 100644 --- a/third_party/material_web_components/package-lock.json +++ b/third_party/material_web_components/package-lock.json
@@ -8,7 +8,7 @@ "name": "chromium-material-web-components", "version": "1.0.0", "dependencies": { - "@material/mwc-button": "0.20.0" + "@material/mwc-button": "0.26.0" }, "devDependencies": { "acorn": "6.4.2", @@ -16,122 +16,124 @@ "resolve": "1.22.0" } }, - "node_modules/@material/animation": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/animation/-/animation-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-m3eUpFRwxcP1tEWJlIH5q77YGSYEe5ITRw5OtyDvxU7ZzF0xKJbBeauQEdCmyig9UvK+J7jUUnCgkT/t/ldLtw==", - "dependencies": { - "tslib": "^1.9.3" - } + "node_modules/@lit/reactive-element": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.3.2.tgz", + "integrity": "sha512-A2e18XzPMrIh35nhIdE4uoqRzoIpEU5vZYuQN4S3Ee1zkGdYC27DP12pewbw/RLgPHzaE4kx/YqxMzebOpm0dA==" }, - "node_modules/@material/animation/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@material/animation": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/animation/-/animation-14.0.0.tgz", + "integrity": "sha512-VlYSfUaIj/BBVtRZI8Gv0VvzikFf+XgK0Zdgsok5c1v5DDnNz5tpB8mnGrveWz0rHbp1X4+CWLKrTwNmjrw3Xw==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@material/base": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/base/-/base-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r98qY6EsPx6BlzT0Pj+H+BTI7r76GEX/zZPgajxZjbPAJSeeK+uCh69Dmhf63meLKaFkKgvLwH5udKJLMqqjpQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/base/-/base-14.0.0.tgz", + "integrity": "sha512-Ou7vS7n1H4Y10MUZyYAbt6H0t67c6urxoCgeVT7M38aQlaNUwFMODp7KT/myjYz2YULfhu3PtfSV3Sltgac9mA==", "dependencies": { - "tslib": "^1.9.3" + "tslib": "^2.1.0" } }, - "node_modules/@material/base/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@material/dom": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/dom/-/dom-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-AwiQDzquolB7rqy8k4+QMVQ8Njb6k0CT+otJ/UNJbj0qNVXZB4njVaWRWrWCt70hYp1rG0cRNkZ01ZJDqABUFw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/dom/-/dom-14.0.0.tgz", + "integrity": "sha512-8t88XyacclTj8qsIw9q0vEj4PI2KVncLoIsIMzwuMx49P2FZg6TsLjor262MI3Qs00UWAifuLMrhnOnfyrbe7Q==", "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" } }, - "node_modules/@material/dom/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@material/feature-targeting": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-HWd0+GMnkVB3anmUc9+MeWCNoogAbb4U7ihzwq7lzLCQyC+i/kunppkUVV7DhL3ZVl1O6zIw1eAT+dgQpN8x4Q==" + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-14.0.0.tgz", + "integrity": "sha512-a5WGgHEq5lJeeNL5yevtgoZjBjXWy6+klfVWQEh8oyix/rMJygGgO7gEc52uv8fB8uAIoYEB3iBMOv8jRq8FeA==", + "dependencies": { + "tslib": "^2.1.0" + } }, "node_modules/@material/mwc-base": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.20.0.tgz", - "integrity": "sha512-q35jN1TGBts3LzKk2RVtgBpLDfBfRrx2hJ4GEVAeJsEGiO5CZrCD0bPlZSRTammzQBbDAh7szvhMiWo0TkRaWw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.26.0.tgz", + "integrity": "sha512-G2xJQ667OzSieXw3IJzRrjDsngfCOnlVPCkl7TnmCThWziTgQISX6kHOEXPYEXwnJmZZrXcxaoc+aeC5cv+nxQ==", "dependencies": { - "@material/base": "=9.0.0-canary.1c156d69d.0", - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", + "@material/base": "=14.0.0", + "@material/dom": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-button": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.20.0.tgz", - "integrity": "sha512-kqQpeuLfaqfH4PZbENT9rwx1sgeFPLHuKy5M31ZeKG1deRTxw11FDGeMxSkePfm1QFfY6DNTsIAG5qC56tUNlw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.26.0.tgz", + "integrity": "sha512-tRO/uSiajvCSR5YVDSoFC6kPCt2okttYOvAfyVkljgNtnhORekcitgKFNQq6JBN2uvD6s/svJXlW7Xv0j/XCQA==", "dependencies": { - "@material/mwc-icon": "^0.20.0", - "@material/mwc-ripple": "^0.20.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/mwc-icon": "^0.26.0", + "@material/mwc-ripple": "^0.26.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-icon": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.20.0.tgz", - "integrity": "sha512-YCtzWbJVSZGcvWKVHwIhwfGMLEqAmRSVGcXTCAH/rOzGU7RkOxQkfNDkLAuTRAX9a7HYQStIJ39ENVcysElljg==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.26.0.tgz", + "integrity": "sha512-snI+u1xru4Q9FwEXhVxUoVjY3zvZ+H2ezYZa8Zn3OLArRcuz6R4yDxp1CZelaxTwyK2Sb6Hsp0h3liPCc2zl6A==", "dependencies": { - "lit-element": "^2.3.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/mwc-ripple": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.20.0.tgz", - "integrity": "sha512-4rlIu+Kk//NsW/u3CnU1kz3dsvwEozax0Zf2CUp+ao0ozclHfQ2+sTZVY0Mr8+GJLn7Oz51gT5OHoarZuWWljA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.26.0.tgz", + "integrity": "sha512-unDFbwhZiqojOLF20/5MnYghBk1V1H1r7mJbXG7Jam8x/V1nbdljPIXj0EP3YInt5dBPQHKcf+JkW1En1LGNFw==", "dependencies": { - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "@material/mwc-base": "^0.20.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/dom": "=14.0.0", + "@material/mwc-base": "^0.26.0", + "@material/ripple": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "node_modules/@material/ripple": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-F1e/LQmYHQFORM/C3hchmANnRwJCXlc7Cp7W+VGpvJdtdzYlTd8DKKcShuOozxUQOjutbNf+Ql8gpZIdYRQaoQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-14.0.0.tgz", + "integrity": "sha512-9XoGBFd5JhFgELgW7pqtiLy+CnCIcV2s9cQ2BWbOQeA8faX9UZIDUx/g76nHLZ7UzKFtsULJxZTwORmsEt2zvw==", "dependencies": { - "@material/animation": "9.0.0-canary.1c156d69d.0", - "@material/base": "9.0.0-canary.1c156d69d.0", - "@material/dom": "9.0.0-canary.1c156d69d.0", - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "@material/theme": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" + "@material/animation": "^14.0.0", + "@material/base": "^14.0.0", + "@material/dom": "^14.0.0", + "@material/feature-targeting": "^14.0.0", + "@material/rtl": "^14.0.0", + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" } }, - "node_modules/@material/ripple/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@material/rtl": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/rtl/-/rtl-14.0.0.tgz", + "integrity": "sha512-xl6OZYyRjuiW2hmbjV2omMV8sQtfmKAjeWnD1RMiAPLCTyOW9Lh/PYYnXjxUrNa0cRwIIbOn5J7OYXokja8puA==", + "dependencies": { + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" + } }, "node_modules/@material/theme": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/theme/-/theme-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r1610TPwUplt4FHMk7cR06Oz1jU/G31wBIh4Frs/YIB0ZonVlI5cZdIkG0IFtNt9ZYWoDwfP/1nQBxdqrDPPhg==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/theme/-/theme-14.0.0.tgz", + "integrity": "sha512-6/SENWNIFuXzeHMPHrYwbsXKgkvCtWuzzQ3cUu4UEt3KcQ5YpViazIM6h8ByYKZP8A9d8QpkJ0WGX5btGDcVoA==", "dependencies": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" } }, + "node_modules/@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, "node_modules/acorn": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", @@ -181,18 +183,32 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/lit-element": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", - "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "node_modules/lit": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.2.3.tgz", + "integrity": "sha512-5/v+r9dH3Pw/o0rhp/qYk3ERvOUclNF31bWb0FiW6MPgwdQIr+/KCt/p3zcd8aPl8lIGnxdGrVcZA+gWS6oFOQ==", "dependencies": { - "lit-html": "^1.1.1" + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" + } + }, + "node_modules/lit-element": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.0.tgz", + "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==", + "dependencies": { + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" } }, "node_modules/lit-html": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.3.0.tgz", - "integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.2.3.tgz", + "integrity": "sha512-vI4j3eWwtQaR8q/O63juZVliBIFMio716X719/lSsGH4UWPy2/7Qf377jsNs4cx3gCHgIbx8yxFgXFQ/igZyXQ==", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } }, "node_modules/path-parse": { "version": "1.0.7", @@ -231,136 +247,130 @@ } }, "node_modules/tslib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", - "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" } }, "dependencies": { + "@lit/reactive-element": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.3.2.tgz", + "integrity": "sha512-A2e18XzPMrIh35nhIdE4uoqRzoIpEU5vZYuQN4S3Ee1zkGdYC27DP12pewbw/RLgPHzaE4kx/YqxMzebOpm0dA==" + }, "@material/animation": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/animation/-/animation-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-m3eUpFRwxcP1tEWJlIH5q77YGSYEe5ITRw5OtyDvxU7ZzF0xKJbBeauQEdCmyig9UvK+J7jUUnCgkT/t/ldLtw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/animation/-/animation-14.0.0.tgz", + "integrity": "sha512-VlYSfUaIj/BBVtRZI8Gv0VvzikFf+XgK0Zdgsok5c1v5DDnNz5tpB8mnGrveWz0rHbp1X4+CWLKrTwNmjrw3Xw==", "requires": { - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "tslib": "^2.1.0" } }, "@material/base": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/base/-/base-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r98qY6EsPx6BlzT0Pj+H+BTI7r76GEX/zZPgajxZjbPAJSeeK+uCh69Dmhf63meLKaFkKgvLwH5udKJLMqqjpQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/base/-/base-14.0.0.tgz", + "integrity": "sha512-Ou7vS7n1H4Y10MUZyYAbt6H0t67c6urxoCgeVT7M38aQlaNUwFMODp7KT/myjYz2YULfhu3PtfSV3Sltgac9mA==", "requires": { - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "tslib": "^2.1.0" } }, "@material/dom": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/dom/-/dom-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-AwiQDzquolB7rqy8k4+QMVQ8Njb6k0CT+otJ/UNJbj0qNVXZB4njVaWRWrWCt70hYp1rG0cRNkZ01ZJDqABUFw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/dom/-/dom-14.0.0.tgz", + "integrity": "sha512-8t88XyacclTj8qsIw9q0vEj4PI2KVncLoIsIMzwuMx49P2FZg6TsLjor262MI3Qs00UWAifuLMrhnOnfyrbe7Q==", "requires": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" } }, "@material/feature-targeting": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-HWd0+GMnkVB3anmUc9+MeWCNoogAbb4U7ihzwq7lzLCQyC+i/kunppkUVV7DhL3ZVl1O6zIw1eAT+dgQpN8x4Q==" + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/feature-targeting/-/feature-targeting-14.0.0.tgz", + "integrity": "sha512-a5WGgHEq5lJeeNL5yevtgoZjBjXWy6+klfVWQEh8oyix/rMJygGgO7gEc52uv8fB8uAIoYEB3iBMOv8jRq8FeA==", + "requires": { + "tslib": "^2.1.0" + } }, "@material/mwc-base": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.20.0.tgz", - "integrity": "sha512-q35jN1TGBts3LzKk2RVtgBpLDfBfRrx2hJ4GEVAeJsEGiO5CZrCD0bPlZSRTammzQBbDAh7szvhMiWo0TkRaWw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-base/-/mwc-base-0.26.0.tgz", + "integrity": "sha512-G2xJQ667OzSieXw3IJzRrjDsngfCOnlVPCkl7TnmCThWziTgQISX6kHOEXPYEXwnJmZZrXcxaoc+aeC5cv+nxQ==", "requires": { - "@material/base": "=9.0.0-canary.1c156d69d.0", - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", + "@material/base": "=14.0.0", + "@material/dom": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "@material/mwc-button": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.20.0.tgz", - "integrity": "sha512-kqQpeuLfaqfH4PZbENT9rwx1sgeFPLHuKy5M31ZeKG1deRTxw11FDGeMxSkePfm1QFfY6DNTsIAG5qC56tUNlw==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-button/-/mwc-button-0.26.0.tgz", + "integrity": "sha512-tRO/uSiajvCSR5YVDSoFC6kPCt2okttYOvAfyVkljgNtnhORekcitgKFNQq6JBN2uvD6s/svJXlW7Xv0j/XCQA==", "requires": { - "@material/mwc-icon": "^0.20.0", - "@material/mwc-ripple": "^0.20.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/mwc-icon": "^0.26.0", + "@material/mwc-ripple": "^0.26.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "@material/mwc-icon": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.20.0.tgz", - "integrity": "sha512-YCtzWbJVSZGcvWKVHwIhwfGMLEqAmRSVGcXTCAH/rOzGU7RkOxQkfNDkLAuTRAX9a7HYQStIJ39ENVcysElljg==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-icon/-/mwc-icon-0.26.0.tgz", + "integrity": "sha512-snI+u1xru4Q9FwEXhVxUoVjY3zvZ+H2ezYZa8Zn3OLArRcuz6R4yDxp1CZelaxTwyK2Sb6Hsp0h3liPCc2zl6A==", "requires": { - "lit-element": "^2.3.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "@material/mwc-ripple": { - "version": "0.20.0", - "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.20.0.tgz", - "integrity": "sha512-4rlIu+Kk//NsW/u3CnU1kz3dsvwEozax0Zf2CUp+ao0ozclHfQ2+sTZVY0Mr8+GJLn7Oz51gT5OHoarZuWWljA==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@material/mwc-ripple/-/mwc-ripple-0.26.0.tgz", + "integrity": "sha512-unDFbwhZiqojOLF20/5MnYghBk1V1H1r7mJbXG7Jam8x/V1nbdljPIXj0EP3YInt5dBPQHKcf+JkW1En1LGNFw==", "requires": { - "@material/dom": "=9.0.0-canary.1c156d69d.0", - "@material/mwc-base": "^0.20.0", - "@material/ripple": "=9.0.0-canary.1c156d69d.0", - "lit-element": "^2.3.0", - "lit-html": "^1.1.2", + "@material/dom": "=14.0.0", + "@material/mwc-base": "^0.26.0", + "@material/ripple": "=14.0.0", + "lit": "^2.0.0", "tslib": "^2.0.1" } }, "@material/ripple": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-F1e/LQmYHQFORM/C3hchmANnRwJCXlc7Cp7W+VGpvJdtdzYlTd8DKKcShuOozxUQOjutbNf+Ql8gpZIdYRQaoQ==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/ripple/-/ripple-14.0.0.tgz", + "integrity": "sha512-9XoGBFd5JhFgELgW7pqtiLy+CnCIcV2s9cQ2BWbOQeA8faX9UZIDUx/g76nHLZ7UzKFtsULJxZTwORmsEt2zvw==", "requires": { - "@material/animation": "9.0.0-canary.1c156d69d.0", - "@material/base": "9.0.0-canary.1c156d69d.0", - "@material/dom": "9.0.0-canary.1c156d69d.0", - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0", - "@material/theme": "9.0.0-canary.1c156d69d.0", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } + "@material/animation": "^14.0.0", + "@material/base": "^14.0.0", + "@material/dom": "^14.0.0", + "@material/feature-targeting": "^14.0.0", + "@material/rtl": "^14.0.0", + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" + } + }, + "@material/rtl": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/rtl/-/rtl-14.0.0.tgz", + "integrity": "sha512-xl6OZYyRjuiW2hmbjV2omMV8sQtfmKAjeWnD1RMiAPLCTyOW9Lh/PYYnXjxUrNa0cRwIIbOn5J7OYXokja8puA==", + "requires": { + "@material/theme": "^14.0.0", + "tslib": "^2.1.0" } }, "@material/theme": { - "version": "9.0.0-canary.1c156d69d.0", - "resolved": "https://registry.npmjs.org/@material/theme/-/theme-9.0.0-canary.1c156d69d.0.tgz", - "integrity": "sha512-r1610TPwUplt4FHMk7cR06Oz1jU/G31wBIh4Frs/YIB0ZonVlI5cZdIkG0IFtNt9ZYWoDwfP/1nQBxdqrDPPhg==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@material/theme/-/theme-14.0.0.tgz", + "integrity": "sha512-6/SENWNIFuXzeHMPHrYwbsXKgkvCtWuzzQ3cUu4UEt3KcQ5YpViazIM6h8ByYKZP8A9d8QpkJ0WGX5btGDcVoA==", "requires": { - "@material/feature-targeting": "9.0.0-canary.1c156d69d.0" + "@material/feature-targeting": "^14.0.0", + "tslib": "^2.1.0" } }, + "@types/trusted-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz", + "integrity": "sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==" + }, "acorn": { "version": "6.4.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.2.tgz", @@ -397,18 +407,32 @@ "has": "^1.0.3" } }, - "lit-element": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-2.4.0.tgz", - "integrity": "sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==", + "lit": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit/-/lit-2.2.3.tgz", + "integrity": "sha512-5/v+r9dH3Pw/o0rhp/qYk3ERvOUclNF31bWb0FiW6MPgwdQIr+/KCt/p3zcd8aPl8lIGnxdGrVcZA+gWS6oFOQ==", "requires": { - "lit-html": "^1.1.1" + "@lit/reactive-element": "^1.3.0", + "lit-element": "^3.2.0", + "lit-html": "^2.2.0" + } + }, + "lit-element": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lit-element/-/lit-element-3.2.0.tgz", + "integrity": "sha512-HbE7yt2SnUtg5DCrWt028oaU4D5F4k/1cntAFHTkzY8ZIa8N0Wmu92PxSxucsQSOXlODFrICkQ5x/tEshKi13g==", + "requires": { + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.2.0" } }, "lit-html": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.3.0.tgz", - "integrity": "sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-2.2.3.tgz", + "integrity": "sha512-vI4j3eWwtQaR8q/O63juZVliBIFMio716X719/lSsGH4UWPy2/7Qf377jsNs4cx3gCHgIbx8yxFgXFQ/igZyXQ==", + "requires": { + "@types/trusted-types": "^2.0.2" + } }, "path-parse": { "version": "1.0.7", @@ -434,9 +458,9 @@ "dev": true }, "tslib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", - "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==" + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" } } }
diff --git a/third_party/material_web_components/package.json b/third_party/material_web_components/package.json index e30f814..967f7c4 100644 --- a/third_party/material_web_components/package.json +++ b/third_party/material_web_components/package.json
@@ -3,7 +3,7 @@ "version": "1.0.0", "author": "calamity@chromium.org", "dependencies": { - "@material/mwc-button": "0.20.0" + "@material/mwc-button": "0.26.0" }, "devDependencies": { "acorn": "6.4.2",
diff --git a/third_party/material_web_components/reproduce.sh b/third_party/material_web_components/reproduce.sh index 297a2e7..1ecd362 100755 --- a/third_party/material_web_components/reproduce.sh +++ b/third_party/material_web_components/reproduce.sh
@@ -34,6 +34,9 @@ npm install +# Replace tslib.js with its ES6 version. +mv components-chromium/node_modules/tslib/tslib.{es6.,}js + # Resolve imports as relative paths so we can load them in chrome://resources/. find components-chromium/ \ \( -name "*.js" \) -type f \ @@ -69,8 +72,6 @@ import("//tools/typescript/ts_library.gni") import("//ui/webui/resources/tools/generate_grd.gni") -# This file is generated by //third_party/material_web_components/reproduce.sh - generate_grd("build_grdp") { grd_prefix = "material_web_components" out_grd = "\${target_gen_dir}/\${grd_prefix}_resources.grdp"
diff --git a/third_party/material_web_components/resolve_imports.js b/third_party/material_web_components/resolve_imports.js index c1e93f86..1dcb8f6 100644 --- a/third_party/material_web_components/resolve_imports.js +++ b/third_party/material_web_components/resolve_imports.js
@@ -44,10 +44,6 @@ resolve.sync(source.value, {basedir: args.basedir || inputDir}); resolved = path.relative(inputDir, resolved); - // Special handling for tslib since resolve.sync only resolves to the "main" - // field in the package.json, and we need the ES6 version. - resolved = resolved.replace('tslib.js', 'tslib.es6.js'); - if (!resolved.startsWith('.')) { resolved = './' + resolved; }
diff --git a/third_party/material_web_components/rewrite_imports.gni b/third_party/material_web_components/rewrite_imports.gni index 90d0d17..5f6ad162 100644 --- a/third_party/material_web_components/rewrite_imports.gni +++ b/third_party/material_web_components/rewrite_imports.gni
@@ -28,7 +28,7 @@ } } - import_mappings = [ "tslib|//resources/mwc/tslib/tslib.es6.js" ] + import_mappings = [ "tslib|//resources/mwc/tslib/tslib.js" ] if (defined(invoker.import_mappings)) { import_mappings += invoker.import_mappings }
diff --git a/third_party/material_web_components/rsync_exclude.txt b/third_party/material_web_components/rsync_exclude.txt index f1806bd..5d77e579 100644 --- a/third_party/material_web_components/rsync_exclude.txt +++ b/third_party/material_web_components/rsync_exclude.txt
@@ -8,10 +8,28 @@ .npmignore */test/ */tests/ +*/development/ +*/dist/ +polyfill-support.* +experimental-hydrate* # Dev Dependencies acorn/ argparse/ +# lit +lit/decorators + +# lit-element +lit-element/private-ssr-support.* +lit-element/decorators + # lit-html -lit-html/src/directives +lit-html/private-ssr-support.* + +# tslib +tslib/modules +tslib/tslib.js + +# @material +@material/animation
diff --git a/third_party/tflite/README.chromium b/third_party/tflite/README.chromium index 6ad0706..e3853d8 100644 --- a/third_party/tflite/README.chromium +++ b/third_party/tflite/README.chromium
@@ -1,8 +1,8 @@ Name: TensorFlow Lite Short Name: tflite URL: https://github.com/tensorflow/tensorflow -Version: 08fef6195f0de0742953553fad4443b9d88a4764 -Date: 2022/05/02 +Version: 783ece207fa191df18e305c796aeb29c3057dc7b +Date: 2022/05/10 License: Apache 2.0 License File: LICENSE Security Critical: Yes
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index 5784b235..31f80388 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -937,7 +937,7 @@ "structures": [4880], }, "<(SHARED_INTERMEDIATE_DIR)/ui/webui/resources/webui_generated_resources.grd": { - "META": {"sizes": {"includes": [1000]}}, + "META": {"sizes": {"includes": [900]}}, "includes": [4900], }, "weblayer/weblayer_resources.grd": {
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 9bb1181a..1183de5 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -72896,6 +72896,29 @@ </int> </enum> +<enum name="PasswordManager.PasswordChangeSuccessTracker.EndEvent"> + <int value="0" label="Automated flow, generated password chosen"/> + <int value="1" label="Automated flow, manual password chosen"/> + <int value="2" label="Automated flow, reset link requested"/> + <int value="3" label="Manual flow, generated password chosen"/> + <int value="4" label="Manual flow, manual password chosen"/> + <int value="5" label="Timeout"/> +</enum> + +<enum name="PasswordManager.PasswordChangeSuccessTracker.EntryPoint"> + <int value="0" label="Leak check in settings"/> + <int value="1" label="Leak warning dialog"/> +</enum> + +<enum name="PasswordManager.PasswordChangeSuccessTracker.StartEvent"> + <int value="0" label="Automated flow"/> + <int value="1" label="Manual unknown flow"/> + <int value="2" label="Manual well-known URL flow"/> + <int value="3" label="Manual domain-specific URL flow"/> + <int value="4" label="Manual homepage flow"/> + <int value="5" label="Manual reset link flow"/> +</enum> + <enum name="PasswordManager.ReauthResult"> <int value="0" label="Success"/> <int value="1" label="Failure"/>
diff --git a/tools/metrics/histograms/metadata/blink/histograms.xml b/tools/metrics/histograms/metadata/blink/histograms.xml index 7ad7427..3b4166c 100644 --- a/tools/metrics/histograms/metadata/blink/histograms.xml +++ b/tools/metrics/histograms/metadata/blink/histograms.xml
@@ -2145,7 +2145,7 @@ <histogram name="Blink.Sms.BackendAvailability" enum="WebOTPBackendAvailability" expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records how often the verification backend is unavailable for the WebOTP API and the corresponding reason. This is recorded once per OTP request. @@ -2153,9 +2153,9 @@ </histogram> <histogram name="Blink.Sms.PendingOriginCount" units="origins" - expires_after="2022-08-28"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> SmsFetcher subscribes to incoming SMSes with origins from SmsProvider. This metric records the number of pending origins that are not unsubscribed when @@ -2164,9 +2164,9 @@ </histogram> <histogram name="Blink.Sms.Receive.CrossDeviceFailure" - enum="WebOTPCrossDeviceFailure" expires_after="2022-10-09"> + enum="WebOTPCrossDeviceFailure" expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the reason why using the WebOTP API on desktop failed on the sharing path. It records one sample per invocation of the API. @@ -2174,10 +2174,10 @@ </histogram> <histogram name="Blink.Sms.Receive.Infobar" enum="WebOTPServiceInfobarAction" - expires_after="2022-08-28"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records how many times the infobar was called and how many times the infobar replaced a keyboard. @@ -2188,14 +2188,14 @@ expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary>Records the result of a call to the WebOTP API.</summary> </histogram> <histogram name="Blink.Sms.Receive.SmsParsingStatus" enum="SmsParsingStatus" - expires_after="2022-08-28"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the status of parsing an incoming SMS when using the WebOTP API. It records one sample per incoming SMS. @@ -2205,10 +2205,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeCancel" units="ms" - expires_after="2022-08-14"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the duration from when the API is called to when the request is cancelled by the service due to duplicated requests or lack of delegate. @@ -2216,10 +2216,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeCancelOnKeyboardDismissal" units="ms" - expires_after="2022-07-17"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the duration from when the keyboard was replaced with an infobar until when the user clicked the cancel button. @@ -2227,10 +2227,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeCancelOnSuccess" units="ms" - expires_after="2022-10-16"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the time from when a successful SMS was retrieved to when the user presses the Cancel button. @@ -2238,10 +2238,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeContinueOnSuccess" units="ms" - expires_after="2022-10-23"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the time from when a successful SMS was retrieved to when the user presses the Continue button. @@ -2249,10 +2249,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeSmsReceive" units="ms" - expires_after="2022-06-19"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the duration from when the API is called to when an SMS has been successfully received. @@ -2263,7 +2263,7 @@ expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the duration from when the API is called to when the user successfully receives the SMS and presses continue to pass the incoming SMS @@ -2272,10 +2272,10 @@ </histogram> <histogram name="Blink.Sms.Receive.TimeUserCancel" units="ms" - expires_after="2022-09-11"> + expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> <owner>goto@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records the duration from when the API is called to when the user successfully receives the SMS and presses "Deny" to terminate the @@ -2286,7 +2286,7 @@ <histogram name="Blink.Sms.WebContentsVisibleOnReceive" enum="Boolean" expires_after="2022-10-30"> <owner>yigu@chromium.org</owner> - <owner>web-identity@google.com</owner> + <owner>fedcm-core@google.com</owner> <summary> Records whether the web contents that receives the OTP is visible or not for the UserConsent backend. Recorded at most once per API call when Chrome sees
diff --git a/tools/metrics/histograms/metadata/browser/histograms.xml b/tools/metrics/histograms/metadata/browser/histograms.xml index 5b05549..d1f3bb54f 100644 --- a/tools/metrics/histograms/metadata/browser/histograms.xml +++ b/tools/metrics/histograms/metadata/browser/histograms.xml
@@ -756,6 +756,57 @@ </summary> </histogram> +<histogram + name="BrowserRenderProcessHost.SuspendedChild.KernelExecutionRecorded" + enum="BooleanRecorded" expires_after="2022-09-01"> + <owner>wfh@chromium.org</owner> + <owner>chrome-stability-core@google.com</owner> + <summary> + Whether or not kernel-mode execution was recorded for a suspended renderer + process. This is recorded after process creation but before process + resumption. This is recorded for every sandboxed Renderer process launched + on Windows only. + </summary> +</histogram> + +<histogram name="BrowserRenderProcessHost.SuspendedChild.NtStatus" + enum="NTSTATUS" expires_after="2022-09-01"> + <owner>wfh@chromium.org</owner> + <owner>chrome-stability-core@google.com</owner> + <summary> + The result of calling base::win::GetLastNtStatus() when a failure was + obtained when trying to obtain the user and kernel execution times for a + suspended child renderer process. This is recorded after process creation + but before process resumption. It is only recorded for failures to obtain + the user and kernel execution times. This is only recorded on Windows. + </summary> +</histogram> + +<histogram name="BrowserRenderProcessHost.SuspendedChild.UserExecutionRecorded" + enum="BooleanRecorded" expires_after="2022-09-01"> + <owner>wfh@chromium.org</owner> + <owner>chrome-stability-core@google.com</owner> + <summary> + Whether or not user-mode execution was recorded for a suspended renderer + process. This is recorded after process creation but before process + resumption. This is recorded for every sandboxed Renderer process launched + on Windows only. + </summary> +</histogram> + +<histogram name="BrowserRenderProcessHost.SuspendedChild.Win32Error" + enum="WinGetLastError" expires_after="2022-09-01"> + <owner>wfh@chromium.org</owner> + <owner>chrome-stability-core@google.com</owner> + <summary> + The result of calling GetLastError when a failure was obtained when trying + to obtain the user and kernel execution times for a suspended child renderer + process. This is recorded after process creation but before process + resumption. It is only recorded for failures to obtain the user and kernel + execution times. This is only recorded on Windows. + </summary> +</histogram> + <histogram name="BrowserServices.BrowsableIntentCheck" units="ms" expires_after="M108"> <owner>peconn@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/chromeos_hps/histograms.xml b/tools/metrics/histograms/metadata/chromeos_hps/histograms.xml index 8c2aeb5..5236a1d 100644 --- a/tools/metrics/histograms/metadata/chromeos_hps/histograms.xml +++ b/tools/metrics/histograms/metadata/chromeos_hps/histograms.xml
@@ -23,7 +23,7 @@ <histograms> <histogram name="ChromeOS.HPS.Image.Invalidity" units="per1000" - expires_after="2022-10-16"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner> @@ -35,7 +35,7 @@ </histogram> <histogram name="ChromeOS.HPS.QuickDim.Enabled" enum="BooleanEnabled" - expires_after="2022-10-16"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner> @@ -45,7 +45,7 @@ </histogram> <histogram name="ChromeOS.HPS.SnoopingProtection.Enabled" enum="BooleanEnabled" - expires_after="2022-10-16"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner> @@ -55,8 +55,20 @@ </summary> </histogram> +<histogram + name="ChromeOS.HPS.SnoopingProtectionNotificationSuppression.Enabled" + enum="BooleanEnabled" expires_after="2023-05-31"> + <owner>martis@chromium.org</owner> + <owner>charleszhao@chromium.org</owner> + <owner>chromeos-hps-swe@google.com</owner> + <summary> + Records the new setting of kSnoopingProtectionNotificationSuppressionEnabled + when users change it on the privacy page. + </summary> +</histogram> + <histogram name="ChromeOS.HPS.TurnOn.Result" enum="HpsTurnOnResult" - expires_after="2022-10-16"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner> @@ -66,7 +78,7 @@ </histogram> <histogram name="ChromeOS.HPS.TurnOn.{Result}.Duration" units="ms" - expires_after="2022-07-01"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner> @@ -81,7 +93,7 @@ </histogram> <histogram name="ChromeOS.HPS.Update.{Stage}.Duration" units="ms" - expires_after="2022-07-01"> + expires_after="2023-05-31"> <owner>evanbenn@chromium.org</owner> <owner>avg@chromium.org</owner> <owner>chromeos-hps-swe@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/download/histograms.xml b/tools/metrics/histograms/metadata/download/histograms.xml index be67087..d0d0117 100644 --- a/tools/metrics/histograms/metadata/download/histograms.xml +++ b/tools/metrics/histograms/metadata/download/histograms.xml
@@ -503,7 +503,7 @@ </histogram> <histogram name="Download.IOSDownloadMobileConfigFileUI" - enum="DownloadMobileConfigFileUI" expires_after="2022-06-20"> + enum="DownloadMobileConfigFileUI" expires_after="2022-12-20"> <owner>sdefresne@chromium.org</owner> <owner>ewannpv@chromium.org</owner> <owner>gambard@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/optimization/histograms.xml b/tools/metrics/histograms/metadata/optimization/histograms.xml index e4790e9..191530d 100644 --- a/tools/metrics/histograms/metadata/optimization/histograms.xml +++ b/tools/metrics/histograms/metadata/optimization/histograms.xml
@@ -731,6 +731,9 @@ <histogram name="OptimizationGuide.PageContentAnnotationsService.ModelAvailable" enum="BooleanAvailable" expires_after="2022-10-30"> + <obsolete> + Removed in M103. + </obsolete> <owner>robertogden@chromium.org</owner> <owner>chrome-intelligence-core@google.com</owner> <summary> @@ -769,6 +772,9 @@ <histogram name="OptimizationGuide.PageContentAnnotationsService.PageEntitiesExecutionLatency" units="ms" expires_after="2022-10-30"> + <obsolete> + Removed in M103. + </obsolete> <owner>mcrouse@chromium.org</owner> <owner>chrome-intelligence-core@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index db2140a..e9cdb80 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -5083,6 +5083,19 @@ </summary> </histogram> +<histogram name="Eche.StreamEvent.Duration.FromInitializeToClose" units="ms" + expires_after="2022-09-30"> + <owner>paulzchen@google.com</owner> + <owner>andychou@google.com</owner> + <owner>exo-core-eng@google.com</owner> + <summary> + Records the elapsed time from when the stream is initializing to when the + stream is closed before the stream doesn't started. Fires during the process + of closing Eche streaming when the stream doesn't start. It is not sent on a + successful connection attempt. + </summary> +</histogram> + <histogram name="EphemeralTab.BottomSheet.CloseReason" enum="BottomSheet.StateChangeReason" expires_after="M92"> <obsolete>
diff --git a/tools/metrics/histograms/metadata/platform/histograms.xml b/tools/metrics/histograms/metadata/platform/histograms.xml index 73e05e4..ac4140b 100644 --- a/tools/metrics/histograms/metadata/platform/histograms.xml +++ b/tools/metrics/histograms/metadata/platform/histograms.xml
@@ -155,66 +155,6 @@ </summary> </histogram> -<histogram name="Platform.Cr50.BoardIdFlags" enum="Cr50BoardIdFlags" - expires_after="2022-09-25"> - <owner>apronin@chromium.org</owner> - <owner>vbendeb@chromium.org</owner> - <summary> - A sparse histogram of values of Board ID flags programmed in H1 devices in - the field. Board ID flags is a 32 bit field, and while there only are a few - expected values, conceivably any bit combination could be encountered. - </summary> -</histogram> - -<histogram name="Platform.Cr50.BoardIdOfRlzMismatch" enum="Cr50CrosRlzCodes" - expires_after="2022-09-30"> - <owner>vbendeb@chromium.org</owner> - <owner>apronin@chromium.org</owner> - <owner>cros-hwsec+uma@chromium.org</owner> - <summary> - A sparse histogram of values indexed by 4 byte Board ID code programmed in - H1 reported by devices where there is a mismatch between the RLZ code and - the Board ID value programmed in the H1. - </summary> -</histogram> - -<histogram name="Platform.Cr50.FlashLog" enum="Cr50FlashLogs" - expires_after="2022-09-25"> - <owner>apronin@chromium.org</owner> - <owner>vbendeb@chromium.org</owner> - <owner>cros-hwsec+uma@chromium.org</owner> - <summary> - A histogram of flash log event types collected from the H1 device. Log event - type is an 8 bit value. This histogram does not allow to drill into - particular log entries' contents, but allows to collect a general statistics - of events. A script running on the Chrome OS device polls the H1 for new - flash log events after every start up. - </summary> -</histogram> - -<histogram name="Platform.Cr50.MatchingBoardId" enum="Cr50CrosRlzCodes" - expires_after="M85"> - <owner>vbendeb@chromium.org</owner> - <summary> - A sparse histogram of values indexed by 4 byte Board ID code programmed in - H1, reported by devices where there is no mismatch between the RLZ code and - the Board ID value. - </summary> -</histogram> - -<histogram name="Platform.Cr50.RlzOfBoardIdMismatch" enum="Cr50CrosRlzCodes" - expires_after="2022-10-09"> - <owner>vbendeb@chromium.org</owner> - <owner>apronin@chromium.org</owner> - <owner>cros-hwsec+uma@chromium.org</owner> - <summary> - A sparse histogram of values indexed by 4 byte RLZ code reported by devices - where there is a mismatch between the RLZ code and the Board ID value - programmed in the H1. Since RLZ code could be misprogrammed, a sparse - histogram is used to allow keeping track of outliers. - </summary> -</histogram> - <histogram name="Platform.CrOS.CrashSenderRemoveReason" enum="CrosCrashSenderRemoveReason" expires_after="2022-11-06"> <owner>iby@chromium.org</owner> @@ -1456,6 +1396,88 @@ </summary> </histogram> +<histogram name="Platform.{GSC}.BoardIdFlags" enum="Cr50BoardIdFlags" + expires_after="2022-09-25"> + <owner>apronin@chromium.org</owner> + <owner>vbendeb@chromium.org</owner> + <owner>cros-hwsec+uma@chromium.org</owner> + <summary> + A sparse histogram of values of Board ID flags programmed in GSC devices in + the field. Board ID flags is a 32 bit field, and while there only are a few + expected values, conceivably any bit combination could be encountered. + </summary> + <token key="GSC"> + <variant name="Cr50"/> + <variant name="Ti50"/> + </token> +</histogram> + +<histogram name="Platform.{GSC}.BoardIdOfRlzMismatch" enum="Cr50CrosRlzCodes" + expires_after="2022-09-30"> + <owner>vbendeb@chromium.org</owner> + <owner>apronin@chromium.org</owner> + <owner>cros-hwsec+uma@chromium.org</owner> + <summary> + A sparse histogram of values indexed by 4 byte Board ID code programmed in + GSC reported by devices where there is a mismatch between the RLZ code and + the Board ID value programmed in the GSC. + </summary> + <token key="GSC"> + <variant name="Cr50"/> + <variant name="Ti50"/> + </token> +</histogram> + +<histogram name="Platform.{GSC}.FlashLog" enum="Cr50FlashLogs" + expires_after="2022-09-25"> + <owner>apronin@chromium.org</owner> + <owner>vbendeb@chromium.org</owner> + <owner>cros-hwsec+uma@chromium.org</owner> + <summary> + A histogram of flash log event types collected from the GSC device. Log + event type is an 8 bit value. This histogram does not allow to drill into + particular log entries' contents, but allows to collect a general statistics + of events. A script running on the Chrome OS device polls the GSC for new + flash log events after every start up. + </summary> + <token key="GSC"> + <variant name="Cr50"/> + <variant name="Ti50"/> + </token> +</histogram> + +<histogram name="Platform.{GSC}.MatchingBoardId" enum="Cr50CrosRlzCodes" + expires_after="2022-10-26"> + <owner>vbendeb@chromium.org</owner> + <owner>cros-hwsec+uma@chromium.org</owner> + <summary> + A sparse histogram of values indexed by 4 byte Board ID code programmed in + GSC, reported by devices where there is no mismatch between the RLZ code and + the Board ID value. + </summary> + <token key="GSC"> + <variant name="Cr50"/> + <variant name="Ti50"/> + </token> +</histogram> + +<histogram name="Platform.{GSC}.RlzOfBoardIdMismatch" enum="Cr50CrosRlzCodes" + expires_after="2022-10-09"> + <owner>vbendeb@chromium.org</owner> + <owner>apronin@chromium.org</owner> + <owner>cros-hwsec+uma@chromium.org</owner> + <summary> + A sparse histogram of values indexed by 4 byte RLZ code reported by devices + where there is a mismatch between the RLZ code and the Board ID value + programmed in the GSC. Since RLZ code could be misprogrammed, a sparse + histogram is used to allow keeping track of outliers. + </summary> + <token key="GSC"> + <variant name="Cr50"/> + <variant name="Ti50"/> + </token> +</histogram> + <histogram name="PlatformFile.UnknownErrors.Posix" enum="PopularOSErrno" expires_after="M95"> <owner>dmurph@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/side_search/histograms.xml b/tools/metrics/histograms/metadata/side_search/histograms.xml index 59a60234..6e8c949 100644 --- a/tools/metrics/histograms/metadata/side_search/histograms.xml +++ b/tools/metrics/histograms/metadata/side_search/histograms.xml
@@ -127,6 +127,17 @@ </summary> </histogram> +<histogram name="SideSearch.TimeSinceSidePanelAvailableToFirstOpen" units="ms" + expires_after="2022-09-29"> + <owner>yuhengh@chromium.org</owner> + <owner>tluk@chromium.org</owner> + <summary> + The time interval between when the side panel is made available to when it + is first opened for a given tab. Emitted for the active tab when the side + panel is toggled open. + </summary> +</histogram> + </histograms> </histogram-configuration>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 58f089b0..10641151 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -15181,6 +15181,44 @@ </metric> </event> +<event name="PasswordManager.PasswordChangeFlowDuration"> + <owner>kolos@chromium.org</owner> + <owner>jkeitel@google.com</owner> + <summary> + Metrics related to password change flows. Chrome offers users several entry + points for password change flows, e.g. from Password Checkup in Settings or + on a leak warning dialog during sign in with compromised credentials. We + collect the duration of and the success rate of such password change flows. + </summary> + <metric name="Duration"> + <summary> + The time that passed during the start of the flow and the end of the flow + in seconds. + </summary> + </metric> + <metric name="EndEvent" + enum="PasswordManager.PasswordChangeSuccessTracker.EndEvent"> + <summary> + Records how the flow was ended, e.g. whether it ended with an generated + password from an automated flow, a password reset link, etc. + </summary> + </metric> + <metric name="EntryPoint" + enum="PasswordManager.PasswordChangeSuccessTracker.EntryPoint"> + <summary> + Records the entry point of the password change flow, e.g. whether it was + from settings or during login. + </summary> + </metric> + <metric name="StartEvent" + enum="PasswordManager.PasswordChangeSuccessTracker.StartEvent"> + <summary> + Records how the flow was started, e.g. whether it was an automated flow, a + manual flow will a well-known/.change-password URL, etc. + </summary> + </metric> +</event> + <event name="PasswordManager.PasswordChangeTriggered"> <owner>brunobraga@google.com</owner> <owner>chrome-duplex@google.com</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 38b56dc..848c057 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -13,8 +13,8 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "bf2ff04bd153ce3371ec8d1121b499c0461e92ee", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/7d03aa9ca589f13a28910e3b1814a9a985e68b62/trace_processor_shell" + "hash": "c1affa19478fea5d3b605bdffd0023bfb97467fe", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/a942004e951f2d6ccd726fc6ee4e62e5f08c2e62/trace_processor_shell" }, "mac_arm64": { "hash": "e1ad4861384b06d911a65f035317914b8cc975c6", @@ -22,7 +22,7 @@ }, "linux": { "hash": "ffbd563cac673fb2ddc6c8ae87b1746081c4079c", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/959f39f214e2af2d65c4425a494bd19782e14915/trace_processor_shell" + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/a942004e951f2d6ccd726fc6ee4e62e5f08c2e62/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index 2e39255b..b87e5e6 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -56,6 +56,12 @@ defines = [ "UI_DATA_PACK_IMPLEMENTATION" ] + if (is_chromeos) { + sources += [ + "resource/temporary_shared_resource_path_chromeos.cc", + "resource/temporary_shared_resource_path_chromeos.h", + ] + } if (is_chromeos_lacros) { sources += [ "resource/data_pack_with_resource_sharing_lacros.cc",
diff --git a/ui/base/resource/data_pack_with_resource_sharing_lacros.cc b/ui/base/resource/data_pack_with_resource_sharing_lacros.cc index 604ac9d..8f8df90 100644 --- a/ui/base/resource/data_pack_with_resource_sharing_lacros.cc +++ b/ui/base/resource/data_pack_with_resource_sharing_lacros.cc
@@ -16,6 +16,7 @@ #include "base/memory/ref_counted_memory.h" #include "base/version.h" #include "components/version_info/version_info.h" +#include "ui/base/resource/temporary_shared_resource_path_chromeos.h" namespace { @@ -308,10 +309,18 @@ // static void DataPackWithResourceSharing::OnFailedToGenerate( ScopedFileWriter& file, - const base::FilePath& path) { + const base::FilePath& shared_resource_path) { + // Close and delete temp shared resource file. file.Close(); - // Reopen `file` to empty the content. - ScopedFileWriter reopen_file(path); + base::FilePath temp_shared_resource_path = + GetPathForTemporarySharedResourceFile(shared_resource_path); + // Skip error checking since this DeleteFile() is for abandoning a file which + // is no longer useful and it won't affect the behavior itself even if + // DeleteFile() fails. + base::DeleteFile(temp_shared_resource_path); + + // Create `shared_resource_path` file with an empty content. + ScopedFileWriter reopen_file(shared_resource_path); reopen_file.Close(); } @@ -412,9 +421,23 @@ const base::FilePath& lacros_path, const base::FilePath& shared_resource_path, ResourceScaleFactor resource_scale_factor) { - // If `shared_resource_path` is already valid, skip regenerating. - if (IsSharedResourceValid(shared_resource_path)) + // Shared resource file should be moved to .temp on Lacros launch by + // ash-chrome, so `shared_resource_path` must be empty. + // If this is not empty, it might fail to load resources asynchronously by + // zygote or utility process. + DCHECK(!base::PathExists(shared_resource_path)); + + // Get the loction of cached shared resource file. This file does not exist + // if this is the first time to generate it after ash reboot. + base::FilePath temp_shared_resource_path = + GetPathForTemporarySharedResourceFile(shared_resource_path); + + // If `temp_shared_resource_path` is already valid, move it back to + // `shared_resource_path` and skip regenerating. + if (IsSharedResourceValid(temp_shared_resource_path) && + base::Move(temp_shared_resource_path, shared_resource_path)) { return true; + } // Write fallback_resources and mapping_table to `shared_resource_path`. // Generate file even if the data generation fails. If the file creation @@ -423,7 +446,7 @@ // file asynchronously will distinguish the cases where the file is under // construction or the case where the file generation fails by checking the // existence of `shared_resource_path` file. - ScopedFileWriter file(shared_resource_path); + ScopedFileWriter file(temp_shared_resource_path); if (!file.valid()) { LOG(ERROR) << "Failed to open shared resource data pack file. In this " << "case, the file does not exist."; @@ -567,7 +590,10 @@ return false; } - return file.Close(); + // As shared resource file is successfully generated at + // `temp_shared_resource_path`, move the contents to `shared_resource_path`. + file.Close(); + return base::Move(temp_shared_resource_path, shared_resource_path); } // statoc
diff --git a/ui/base/resource/data_pack_with_resource_sharing_lacros.h b/ui/base/resource/data_pack_with_resource_sharing_lacros.h index 58ef242..86661ff6 100644 --- a/ui/base/resource/data_pack_with_resource_sharing_lacros.h +++ b/ui/base/resource/data_pack_with_resource_sharing_lacros.h
@@ -150,16 +150,16 @@ std::map<uint16_t, base::StringPiece> fallback_resources, size_t margin_to_skip, ScopedFileWriter& file); - // Empty the content in `path` before finishing a file generation. - // Close `file` which is ScopedFileWriter for `path` and reopen it to empty - // the whole content. + // Close and delete temp shared resource file used for generating and create + // `shared_resource_path` with an empty content. // This should be called when failing during generating a shared resource. // DO NOT remove a file itself with empty content because zygote/utility - // processes will check if `path` exists or not to distinguish followings: + // processes will check if `shared_resource_path` exists or not to distinguish + // following 2 cases: // 1. A file generation has finished with failure. // 2. A file is still under construction. static void OnFailedToGenerate(ScopedFileWriter& file, - const base::FilePath& path); + const base::FilePath& shared_resource_path); std::unique_ptr<DataPack::DataSource> data_source_;
diff --git a/ui/base/resource/temporary_shared_resource_path_chromeos.cc b/ui/base/resource/temporary_shared_resource_path_chromeos.cc new file mode 100644 index 0000000..e8e1617 --- /dev/null +++ b/ui/base/resource/temporary_shared_resource_path_chromeos.cc
@@ -0,0 +1,15 @@ +// 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. + +#include "ui/base/resource/temporary_shared_resource_path_chromeos.h" + +namespace ui { + +base::FilePath GetPathForTemporarySharedResourceFile( + const base::FilePath& shared_resource_path) { + return base::FilePath(shared_resource_path.value() + + FILE_PATH_LITERAL(".temp")); +} + +} // namespace ui
diff --git a/ui/base/resource/temporary_shared_resource_path_chromeos.h b/ui/base/resource/temporary_shared_resource_path_chromeos.h new file mode 100644 index 0000000..14ae9a4 --- /dev/null +++ b/ui/base/resource/temporary_shared_resource_path_chromeos.h
@@ -0,0 +1,25 @@ +// 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. + +#ifndef UI_BASE_RESOURCE_TEMPORARY_SHARED_RESOURCE_PATH_CHROMEOS_H_ +#define UI_BASE_RESOURCE_TEMPORARY_SHARED_RESOURCE_PATH_CHROMEOS_H_ + +#include "base/files/file_path.h" +#include "ui/base/resource/data_pack_export.h" + +namespace ui { + +// Return temporary shared resource path name for `shared_resource_path` which +// represents the name of shared resource pak. +// Shared resource pak is renamed to this temporary name on Lacros launch to +// avoid being accessed asynchronously before the verification. It will be moved +// back after it's verified in DataPackWithResourceSharing. +// Note that the temporary shared resource file path might differ between ash +// and lacros if the version is not up to date. +base::FilePath UI_DATA_PACK_EXPORT GetPathForTemporarySharedResourceFile( + const base::FilePath& shared_resource_path); + +} // namespace ui + +#endif // UI_BASE_RESOURCE_TEMPORARY_SHARED_RESOURCE_PATH_CHROMEOS_H_
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc index 1306d5a..c6d6b9e 100644 --- a/ui/base/ui_base_switches.cc +++ b/ui/base/ui_base_switches.cc
@@ -26,7 +26,8 @@ #if BUILDFLAG(IS_CHROMEOS) // Enable resources file sharing with ash-chrome. -// This flag is enabled when feature::kLacrosResourcesFileSharing is set. +// This flag is enabled when feature::kLacrosResourcesFileSharing is set and +// ash-side operation is successfully done. const char kEnableResourcesFileSharing[] = "enable-resouces-file-sharing"; #endif
diff --git a/ui/events/ozone/evdev/BUILD.gn b/ui/events/ozone/evdev/BUILD.gn index 7660fe6..e1f06d8 100644 --- a/ui/events/ozone/evdev/BUILD.gn +++ b/ui/events/ozone/evdev/BUILD.gn
@@ -198,8 +198,10 @@ } source_set("event_device_info") { - public = [ "event_device_info.h" ] - sources = [ "event_device_info.cc" ] + sources = [ + "event_device_info.cc", + "event_device_info.h", + ] deps = [ "//base",
diff --git a/ui/events/ozone/evdev/event_device_info.cc b/ui/events/ozone/evdev/event_device_info.cc index 6206aad..93dc643 100644 --- a/ui/events/ozone/evdev/event_device_info.cc +++ b/ui/events/ozone/evdev/event_device_info.cc
@@ -93,6 +93,7 @@ {0x1b1c, 0x1b94}, // Corsair Katar Pro Wireless (USB dongle) {0x1bae, 0x1b1c}, // Corsair Katar Pro Wireless (Bluetooth) {0x1bcf, 0x08a0}, // Kensington Pro Fit Full-size + {0x2201, 0x0100}, // AirTurn PEDpro {0x256c, 0x006d}, // Huion HS64 {0x258a, 0x1007}, // Acer Cestus 330 {0x2717, 0x003b}, // Xiaomi Mi Portable Mouse
diff --git a/ui/file_manager/file_manager/background/js/mock_volume_manager.js b/ui/file_manager/file_manager/background/js/mock_volume_manager.js index c3106900..6016e48f 100644 --- a/ui/file_manager/file_manager/background/js/mock_volume_manager.js +++ b/ui/file_manager/file_manager/background/js/mock_volume_manager.js
@@ -227,6 +227,10 @@ throw new Error('Not implemented'); } + async cancelMounting(fileUrl) { + throw new Error('Not implemented'); + } + async unmount(volumeInfo) { throw new Error('Not implemented'); }
diff --git a/ui/file_manager/file_manager/background/js/volume_manager_impl.js b/ui/file_manager/file_manager/background/js/volume_manager_impl.js index 0c95da1..fdb81aa 100644 --- a/ui/file_manager/file_manager/background/js/volume_manager_impl.js +++ b/ui/file_manager/file_manager/background/js/volume_manager_impl.js
@@ -6,6 +6,7 @@ import {dispatchSimpleEvent} from 'chrome://resources/js/cr.m.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js'; +import {promisify} from '../../common/js/api.js'; import {util} from '../../common/js/util.js'; import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; import {VolumeInfo} from '../../externs/volume_info.js'; @@ -331,6 +332,12 @@ } /** @override */ + async cancelMounting(fileUrl) { + console.warn(`Cancelling mounting archive at '${fileUrl}'`); + return promisify(chrome.fileManagerPrivate.cancelMounting, fileUrl); + } + + /** @override */ async unmount({volumeId}) { console.warn(`Unmounting '${volumeId}'`); chrome.fileManagerPrivate.removeMount(volumeId);
diff --git a/ui/file_manager/file_manager/common/js/filtered_volume_manager.js b/ui/file_manager/file_manager/common/js/filtered_volume_manager.js index 181d789..8adb972 100644 --- a/ui/file_manager/file_manager/common/js/filtered_volume_manager.js +++ b/ui/file_manager/file_manager/common/js/filtered_volume_manager.js
@@ -450,6 +450,12 @@ } /** @override */ + async cancelMounting(fileUrl) { + await this.initialized_; + return this.volumeManager_.cancelMounting(fileUrl); + } + + /** @override */ async unmount(volumeInfo) { await this.initialized_; return this.volumeManager_.unmount(volumeInfo);
diff --git a/ui/file_manager/file_manager/externs/volume_manager.js b/ui/file_manager/file_manager/externs/volume_manager.js index 1e792af..51ab48c 100644 --- a/ui/file_manager/file_manager/externs/volume_manager.js +++ b/ui/file_manager/file_manager/externs/volume_manager.js
@@ -51,6 +51,14 @@ mountArchive(fileUrl, password) {} /** + * Cancels mounting an archive. + * @param {string} fileUrl File url to the archive file. + * @return {!Promise<void>} Fulfilled on success, otherwise rejected + * with a VolumeManagerCommon.VolumeError. + */ + cancelMounting(fileUrl) {} + + /** * Unmounts a volume. * @param {!VolumeInfo} volumeInfo Volume to be unmounted. * @return {!Promise<void>} Fulfilled on success, otherwise rejected with a
diff --git a/ui/file_manager/file_manager/foreground/js/file_tasks.js b/ui/file_manager/file_manager/foreground/js/file_tasks.js index c6e2eb0d..8d266d0 100644 --- a/ui/file_manager/file_manager/foreground/js/file_tasks.js +++ b/ui/file_manager/file_manager/foreground/js/file_tasks.js
@@ -920,21 +920,31 @@ item.type = ProgressItemType.MOUNT_ARCHIVE; item.message = strf('ARCHIVE_MOUNT_MESSAGE', filename); + item.cancelCallback = () => { + this.volumeManager_.cancelMounting(url); + }; + // Display progress panel. item.state = ProgressItemState.PROGRESSING; this.progressCenter_.updateItem(item); + let wasCancelled = false; + // First time, try without providing a password. try { return await this.volumeManager_.mountArchive(url); } catch (error) { // If error is not about needing a password, propagate it. + if (error === VolumeManagerCommon.VolumeError.CANCELLED) { + wasCancelled = true; + } if (error !== VolumeManagerCommon.VolumeError.NEED_PASSWORD) { throw error; } } finally { // Remove progress panel. - item.state = ProgressItemState.COMPLETED; + item.state = wasCancelled ? ProgressItemState.CANCELED : + ProgressItemState.COMPLETED; this.progressCenter_.updateItem(item); } @@ -1004,8 +1014,10 @@ error.stack || error}`); } } catch (error) { - // No need to display an error message if user canceled. - if (error === FilesPasswordDialog.USER_CANCELLED) { + // No need to display an error message if user canceled mounting or + // canceled the password prompt. + if (error === FilesPasswordDialog.USER_CANCELLED || + error === VolumeManagerCommon.VolumeError.CANCELLED) { return; }
diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn index e2b78831..21dc835 100644 --- a/ui/ozone/platform/wayland/BUILD.gn +++ b/ui/ozone/platform/wayland/BUILD.gn
@@ -218,6 +218,7 @@ "//mojo/public/cpp/system", "//skia", "//third_party/libsync", + "//third_party/re2", "//third_party/wayland:wayland_util", "//third_party/wayland-protocols:alpha_compositing_protocol", "//third_party/wayland-protocols:cursor_shapes_protocol",
diff --git a/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc b/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc index ebd77426..aaff3e1 100644 --- a/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc +++ b/ui/ozone/platform/wayland/gpu/wayland_surface_factory_unittest.cc
@@ -892,6 +892,10 @@ class WaylandSurfaceFactoryCompositorV3 : public WaylandSurfaceFactoryTest {}; TEST_P(WaylandSurfaceFactoryCompositorV3, SurfaceDamageTest) { + // This tests multiple buffers per-frame and order of SwapCompletionCallbacks. + // Even when all OnSubmission from later frames are called, their + // SwapCompletionCallbacks should not run until previous frames' + // SwapCompletionCallbacks run. gl::SetGLImplementation(gl::kGLImplementationEGLGLES2); buffer_manager_gpu_->use_fake_gbm_device_for_test_ = true; @@ -906,7 +910,7 @@ static_cast<ui::GbmSurfacelessWayland*>(gl_surface.get()) ->SetNoGLFlushForTests(); - // This test only needs 1 buffer. + // Expect to create 4 buffers. EXPECT_CALL(*server_.zwp_linux_dmabuf_v1(), CreateParams(_, _, _)).Times(1); gfx::Size test_buffer_size = {300, 100}; @@ -914,15 +918,12 @@ gfx::Rect test_buffer_dmg = gfx::ToEnclosingRect(gfx::ScaleRect( test_buffer_dmg_uv, test_buffer_size.width(), test_buffer_size.height())); gfx::RectF crop_uv = {0.1f, 0.2f, 0.5, 0.5f}; - gfx::Rect expected_src = gfx::ToEnclosingRect( - gfx::ScaleRect({0.2f, 0.4f, 0.5f, 0.5f}, test_buffer_size.height(), - test_buffer_size.width())); - gfx::RectF expected_combined_uv = {0.2, 0.f, 0.64, 0.8}; + gfx::RectF expected_combined_uv = {0.2, 0.2, 0.8, 0.64}; gfx::Rect expected_surface_dmg = gfx::ToEnclosingRect( gfx::ScaleRect(expected_combined_uv, window_->GetBounds().width(), window_->GetBounds().height())); - // Create buffer and FakeGlImageNativePixmap. + // Create buffers and FakeGlImageNativePixmap. std::vector<scoped_refptr<FakeGLImageNativePixmap>> fake_gl_image; auto native_pixmap = surface_factory_->CreateNativePixmap( widget_, nullptr, test_buffer_size, gfx::BufferFormat::BGRA_8888, @@ -932,7 +933,8 @@ auto* root_surface = server_.GetObject<wl::MockSurface>( window_->root_surface()->GetSurfaceId()); - auto* test_viewport = root_surface->viewport(); + auto* mock_primary_surface = server_.GetObject<wl::MockSurface>( + window_->primary_subsurface()->wayland_surface()->GetSurfaceId()); CallbacksHelper cbs_helper; // Submit a frame with an overlay and background. @@ -950,7 +952,7 @@ gl_surface->ScheduleOverlayPlane( fake_gl_image[0].get(), nullptr, gfx::OverlayPlaneData( - INT32_MIN, gfx::OverlayTransform::OVERLAY_TRANSFORM_ROTATE_90, + INT32_MIN, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, gfx::RectF(window_->GetBounds()), crop_uv, false, gfx::Rect(test_buffer_dmg), 1.0f, gfx::OverlayPriorityHint::kNone, gfx::RRectF(), gfx::ColorSpace::CreateSRGB(), absl::nullopt)); @@ -969,24 +971,15 @@ // Wait until the mojo calls are done. base::RunLoop().RunUntilIdle(); - EXPECT_CALL(*test_viewport, - SetSource(expected_src.x(), expected_src.y(), - expected_src.width(), expected_src.height())) - .Times(1); - EXPECT_CALL(*test_viewport, SetDestination(window_->GetBounds().width(), - window_->GetBounds().height())) - .Times(1); - EXPECT_CALL(*root_surface, SetBufferTransform(WL_OUTPUT_TRANSFORM_90)) - .Times(1); Expectation damage = - EXPECT_CALL(*root_surface, Damage(expected_surface_dmg.origin().x(), - expected_surface_dmg.origin().y(), - expected_surface_dmg.width(), - expected_surface_dmg.height())); + EXPECT_CALL(*surface_, Damage(expected_surface_dmg.origin().x(), + expected_surface_dmg.origin().y(), + expected_surface_dmg.width(), + expected_surface_dmg.height())); wl_resource* buffer_resource = nullptr; - Expectation attach = EXPECT_CALL(*root_surface, Attach(_, 0, 0)) + Expectation attach = EXPECT_CALL(*surface_, Attach(_, 0, 0)) .WillOnce(SaveArg<0>(&buffer_resource)); - EXPECT_CALL(*root_surface, Commit()).After(damage, attach); + EXPECT_CALL(*surface_, Commit()).After(damage, attach); // Let's sync so that 1) GbmSurfacelessWayland submits the buffer according to // internal queue and fake server processes the request. @@ -999,9 +992,10 @@ params_vector.front()->resource(), params_vector.front()->buffer_resource()); - // And create buffer. + // And create buffers. Sync(); + testing::Mock::VerifyAndClearExpectations(mock_primary_surface); testing::Mock::VerifyAndClearExpectations(root_surface); // Give mojo the chance to pass the callbacks.
diff --git a/ui/ozone/platform/wayland/host/DEPS b/ui/ozone/platform/wayland/host/DEPS index 02595ff..bae43b4d 100644 --- a/ui/ozone/platform/wayland/host/DEPS +++ b/ui/ozone/platform/wayland/host/DEPS
@@ -9,4 +9,5 @@ "+components/crash/core/common", "+dbus", "+ui/base/linux", + "+third_party/re2", ]
diff --git a/ui/ozone/platform/wayland/host/wayland_event_watcher.cc b/ui/ozone/platform/wayland/host/wayland_event_watcher.cc index 224e45b..ec764c34 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_watcher.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_watcher.cc
@@ -10,11 +10,22 @@ #include "base/logging.h" #include "base/strings/stringprintf.h" #include "components/crash/core/common/crash_key.h" +#include "third_party/re2/src/re2/re2.h" namespace ui { namespace { +// Formats the |message| by removing '@' char followed by any digits until the +// next char. Also removes new line, tab and carriage-return. +void FormatErrorMessage(std::string* message) { + const re2::RE2 kInvalidChars[] = {"\n", "\r", "\t", "[@]+[0-9]+"}; + if (message) { + for (const auto& pattern : kInvalidChars) + re2::RE2::Replace(message, pattern, ""); + } +} + // Wayland error log that will be stored if the client (Chromium) is // disconnected due to a protocol error. static std::string* g_error_log = nullptr; @@ -23,6 +34,9 @@ DCHECK(!g_error_log); g_error_log = new std::string(base::StringPrintV(fmt, argp)); LOG(ERROR) << "libwayland: " << *g_error_log; + // Format the error message only after it's printed. Otherwise, object id will + // be lost and local development and debugging will be harder to do. + FormatErrorMessage(g_error_log); } std::string GetWaylandProtocolError(int err, wl_display* display) { @@ -36,17 +50,18 @@ "Fatal Wayland protocol error %u on interface %s (object %u). " "Shutting down..", ec, intf->name, id); - LOG(ERROR) << error_string; } else { error_string = base::StringPrintf( "Fatal Wayland protocol error %u. Shutting down..", ec); - LOG(ERROR) << error_string; } } else { error_string = base::StringPrintf("Fatal Wayland communication error: %s.", std::strerror(err)); - LOG(ERROR) << error_string; } + LOG(ERROR) << error_string; + // Format the error message only after it's printed. Otherwise, object id will + // be lost and local development and debugging will be harder to do. + FormatErrorMessage(&error_string); return error_string; }
diff --git a/ui/ozone/platform/wayland/host/wayland_event_watcher_unittest.cc b/ui/ozone/platform/wayland/host/wayland_event_watcher_unittest.cc index 809e92b..0c9f0c29 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_watcher_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_watcher_unittest.cc
@@ -38,12 +38,11 @@ auto* xdg_surface = mock_surface->xdg_surface(); // Prepare the expectation error string. - const std::string expected_error_code = base::StrCat( - {wl_resource_get_class(xdg_surface->resource()), "@", - NumberToString(wl_resource_get_id(xdg_surface->resource())), ": error ", - NumberToString( - static_cast<uint32_t>(XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER)), - ": ", kTestErrorString, "\n"}); + const std::string expected_error_code = + base::StrCat({wl_resource_get_class(xdg_surface->resource()), ": error ", + NumberToString(static_cast<uint32_t>( + XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER)), + ": ", kTestErrorString}); wl_resource_post_error(xdg_surface->resource(), XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER, "%s", @@ -62,9 +61,9 @@ // Prepare the expectation error string. const std::string expected_error_code = base::StrCat( - {"wl_display@1: error ", + {"wl_display: error ", NumberToString(static_cast<uint32_t>(WL_DISPLAY_ERROR_NO_MEMORY)), - ": no memory\n"}); + ": no memory"}); wl_resource_post_no_memory(xdg_surface->resource()); @@ -76,9 +75,9 @@ TEST_P(WaylandEventWatcherTest, CrashKeyClientNoMemoryError) { const std::string expected_error_code = base::StrCat( - {"wl_display@1: error ", + {"wl_display: error ", NumberToString(static_cast<uint32_t>(WL_DISPLAY_ERROR_NO_MEMORY)), - ": no memory\n"}); + ": no memory"}); wl_client_post_no_memory(server_.client()); @@ -91,9 +90,9 @@ TEST_P(WaylandEventWatcherTest, CrashKeyClientImplementationError) { const std::string kError = "A nice error."; const std::string expected_error_code = base::StrCat( - {"wl_display@1: error ", + {"wl_display: error ", NumberToString(static_cast<uint32_t>(WL_DISPLAY_ERROR_IMPLEMENTATION)), - ": ", kError, "\n"}); + ": ", kError}); wl_client_post_implementation_error(server_.client(), "%s", kError.c_str());
diff --git a/ui/ozone/platform/wayland/host/wayland_frame_manager.cc b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc index 5bcafde..1430d12b0 100644 --- a/ui/ozone/platform/wayland/host/wayland_frame_manager.cc +++ b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc
@@ -265,7 +265,7 @@ surface->SetBufferTransform(config->transform); surface->SetSurfaceBufferScale(ceil(config->surface_scale_factor)); - surface->SetBufferCrop(config->crop_rect); + surface->SetViewportSource(config->crop_rect); surface->SetViewportDestination(config->bounds_rect.size()); surface->SetOpacity(config->opacity); surface->SetBlending(config->enable_blend);
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc index 877876a3..22f53c1 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.cc +++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
@@ -332,9 +332,10 @@ return augmented_surface_.get(); } -void WaylandSurface::SetBufferCrop(const gfx::RectF& crop) { +void WaylandSurface::SetViewportSource(const gfx::RectF& src_rect) { DCHECK(!apply_state_immediately_); - pending_state_.crop = crop == gfx::RectF{1.f, 1.f} ? gfx::RectF() : crop; + pending_state_.crop = + src_rect == gfx::RectF{1.f, 1.f} ? gfx::RectF() : src_rect; } void WaylandSurface::SetOpacity(const float opacity) { @@ -549,12 +550,8 @@ if (pending_state_.crop.IsEmpty()) { viewport_src_dip = gfx::RectF(bounds); } else { - // viewport_src_dip needs to be in post-transform coordinates. - gfx::RectF crop_transformed = wl::ApplyWaylandTransform( - pending_state_.crop, gfx::SizeF(1, 1), - wl::ToWaylandTransform(pending_state_.buffer_transform)); viewport_src_dip = - gfx::ScaleRect(crop_transformed, bounds.width(), bounds.height()); + gfx::ScaleRect(pending_state_.crop, bounds.width(), bounds.height()); DCHECK(viewport()); if (wl_fixed_from_double(viewport_src_dip.width()) == 0 || wl_fixed_from_double(viewport_src_dip.height()) == 0) {
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.h b/ui/ozone/platform/wayland/host/wayland_surface.h index 4583971..7b5dec9d 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.h +++ b/ui/ozone/platform/wayland/host/wayland_surface.h
@@ -120,14 +120,13 @@ // reset to cover the entire wl_surface. void SetInputRegion(const gfx::Rect* region_px); - // Set the crop uv of the attached wl_buffer. - // Unlike wp_viewport.set_source, this crops the buffer prior to - // |buffer_transform| being applied to the buffer, it will be transformed s.t. - // wp_viewport.source is called with correct params. + // Set the source rectangle of the associated wl_surface. // See: // https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/viewporter/viewporter.xml - // If |crop| is empty, the source rectangle is unset. - void SetBufferCrop(const gfx::RectF& crop); + // If |src_rect| is empty, the source rectangle is unset. + // Note this method does not send corresponding wayland requests until + // attaching the next buffer. + void SetViewportSource(const gfx::RectF& src_rect); // Sets the opacity of the wl_surface using zcr_blending_v1_set_alpha. // See: alpha-compositing-unstable-v1.xml @@ -139,6 +138,8 @@ // Set the destination size of the associated wl_surface according to // |dest_size_px|, which should be in physical pixels. + // Note this method sends corresponding wayland requests immediately because + // it does not need a new buffer attach to take effect. void SetViewportDestination(const gfx::SizeF& dest_size_px); // Creates a wl_subsurface relating this surface and a parent surface,
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 699b82d7..2f18f9d 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -3323,7 +3323,7 @@ surface->AttachBuffer(connection_->buffer_manager_host()->EnsureBufferHandle( surface, buffer_id)); - surface->SetBufferCrop({0.5, 0.5, 0.5, 0.5}); + surface->SetViewportSource({0.5, 0.5, 0.5, 0.5}); surface->SetViewportDestination({800, 600}); surface->ApplyPendingState(); surface->Commit(); @@ -3339,7 +3339,7 @@ surface->AttachBuffer(connection_->buffer_manager_host()->EnsureBufferHandle( surface, buffer_id)); - surface->SetBufferCrop({0.5, 0.5, 0.5, 0.5}); + surface->SetViewportSource({0.5, 0.5, 0.5, 0.5}); surface->SetViewportDestination({800, 600}); surface->ApplyPendingState(); surface->Commit(); @@ -3355,7 +3355,7 @@ surface->AttachBuffer(connection_->buffer_manager_host()->EnsureBufferHandle( surface, buffer_id)); - surface->SetBufferCrop({0., 0., 1., 1.}); + surface->SetViewportSource({0., 0., 1., 1.}); surface->SetViewportDestination({1024, 768}); surface->ApplyPendingState(); surface->Commit(); @@ -3371,7 +3371,7 @@ surface->AttachBuffer(connection_->buffer_manager_host()->EnsureBufferHandle( surface, buffer_id)); - surface->SetBufferCrop({0., 0., 1., 1.}); + surface->SetViewportSource({0., 0., 1., 1.}); surface->SetViewportDestination({1024, 768}); surface->ApplyPendingState(); surface->Commit();
diff --git a/ui/ozone/platform/wayland/test/mock_surface.cc b/ui/ozone/platform/wayland/test/mock_surface.cc index fa3fff5f..ef9f740c 100644 --- a/ui/ozone/platform/wayland/test/mock_surface.cc +++ b/ui/ozone/platform/wayland/test/mock_surface.cc
@@ -66,13 +66,6 @@ mock_surface->set_buffer_scale(scale); } -void SetBufferTransform(struct wl_client* client, - struct wl_resource* resource, - int32_t transform) { - auto* mock_surface = GetUserDataAs<MockSurface>(resource); - mock_surface->SetBufferTransform(transform); -} - void DamageBuffer(struct wl_client* client, struct wl_resource* resource, int32_t x, @@ -101,16 +94,16 @@ } // namespace const struct wl_surface_interface kMockSurfaceImpl = { - DestroyResource, // destroy - Attach, // attach - Damage, // damage - Frame, // frame - SetOpaqueRegion, // set_opaque_region - SetInputRegion, // set_input_region - Commit, // commit - SetBufferTransform, // set_buffer_transform - SetBufferScale, // set_buffer_scale - DamageBuffer, // damage_buffer + DestroyResource, // destroy + Attach, // attach + Damage, // damage + Frame, // frame + SetOpaqueRegion, // set_opaque_region + SetInputRegion, // set_input_region + Commit, // commit + nullptr, // set_buffer_transform + SetBufferScale, // set_buffer_scale + DamageBuffer, // damage_buffer }; const struct zwp_linux_surface_synchronization_v1_interface
diff --git a/ui/ozone/platform/wayland/test/mock_surface.h b/ui/ozone/platform/wayland/test/mock_surface.h index 93f0a00..fb4fedb 100644 --- a/ui/ozone/platform/wayland/test/mock_surface.h +++ b/ui/ozone/platform/wayland/test/mock_surface.h
@@ -48,7 +48,6 @@ void(int32_t x, int32_t y, int32_t width, int32_t height)); MOCK_METHOD0(Commit, void()); MOCK_METHOD1(SetBufferScale, void(int32_t scale)); - MOCK_METHOD1(SetBufferTransform, void(int32_t transform)); MOCK_METHOD4(DamageBuffer, void(int32_t x, int32_t y, int32_t width, int32_t height));
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index abd7f6d2..54373c0 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -887,10 +887,8 @@ const gfx::Rect& restore_bounds) { if (!content_window_) return; - // Avoid changing desktop window visibility state when browser is running in - // headless mode, see https://crbug.com/1237546. - if (!headless_mode_) - desktop_window_tree_host_->Show(show_state, restore_bounds); + + desktop_window_tree_host_->Show(show_state, restore_bounds); } void DesktopNativeWidgetAura::Hide() {
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index d32ed5e..11ae44a 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -113,6 +113,9 @@ // DesktopWindowTreeHost's transparency. void UpdateWindowTransparency(); + // Returns true if the desktop window was created in headless mode. + bool IsHeadlessMode() const { return headless_mode_; } + protected: // internal::NativeWidgetPrivate: void InitNativeWidget(Widget::InitParams params) override;
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index ece3dfb..2715b3a1 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -802,6 +802,10 @@ return native_widget_delegate_->IsModal(); } +bool DesktopWindowTreeHostWin::IsHeadless() const { + return desktop_native_widget_aura_->IsHeadlessMode(); +} + int DesktopWindowTreeHostWin::GetInitialShowState() const { return CanActivate() ? SW_SHOWNORMAL : SW_SHOWNOACTIVATE; }
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index 444581249..acd6f44 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -205,6 +205,7 @@ bool WantsMouseEventsWhenInactive() const override; bool WidgetSizeIsClientSize() const override; bool IsModal() const override; + bool IsHeadless() const override; int GetInitialShowState() const override; int GetNonClientComponent(const gfx::Point& point) const override; void GetWindowMask(const gfx::Size& size, SkPath* path) override;
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index 2b69f47..0a34478 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -358,7 +358,7 @@ hwnd_(owner_->hwnd()), cancel_unlock_(false), should_lock_(owner_->IsVisible() && !owner->HasChildRenderingWindow() && - ::IsWindow(hwnd_) && + ::IsWindow(hwnd_) && !owner_->IsHeadless() && (!(GetWindowLong(hwnd_, GWL_STYLE) & WS_CAPTION) || !ui::win::IsAeroGlassEnabled())) { if (should_lock_) @@ -694,6 +694,14 @@ break; } + // In headless mode the platform window is always hidden, so instead of + // showing it just maintain a local flag to track the expected headless + // window visibility state. + if (IsHeadless()) { + headless_window_visibility_state_ = true; + return; + } + ShowWindow(hwnd(), native_show_state); // When launched from certain programs like bash and Windows Live // Messenger, show_state is set to SW_HIDE, so we need to correct that @@ -720,6 +728,14 @@ } void HWNDMessageHandler::Hide() { + // In headless mode the platform window is always hidden, so instead of + // hiding it just maintain a local flag to track the expected headless + // window visibility state. + if (IsHeadless()) { + headless_window_visibility_state_ = false; + return; + } + if (IsWindow(hwnd())) { // NOTE: Be careful not to activate any windows here (for example, calling // ShowWindow(SW_HIDE) will automatically activate another window). This @@ -772,7 +788,11 @@ } bool HWNDMessageHandler::IsVisible() const { - return !!::IsWindowVisible(hwnd()); + // In headless mode the platform window is always hidden, so instead of + // returning the actual window visibility state return the expected visibility + // state maintained by Show/Hide() calls. + return IsHeadless() ? headless_window_visibility_state_ + : !!::IsWindowVisible(hwnd()); } bool HWNDMessageHandler::IsActive() const { @@ -795,6 +815,10 @@ return (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_TOPMOST) != 0; } +bool HWNDMessageHandler::IsHeadless() const { + return delegate_->IsHeadless(); +} + bool HWNDMessageHandler::RunMoveLoop(const gfx::Vector2d& drag_offset, bool hide_on_escape) { ReleaseCapture(); @@ -907,6 +931,10 @@ } void HWNDMessageHandler::SetFullscreen(bool fullscreen) { + // Avoid setting fullscreen mode when in headless mode. + if (IsHeadless()) + return; + background_fullscreen_hack_ = false; auto ref = msg_handler_weak_factory_.GetWeakPtr(); fullscreen_handler()->SetFullscreen(fullscreen);
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index f4efdc71..3779c50 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h
@@ -142,6 +142,7 @@ bool IsMaximized() const; bool IsFullscreen() const; bool IsAlwaysOnTop() const; + bool IsHeadless() const; bool RunMoveLoop(const gfx::Vector2d& drag_offset, bool hide_on_escape); void EndMoveLoop(); @@ -810,6 +811,11 @@ // call HandleWindowMinimizedOrRestored() when we get a WM_ACTIVATE message. bool notify_restore_on_activate_ = false; + // This tracks headless window visibility state. In headless mode + // the platform window is always hidden, so we use this boolean + // to track the window's requested visibility state. + bool headless_window_visibility_state_ = false; + // This is a map of the HMONITOR to full screeen window instance. It is safe // to keep a raw pointer to the HWNDMessageHandler instance as we track the // window destruction and ensure that the map is cleaned up.
diff --git a/ui/views/win/hwnd_message_handler_delegate.h b/ui/views/win/hwnd_message_handler_delegate.h index d8e0f1d..caff85f 100644 --- a/ui/views/win/hwnd_message_handler_delegate.h +++ b/ui/views/win/hwnd_message_handler_delegate.h
@@ -78,6 +78,9 @@ // Returns true if the delegate represents a modal window. virtual bool IsModal() const = 0; + // Returns true if the delegate represents a headless window. + virtual bool IsHeadless() const = 0; + // Returns the show state that should be used for the application's first // window. virtual int GetInitialShowState() const = 0;