diff --git a/DEPS b/DEPS index cfc6878..bd96ca37 100644 --- a/DEPS +++ b/DEPS
@@ -328,7 +328,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': 'd7bff2860378b174fe97c8cffc29fe79598bb58e', + 'devtools_frontend_revision': '0fd7444012e1c51dd13ac3f90c467e012c7dc320', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -809,7 +809,7 @@ 'packages': [ { 'package': 'chromium/rts/model/linux-amd64', - 'version': 'R2Scs9LeEnk6Gci1aTeYhO1St6xc1j8xDHJ38D2MgfYC', + 'version': 'YroYWbHOD0mEJC7zMZ2T6a0-6rc1g2tWrXM4Zp8O5o0C', }, ], 'dep_type': 'cipd', @@ -820,7 +820,7 @@ 'packages': [ { 'package': 'chromium/rts/model/mac-amd64', - 'version': 'Lay0gyvZ5bikG7V3ktlmqDpwbVBYWTadIMjkw8ryY7UC', + 'version': '5dwZtckJhPng3Ae41onM6DPbQkH_GcSiM2lLJINeAIcC', }, ], 'dep_type': 'cipd', @@ -831,7 +831,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'X5YUlPp5VK-OorwQPdVpGyHCyLDADSQujpS7VenyLfsC', + 'version': 'ifBQjUkeY7JX1jridKaMdrKGb_e3W8DdUxyapL46YrYC', }, ], 'dep_type': 'cipd', @@ -1735,7 +1735,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '48cf29b0b746a3d74cdbb75ae4124a29be15bd14', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '56db8d09529d5ba92d24954a1d78a90c8ea2cd85', + Var('webrtc_git') + '/src.git' + '@' + '8e5a64ae7e74ecb0d8eee4690e44acb758a4bbea', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1805,7 +1805,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@0f111ddf9f9847a073884f83bf50e963bdfc9158', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@6a1317bc1adb7c7f20470b4e0b56100727211520', 'condition': 'checkout_src_internal', }, @@ -1835,7 +1835,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': '_adU8cEJ6gmVsqhP8WodJ33mbeFyMfohPmMyt4J6LHwC', + 'version': 'Gx1YbWcoFfN_I2nQVxzPObH9lniTwQTbCkMNyC8UU_AC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1846,7 +1846,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'cGZ7uWRLKo2a9HooX42JwEdJkp6Ooykfe0v-JuEfWSAC', + 'version': 'j-UCJjIllGzw7XC5dlqYw8vIMwrY7zQWgutFJNBf0yoC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/aw_render_process.cc b/android_webview/browser/aw_render_process.cc index 40486f2c..b8b26fc 100644 --- a/android_webview/browser/aw_render_process.cc +++ b/android_webview/browser/aw_render_process.cc
@@ -4,13 +4,12 @@ #include "android_webview/browser/aw_render_process.h" +#include "android_webview/browser_jni_headers/AwRenderProcess_jni.h" #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" - #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" - -#include "android_webview/browser_jni_headers/AwRenderProcess_jni.h" +#include "ipc/ipc_channel_proxy.h" using base::android::AttachCurrentThread; using content::BrowserThread;
diff --git a/ash/components/drivefs/fake_drivefs.cc b/ash/components/drivefs/fake_drivefs.cc index 26dfaac..22f2dfd 100644 --- a/ash/components/drivefs/fake_drivefs.cc +++ b/ash/components/drivefs/fake_drivefs.cc
@@ -510,4 +510,9 @@ mojom::QuotaUsage::New()); } +void FakeDriveFs::EnableMirroring( + drivefs::mojom::DriveFs::EnableMirroringCallback callback) { + std::move(callback).Run(drivefs::mojom::MirrorSyncStatus::kSuccess); +} + } // namespace drivefs
diff --git a/ash/components/drivefs/fake_drivefs.h b/ash/components/drivefs/fake_drivefs.h index 7a2e225..07fe894 100644 --- a/ash/components/drivefs/fake_drivefs.h +++ b/ash/components/drivefs/fake_drivefs.h
@@ -144,6 +144,9 @@ void GetQuotaUsage( drivefs::mojom::DriveFs::GetQuotaUsageCallback callback) override; + void EnableMirroring( + drivefs::mojom::DriveFs::EnableMirroringCallback callback) override; + const base::FilePath mount_path_; int64_t next_stable_id_ = 1;
diff --git a/ash/components/drivefs/mojom/drivefs.mojom b/ash/components/drivefs/mojom/drivefs.mojom index 6d2f2e91..b17bbb24 100644 --- a/ash/components/drivefs/mojom/drivefs.mojom +++ b/ash/components/drivefs/mojom/drivefs.mojom
@@ -108,6 +108,9 @@ // Returns the total and free space available in the user's Drive. GetQuotaUsage() => (FileError error, QuotaUsage quota); + + // Turn on mirror sync capability. + EnableMirroring() => (MirrorSyncStatus status); }; // Implemented by Chrome, used from DriveFS. @@ -202,6 +205,16 @@ kAuthError, }; +[Extensible] +enum MirrorSyncStatus { + // Successfully turned on mirror sync. + kSuccess, + // Failed to turn on mirror sync. + kFailure, + // The mirror sync feature is disabled by feature flag. + kFeatureNotEnabled, +}; + enum DialogResult { // The dialog was not displayed to the user. kNotDisplayed,
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index f83ca77..6b0a41d 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -510,6 +510,12 @@ const base::Feature kEnableIdleInhibit{"EnableIdleInhibit", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables selecting IKEv2 as the VPN provider type when creating a VPN network. +// This will only take effect when running a compatible kernel, see +// crbug/1275421. +const base::Feature kEnableIkev2Vpn{"EnableIkev2Vpn", + base::FEATURE_DISABLED_BY_DEFAULT}; + // If enabled, the input device cards will be shown in the diagnostics app. const base::Feature kEnableInputInDiagnosticsApp{ "EnableInputInDiagnosticsApp", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -1580,6 +1586,10 @@ return base::FeatureList::IsEnabled(kDragWindowToNewDesk); } +bool IsDriveFsMirroringEnabled() { + return base::FeatureList::IsEnabled(kDriveFsMirroring); +} + bool IsEchePhoneHubPermissionsOnboarding() { return base::FeatureList::IsEnabled(kEchePhoneHubPermissionsOnboarding); } @@ -1733,6 +1743,11 @@ kKeyboardBasedDisplayArrangementInSettings); } +bool IsLanguagePacksEnabled() { + return base::FeatureList::IsEnabled(kHandwritingLegacyRecognition) || + base::FeatureList::IsEnabled(kHandwritingLegacyRecognitionAllLang); +} + bool IsLauncherAppSortEnabled() { return IsProductivityLauncherEnabled() && base::FeatureList::IsEnabled(kLauncherAppSort);
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 4c11230..1628a13 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -206,6 +206,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kEnableIdleInhibit; COMPONENT_EXPORT(ASH_CONSTANTS) +extern const base::Feature kEnableIkev2Vpn; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kEnableInputInDiagnosticsApp; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kEnableKeyboardBacklightToggle; @@ -584,6 +586,7 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDisplayAlignmentAssistanceEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDragUnpinnedAppToPinEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDragWindowToNewDeskEnabled(); +COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDriveFsMirroringEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsEchePhoneHubPermissionsOnboarding(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsEcheSWAEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsEcheCustomWidgetEnabled(); @@ -626,6 +629,7 @@ bool IsKeyboardBacklightToggleEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsKeyboardBasedDisplayArrangementInSettingsEnabled(); +COMPONENT_EXPORT(ASH_CONSTANTS) bool IsLanguagePacksEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsLauncherAppSortEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsLauncherFolderRenameKeepsSortOrderEnabled();
diff --git a/ash/webui/web_applications/test/js_library_test.cc b/ash/webui/web_applications/test/js_library_test.cc index 0b8e149..5a937b4 100644 --- a/ash/webui/web_applications/test/js_library_test.cc +++ b/ash/webui/web_applications/test/js_library_test.cc
@@ -42,7 +42,7 @@ base::FilePath path; CHECK(base::PathService::Get(base::BasePathKey::DIR_SOURCE_ROOT, &path)); path = path.Append(kRootDir); - path = path.AppendASCII(url_path.substr(0, url_path.find("?"))); + path = path.AppendASCII(url_path.substr(0, url_path.find('?'))); std::string contents; {
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 4f825b7..5d3b67e 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20220227.0.1 +7.20220227.3.1
diff --git a/build/fuchsia/linux_internal.sdk.sha1 b/build/fuchsia/linux_internal.sdk.sha1 index 4f825b7..9cf1c5d 100644 --- a/build/fuchsia/linux_internal.sdk.sha1 +++ b/build/fuchsia/linux_internal.sdk.sha1
@@ -1 +1 @@ -7.20220227.0.1 +7.20220228.0.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 4f825b7..5d3b67e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20220227.0.1 +7.20220227.3.1
diff --git a/cc/base/index_rect_unittest.cc b/cc/base/index_rect_unittest.cc index d66813e..a32a70ef 100644 --- a/cc/base/index_rect_unittest.cc +++ b/cc/base/index_rect_unittest.cc
@@ -4,7 +4,6 @@ #include "cc/base/index_rect.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { @@ -23,7 +22,7 @@ {0, 0, 0, 0, 1, 1}, {10, 10, 10, 10, 1, 1}}; - for (size_t i = 0; i < base::size(num_indices_cases); ++i) { + for (size_t i = 0; i < std::size(num_indices_cases); ++i) { const NumIndicesCase& value = num_indices_cases[i]; IndexRect rect(value.left, value.right, value.top, value.bottom); EXPECT_EQ(value.num_indices_x, rect.num_indices_x()); @@ -50,7 +49,7 @@ {{-10, 5, -10, 5}, {0, 10, 0, 10}, {0, 5, 0, 5}, true}, {{0, 5, 0, 5}, {10, 20, 10, 20}, {0, 0, 0, 0}, false}}; - for (size_t i = 0; i < base::size(clamp_to_cases); ++i) { + for (size_t i = 0; i < std::size(clamp_to_cases); ++i) { const ClampToCase& value = clamp_to_cases[i]; IndexRect first(value.first.left, value.first.right, value.first.top, value.first.bottom); @@ -83,7 +82,7 @@ {-10, 10, -10, 10, 20, 20, false}, {-10, 10, -10, 10, 20, 5, false}, {-10, 10, -10, 10, 5, 20, false}}; - for (size_t i = 0; i < base::size(contains_cases); ++i) { + for (size_t i = 0; i < std::size(contains_cases); ++i) { const ContainsCase& value = contains_cases[i]; IndexRect rect(value.left, value.right, value.top, value.bottom); EXPECT_EQ(value.contained, rect.Contains(value.index_x, value.index_y));
diff --git a/cc/base/list_container_unittest.cc b/cc/base/list_container_unittest.cc index 5ce75f1..cbba1aa 100644 --- a/cc/base/list_container_unittest.cc +++ b/cc/base/list_container_unittest.cc
@@ -9,7 +9,6 @@ #include <algorithm> #include <vector> -#include "base/cxx17_backports.h" #include "base/memory/raw_ptr.h" #include "testing/gtest/include/gtest/gtest.h" @@ -798,7 +797,7 @@ list.AllocateAndConstruct<SimpleDerivedElement>(); element->set_value(initial_list_element); } - EXPECT_EQ(base::size(initial_list), list.size()); + EXPECT_EQ(std::size(initial_list), list.size()); // Insert the missing elements. auto iter = list.begin(); @@ -917,7 +916,7 @@ 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 37, 51, 52, 54, 56, 60, 64, 65, 70, 75, 76, 80, 81, 83, 86, 87, 90, 93, 95, 97, 98, }; - const size_t size = base::size(initial_list); + const size_t size = std::size(initial_list); for (size_t i = 0; i < size; ++i) { SimpleDerivedElement* element = list.AllocateAndConstruct<SimpleDerivedElement>(); @@ -1044,7 +1043,7 @@ 23, 24, 25, 26, 27, 28, 29, 30, 32, 34, 36, 37, 51, 52, 54, 56, 60, 64, 65, 70, 75, 76, 80, 81, 83, 86, 87, 90, 93, 95, 97, 98, }; - const size_t size = base::size(initial_list); + const size_t size = std::size(initial_list); for (size_t i = 0; i < size; ++i) { SimpleDerivedElement* element = list.AllocateAndConstruct<SimpleDerivedElement>();
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc index 319c9d88..def7f01 100644 --- a/cc/layers/picture_layer_impl_unittest.cc +++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -12,7 +12,6 @@ #include <set> #include <utility> -#include "base/cxx17_backports.h" #include "base/location.h" #include "base/memory/raw_ptr.h" #include "base/test/scoped_feature_list.h" @@ -3482,7 +3481,7 @@ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > std::numeric_limits<float>::epsilon()) { ++scale_index; - ASSERT_LT(scale_index, base::size(expected_scales)); + ASSERT_LT(scale_index, std::size(expected_scales)); } EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]); @@ -3530,7 +3529,7 @@ while (std::abs(tile->contents_scale_key() - expected_scales[scale_index]) > std::numeric_limits<float>::epsilon()) { ++scale_index; - ASSERT_LT(scale_index, base::size(expected_scales)); + ASSERT_LT(scale_index, std::size(expected_scales)); } EXPECT_FLOAT_EQ(tile->contents_scale_key(), expected_scales[scale_index]);
diff --git a/cc/layers/surface_layer_impl.cc b/cc/layers/surface_layer_impl.cc index 13cabd0..7f5acea 100644 --- a/cc/layers/surface_layer_impl.cc +++ b/cc/layers/surface_layer_impl.cc
@@ -5,10 +5,10 @@ #include "cc/layers/surface_layer_impl.h" #include <stdint.h> + #include <algorithm> #include <utility> -#include "base/cxx17_backports.h" #include "base/synchronization/waitable_event.h" #include "base/trace_event/traced_value.h" #include "cc/debug/debug_colors.h" @@ -244,7 +244,7 @@ 0x800000ff, // Blue. 0x80ee82ee, // Violet. }; - const int kNumColors = base::size(colors); + const int kNumColors = std::size(colors); const int kStripeWidth = 300; const int kStripeHeight = 300;
diff --git a/cc/metrics/compositor_frame_reporter.cc b/cc/metrics/compositor_frame_reporter.cc index f5bb6ff1..d14ff1a 100644 --- a/cc/metrics/compositor_frame_reporter.cc +++ b/cc/metrics/compositor_frame_reporter.cc
@@ -10,7 +10,6 @@ #include <utility> #include "base/cpu_reduction_experiment.h" -#include "base/cxx17_backports.h" #include "base/metrics/histogram_macros.h" #include "base/strings/strcat.h" #include "base/time/time.h" @@ -63,7 +62,7 @@ constexpr const char* kReportTypeNames[]{ "", "MissedDeadlineFrame.", "DroppedFrame.", "CompositorOnlyFrame."}; -static_assert(base::size(kReportTypeNames) == kFrameReportTypeCount, +static_assert(std::size(kReportTypeNames) == kFrameReportTypeCount, "Compositor latency report types has changed."); // This value should be recalculated in case of changes to the number of values @@ -143,7 +142,7 @@ bool CompositorFrameReporter::ProcessedBlinkBreakdown::Iterator::IsValid() const { - return index_ < base::size(owner_->list_); + return index_ < std::size(owner_->list_); } void CompositorFrameReporter::ProcessedBlinkBreakdown::Iterator::Advance() { @@ -212,7 +211,7 @@ CompositorFrameReporter::ProcessedVizBreakdown::Iterator::~Iterator() = default; bool CompositorFrameReporter::ProcessedVizBreakdown::Iterator::IsValid() const { - return index_ < base::size(owner_->list_) && owner_->list_[index_]; + return index_ < std::size(owner_->list_) && owner_->list_[index_]; } void CompositorFrameReporter::ProcessedVizBreakdown::Iterator::Advance() {
diff --git a/cc/metrics/compositor_timing_history.cc b/cc/metrics/compositor_timing_history.cc index e8549001..479fd3b 100644 --- a/cc/metrics/compositor_timing_history.cc +++ b/cc/metrics/compositor_timing_history.cc
@@ -6,11 +6,11 @@ #include <stddef.h> #include <stdint.h> + #include <algorithm> #include <utility> #include <vector> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_macros.h" @@ -286,12 +286,12 @@ 32000000, }; -#define UMA_HISTOGRAM_CUSTOM_TIMES_VSYNC_ALIGNED(name, sample) \ - do { \ - UMA_HISTOGRAM_CUSTOM_ENUMERATION( \ - name "2", sample.InMicroseconds(), \ - std::vector<int>(kUMAVSyncBuckets, \ - kUMAVSyncBuckets + base::size(kUMAVSyncBuckets))); \ +#define UMA_HISTOGRAM_CUSTOM_TIMES_VSYNC_ALIGNED(name, sample) \ + do { \ + UMA_HISTOGRAM_CUSTOM_ENUMERATION( \ + name "2", sample.InMicroseconds(), \ + std::vector<int>(kUMAVSyncBuckets, \ + kUMAVSyncBuckets + std::size(kUMAVSyncBuckets))); \ } while (false) #define UMA_HISTOGRAM_CUSTOM_TIMES_DURATION_SUFFIX(name, suffix, sample) \ @@ -300,7 +300,7 @@ name "2" suffix, sample.InMicroseconds(), \ std::vector<int>( \ kUMADurationBuckets, \ - kUMADurationBuckets + base::size(kUMADurationBuckets))); \ + kUMADurationBuckets + std::size(kUMADurationBuckets))); \ } while (false) #define UMA_HISTOGRAM_CUSTOM_TIMES_DURATION(name, sample) \
diff --git a/cc/metrics/dropped_frame_counter.cc b/cc/metrics/dropped_frame_counter.cc index 5283cca..587b1159 100644 --- a/cc/metrics/dropped_frame_counter.cc +++ b/cc/metrics/dropped_frame_counter.cc
@@ -31,7 +31,7 @@ // Search backwards using the bucket bounds defined above. size_t DecideSmoothnessBucket(double pdf) { - size_t i = base::size(kBucketBounds) - 1; + size_t i = std::size(kBucketBounds) - 1; while (pdf < kBucketBounds[i]) i--; return i; @@ -96,9 +96,9 @@ std::vector<double> SlidingWindowHistogram::GetPercentDroppedFrameBuckets() const { if (total_count_ == 0) - return std::vector<double>(base::size(kBucketBounds), 0); - std::vector<double> buckets(base::size(kBucketBounds)); - for (size_t i = 0; i < base::size(kBucketBounds); ++i) { + return std::vector<double>(std::size(kBucketBounds), 0); + std::vector<double> buckets(std::size(kBucketBounds)); + for (size_t i = 0; i < std::size(kBucketBounds); ++i) { buckets[i] = static_cast<double>(smoothness_buckets_[i]) * 100 / total_count_; } @@ -112,7 +112,7 @@ } std::ostream& SlidingWindowHistogram::Dump(std::ostream& stream) const { - for (size_t i = 0; i < base::size(histogram_bins_); ++i) { + for (size_t i = 0; i < std::size(histogram_bins_); ++i) { stream << i << ": " << histogram_bins_[i] << std::endl; } return stream << "Total: " << total_count_; @@ -349,7 +349,7 @@ sliding_window_histogram_[SmoothnessStrategy::kDefaultStrategy] .GetPercentDroppedFrameBuckets(); DCHECK_EQ(sliding_window_buckets.size(), - base::size(smoothness_data.buckets)); + std::size(smoothness_data.buckets)); std::copy(sliding_window_buckets.begin(), sliding_window_buckets.end(), smoothness_data.buckets);
diff --git a/cc/metrics/event_metrics.cc b/cc/metrics/event_metrics.cc index fe6c2f6..a2ad67a8 100644 --- a/cc/metrics/event_metrics.cc +++ b/cc/metrics/event_metrics.cc
@@ -9,7 +9,6 @@ #include <utility> #include "base/check.h" -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/notreached.h" #include "base/time/default_tick_clock.h" @@ -65,7 +64,7 @@ ScrollUpdateEventMetrics::ScrollUpdateType::kContinued), #undef EVENT_TYPE }; -static_assert(base::size(kInterestingEvents) == +static_assert(std::size(kInterestingEvents) == static_cast<int>(EventMetrics::EventType::kMaxValue) + 1, "EventMetrics::EventType has changed."); @@ -85,7 +84,7 @@ SCROLL_TYPE(Wheel), #undef SCROLL_TYPE }; -static_assert(base::size(kScrollTypes) == +static_assert(std::size(kScrollTypes) == static_cast<int>(ScrollEventMetrics::ScrollType::kMaxValue) + 1, "ScrollEventMetrics::ScrollType has changed."); @@ -104,7 +103,7 @@ PINCH_TYPE(Touchscreen, Touchscreen), #undef PINCH_TYPE }; -static_assert(base::size(kPinchTypes) == +static_assert(std::size(kPinchTypes) == static_cast<int>(PinchEventMetrics::PinchType::kMaxValue) + 1, "PinchEventMetrics::PinchType has changed."); @@ -113,7 +112,7 @@ absl::optional<bool> scroll_is_inertial, absl::optional<ScrollUpdateEventMetrics::ScrollUpdateType> scroll_update_type) { - for (size_t i = 0; i < base::size(kInterestingEvents); i++) { + for (size_t i = 0; i < std::size(kInterestingEvents); i++) { const auto& interesting_event = kInterestingEvents[i]; if (ui_event_type == interesting_event.ui_event_type && scroll_is_inertial == interesting_event.scroll_is_inertial && @@ -128,7 +127,7 @@ } ScrollEventMetrics::ScrollType ToScrollType(ui::ScrollInputType ui_input_type) { - for (size_t i = 0; i < base::size(kScrollTypes); i++) { + for (size_t i = 0; i < std::size(kScrollTypes); i++) { if (ui_input_type == kScrollTypes[i].ui_input_type) { auto metrics_scroll_type = static_cast<ScrollEventMetrics::ScrollType>(i); DCHECK_EQ(metrics_scroll_type, kScrollTypes[i].metrics_scroll_type); @@ -140,7 +139,7 @@ } PinchEventMetrics::PinchType ToPinchType(ui::ScrollInputType ui_input_type) { - for (size_t i = 0; i < base::size(kPinchTypes); i++) { + for (size_t i = 0; i < std::size(kPinchTypes); i++) { if (ui_input_type == kPinchTypes[i].ui_input_type) { auto metrics_pinch_type = static_cast<PinchEventMetrics::PinchType>(i); DCHECK_EQ(metrics_pinch_type, kPinchTypes[i].metrics_pinch_type);
diff --git a/cc/metrics/events_metrics_manager_unittest.cc b/cc/metrics/events_metrics_manager_unittest.cc index 4f5bfc4..2464407 100644 --- a/cc/metrics/events_metrics_manager_unittest.cc +++ b/cc/metrics/events_metrics_manager_unittest.cc
@@ -8,7 +8,6 @@ #include <vector> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/test/simple_test_tick_clock.h" #include "cc/metrics/event_metrics.h" #include "testing/gmock/include/gmock/gmock.h" @@ -190,7 +189,7 @@ }, }; - for (size_t i = 0; i < base::size(configs); i++) { + for (size_t i = 0; i < std::size(configs); i++) { auto& config = configs[i]; std::vector<const EventMetrics*> expected_saved_metrics;
diff --git a/cc/mojom/render_frame_metadata_mojom_traits.h b/cc/mojom/render_frame_metadata_mojom_traits.h index b225ecd..18fef4ff5 100644 --- a/cc/mojom/render_frame_metadata_mojom_traits.h +++ b/cc/mojom/render_frame_metadata_mojom_traits.h
@@ -36,7 +36,7 @@ return metadata.root_background_color; } - static absl::optional<gfx::PointF> root_scroll_offset( + static const absl::optional<gfx::PointF>& root_scroll_offset( const cc::RenderFrameMetadata& metadata) { return metadata.root_scroll_offset; } @@ -54,8 +54,8 @@ return metadata.is_mobile_optimized; } - static absl::optional<cc::DelegatedInkBrowserMetadata> delegated_ink_metadata( - const cc::RenderFrameMetadata& metadata) { + static const absl::optional<cc::DelegatedInkBrowserMetadata>& + delegated_ink_metadata(const cc::RenderFrameMetadata& metadata) { return metadata.delegated_ink_metadata; }
diff --git a/cc/paint/filter_operation.cc b/cc/paint/filter_operation.cc index 4c93eae..dc7fb38 100644 --- a/cc/paint/filter_operation.cc +++ b/cc/paint/filter_operation.cc
@@ -321,7 +321,7 @@ break; case FilterOperation::COLOR_MATRIX: { value->BeginArray("matrix"); - for (size_t i = 0; i < base::size(matrix_); ++i) + for (size_t i = 0; i < std::size(matrix_); ++i) value->AppendDouble(matrix_[i]); value->EndArray(); break;
diff --git a/cc/paint/paint_op_buffer_unittest.cc b/cc/paint/paint_op_buffer_unittest.cc index 8ede6e3..f4806d8 100644 --- a/cc/paint/paint_op_buffer_unittest.cc +++ b/cc/paint/paint_op_buffer_unittest.cc
@@ -7,7 +7,6 @@ #include <algorithm> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/strings/stringprintf.h" @@ -2611,11 +2610,11 @@ static_cast<SkBlendMode>(static_cast<uint8_t>(~0)), }; - for (size_t i = 0; i < base::size(bad_modes_for_draw_color); ++i) { + for (size_t i = 0; i < std::size(bad_modes_for_draw_color); ++i) { buffer.push<DrawColorOp>(SK_ColorMAGENTA, bad_modes_for_draw_color[i]); } - for (size_t i = 0; i < base::size(bad_modes_for_flags); ++i) { + for (size_t i = 0; i < std::size(bad_modes_for_flags); ++i) { PaintFlags flags = test_flags[i % test_flags.size()]; flags.setBlendMode(bad_modes_for_flags[i]); buffer.push<DrawRectOp>(test_rects[i % test_rects.size()], flags);
diff --git a/cc/paint/solid_color_analyzer_unittest.cc b/cc/paint/solid_color_analyzer_unittest.cc index a2bec2e..45b105c 100644 --- a/cc/paint/solid_color_analyzer_unittest.cc +++ b/cc/paint/solid_color_analyzer_unittest.cc
@@ -4,7 +4,6 @@ #include "cc/paint/solid_color_analyzer.h" -#include "base/cxx17_backports.h" #include "base/memory/ref_counted.h" #include "build/build_config.h" #include "cc/paint/display_item_list.h" @@ -424,7 +423,7 @@ for (int case_scale = 0; case_scale < 2; ++case_scale) { bool scaled = case_scale > 0; - for (size_t i = 0; i < base::size(cases); ++i) { + for (size_t i = 0; i < std::size(cases); ++i) { Reset(); Initialize(canvas_rect);
diff --git a/cc/test/task_graph_runner_test_template.h b/cc/test/task_graph_runner_test_template.h index 935a7f9..2c4a18c 100644 --- a/cc/test/task_graph_runner_test_template.h +++ b/cc/test/task_graph_runner_test_template.h
@@ -5,13 +5,12 @@ #ifndef CC_TEST_TASK_GRAPH_RUNNER_TEST_TEMPLATE_H_ #define CC_TEST_TASK_GRAPH_RUNNER_TEST_TEMPLATE_H_ -#include "base/memory/raw_ptr.h" #include "cc/raster/task_graph_runner.h" #include <vector> #include "base/bind.h" -#include "base/cxx17_backports.h" +#include "base/memory/raw_ptr.h" #include "base/synchronization/lock.h" #include "base/threading/simple_thread.h" #include "cc/raster/task_category.h" @@ -281,8 +280,8 @@ TaskInfo(i, 0u, 2u, 1u, 0u, 1u), // Priority 1 TaskInfo(i, 1u, 3u, 1u, 0u, 0u) // Priority 0 }; - this->ScheduleTasks( - i, std::vector<TaskInfo>(tasks, tasks + base::size(tasks))); + this->ScheduleTasks(i, + std::vector<TaskInfo>(tasks, tasks + std::size(tasks))); } for (int i = 0; i < kNamespaceCount; ++i) {
diff --git a/cc/tiles/picture_layer_tiling.cc b/cc/tiles/picture_layer_tiling.cc index c6f453e..a8f454c1c 100644 --- a/cc/tiles/picture_layer_tiling.cc +++ b/cc/tiles/picture_layer_tiling.cc
@@ -13,7 +13,6 @@ #include "base/check_op.h" #include "base/containers/flat_map.h" -#include "base/cxx17_backports.h" #include "base/numerics/safe_conversions.h" #include "base/trace_event/trace_event.h" #include "base/trace_event/traced_value.h" @@ -621,7 +620,7 @@ &visible_rect_in_layer_space, &skewport_in_layer_space, &soon_border_rect_in_layer_space, &eventually_rect_in_layer_space}; gfx::Rect output_rects[4]; - for (size_t i = 0; i < base::size(input_rects); ++i) + for (size_t i = 0; i < std::size(input_rects); ++i) output_rects[i] = EnclosingContentsRectFromLayerRect(*input_rects[i]); // Make sure the eventually rect is aligned to tile bounds. output_rects[3] =
diff --git a/cc/tiles/tile_manager_perftest.cc b/cc/tiles/tile_manager_perftest.cc index fcdc95a2..9d7563f 100644 --- a/cc/tiles/tile_manager_perftest.cc +++ b/cc/tiles/tile_manager_perftest.cc
@@ -5,7 +5,6 @@ #include <stddef.h> #include <stdint.h> -#include "base/cxx17_backports.h" #include "base/lazy_instance.h" #include "base/location.h" #include "base/threading/thread_task_runner_handle.h" @@ -93,7 +92,7 @@ std::unique_ptr<RasterTilePriorityQueue> queue( host_impl()->BuildRasterQueue(priorities[priority_count], RasterTilePriorityQueue::Type::ALL)); - priority_count = (priority_count + 1) % base::size(priorities); + priority_count = (priority_count + 1) % std::size(priorities); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -124,7 +123,7 @@ ASSERT_TRUE(queue->Top().tile()); queue->Pop(); } - priority_count = (priority_count + 1) % base::size(priorities); + priority_count = (priority_count + 1) % std::size(priorities); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -153,7 +152,7 @@ do { std::unique_ptr<EvictionTilePriorityQueue> queue( host_impl()->BuildEvictionQueue(priorities[priority_count])); - priority_count = (priority_count + 1) % base::size(priorities); + priority_count = (priority_count + 1) % std::size(priorities); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired()); @@ -190,7 +189,7 @@ ASSERT_TRUE(queue->Top().tile()); queue->Pop(); } - priority_count = (priority_count + 1) % base::size(priorities); + priority_count = (priority_count + 1) % std::size(priorities); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired());
diff --git a/cc/tiles/tile_manager_unittest.cc b/cc/tiles/tile_manager_unittest.cc index e104da2..7fa41d4 100644 --- a/cc/tiles/tile_manager_unittest.cc +++ b/cc/tiles/tile_manager_unittest.cc
@@ -1903,7 +1903,7 @@ gfx::Size size(10, 12); TileResolution resolutions[] = {HIGH_RESOLUTION, LOW_RESOLUTION}; - for (size_t i = 0; i < base::size(resolutions); ++i) { + for (size_t i = 0; i < std::size(resolutions); ++i) { SCOPED_TRACE(resolutions[i]); // Make a RasterSource that will draw a blue bitmap image.
diff --git a/cc/trees/frame_rate_estimator_unittest.cc b/cc/trees/frame_rate_estimator_unittest.cc index fe684fa..d8c89ec 100644 --- a/cc/trees/frame_rate_estimator_unittest.cc +++ b/cc/trees/frame_rate_estimator_unittest.cc
@@ -4,7 +4,6 @@ #include "cc/trees/frame_rate_estimator.h" -#include "base/cxx17_backports.h" #include "base/test/test_simple_task_runner.h" #include "components/viz/common/frame_sinks/begin_frame_args.h" #include "testing/gtest/include/gtest/gtest.h" @@ -82,10 +81,10 @@ const base::TimeDelta kIntervalForHalfFps = viz::BeginFrameArgs::DefaultInterval() * 2; base::TimeTicks time; - for (size_t i = 0; i <= base::size(kIntervals); ++i) { + for (size_t i = 0; i <= std::size(kIntervals); ++i) { estimator_->WillDraw(time); EXPECT_EQ(kIntervalForHalfFps, estimator_->GetPreferredInterval()); - if (i < base::size(kIntervals)) + if (i < std::size(kIntervals)) time += kIntervals[i]; } }
diff --git a/cc/trees/layer_tree_host_pixeltest_blending.cc b/cc/trees/layer_tree_host_pixeltest_blending.cc index 316bcb4..f8b31c67 100644 --- a/cc/trees/layer_tree_host_pixeltest_blending.cc +++ b/cc/trees/layer_tree_host_pixeltest_blending.cc
@@ -4,7 +4,6 @@ #include <stdint.h> -#include "base/cxx17_backports.h" #include "build/build_config.h" #include "cc/layers/solid_color_layer.h" #include "cc/paint/paint_image.h" @@ -58,7 +57,7 @@ 0x00000000 // transparent }; -const int kCSSTestColorsCount = base::size(kCSSTestColors); +const int kCSSTestColorsCount = std::size(kCSSTestColors); using RenderPassOptions = uint32_t; const uint32_t kUseMasks = 1 << 0;
diff --git a/cc/trees/layer_tree_host_pixeltest_masks.cc b/cc/trees/layer_tree_host_pixeltest_masks.cc index b4626e8..413b0fc 100644 --- a/cc/trees/layer_tree_host_pixeltest_masks.cc +++ b/cc/trees/layer_tree_host_pixeltest_masks.cc
@@ -4,7 +4,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "build/build_config.h" #include "cc/layers/content_layer_client.h" #include "cc/layers/picture_layer.h" @@ -834,7 +833,7 @@ for (int j = 0; j < (bounds.height() + grid_size - 1) / grid_size; j++) { for (int i = 0; i < (bounds.width() + grid_size - 1) / grid_size; i++) { PaintFlags flags; - flags.setColor(test_colors[(i + j * 3) % base::size(test_colors)]); + flags.setColor(test_colors[(i + j * 3) % std::size(test_colors)]); display_list->push<DrawRectOp>( SkRect::MakeXYWH(i * grid_size, j * grid_size, grid_size, grid_size),
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index c546ae7..85e7ddf 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -6,7 +6,6 @@ #include <stdint.h> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/memory/raw_ptr.h" #include "build/build_config.h" #include "cc/layers/heads_up_display_layer.h" @@ -330,7 +329,7 @@ }, }; - if (test_case_ >= base::size(kTests)) + if (test_case_ >= std::size(kTests)) return false; // Make sure that we lost our context at least once in the last test run so // the test did something.
diff --git a/cc/trees/occlusion_unittest.cc b/cc/trees/occlusion_unittest.cc index a0c17bd..ac205211 100644 --- a/cc/trees/occlusion_unittest.cc +++ b/cc/trees/occlusion_unittest.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { @@ -37,8 +36,8 @@ #define EXPECT_OCCLUSION(occlusion, rects, ...) \ { \ bool expected[] = {__VA_ARGS__}; \ - ASSERT_EQ(base::size(rects), base::size(expected)); \ - for (size_t i = 0; i < base::size(rects); ++i) \ + ASSERT_EQ(std::size(rects), std::size(expected)); \ + for (size_t i = 0; i < std::size(rects); ++i) \ EXPECT_EQ(expected[i], occlusion.IsOccluded(rects[i])) \ << "Test failed for index " << i << "."; \ }
diff --git a/chrome/VERSION b/chrome/VERSION index 8ccc26f..287b7b2 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=101 MINOR=0 -BUILD=4914 +BUILD=4916 PATCH=0
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java index bb22e78..ec347dc0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesTest.java
@@ -10,9 +10,6 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.endsWith; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.view.KeyEvent; @@ -35,7 +32,6 @@ import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.JniMocker; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeTabbedActivity; @@ -54,14 +50,12 @@ import org.chromium.chrome.test.util.ChromeTabUtils; 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.omnibox.AutocompleteMatch.NavsuggestTile; import org.chromium.components.omnibox.AutocompleteMatchBuilder; import org.chromium.components.omnibox.AutocompleteResult; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.net.test.EmbeddedTestServer; -import org.chromium.ui.modaldialog.ModalDialogManager; -import org.chromium.ui.modaldialog.ModalDialogProperties; -import org.chromium.ui.modelutil.PropertyModel; import org.chromium.url.GURL; import java.util.Arrays; @@ -81,7 +75,6 @@ // Note: since we use the TestAutocompleteController, this could be any string. private static final String START_PAGE_LOCATION = "/echo/start.html"; private static final String SEARCH_QUERY = "related search query"; - private static final int MV_TILE_CAROUSEL_MATCH_POSITION = 1; @ClassRule public static final ChromeTabbedActivityTestRule sActivityTestRule = @@ -178,7 +171,6 @@ // Second suggestion is the MV Tiles. builder.setType(OmniboxSuggestionType.TILE_NAVSUGGEST); builder.setNavsuggestTiles(Arrays.asList(new NavsuggestTile[] {mTile1, mTile2, mTile3})); - builder.setDeletable(true); autocompleteResult.getSuggestionsList().add(builder.build()); builder.reset(); @@ -218,19 +210,9 @@ }); } - private void longClickTileAtPosition(int position) { - TestThreadUtils.runOnUiThreadBlocking(() -> { - LayoutManager manager = mCarousel.view.getRecyclerViewForTest().getLayoutManager(); - Assert.assertTrue(position < manager.getItemCount()); - manager.scrollToPosition(position); - View view = manager.findViewByPosition(position); - Assert.assertNotNull(view); - view.performLongClick(); - }); - } - @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void keyboardNavigation_highlightingNextTileUpdatesUrlBarText() throws InterruptedException { // Skip past the 'what-you-typed' suggestion. @@ -251,6 +233,7 @@ @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void keyboardNavigation_highlightingPreviousTileUpdatesUrlBarText() throws InterruptedException { // Skip past the 'what-you-typed' suggestion. @@ -271,6 +254,7 @@ @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void keyboardNavigation_highlightAlwaysStartsWithFirstElement() throws InterruptedException { // Skip past the 'what-you-typed' suggestion. @@ -297,6 +281,7 @@ @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void touchNavigation_clickOnFirstMVTile() throws Exception { clickTileAtPosition(0); ChromeTabUtils.waitForTabPageLoaded(mTab, mTile1.url.getSpec()); @@ -304,6 +289,7 @@ @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void touchNavigation_clickOnMiddleMVTile() throws Exception { clickTileAtPosition(1); ChromeTabUtils.waitForTabPageLoaded(mTab, mTile2.url.getSpec()); @@ -311,51 +297,9 @@ @Test @MediumTest + @EnableFeatures("OmniboxMostVisitedTiles") public void touchNavigation_clickOnLastMVTile() throws Exception { clickTileAtPosition(2); ChromeTabUtils.waitForTabPageLoaded(mTab, mTile3.url.getSpec()); } - - @Test - @MediumTest - public void touchNavigation_deleteMostVisitedTile() throws Exception { - final int tileToDelete = 2; - ModalDialogManager manager = mAutocomplete.getModalDialogManagerForTest(); - longClickTileAtPosition(tileToDelete); - - // Wait for the delete dialog to come up... - CriteriaHelper.pollUiThread(() -> { - PropertyModel deleteDialog = manager.getCurrentDialogForTest(); - if (deleteDialog == null) return false; - deleteDialog.get(ModalDialogProperties.CONTROLLER) - .onClick(deleteDialog, ModalDialogProperties.ButtonType.POSITIVE); - return true; - }); - - // ... and go away. - CriteriaHelper.pollUiThread(() -> { return manager.getCurrentDialogForTest() == null; }); - - verify(mController, times(1)) - .deleteMatchElement(eq(MV_TILE_CAROUSEL_MATCH_POSITION), eq(tileToDelete)); - } - - @Test - @MediumTest - public void touchNavigation_dismissDeleteMostVisitedTile() throws Exception { - ModalDialogManager manager = mAutocomplete.getModalDialogManagerForTest(); - longClickTileAtPosition(2); - - // Wait for the delete dialog to come up... - CriteriaHelper.pollUiThread(() -> { - PropertyModel deleteDialog = manager.getCurrentDialogForTest(); - if (deleteDialog == null) return false; - deleteDialog.get(ModalDialogProperties.CONTROLLER) - .onClick(deleteDialog, ModalDialogProperties.ButtonType.NEGATIVE); - return true; - }); - - // ... and go away. - CriteriaHelper.pollUiThread(() -> { return manager.getCurrentDialogForTest() == null; }); - verify(mController, never()).deleteMatchElement(anyInt(), anyInt()); - } }
diff --git a/chrome/app/resources/generated_resources_hy.xtb b/chrome/app/resources/generated_resources_hy.xtb index 2f647735..e6bc89d8 100644 --- a/chrome/app/resources/generated_resources_hy.xtb +++ b/chrome/app/resources/generated_resources_hy.xtb
@@ -1242,6 +1242,7 @@ <translation id="2203088913459920044">Անվանման մեջ կարող են օգտագործվել տառեր, թվեր և հատուկ նշաններ</translation> <translation id="220321590587754225">Չհաջողվեց միանալ։ Նորից փորձեք։</translation> <translation id="2204034823255629767">Կարդալ և փոխել այն ամենն, ինչ դուք մուտքագրում եք</translation> +<translation id="2207115382329026341">Միացրեք հավելվածների հեռարձակման կարգավորումները հեռախոսում։</translation> <translation id="220858061631308971">Մուտքագրեք այս PIN կոդը «<ph name="DEVICE_NAME" />»-ում՝</translation> <translation id="2210462644007531147">Չհաջողվեց ավարտել տեղադրումը</translation> <translation id="2212565012507486665">Թույլատրել քուքիները</translation> @@ -1432,6 +1433,7 @@ <translation id="2367972762794486313">Ցույց տալ հավելվածները</translation> <translation id="236939127352773362">Երբ մոտակա սարքերը միմյանց հետ տվյալներ են փոխանակում</translation> <translation id="2371076942591664043">Բացել ավարտվելուն &պես</translation> +<translation id="237307274687369010">Չհաջողվեց գործարկել <ph name="APP_NAME" /> հավելվածը</translation> <translation id="2373666622366160481">Հարմարեցնել թղթին</translation> <translation id="2375406435414127095">Միացրեք ձեր հեռախոսը</translation> <translation id="2377588536920405462">Դուք կարող եք անջատել տեղորոշումը սարքի կարգավորումներում։ Բացի այդ, տեղորոշման կարգավորումներում հնարավոր է անջատել Wi-Fi-ի, բջջային ցանցերի ու տվիչների օգտագործումը տեղորոշման համար։</translation>
diff --git a/chrome/app/resources/generated_resources_my.xtb b/chrome/app/resources/generated_resources_my.xtb index 84d5122..c96cd34 100644 --- a/chrome/app/resources/generated_resources_my.xtb +++ b/chrome/app/resources/generated_resources_my.xtb
@@ -7459,7 +7459,7 @@ <translation id="8509177919508253835">လုံခြုံရေးကီးများ ပြင်ဆင်သတ်မှတ်ပြီး ပင်နံပါတ်များ ပြုလုပ်ပါ</translation> <translation id="8509646642152301857">စာလုံးပေါင်း စစ်ကြည့်ရေး အဘိဓာန် ဒေါင်းလုဒ် လုပ်မရခဲ့ပါ။</translation> <translation id="8509967119010808787">သင့်တဘ်များတွင် ရှာရန် ဤနေရာကို နှိပ်ပါ</translation> -<translation id="8512396579636492893">{COUNT,plural, =0{လုံခြုံမှုလျော့နည်းသည့် စကားဝှက် မရှိပါ}=1{လုံခြုံမှုလျော့နည်းသည့် စကားဝှက် {COUNT} ခု တွေ့သည်}other{လုံခြုံမှုလျော့နည်းသည့် စကားဝှက် {COUNT} ခု တွေ့သည်}}</translation> +<translation id="8512396579636492893">{COUNT,plural, =0{လုံခြုံမှုလျော့နည်းသည့် စကားဝှက် မရှိပါ}=1{အားနည်းသည့် စကားဝှက် {COUNT} ခု တွေ့သည်}other{အားနည်းသည့် စကားဝှက် {COUNT} ခု တွေ့သည်}}</translation> <translation id="8512476990829870887">လုပ်ငန်းစဉ် အဆုံးသတ်ရန်</translation> <translation id="851263357009351303">ပုံများပြရန် <ph name="HOST" /> ကိုအမြဲတမ်း ခွင့်ပြုမည်</translation> <translation id="8513108775083588393">အော်တို-လှည့်</translation>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 1ae0f89b..0347d90 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -3287,6 +3287,9 @@ {"enable-dns-proxy", flag_descriptions::kEnableDnsProxyName, flag_descriptions::kEnableDnsProxyDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kEnableDnsProxy)}, + {"enable-ikev2-vpn", flag_descriptions::kEnableIkev2VpnName, + flag_descriptions::kEnableIkev2VpnDescription, kOsCrOS, + FEATURE_VALUE_TYPE(ash::features::kEnableIkev2Vpn)}, {"enable-wireguard", flag_descriptions::kEnableWireGuardName, flag_descriptions::kEnableWireGuardDescription, kOsCrOS, FEATURE_VALUE_TYPE(ash::features::kEnableWireGuard)},
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc index d9431e7b..24a0ab0f 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
@@ -290,7 +290,7 @@ void AutocompleteControllerAndroid::OnSuggestionSelected( JNIEnv* env, - jint match_index, + jint selected_index, const jint j_window_open_disposition, const JavaParamRef<jstring>& j_current_url, jint j_page_classification, @@ -303,7 +303,8 @@ content::WebContents* web_contents = content::WebContents::FromJavaWebContents(j_web_contents); - const auto& match = autocomplete_controller_->result().match_at(match_index); + const auto& match = + autocomplete_controller_->result().match_at(selected_index); SuggestionAnswer::LogAnswerUsed(match.answer); TemplateURLService* template_url_service = TemplateURLServiceFactory::GetForProfile(profile_); @@ -335,7 +336,7 @@ : input_.text(), false, /* don't know */ input_.type(), false, /* not keyword mode */ - OmniboxEventProto::INVALID, true, match_index, + OmniboxEventProto::INVALID, true, selected_index, static_cast<WindowOpenDisposition>(j_window_open_disposition), false, sessions::SessionTabHelper::IdForTab(web_contents), OmniboxEventProto::PageClassification(j_page_classification), @@ -350,29 +351,21 @@ ->OnOmniboxOpenedUrl(log); } -void AutocompleteControllerAndroid::DeleteMatch(JNIEnv* env, jint match_index) { - const auto& match = autocomplete_controller_->result().match_at(match_index); +void AutocompleteControllerAndroid::DeleteSuggestion(JNIEnv* env, jint index) { + const auto& match = autocomplete_controller_->result().match_at(index); if (match.SupportsDeletion()) autocomplete_controller_->DeleteMatch(match); } -void AutocompleteControllerAndroid::DeleteMatchElement(JNIEnv* env, - jint match_index, - jint element_index) { - const auto& match = autocomplete_controller_->result().match_at(match_index); - if (match.SupportsDeletion()) - autocomplete_controller_->DeleteMatchElement(match, element_index); -} - ScopedJavaLocalRef<jobject> AutocompleteControllerAndroid:: UpdateMatchDestinationURLWithAdditionalAssistedQueryStats( JNIEnv* env, - jint match_index, + jint selected_index, jlong elapsed_time_since_input_change, const JavaParamRef<jstring>& jnew_query_text, const JavaParamRef<jobjectArray>& jnew_query_params) { AutocompleteMatch match( - autocomplete_controller_->result().match_at(match_index)); + autocomplete_controller_->result().match_at(selected_index)); if (!jnew_query_text.is_null()) { std::u16string query = @@ -402,9 +395,9 @@ ScopedJavaLocalRef<jobject> AutocompleteControllerAndroid::GetMatchingTabForSuggestion(JNIEnv* env, - jint match_index) { + jint index) { const AutocompleteMatch& match = - autocomplete_controller_->result().match_at(match_index); + autocomplete_controller_->result().match_at(index); return match.GetMatchingJavaTab().get(env); }
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.h b/chrome/browser/android/omnibox/autocomplete_controller_android.h index e150fb3..ff61340 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.h +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.h
@@ -63,25 +63,24 @@ void OnSuggestionSelected( JNIEnv* env, - jint match_index, + jint selected_index, const jint j_window_open_disposition, const base::android::JavaParamRef<jstring>& j_current_url, jint j_page_classification, jlong elapsed_time_since_first_modified, jint completed_length, const base::android::JavaParamRef<jobject>& j_web_contents); - void DeleteMatch(JNIEnv* env, jint match_index); - void DeleteMatchElement(JNIEnv* env, jint match_index, jint element_index); + void DeleteSuggestion(JNIEnv* env, jint selected_index); base::android::ScopedJavaLocalRef<jobject> UpdateMatchDestinationURLWithAdditionalAssistedQueryStats( JNIEnv* env, - jint match_index, + jint selected_index, jlong elapsed_time_since_input_change, const base::android::JavaParamRef<jstring>& jnew_query_text, const base::android::JavaParamRef<jobjectArray>& jnew_query_params); base::android::ScopedJavaLocalRef<jobject> GetMatchingTabForSuggestion( JNIEnv* env, - jint match_index); + jint index); // KeyedService: void Shutdown() override;
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.cc b/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.cc index 2e203d5..e28d6e7 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.cc
@@ -8,10 +8,13 @@ #include "base/metrics/histogram_macros.h" #include "chrome/browser/apps/app_service/metrics/app_platform_metrics.h" #include "chrome/browser/apps/app_service/web_contents_app_id_utils.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "components/app_constants/constants.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/scoped_user_pref_update.h" #include "components/services/app_service/public/cpp/instance_update.h" #include "components/services/app_service/public/cpp/types_util.h" #include "content/public/browser/web_contents.h" @@ -26,6 +29,25 @@ namespace { +constexpr char kInputEventMouseKey[] = "mouse"; +constexpr char kInputEventStylusKey[] = "stylus"; +constexpr char kInputEventTouchKey[] = "touch"; +constexpr char kInputEventKeyboardKey[] = "keyboard"; + +base::flat_map<std::string, InputEventSource>& GetInputEventSourceMap() { + static base::NoDestructor<base::flat_map<std::string, InputEventSource>> + input_event_source_map; + if (input_event_source_map->empty()) { + *input_event_source_map = { + {kInputEventMouseKey, InputEventSource::kMouse}, + {kInputEventStylusKey, InputEventSource::kStylus}, + {kInputEventTouchKey, InputEventSource::kTouch}, + {kInputEventKeyboardKey, InputEventSource::kKeyboard}, + }; + } + return *input_event_source_map; +} + InputEventSource GetInputEventSource(ui::EventPointerType type) { switch (type) { case ui::EventPointerType::kUnknown: @@ -41,8 +63,79 @@ } } +// Returns the input event source for the given `event_source` string. +InputEventSource GetInputEventSourceFromString( + const std::string& event_source) { + const auto& input_event_source_map = GetInputEventSourceMap(); + auto it = input_event_source_map.find(event_source); + return (it != input_event_source_map.end()) ? it->second + : InputEventSource::kUnknown; +} + +// Returns the string key for `event_source` to save input events in the user +// pref. +std::string GetInputEventSourceKey(InputEventSource event_source) { + switch (event_source) { + case InputEventSource::kUnknown: + return std::string(); + case InputEventSource::kMouse: + return kInputEventMouseKey; + case InputEventSource::kStylus: + return kInputEventStylusKey; + case InputEventSource::kTouch: + return kInputEventTouchKey; + case InputEventSource::kKeyboard: + return kInputEventKeyboardKey; + } +} + +base::Value ConvertEventCountsToValue( + const AppPlatformInputMetrics::EventSourceToCounts& event_counts) { + base::Value event_counts_dict(base::Value::Type::DICTIONARY); + for (const auto& counts : event_counts) { + base::Value count_dict(base::Value::Type::DICTIONARY); + for (const auto& it : counts.second) { + count_dict.SetIntKey(GetAppTypeHistogramName(it.first), it.second); + } + event_counts_dict.SetKey(GetInputEventSourceKey(counts.first), + std::move(count_dict)); + } + return event_counts_dict; +} + +AppPlatformInputMetrics::EventSourceToCounts ConvertDictValueToEventCounts( + const base::Value::Dict& event_counts) { + AppPlatformInputMetrics::EventSourceToCounts ret; + for (const auto [app_id, counts] : event_counts) { + auto event_source = GetInputEventSourceFromString(app_id); + if (event_source == InputEventSource::kUnknown) { + continue; + } + + const base::Value::Dict* counts_dict = counts.GetIfDict(); + if (!counts_dict) { + continue; + } + for (const auto [app_type, count_value] : *counts_dict) { + auto app_type_name = GetAppTypeNameFromString(app_type); + if (app_type_name == AppTypeName::kUnknown) { + continue; + } + + auto count = count_value.GetIfInt(); + if (!count.has_value()) { + continue; + } + ret[event_source][app_type_name] = count.value(); + } + } + return ret; +} + } // namespace +constexpr char kAppInputEventsKey[] = "app_platform_metrics.app_input_events"; + AppPlatformInputMetrics::AppPlatformInputMetrics( Profile* profile, apps::AppRegistryCache& app_registry_cache, @@ -82,7 +175,18 @@ } void AppPlatformInputMetrics::OnFiveMinutes() { - for (const auto& event_counts : app_id_to_event_count_per_five_minutes_) { + // For the first five minutes, since the saved input events in pref haven't + // been recorded yet, read the input events saved in the user pref, and record + // the input events UKM, then save the new input events to the user pref. + if (should_record_ukm_from_pref_) { + RecordInputEventsUkmFromPref(); + should_record_ukm_from_pref_ = false; + } + SaveInputEvents(); +} + +void AppPlatformInputMetrics::OnTwoHours() { + for (const auto& event_counts : app_id_to_event_count_per_two_hours_) { ukm::SourceId source_id = GetSourceId(event_counts.first); if (source_id == ukm::kInvalidSourceId) { continue; @@ -92,11 +196,8 @@ // counts. RecordInputEventsUkm(source_id, event_counts.second); } - app_id_to_event_count_per_five_minutes_.clear(); -} -void AppPlatformInputMetrics::OnTwoHours() { - // TODO(crbug.com/1299978): Record the input events AppKM. + app_id_to_event_count_per_two_hours_.clear(); } void AppPlatformInputMetrics::OnInstanceUpdate(const InstanceUpdate& update) { @@ -237,8 +338,8 @@ return; } - ++app_id_to_event_count_per_five_minutes_[it->second.app_id][event_source] - [it->second.app_type_name]; + ++app_id_to_event_count_per_two_hours_[it->second.app_id][event_source] + [it->second.app_type_name]; } ukm::SourceId AppPlatformInputMetrics::GetSourceId(const std::string& app_id) { @@ -270,4 +371,38 @@ } } +void AppPlatformInputMetrics::SaveInputEvents() { + DictionaryPrefUpdate input_events_update(profile_->GetPrefs(), + kAppInputEventsKey); + input_events_update->GetDict().clear(); + for (const auto& event_counts : app_id_to_event_count_per_two_hours_) { + input_events_update->SetPath( + event_counts.first, ConvertEventCountsToValue(event_counts.second)); + } +} + +void AppPlatformInputMetrics::RecordInputEventsUkmFromPref() { + DictionaryPrefUpdate input_events_update(profile_->GetPrefs(), + kAppInputEventsKey); + if (!input_events_update->is_dict()) { + return; + } + + for (const auto [app_id, events] : input_events_update->GetDict()) { + ukm::SourceId source_id = GetSourceId(app_id); + if (source_id == ukm::kInvalidSourceId) { + continue; + } + + const base::Value::Dict* events_dict = events.GetIfDict(); + if (!events_dict) { + continue; + } + + EventSourceToCounts event_counts = + ConvertDictValueToEventCounts(*events_dict); + RecordInputEventsUkm(source_id, event_counts); + } +} + } // namespace apps
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.h b/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.h index 93669b4..d0a8b9ba 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.h +++ b/chrome/browser/apps/app_service/metrics/app_platform_input_metrics.h
@@ -33,11 +33,20 @@ kMaxValue = kKeyboard, }; +extern const char kAppInputEventsKey[]; + // This class is used to record the input events for the app windows. class AppPlatformInputMetrics : public ui::EventHandler, public AppRegistryCache::Observer, public InstanceRegistry::Observer { public: + // For web apps and Chrome apps, there might be different app type name for + // opening in tab or window. So record the app type name for the event count. + using CountPerAppType = base::flat_map<AppTypeName, int>; + + // The map to record the event count for each InputEventSource. + using EventSourceToCounts = base::flat_map<InputEventSource, CountPerAppType>; + AppPlatformInputMetrics(Profile* profile, AppRegistryCache& app_registry_cache, InstanceRegistry& instance_registry); @@ -63,13 +72,6 @@ AppTypeName app_type_name; }; - // For web apps and Chrome apps, there might be different app type name for - // opening in tab or window. So record the app type name for the event count. - using CountPerAppType = base::flat_map<AppTypeName, int>; - - // The map to record the event count for each InputEventSource. - using EventSourceToCounts = base::flat_map<InputEventSource, CountPerAppType>; - // InstanceRegistry::Observer: void OnInstanceUpdate(const InstanceUpdate& update) override; void OnInstanceRegistryWillBeDestroyed(InstanceRegistry* cache) override; @@ -94,10 +96,30 @@ void RecordInputEventsUkm(ukm::SourceId source_id, const EventSourceToCounts& event_counts); + // Saves the input events in `app_id_to_event_count_per_two_hours_` to the + // user pref each 2 hours. For example: + // web_app_id1: { + // mouse: { ChromeBrowser: 5, WebApp: 2} + // keyboard: { ChromeBrowser: 2, WebApp: 3} + // }, + // chrome_app_id2: { + // stylus: { ChromeBrowser: 2, ChromeApp: 12} + // keyboard: { ChromeBrowser: 3, ChromeApp: 30} + // }, + // Arc_app_id3: { + // mouse: { Arc: 5} + // }, + void SaveInputEvents(); + + // Records the input events UKM saved in the user pref. + void RecordInputEventsUkmFromPref(); + Profile* profile_; BrowserToTabList browser_to_tab_list_; + bool should_record_ukm_from_pref_ = true; + // The map from the window to the app info. base::flat_map<aura::Window*, AppInfo> window_to_app_info_; @@ -123,7 +145,7 @@ // mouse: { Arc: 5} // }, std::map<std::string, EventSourceToCounts> - app_id_to_event_count_per_five_minutes_; + app_id_to_event_count_per_two_hours_; }; } // namespace apps
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service.cc index f0d1cf5..f402104c 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service.cc
@@ -48,6 +48,7 @@ registry->RegisterDictionaryPref(kAppRunningDuration); registry->RegisterDictionaryPref(kAppActivatedCount); registry->RegisterDictionaryPref(kAppUsageTime); + registry->RegisterDictionaryPref(kAppInputEventsKey); } // static
diff --git a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc index 8a090aa..bc48ed4 100644 --- a/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc +++ b/chrome/browser/apps/app_service/metrics/app_platform_metrics_service_unittest.cc
@@ -1799,6 +1799,12 @@ (int)event_source); } + void VerifyNoUkm() { + auto entries = + test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(0U, entries.size()); + } + private: std::unique_ptr<ash::AshTestHelper> ash_test_helper_; @@ -1813,12 +1819,14 @@ ModifyInstance(/*app_id=*/"a", window(), kActive); CreateInputEvent(InputEventSource::kMouse); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm("app://com.google.A", AppTypeName::kArc, /*event_count=*/1, InputEventSource::kMouse); ModifyInstance(/*app_id=*/"a", window(), apps::InstanceState::kDestroyed); CreateInputEvent(InputEventSource::kMouse); - app_platform_input_metrics()->OnFiveMinutes(); + app_platform_input_metrics()->OnTwoHours(); // Verify no more input event is recorded. VerifyUkm("app://com.google.A", AppTypeName::kArc, /*event_count=*/1, InputEventSource::kMouse); @@ -1828,6 +1836,8 @@ ModifyInstance(/*app_id=*/"a", window(), apps::InstanceState::kActive); CreateInputEvent(InputEventSource::kMouse); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm("app://com.google.A", AppTypeName::kArc, /*event_count=*/1, InputEventSource::kMouse); } @@ -1836,6 +1846,8 @@ ModifyInstance(/*app_id=*/"w", window(), apps::InstanceState::kActive); CreateInputEvent(InputEventSource::kStylus); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm("https://foo.com", AppTypeName::kWeb, /*event_count=*/1, InputEventSource::kStylus); } @@ -1845,6 +1857,8 @@ CreateInputEvent(InputEventSource::kTouch); CreateInputEvent(InputEventSource::kTouch); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm("app://com.google.A", AppTypeName::kArc, /*event_count=*/2, InputEventSource::kTouch); } @@ -1853,6 +1867,8 @@ ModifyInstance(/*app_id=*/"a", window(), apps::InstanceState::kActive); CreateInputEvent(InputEventSource::kKeyboard); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm("app://com.google.A", AppTypeName::kArc, /*event_count=*/1, InputEventSource::kKeyboard); @@ -1860,9 +1876,14 @@ CreateInputEvent(InputEventSource::kKeyboard); app_platform_input_metrics()->OnFiveMinutes(); - // Verify 2 input metrics events are recorded. - const auto entries = + // Verify no more input events UKM recorded. + auto entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(1U, entries.size()); + + app_platform_input_metrics()->OnTwoHours(); + // Verify 2 input metrics events are recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); ASSERT_EQ(2U, entries.size()); std::set<int> counts; for (const auto* entry : entries) { @@ -1886,6 +1907,8 @@ CreateInputEvent(InputEventSource::kKeyboard); CreateInputEvent(InputEventSource::kStylus); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); // Verify 3 input metrics events are recorded. const auto entries = @@ -1927,6 +1950,8 @@ ModifyInstance(app_constants::kChromeAppId, window(), kActiveInstanceState); CreateInputEvent(InputEventSource::kMouse); app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + app_platform_input_metrics()->OnTwoHours(); VerifyUkm(std::string("app://") + app_constants::kChromeAppId, AppTypeName::kChromeBrowser, /*event_count=*/1, InputEventSource::kMouse); @@ -1941,6 +1966,13 @@ ModifyInstance(web_app_id1, web_app_window1.get(), kActiveInstanceState); CreateInputEvent(InputEventSource::kMouse); app_platform_input_metrics()->OnFiveMinutes(); + + // Verify no more input events UKM recorded. + auto entries = + test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(1U, entries.size()); + + app_platform_input_metrics()->OnTwoHours(); // Verify 2 input metrics events are recorded. VerifyUkm(2, url1.spec(), AppTypeName::kChromeBrowser, /*event_count=*/1, InputEventSource::kMouse); @@ -1957,6 +1989,12 @@ CreateInputEvent(InputEventSource::kStylus); CreateInputEvent(InputEventSource::kStylus); app_platform_input_metrics()->OnFiveMinutes(); + + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(2U, entries.size()); + + app_platform_input_metrics()->OnTwoHours(); // Verify 3 input metrics events are recorded. VerifyUkm(3, url2.spec(), AppTypeName::kChromeBrowser, /*event_count=*/2, InputEventSource::kStylus); @@ -1967,6 +2005,12 @@ ModifyInstance(web_app_id1, web_app_window1.get(), kActiveInstanceState); CreateInputEvent(InputEventSource::kKeyboard); app_platform_input_metrics()->OnFiveMinutes(); + + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(3U, entries.size()); + + app_platform_input_metrics()->OnTwoHours(); // Verify 4 input metrics events are recorded. VerifyUkm(4, url1.spec(), AppTypeName::kChromeBrowser, /*event_count=*/1, InputEventSource::kKeyboard); @@ -1975,10 +2019,90 @@ ModifyInstance(web_app_id1, web_app_window1.get(), kInactiveInstanceState); CreateInputEvent(InputEventSource::kStylus); app_platform_input_metrics()->OnFiveMinutes(); + + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(4U, entries.size()); + + app_platform_input_metrics()->OnTwoHours(); // Verify 5 input metrics events are recorded. VerifyUkm(5, std::string("app://") + app_constants::kChromeAppId, AppTypeName::kChromeBrowser, /*event_count=*/1, InputEventSource::kStylus); } +TEST_F(AppPlatformInputMetricsTest, InputEventsUkmReportAfterReboot) { + ModifyInstance(/*app_id=*/"a", window(), apps::InstanceState::kActive); + CreateInputEvent(InputEventSource::kKeyboard); + CreateInputEvent(InputEventSource::kStylus); + CreateInputEvent(InputEventSource::kStylus); + app_platform_input_metrics()->OnFiveMinutes(); + VerifyNoUkm(); + ModifyInstance(/*app_id=*/"a", window(), kInactiveInstanceState); + + // Reset PlatformMetricsService to simulate the system reboot, and verify + // AppKM is restored from the user pref and reported after 5 minutes after + // reboot. + ResetAppPlatformMetricsService(); + VerifyNoUkm(); + + ModifyInstance(/*app_id=*/"a", window(), apps::InstanceState::kActive); + CreateInputEvent(InputEventSource::kStylus); + + app_platform_input_metrics()->OnFiveMinutes(); + // Verify 2 input metrics events are recorded from pref. + auto entries = + test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(2U, entries.size()); + int event_source; + int keyboard_event_count = 0; + int stylus_event_count = 0; + for (const auto* entry : entries) { + test_ukm_recorder()->ExpectEntrySourceHasUrl(entry, + GURL("app://com.google.A")); + test_ukm_recorder()->ExpectEntryMetric(entry, "AppType", + (int)AppTypeName::kArc); + event_source = + *(test_ukm_recorder()->GetEntryMetric(entry, "AppInputEventSource")); + if (event_source == (int)InputEventSource::kKeyboard) { + keyboard_event_count = + *(test_ukm_recorder()->GetEntryMetric(entry, "AppInputEventCount")); + } else if (event_source == (int)InputEventSource::kStylus) { + stylus_event_count = + *(test_ukm_recorder()->GetEntryMetric(entry, "AppInputEventCount")); + } + } + EXPECT_EQ(1, keyboard_event_count); + EXPECT_EQ(2, stylus_event_count); + + CreateInputEvent(InputEventSource::kStylus); + app_platform_input_metrics()->OnFiveMinutes(); + + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(2U, entries.size()); + + ModifyInstance(/*app_id=*/"a", window(), kInactiveInstanceState); + + // Reset PlatformMetricsService to simulate the system reboot, and verify + // only the new AppKM is reported. + ResetAppPlatformMetricsService(); + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(2U, entries.size()); + + app_platform_input_metrics()->OnFiveMinutes(); + // Verify the input metrics events are recorded from pref. + VerifyUkm(/*count=*/3, "app://com.google.A", AppTypeName::kArc, + /*event_count=*/2, InputEventSource::kStylus); + + // Reset PlatformMetricsService to simulate the system reboot, and verify no + // more AppKM is reported. + ResetAppPlatformMetricsService(); + app_platform_input_metrics()->OnFiveMinutes(); + // Verify no more input events UKM recorded. + entries = test_ukm_recorder()->GetEntriesByName("ChromeOSApp.InputEvent"); + ASSERT_EQ(3U, entries.size()); +} + } // namespace apps
diff --git a/chrome/browser/ash/crostini/crostini_manager.cc b/chrome/browser/ash/crostini/crostini_manager.cc index 034cf26..09dfff8 100644 --- a/chrome/browser/ash/crostini/crostini_manager.cc +++ b/chrome/browser/ash/crostini/crostini_manager.cc
@@ -2597,9 +2597,6 @@ if (signal.owner_id() != owner_id_) return; ContainerId container_id(signal.vm_name(), signal.container_name()); - for (auto& observer : container_shutdown_observers_) { - observer.OnContainerShutdown(container_id); - } // Find the callbacks to call, then erase them from the map. auto range_callbacks = shutdown_container_callbacks_.equal_range(container_id); @@ -2608,23 +2605,7 @@ } shutdown_container_callbacks_.erase(range_callbacks.first, range_callbacks.second); - - // Remove from running containers multimap. - auto range_containers = running_containers_.equal_range(signal.vm_name()); - for (auto it = range_containers.first; it != range_containers.second; ++it) { - if (it->second.name == signal.container_name()) { - running_containers_.erase(it); - break; - } - } - if (running_containers_.empty()) { - auto* engagement_metrics_service = - CrostiniEngagementMetricsService::Factory::GetForProfile(profile_); - // This is null in unit tests. - if (engagement_metrics_service) { - engagement_metrics_service->SetBackgroundActive(false); - } - } + RemoveStoppedContainer(container_id); } void CrostiniManager::OnInstallLinuxPackageProgress( @@ -2899,6 +2880,7 @@ break; case vm_tools::cicerone::StopLxdContainerResponse::STOPPED: + RemoveStoppedContainer(container_id); std::move(callback).Run(CrostiniResult::SUCCESS); break; @@ -3140,6 +3122,7 @@ result = CrostiniResult::CONTAINER_STOP_CANCELLED; break; case vm_tools::cicerone::LxdContainerStoppingSignal::STOPPED: + RemoveStoppedContainer(container_id); result = CrostiniResult::SUCCESS; break; case vm_tools::cicerone::LxdContainerStoppingSignal::STOPPING: @@ -3801,4 +3784,28 @@ DCHECK(restarter_it != restarters_by_id_.end()); restarter_it->second->StartLxdContainerFinished(result); } + +void CrostiniManager::RemoveStoppedContainer(const ContainerId& container_id) { + // Run all ContainerShutdown observers + for (auto& observer : container_shutdown_observers_) { + observer.OnContainerShutdown(container_id); + } + // Remove from running containers multimap. + auto range_containers = running_containers_.equal_range(container_id.vm_name); + for (auto it = range_containers.first; it != range_containers.second; ++it) { + if (it->second.name == container_id.container_name) { + running_containers_.erase(it); + break; + } + } + if (running_containers_.empty()) { + auto* engagement_metrics_service = + CrostiniEngagementMetricsService::Factory::GetForProfile(profile_); + // This is null in unit tests. + if (engagement_metrics_service) { + engagement_metrics_service->SetBackgroundActive(false); + } + } +} + } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_manager.h b/chrome/browser/ash/crostini/crostini_manager.h index 48cb95e1..bf97a04 100644 --- a/chrome/browser/ash/crostini/crostini_manager.h +++ b/chrome/browser/ash/crostini/crostini_manager.h
@@ -841,6 +841,9 @@ // metric logging the type. Mostly happens async and best-effort. void EmitVmDiskTypeMetric(const std::string vm_name); + // Removes specified container id from running_containers list. + void RemoveStoppedContainer(const ContainerId& container_id); + Profile* profile_; std::string owner_id_;
diff --git a/chrome/browser/ash/crostini/crostini_util.cc b/chrome/browser/ash/crostini/crostini_util.cc index c005bcb0..6f57c3e1 100644 --- a/chrome/browser/ash/crostini/crostini_util.cc +++ b/chrome/browser/ash/crostini/crostini_util.cc
@@ -655,4 +655,24 @@ } } +bool ShouldStopVm(Profile* profile, const ContainerId& container_id) { + bool is_last_container = true; + base::Value::ConstListView containers = + profile->GetPrefs() + ->GetList(prefs::kCrostiniContainers) + ->GetListDeprecated(); + for (const auto& dict : containers) { + ContainerId container(dict); + if (container.container_name != container_id.container_name && + container.vm_name == container_id.vm_name) { + if (CrostiniManager::GetForProfile(profile)->GetContainerInfo( + container)) { + is_last_container = false; + break; + } + } + } + return is_last_container; +} + } // namespace crostini
diff --git a/chrome/browser/ash/crostini/crostini_util.h b/chrome/browser/ash/crostini/crostini_util.h index e94c869..edaf3797 100644 --- a/chrome/browser/ash/crostini/crostini_util.h +++ b/chrome/browser/ash/crostini/crostini_util.h
@@ -247,6 +247,10 @@ void RecordAppLaunchResultHistogram(CrostiniAppLaunchAppType type, crostini::CrostiniResult reason); +// Tests whether or not the specified Container is the last one running on it's +// VM. Returns true if the VM should be stopped. +bool ShouldStopVm(Profile* profile, const ContainerId& container_id); + } // namespace crostini #endif // CHROME_BROWSER_ASH_CROSTINI_CROSTINI_UTIL_H_
diff --git a/chrome/browser/ash/crostini/crostini_util_unittest.cc b/chrome/browser/ash/crostini/crostini_util_unittest.cc index 0b693a1..e8109fc 100644 --- a/chrome/browser/ash/crostini/crostini_util_unittest.cc +++ b/chrome/browser/ash/crostini/crostini_util_unittest.cc
@@ -6,6 +6,7 @@ #include "base/bind.h" #include "base/run_loop.h" +#include "chrome/browser/ash/crostini/crostini_manager.h" #include "chrome/browser/ash/crostini/crostini_pref_names.h" #include "chrome/browser/ash/crostini/crostini_test_helper.h" #include "chrome/browser/browser_process_platform_part_base.h" @@ -172,6 +173,49 @@ EXPECT_EQ(result[0], dictionary1); EXPECT_EQ(result[1], dictionary2); EXPECT_EQ(result[2], dictionary3); +} -} // namespace crostini +TEST_F(CrostiniUtilTest, ShouldStopVm) { + CrostiniManager* manager = CrostiniManager::GetForProfile(profile_.get()); + ContainerId containera("apple", "banana"); + ContainerId containerb("potato", "strawberry"); + base::Value containers(base::Value::Type::LIST); + containers.Append(containera.ToDictValue().Clone()); + containers.Append(containerb.ToDictValue().Clone()); + + manager->AddRunningVmForTesting("apple"); + manager->AddRunningVmForTesting("potato"); + manager->AddRunningContainerForTesting( + "apple", ContainerInfo("banana", "bo", "home", "1.2.3.4")); + manager->AddRunningContainerForTesting( + "potato", ContainerInfo("strawberry", "bo", "home", "1.2.3.4")); + + ASSERT_TRUE(manager->IsVmRunning("apple")); + ASSERT_TRUE(manager->IsVmRunning("potato")); + + profile_->GetPrefs()->Set(prefs::kCrostiniContainers, std::move(containers)); + + EXPECT_TRUE(ShouldStopVm(profile_.get(), containera)); +} + +TEST_F(CrostiniUtilTest, ShouldNotStopVm) { + CrostiniManager* manager = CrostiniManager::GetForProfile(profile_.get()); + ContainerId containera("apple", "banana"); + ContainerId containerb("apple", "strawberry"); + base::Value containers(base::Value::Type::LIST); + containers.Append(containera.ToDictValue().Clone()); + containers.Append(containerb.ToDictValue().Clone()); + + manager->AddRunningVmForTesting("apple"); + manager->AddRunningContainerForTesting( + "apple", ContainerInfo("banana", "bo", "home", "1.2.3.4")); + manager->AddRunningContainerForTesting( + "apple", ContainerInfo("strawberry", "bo", "home", "1.2.3.4")); + + ASSERT_TRUE(manager->IsVmRunning("apple")); + + profile_->GetPrefs()->Set(prefs::kCrostiniContainers, std::move(containers)); + + EXPECT_FALSE(ShouldStopVm(profile_.get(), containera)); +} } // namespace crostini
diff --git a/chrome/browser/ash/drive/drive_integration_service.cc b/chrome/browser/ash/drive/drive_integration_service.cc index 396b6bd..767f177 100644 --- a/chrome/browser/ash/drive/drive_integration_service.cc +++ b/chrome/browser/ash/drive/drive_integration_service.cc
@@ -11,6 +11,7 @@ #include <vector> #include "ash/components/drivefs/drivefs_bootstrap.h" +#include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/adapters.h" @@ -363,6 +364,12 @@ prefs::kDisableDriveOverCellular, base::BindRepeating(&PreferenceWatcher::UpdateSyncPauseState, weak_ptr_factory_.GetWeakPtr())); + if (chromeos::features::IsDriveFsMirroringEnabled()) { + pref_change_registrar_.Add( + prefs::kDriveFsEnableMirrorSync, + base::BindRepeating(&PreferenceWatcher::ToggleLocalMirroring, + weak_ptr_factory_.GetWeakPtr())); + } } PreferenceWatcher(const PreferenceWatcher&) = delete; @@ -412,6 +419,17 @@ !pref_service_->GetBoolean(prefs::kDisableDrive)); } + void ToggleLocalMirroring() { + DCHECK(integration_service_); + if (chromeos::features::IsDriveFsMirroringEnabled() && + pref_service_->GetBoolean(prefs::kDriveFsEnableMirrorSync)) { + // TODO(b/216228528): Disable mirror sync when the API is available. + integration_service_->EnableMirroring(base::BindOnce( + &DriveIntegrationService::OnEnableMirroringStatusUpdate, + integration_service_->weak_ptr_factory_.GetWeakPtr())); + } + } + void AddNetworkPortalDetectorObserver() { if (chromeos::network_portal_detector::IsInitialized()) { chromeos::network_portal_detector::GetInstance()->AddAndFireObserver( @@ -1138,6 +1156,16 @@ std::move(callback).Run(error, std::move(items.value())); } +void DriveIntegrationService::OnEnableMirroringStatusUpdate( + drivefs::mojom::MirrorSyncStatus status) { + VLOG(1) << "OnEnableMirroringStatusUpdate: " << status; + mirroring_enabled_ = (status == drivefs::mojom::MirrorSyncStatus::kSuccess); +} + +bool DriveIntegrationService::IsMirroringEnabled() { + return mirroring_enabled_; +} + void DriveIntegrationService::GetMetadata( const base::FilePath& local_path, drivefs::mojom::DriveFs::GetMetadataCallback callback) { @@ -1242,6 +1270,14 @@ } } +void DriveIntegrationService::EnableMirroring( + drivefs::mojom::DriveFs::EnableMirroringCallback callback) { + if (chromeos::features::IsDriveFsMirroringEnabled() && + GetDriveFsInterface()) { + GetDriveFsInterface()->EnableMirroring(std::move(callback)); + } +} + //===================== DriveIntegrationServiceFactory ======================= DriveIntegrationServiceFactory::FactoryCallback*
diff --git a/chrome/browser/ash/drive/drive_integration_service.h b/chrome/browser/ash/drive/drive_integration_service.h index e97cb3d..792327c8 100644 --- a/chrome/browser/ash/drive/drive_integration_service.h +++ b/chrome/browser/ash/drive/drive_integration_service.h
@@ -232,6 +232,12 @@ bool crop_to_square, GetThumbnailCallback callback); + // Enable Mirroring for the current device. + void EnableMirroring( + drivefs::mojom::DriveFs::EnableMirroringCallback callback); + + bool IsMirroringEnabled(); + private: enum State { NOT_INITIALIZED, @@ -315,6 +321,8 @@ drive::FileError error, absl::optional<std::vector<drivefs::mojom::QueryItemPtr>> items); + void OnEnableMirroringStatusUpdate(drivefs::mojom::MirrorSyncStatus status); + friend class DriveIntegrationServiceFactory; Profile* profile_; @@ -325,6 +333,8 @@ // Custom mount point name that can be injected for testing in constructor. std::string mount_point_name_; + bool mirroring_enabled_ = false; + base::FilePath cache_root_directory_; std::unique_ptr<EventLogger> logger_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
diff --git a/chrome/browser/ash/drive/drive_integration_service_browsertest.cc b/chrome/browser/ash/drive/drive_integration_service_browsertest.cc index ed06e13..378d26c 100644 --- a/chrome/browser/ash/drive/drive_integration_service_browsertest.cc +++ b/chrome/browser/ash/drive/drive_integration_service_browsertest.cc
@@ -4,7 +4,9 @@ #include "chrome/browser/ash/drive/drive_integration_service.h" +#include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" +#include "base/base_switches.h" #include "base/bind.h" #include "base/command_line.h" #include "base/files/file_util.h" @@ -296,4 +298,40 @@ EXPECT_FALSE(drive_service->is_enabled()); } +class DriveIntegrationBrowserTestWithMirrorSyncEnabled + : public DriveIntegrationServiceBrowserTest { + public: + DriveIntegrationBrowserTestWithMirrorSyncEnabled() { + scoped_feature_list_.InitWithFeatures( + {chromeos::features::kDriveFsMirroring}, {}); + } + + DriveIntegrationBrowserTestWithMirrorSyncEnabled( + const DriveIntegrationBrowserTestWithMirrorSyncEnabled&) = delete; + DriveIntegrationBrowserTestWithMirrorSyncEnabled& operator=( + const DriveIntegrationBrowserTestWithMirrorSyncEnabled&) = delete; + + ~DriveIntegrationBrowserTestWithMirrorSyncEnabled() override {} + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(DriveIntegrationBrowserTestWithMirrorSyncEnabled, + EnableMirrorSync) { + auto* drive_service = + DriveIntegrationServiceFactory::FindForProfile(browser()->profile()); + + // Ensure the mirror syncing service is disabled. + EXPECT_FALSE(browser()->profile()->GetPrefs()->GetBoolean( + prefs::kDriveFsEnableMirrorSync)); + EXPECT_FALSE(drive_service->IsMirroringEnabled()); + + // Enable mirroring and ensure the integration service has it enabled. + browser()->profile()->GetPrefs()->SetBoolean(prefs::kDriveFsEnableMirrorSync, + true); + base::RunLoop().RunUntilIdle(); + EXPECT_TRUE(drive_service->IsMirroringEnabled()); +} + } // namespace drive
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index 019b3b3..21c5cee 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -1607,6 +1607,7 @@ GuestOs, /* guest_os.js */ FilesAppBrowserTest, ::testing::Values(TestCase("fakesListed").EnableGuestOsFiles(), + TestCase("mountGuestError").EnableGuestOsFiles(), TestCase("notListedWithoutFlag"))); } // namespace file_manager
diff --git a/chrome/browser/ash/file_manager/file_tasks.h b/chrome/browser/ash/file_manager/file_tasks.h index 5c7ce5e..93c06fb 100644 --- a/chrome/browser/ash/file_manager/file_tasks.h +++ b/chrome/browser/ash/file_manager/file_tasks.h
@@ -6,27 +6,25 @@ // // WHAT ARE FILE TASKS? // -// File tasks are representation of actions that can be performed over the -// currently selected files from the Files app. A task can be either of: +// File tasks are actions that can be performed over the currently selected +// files from the Files app. A task can be one of: // -// 1) Chrome extension or app, registered via "file_handlers" or -// "file_browser_handlers" in manifest.json (ex. Text.app). This information -// comes from FileBrowserHandler::GetHandlers() +// 1) A Chrome Extension or App, registered via "file_handlers" or +// "file_browser_handlers" in manifest.json (ex. Text.app). This information +// comes from FileBrowserHandler::GetHandlers() // -// See also: -// https://developer.chrome.com/extensions/manifest.html#file_handlers +// See also: https://developer.chrome.com/extensions/manifest.html#file_handlers // https://developer.chrome.com/extensions/fileBrowserHandler.html // -// 2) Built-in handlers provided from the Files app. The Files app provides -// lots of file_browser_handlers, such as "play", "mount-archive". These -// built-in handlers are often handled in special manners inside the Files -// app. This information also comes from FileBrowserHandler::GetHandlers(). +// 2) Built-in handlers provided by the Files app. The Files app provides lots +// of file_browser_handlers, such as "play", "mount-archive". These built-in +// handlers are often handled specially inside the Files app. This +// information also comes from FileBrowserHandler::GetHandlers(). // -// See also: -// ui/file_manager/file_manager/manifest.json +// See also: ui/file_manager/file_manager/manifest.json // -// For example, if the user is now selecting a JPEG file, the Files app will -// receive file tasks represented as a JSON object via +// For example, if the user selects a JPEG file, the Files app will receive file +// tasks represented as a JSON object via // chrome.fileManagerPrivate.getFileTasks() API, which look like: // // [ @@ -58,7 +56,7 @@ // // The "TaskId" format encoding is as follows: // -// <app-id>|<task-type>|<task-action-id> +// <app-id>|<task-type>|<action-id> // // <app-id> is a Chrome Extension/App ID. // @@ -69,23 +67,27 @@ // - "arc" - ARC App // - "crostini" - Crostini App // -// <task-action-id> is an ID string used for identifying actions provided -// from a single Chrome Extension/App. In other words, a single -// Chrome/Extension can provide multiple file handlers hence each of them -// needs to have a unique action ID. For Crostini apps, <task-action-id> is -// always "open-with". +// <action-id> is an ID string used for identifying actions provided from a +// single Chrome Extension/App. In other words, a single Chrome/Extension can +// provide multiple file handlers hence each of them needs to have a unique +// action ID. For Crostini apps, <action-id> is always "open-with". // -// HOW TASKS ARE EXECUTED? +// HOW ARE TASKS EXECUTED? // -// chrome.fileManagerPrivate.executeTask() is used to open a file with a -// handler (Chrome Extension/App), and to open files directly in the browser -// without any handler, e.g. PDF. +// chrome.fileManagerPrivate.executeTask() is used to open a file with a handler +// (Chrome Extension/App), and to open files directly in the browser without any +// handler, e.g. PDF. // -// Some built-in handlers such as "play" are handled internally in the Files -// app. "mount-archive" is handled very differently. +// Files app also has "internal tasks" which we can split into three categories: +// 1. Tasks that open in the browser. The JS-side calls executeTask(), and we +// spawn a new browser tab here on the C++ side. e.g. "view-in-browser", +// "view-pdf" and "open-hosted-*". +// 2. Tasks that are handled internally by Files app JS. e.g. "mount-archive", +// "install-linux-package" and "import-crostini-image". +// 3. Tasks where the browser process opens Files app to a folder or file, e.g. +// "open" and "select", through file_manager::util::OpenItem(). // -// See also: -// ui/file_manager/file_manager/foreground/js/file_tasks.js +// See also: ui/file_manager/file_manager/foreground/js/file_tasks.js // #ifndef CHROME_BROWSER_ASH_FILE_MANAGER_FILE_TASKS_H_
diff --git a/chrome/browser/ash/preferences.cc b/chrome/browser/ash/preferences.cc index d81cf2b6..5f7caa4 100644 --- a/chrome/browser/ash/preferences.cc +++ b/chrome/browser/ash/preferences.cc
@@ -253,6 +253,9 @@ registry->RegisterBooleanPref(drive::prefs::kDriveFsPinnedMigrated, false); registry->RegisterBooleanPref(drive::prefs::kDriveFsEnableVerboseLogging, false); + // Do not sync drive::prefs::kDriveFsEnableMirrorSync because we're syncing + // local files and users may wish to turn this off on a per device basis. + registry->RegisterBooleanPref(drive::prefs::kDriveFsEnableMirrorSync, false); // We don't sync ::prefs::kLanguageCurrentInputMethod and PreviousInputMethod // because they're just used to track the logout state of the device. registry->RegisterStringPref(::prefs::kLanguageCurrentInputMethod, "");
diff --git a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc index 1e5cba0b..d29219c 100644 --- a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc +++ b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc
@@ -80,7 +80,7 @@ : chromeos::SystemWebDialogDelegate(GURL(url), /*title=*/std::u16string()) {} -ChromeCameraAppUIDelegate::CameraAppDialog::~CameraAppDialog() {} +ChromeCameraAppUIDelegate::CameraAppDialog::~CameraAppDialog() = default; ui::ModalType ChromeCameraAppUIDelegate::CameraAppDialog::GetDialogModalType() const { @@ -129,7 +129,7 @@ ->CheckMediaAccessPermission(render_frame_host, security_origin, type); } -ChromeCameraAppUIDelegate::FileMonitor::FileMonitor() {} +ChromeCameraAppUIDelegate::FileMonitor::FileMonitor() = default; ChromeCameraAppUIDelegate::FileMonitor::~FileMonitor() = default;
diff --git a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc index b1177d6..1c719255 100644 --- a/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc +++ b/chrome/browser/ash/web_applications/help_app/help_app_discover_tab_notification_unittest.cc
@@ -22,7 +22,7 @@ class HelpAppDiscoverTabNotificationTest : public BrowserWithTestWindowTest { public: - HelpAppDiscoverTabNotificationTest() {} + HelpAppDiscoverTabNotificationTest() = default; ~HelpAppDiscoverTabNotificationTest() override = default; HelpAppDiscoverTabNotificationTest(
diff --git a/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc b/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc index 6813b64e..c86351c 100644 --- a/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc +++ b/chrome/browser/ash/web_applications/media_app/media_app_integration_browsertest.cc
@@ -47,6 +47,8 @@ #include "services/media_session/public/mojom/media_controller.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" +#include "ui/aura/window.h" +#include "ui/aura/window_observer.h" #include "ui/gfx/color_palette.h" using platform_util::OpenOperationResult; @@ -718,10 +720,10 @@ %EOF`; const pdfBlob = new Blob([pdf], {type: 'application/pdf'}); const blobUrl = URL.createObjectURL(pdfBlob); - const blobUuid = encodeURIComponent( - (new URL(blobUrl.substring(5))).pathname.substring(1)); + const blobUuid = + (new URL(blobUrl.substring(5))).pathname.substring(1); document.querySelector('backlight-app').delegate.openInSandboxedViewer( - 'TestPdfTitle', blobUuid); + 'PDF Accessibility Mode - TestPdfTitle.pdf', blobUuid); )"; content::WebContents* web_ui = LaunchWithNoFiles(); @@ -735,10 +737,31 @@ content::WebContents* popup_ui = popup_browser->tab_strip_model()->GetActiveWebContents(); - content::TitleWatcher watcher(popup_ui, u"TestPdfTitle"); + content::TitleWatcher watcher(popup_ui, + u"PDF Accessibility Mode - TestPdfTitle.pdf"); - EXPECT_EQ(u"TestPdfTitle", watcher.WaitAndGetTitle()); - EXPECT_EQ(u"TestPdfTitle", popup_ui->GetTitle()); + EXPECT_EQ(u"PDF Accessibility Mode - TestPdfTitle.pdf", + watcher.WaitAndGetTitle()); + EXPECT_EQ(u"PDF Accessibility Mode - TestPdfTitle.pdf", popup_ui->GetTitle()); + + const char16_t kExpectedWindowTitle[] = + u"Gallery - PDF Accessibility Mode - TestPdfTitle.pdf"; + aura::Window* popup_window = popup_ui->GetTopLevelNativeWindow(); + + // The NativeWindow title change may happen asynchronously. + if (popup_window->GetTitle() != kExpectedWindowTitle) { + struct NativeWindowTitleWatcher : public aura::WindowObserver { + base::RunLoop run_loop; + void OnWindowTitleChanged(aura::Window* window) override { + run_loop.Quit(); + } + } wait_for_title_change; + popup_window->AddObserver(&wait_for_title_change); + wait_for_title_change.run_loop.Run(); + popup_window->RemoveObserver(&wait_for_title_change); + } + + EXPECT_EQ(kExpectedWindowTitle, popup_window->GetTitle()); EXPECT_TRUE(content::WaitForLoadStop(popup_ui)); content::RenderFrameHost* untrusted_ui = ChildFrameAt(popup_ui, 0);
diff --git a/chrome/browser/ash/web_applications/media_app/media_web_app_info.cc b/chrome/browser/ash/web_applications/media_app/media_web_app_info.cc index 66090da..3fbf7ff1 100644 --- a/chrome/browser/ash/web_applications/media_app/media_web_app_info.cc +++ b/chrome/browser/ash/web_applications/media_app/media_web_app_info.cc
@@ -186,7 +186,7 @@ #if DCHECK_IS_ON() // Check |launch_files| all come from the same directory. if (!launch_dir.empty()) { - for (auto path : params.launch_files) { + for (const auto& path : params.launch_files) { DCHECK_EQ(launch_dir, path.DirName()); } }
diff --git a/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc b/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc index 123a1f4..ce71ba05 100644 --- a/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc +++ b/chrome/browser/ash/web_applications/personalization_app/personalization_app_wallpaper_provider_impl.cc
@@ -365,7 +365,7 @@ } std::vector<ash::OnlineWallpaperVariant> variants; - for (auto entry : image_asset_id_map_) { + for (const auto& entry : image_asset_id_map_) { const ImageInfo& image_info = entry.second; if (image_info.unit_id == it->second.unit_id && image_info.collection_id == it->second.collection_id) {
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index 21acebb..f8bb05c 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -3092,10 +3092,17 @@ EXPECT_EQ("15125551234", GetFieldValueById("phone_form2")); } -// TODO(https://crbug.com/1290277): Check back if flakiness is fixed now. // Test that forms that dynamically change a second time do not get filled. +// Test is flaky on Mac, see https://crbug.com/1290277. +#if BUILDFLAG(IS_MAC) +#define MAYBE_DynamicChangingFormFill_SecondChange \ + DISABLED_DynamicChangingFormFill_SecondChange +#else +#define MAYBE_DynamicChangingFormFill_SecondChange \ + DynamicChangingFormFill_SecondChange +#endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(AutofillInteractiveTestDynamicForm, - DynamicChangingFormFill_SecondChange) { + MAYBE_DynamicChangingFormFill_SecondChange) { CreateTestProfile(); GURL url = embedded_test_server()->GetURL( "a.com", "/autofill/double_dynamic_form.html"); @@ -3168,9 +3175,14 @@ // Test that we can autofill forms that dynamically change select fields to text // fields by changing the visibilities. -// TODO(https://crbug.com/1297560): Check back if flakiness is fixed now. +// Test is flaky on Mac, see https://crbug.com/1290277. +#if BUILDFLAG(IS_MAC) +#define MAYBE_DynamicFormFill_SelectToText DISABLED_DynamicFormFill_SelectToText +#else +#define MAYBE_DynamicFormFill_SelectToText DynamicFormFill_SelectToText +#endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(AutofillInteractiveTestDynamicForm, - DynamicFormFill_SelectToText) { + MAYBE_DynamicFormFill_SelectToText) { CreateTestProfile(); GURL url = embedded_test_server()->GetURL( @@ -3219,8 +3231,16 @@ // Test that we can autofill forms that dynamically change the element that // has been clicked on. +// Test is flaky on Mac, see https://crbug.com/1290277. +#if BUILDFLAG(IS_MAC) +#define MAYBE_DynamicFormFill_FirstElementDisappears \ + DISABLED_DynamicFormFill_FirstElementDisappears +#else +#define MAYBE_DynamicFormFill_FirstElementDisappears \ + DynamicFormFill_FirstElementDisappears +#endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(AutofillInteractiveTestDynamicForm, - DynamicFormFill_FirstElementDisappears) { + MAYBE_DynamicFormFill_FirstElementDisappears) { CreateTestProfile(); GURL url = embedded_test_server()->GetURL( "a.com", "/autofill/dynamic_form_element_invalid.html"); @@ -3293,9 +3313,17 @@ // Test that we can autofill forms that dynamically change the element that // has been clicked on, even though there are multiple forms with identical // names. -// TODO(https://crbug.com/1290277): Check back if flakiness is fixed now. -IN_PROC_BROWSER_TEST_P(AutofillInteractiveTestDynamicForm, - DynamicFormFill_FirstElementDisappearsBadnameUnowned) { +// Test is flaky on Mac, see https://crbug.com/1290277. +#if BUILDFLAG(IS_MAC) +#define MAYBE_DynamicFormFill_FirstElementDisappearsBadnameUnowned \ + DISABLED_DynamicFormFill_FirstElementDisappearsBadnameUnowned +#else +#define MAYBE_DynamicFormFill_FirstElementDisappearsBadnameUnowned \ + DynamicFormFill_FirstElementDisappearsBadnameUnowned +#endif // BUILDFLAG(IS_MAC) +IN_PROC_BROWSER_TEST_P( + AutofillInteractiveTestDynamicForm, + MAYBE_DynamicFormFill_FirstElementDisappearsBadnameUnowned) { CreateTestProfile(); GURL url = embedded_test_server()->GetURL( "a.com", "/autofill/dynamic_form_element_invalid_unowned_badnames.html"); @@ -3412,9 +3440,16 @@ // Test that we can Autofill dynamically changing selects that have options // added and removed only once. -// TODO(https://crbug.com/1290277): Check back if flakiness is fixed now. +// Test is flaky on Mac, see https://crbug.com/1290277. +#if BUILDFLAG(IS_MAC) +#define MAYBE_DynamicChangingFormFill_DoubleSelectUpdated \ + DISABLED_DynamicChangingFormFill_DoubleSelectUpdated +#else +#define MAYBE_DynamicChangingFormFill_DoubleSelectUpdated \ + DynamicChangingFormFill_DoubleSelectUpdated +#endif // BUILDFLAG(IS_MAC) IN_PROC_BROWSER_TEST_P(AutofillInteractiveTestDynamicForm, - DynamicChangingFormFill_DoubleSelectUpdated) { + MAYBE_DynamicChangingFormFill_DoubleSelectUpdated) { CreateTestProfile(); GURL url = embedded_test_server()->GetURL( "a.com", "/autofill/dynamic_form_double_select_options_change.html");
diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 795b73b..1bd8bf7 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc
@@ -75,6 +75,8 @@ extension_misc::kCalendarAppId, web_app::kGoogleCalendarAppId, + web_app::kMessagesAppId, + arc::kYoutubeAppId, extension_misc::kYoutubeAppId, web_app::kYoutubeAppId,
diff --git a/chrome/browser/chromeos/extensions/file_manager/event_router.cc b/chrome/browser/chromeos/extensions/file_manager/event_router.cc index 38319aaa..469bda7 100644 --- a/chrome/browser/chromeos/extensions/file_manager/event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/event_router.cc
@@ -245,10 +245,12 @@ switch (type) { case file_manager::io_task::OperationType::kCopy: return file_manager_private::IO_TASK_TYPE_COPY; - case file_manager::io_task::OperationType::kMove: - return file_manager_private::IO_TASK_TYPE_MOVE; case file_manager::io_task::OperationType::kDelete: return file_manager_private::IO_TASK_TYPE_DELETE; + case file_manager::io_task::OperationType::kExtract: + return file_manager_private::IO_TASK_TYPE_EXTRACT; + case file_manager::io_task::OperationType::kMove: + return file_manager_private::IO_TASK_TYPE_MOVE; case file_manager::io_task::OperationType::kZip: return file_manager_private::IO_TASK_TYPE_ZIP; default:
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.cc index 07ac8d9..7caee24e 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.cc
@@ -9,6 +9,13 @@ #include "chrome/browser/profiles/profile.h" #include "extensions/browser/extension_function.h" +namespace { +// Thresholds for mountGuest() API. +constexpr base::TimeDelta kMountGuestSlowOperationThreshold = base::Seconds(10); +constexpr base::TimeDelta kMountGuestVerySlowOperationThreshold = + base::Seconds(30); +} // namespace + namespace extensions { ExtensionFunction::ResponseAction @@ -28,4 +35,18 @@ return RespondNow(OneArgument(std::move(entries))); } +FileManagerPrivateMountGuestFunction::FileManagerPrivateMountGuestFunction() { + // Mounting shares may require a VM to be started. + SetWarningThresholds(kMountGuestSlowOperationThreshold, + kMountGuestVerySlowOperationThreshold); +} + +FileManagerPrivateMountGuestFunction::~FileManagerPrivateMountGuestFunction() = + default; + +ExtensionFunction::ResponseAction FileManagerPrivateMountGuestFunction::Run() { + LOG(ERROR) << "Mount not implemented"; + return RespondNow(Error("Not implemented")); +} + } // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.h b/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.h index 534de04e8..99b8a2d 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.h +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_guest_os.h
@@ -27,6 +27,25 @@ ResponseAction Run() override; }; +// Implements the chrome.fileManagerPrivate.mountGuest method. +// Mounts a Guest OS. +class FileManagerPrivateMountGuestFunction : public LoggedExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.mountGuest", + FILEMANAGERPRIVATE_MOUNTGUEST) + FileManagerPrivateMountGuestFunction(); + + FileManagerPrivateMountGuestFunction( + const FileManagerPrivateMountGuestFunction&) = delete; + FileManagerPrivateMountGuestFunction& operator=( + const FileManagerPrivateMountGuestFunction&) = delete; + + private: + ~FileManagerPrivateMountGuestFunction() override; + + ResponseAction Run() override; +}; + } // namespace extensions #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_GUEST_OS_H_
diff --git a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc index fd52fe2..b35d4d1b01 100644 --- a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc +++ b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc
@@ -24,6 +24,7 @@ #include "components/prefs/pref_service.h" #include "content/public/browser/navigation_handle.h" #include "content/public/browser/render_process_host.h" +#include "ipc/ipc_channel_proxy.h" namespace {
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index ef75e6e..98afbd66 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2252,6 +2252,11 @@ "expiry_milestone": 100 }, { + "name": "enable-ikev2-vpn", + "owners": [ "jiejiang", "taoyl", "cros-networking@google.com" ], + "expiry_milestone": 106 + }, + { "name": "enable-image-reader", "owners": [ "vikassoni", "liberato" ], "expiry_milestone": 115 @@ -3978,12 +3983,7 @@ { "name": "media-app-handles-pdf", "owners": [ "//ash/webui/media_app_ui/OWNERS" ], - "expiry_milestone": 100 - }, - { - "name": "media-app-multi-window", - "owners": [ "//ash/webui/media_app_ui/OWNERS" ], - "expiry_milestone": 98 + "expiry_milestone": 106 }, { "name": "media-router-cast-allow-all-ips",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index dabb889..c544d1b2a 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -4698,6 +4698,12 @@ const char kEnableIdleInhibitDescription[] = "Enables the Wayland idle-inhibit-unstable-v1 protocol"; +const char kEnableIkev2VpnName[] = "Enable IKEv2 VPN"; +const char kEnableIkev2VpnDescription[] = + "Enable selecting IKEv2 as the VPN provider type when creating a VPN " + "network. This will only take effect when running a compatible kernel, see " + "crbug/1275421."; + const char kEnableNetworkingInDiagnosticsAppName[] = "Enable networking cards in the Diagnostics App"; const char kEnableNetworkingInDiagnosticsAppDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 2c9ad95..95860a0 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -2703,6 +2703,9 @@ extern const char kEnableIdleInhibitName[]; extern const char kEnableIdleInhibitDescription[]; +extern const char kEnableIkev2VpnName[]; +extern const char kEnableIkev2VpnDescription[]; + extern const char kEnableNetworkingInDiagnosticsAppName[]; extern const char kEnableNetworkingInDiagnosticsAppDescription[];
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.cc b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.cc index e3eaad9..56ca61d 100644 --- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.cc +++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.cc
@@ -20,9 +20,7 @@ std::unique_ptr<network::ResourceRequest> resource_request, const net::NetworkTrafficAnnotationTag& network_traffic_annotation) { streaming_url_loader_ = std::make_unique<StreamingSearchPrefetchURLLoader>( - this, profile, std::move(resource_request), network_traffic_annotation, - base::BindOnce(&StreamingSearchPrefetchRequest::StopPrefetch, - weak_factory_.GetWeakPtr())); + this, profile, std::move(resource_request), network_traffic_annotation); } std::unique_ptr<SearchPrefetchURLLoader>
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h index ad75d40..ff051c6 100644 --- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h +++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_request.h
@@ -47,8 +47,6 @@ private: // The ongoing prefetch request. Null before and after the fetch. std::unique_ptr<StreamingSearchPrefetchURLLoader> streaming_url_loader_; - - base::WeakPtrFactory<StreamingSearchPrefetchRequest> weak_factory_{this}; }; #endif // CHROME_BROWSER_PREFETCH_SEARCH_PREFETCH_STREAMING_SEARCH_PREFETCH_REQUEST_H_
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc index 6898ac6..43c5457 100644 --- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc +++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.cc
@@ -33,11 +33,9 @@ StreamingSearchPrefetchRequest* streaming_prefetch_request, Profile* profile, std::unique_ptr<network::ResourceRequest> resource_request, - const net::NetworkTrafficAnnotationTag& network_traffic_annotation, - base::OnceClosure stop_prefetch_closure) + const net::NetworkTrafficAnnotationTag& network_traffic_annotation) : resource_request_(std::move(resource_request)), - streaming_prefetch_request_(streaming_prefetch_request), - stop_prefetch_closure_(std::move(stop_prefetch_closure)) { + streaming_prefetch_request_(streaming_prefetch_request) { DCHECK(streaming_prefetch_request_); auto url_loader_factory = profile->GetDefaultStoragePartition() ->GetURLLoaderFactoryForBrowserProcess(); @@ -60,6 +58,7 @@ StreamingSearchPrefetchURLLoader::ServingResponseHandler( std::unique_ptr<SearchPrefetchURLLoader> loader) { DCHECK(!streaming_prefetch_request_); + DCHECK(!forwarding_client_); return base::BindOnce( &StreamingSearchPrefetchURLLoader::SetUpForwardingClient, weak_factory_.GetWeakPtr(), std::move(loader)); @@ -79,12 +78,19 @@ // At this point, we are bound to the mojo receiver, so we can release // |loader|, which points to |this|. receiver_.Bind(std::move(receiver)); - loader.release(); + self_pointer_ = std::move(loader); receiver_.set_disconnect_handler(base::BindOnce( &StreamingSearchPrefetchURLLoader::OnURLLoaderClientMojoDisconnect, weak_factory_.GetWeakPtr())); forwarding_client_.Bind(std::move(forwarding_client)); + // If the object previously encountered an error while still owned elsewhere, + // schedule the delete for now. + if (pending_delete_) { + PostTaskToDeleteSelf(); + return; + } + // We are serving, so if the request is complete before serving, mark the // request completion time as now. if (status_) { @@ -134,7 +140,7 @@ if (streaming_prefetch_request_) { streaming_prefetch_request_->ErrorEncountered(); } else { - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); } } @@ -169,8 +175,8 @@ void StreamingSearchPrefetchURLLoader::OnStartLoadingResponseBody( mojo::ScopedDataPipeConsumerHandle body) { if (forwarding_client_) { - DCHECK(forwarding_client_); DCHECK(!streaming_prefetch_request_); + DCHECK(self_pointer_); forwarding_client_->OnStartLoadingResponseBody(std::move(body)); return; } @@ -205,6 +211,9 @@ } void StreamingSearchPrefetchURLLoader::OnStartLoadingResponseBodyFromData() { + DCHECK(forwarding_client_); + DCHECK(self_pointer_); + DCHECK(!streaming_prefetch_request_); mojo::ScopedDataPipeConsumerHandle consumer_handle; MojoCreateDataPipeOptions options; @@ -218,7 +227,7 @@ mojo::CreateDataPipe(&options, producer_handle_, consumer_handle); if (rv != MOJO_RESULT_OK) { - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); return; } @@ -239,14 +248,20 @@ void StreamingSearchPrefetchURLLoader::OnHandleReady( MojoResult result, const mojo::HandleSignalsState& state) { + DCHECK(forwarding_client_); + DCHECK(self_pointer_); + DCHECK(!streaming_prefetch_request_); if (result != MOJO_RESULT_OK) { - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); return; } PushData(); } void StreamingSearchPrefetchURLLoader::PushData() { + DCHECK(forwarding_client_); + DCHECK(self_pointer_); + DCHECK(!streaming_prefetch_request_); while (true) { DCHECK_GE(bytes_of_raw_data_to_transfer_, write_position_); uint32_t write_size = @@ -266,7 +281,7 @@ } if (result != MOJO_RESULT_OK) { - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); return; } @@ -278,6 +293,8 @@ void StreamingSearchPrefetchURLLoader::Finish() { DCHECK(forwarding_client_); + DCHECK(self_pointer_); + DCHECK(!streaming_prefetch_request_); serving_from_data_ = false; handle_watcher_.reset(); @@ -292,12 +309,14 @@ network_url_loader_.reset(); if (forwarding_client_ && !serving_from_data_) { DCHECK(!streaming_prefetch_request_); + DCHECK(self_pointer_); forwarding_client_->OnComplete(status); return; } if (streaming_prefetch_request_) { DCHECK(!forwarding_client_); + DCHECK(!self_pointer_); if (status.error_code == net::OK) { streaming_prefetch_request_->MarkPrefetchAsComplete(); } else { @@ -310,6 +329,9 @@ } void StreamingSearchPrefetchURLLoader::RunEventQueue() { + DCHECK(forwarding_client_); + DCHECK(self_pointer_); + DCHECK(!streaming_prefetch_request_); for (auto& event : event_queue_) { std::move(event).Run(); } @@ -351,28 +373,31 @@ return; } - if (!forwarding_client_) { - DCHECK(streaming_prefetch_request_); + if (streaming_prefetch_request_) { + DCHECK(!forwarding_client_); + DCHECK(!self_pointer_); streaming_prefetch_request_->ErrorEncountered(); } else { - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); } } void StreamingSearchPrefetchURLLoader::OnURLLoaderClientMojoDisconnect() { DCHECK(forwarding_client_); DCHECK(!streaming_prefetch_request_); - PostTaskToStopPrefetchAndDeleteSelf(); + PostTaskToDeleteSelf(); } void StreamingSearchPrefetchURLLoader::ClearOwnerPointer() { streaming_prefetch_request_ = nullptr; } -void StreamingSearchPrefetchURLLoader::PostTaskToStopPrefetchAndDeleteSelf() { - // To avoid UAF bugs, post a separate task to delete this object. - if (stop_prefetch_closure_) { - base::SequencedTaskRunnerHandle::Get()->PostTask( - FROM_HERE, std::move(stop_prefetch_closure_)); +void StreamingSearchPrefetchURLLoader::PostTaskToDeleteSelf() { + if (!self_pointer_) { + pending_delete_ = true; + return; } + // To avoid UAF bugs, post a separate task to delete this object. + base::SequencedTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, + std::move(self_pointer_)); }
diff --git a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h index 4bdd35b..cbfa20de 100644 --- a/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h +++ b/chrome/browser/prefetch/search_prefetch/streaming_search_prefetch_url_loader.h
@@ -40,8 +40,7 @@ StreamingSearchPrefetchRequest* streaming_prefetch_request, Profile* profile, std::unique_ptr<network::ResourceRequest> resource_request, - const net::NetworkTrafficAnnotationTag& network_traffic_annotation, - base::OnceClosure stop_prefetch_closure); + const net::NetworkTrafficAnnotationTag& network_traffic_annotation); ~StreamingSearchPrefetchURLLoader() override; @@ -108,8 +107,8 @@ // Clears |producer_handle_| and |handle_watcher_|. void Finish(); - // Post a task to delete this object by running stop_prefetch_closure_. - void PostTaskToStopPrefetchAndDeleteSelf(); + // Post a task to delete this object at a later point. + void PostTaskToDeleteSelf(); // Sets up mojo forwarding to the navigation path. Resumes // |network_url_loader_| calls. Serves the start of the response to the @@ -170,8 +169,13 @@ mojo::ScopedDataPipeProducerHandle producer_handle_; std::unique_ptr<mojo::SimpleWatcher> handle_watcher_; - // Closure to cancel this prefetch. Running this callback will destroy |this|. - base::OnceClosure stop_prefetch_closure_; + // Set when this manages it's own lifetime. + std::unique_ptr<SearchPrefetchURLLoader> self_pointer_; + + // Set to true when we encounter an error in between when the prefetch request + // owns this loader and the loader has started. When the forwarding client is + // set up, we will delete soon |this|. + bool pending_delete_ = false; base::WeakPtrFactory<StreamingSearchPrefetchURLLoader> weak_factory_{this}; };
diff --git a/chrome/browser/profiles/renderer_updater.cc b/chrome/browser/profiles/renderer_updater.cc index 82bbd5d..290b0e3 100644 --- a/chrome/browser/profiles/renderer_updater.cc +++ b/chrome/browser/profiles/renderer_updater.cc
@@ -22,6 +22,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h" #include "extensions/buildflags/buildflags.h" +#include "ipc/ipc_channel_proxy.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "services/network/public/cpp/features.h"
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb index 0f97631d..70ef57384 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb
@@ -536,7 +536,7 @@ <translation id="4601367666219428522">աղսկ <ph name="TABLENAME" />․ <ph name="TABLEROWS" />x<ph name="TABLECOLS" /></translation> <translation id="4615592953348396470">Անտեսվում է հաջորդ ստեղնի սեղմումը</translation> <translation id="4623097797855662355">Հիշատակարան</translation> -<translation id="463135993322337640">ChromeVox-ի նորություններին ծանոթանալու համար՝ սեղմեք ChromeVox + O + N ստեղնները:</translation> +<translation id="463135993322337640">ChromeVox-ի նորություններին ծանոթանալու համար՝ սեղմեք ChromeVox + O + N ստեղները:</translation> <translation id="4649220074413114917">Երկու մատով էկրանին հպելով կարող եք անջատել տեքստի հնչեցումը, հատկապես, եթե չեք ցանկանում, որ ChromeVox-ը որևէ տեքստ հնչեցնի։ Շարունակելու համար երկու մատով հպեք էկրանին։</translation> <translation id="4660783501463101648">Classic տարբերակը հեռացվել է։ ChromeVox Classic տարբերակին վերադառնալու ստեղնների համակցությունը հեռացվել է։</translation> <translation id="4661075872484491155">tree</translation>
diff --git a/chrome/browser/sync/test/integration/two_client_web_apps_integration_test_mac_win_linux.cc b/chrome/browser/sync/test/integration/two_client_web_apps_integration_test_mac_win_linux.cc index db6788b4..1845804 100644 --- a/chrome/browser/sync/test/integration/two_client_web_apps_integration_test_mac_win_linux.cc +++ b/chrome/browser/sync/test/integration/two_client_web_apps_integration_test_mac_win_linux.cc
@@ -18,9 +18,18 @@ using TwoClientWebAppsIntegrationTestMacWinLinux = TwoClientWebAppsIntegrationTestBase; +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -36,9 +45,18 @@ helper_.CheckLaunchIconShown(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -53,9 +71,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -68,9 +95,18 @@ helper_.CheckTabCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -84,9 +120,18 @@ helper_.CheckLaunchIconNotShown(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -102,9 +147,18 @@ helper_.CheckLaunchIconShown(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -119,9 +173,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -134,9 +197,17 @@ helper_.CheckTabCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -150,9 +221,18 @@ helper_.CheckLaunchIconNotShown(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_37SiteA_17_20) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -168,9 +248,18 @@ helper_.CheckLaunchIconShown(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_34SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -185,9 +274,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_34SiteA_22) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -200,9 +298,18 @@ helper_.CheckTabCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_37SiteA_18_19) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -263,9 +370,19 @@ helper_.CheckTabCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20 \ + DISABLED_WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20 +#else +#define MAYBE_WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20 \ + WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20 +#endif + IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20) { + MAYBE_WebAppIntegration_30SiteC_12SiteC_40Client2_45SiteC_46SiteC_12SiteC_37SiteC_17_20) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -296,8 +413,9 @@ helper_.CheckLaunchIconNotShown(); } -IN_PROC_BROWSER_TEST_F(TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_41_30SiteA_42_40Client2_45SiteA) { +IN_PROC_BROWSER_TEST_F( + TwoClientWebAppsIntegrationTestMacWinLinux, + DISABLED_WebAppIntegration_41_30SiteA_42_40Client2_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -308,8 +426,9 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } -IN_PROC_BROWSER_TEST_F(TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_41_31SiteA_42_40Client2_45SiteA) { +IN_PROC_BROWSER_TEST_F( + TwoClientWebAppsIntegrationTestMacWinLinux, + DISABLED_WebAppIntegration_41_31SiteA_42_40Client2_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -320,8 +439,17 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } -IN_PROC_BROWSER_TEST_F(TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_41_47SiteA_42_40Client2_45SiteA) { +// Flaky, see https://crbug.com/1273666 +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_41_47SiteA_42_40Client2_45SiteA \ + DISABLED_WebAppIntegration_41_47SiteA_42_40Client2_45SiteA +#else +#define MAYBE_WebAppIntegration_41_47SiteA_42_40Client2_45SiteA \ + WebAppIntegration_41_47SiteA_42_40Client2_45SiteA +#endif +IN_PROC_BROWSER_TEST_F( + TwoClientWebAppsIntegrationTestMacWinLinux, + MAYBE_WebAppIntegration_41_47SiteA_42_40Client2_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -344,8 +472,17 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } -IN_PROC_BROWSER_TEST_F(TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_41_30SiteC_42_40Client2_45SiteC) { +// TODO(crbug.com/1273666): Test failed on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_41_30SiteC_42_40Client2_45SiteC \ + DISABLED_WebAppIntegration_41_30SiteC_42_40Client2_45SiteC +#else +#define MAYBE_WebAppIntegration_41_30SiteC_42_40Client2_45SiteC \ + WebAppIntegration_41_30SiteC_42_40Client2_45SiteC +#endif +IN_PROC_BROWSER_TEST_F( + TwoClientWebAppsIntegrationTestMacWinLinux, + MAYBE_WebAppIntegration_41_30SiteC_42_40Client2_45SiteC) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -368,9 +505,18 @@ helper_.CheckAppInListNotLocallyInstalled("SiteC"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -385,9 +531,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -402,9 +557,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24 +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_46SiteA_12SiteA_35SiteA_24) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -419,9 +583,18 @@ helper_.CheckWindowCreated(); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -436,9 +609,18 @@ helper_.CheckAppNotInList("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -453,9 +635,18 @@ helper_.CheckAppNotInList("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_10SiteA_15SiteA_40Client1_15SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -486,9 +677,18 @@ helper_.CheckAppNotInList("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -503,9 +703,18 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -520,9 +729,17 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_10SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -553,9 +770,18 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_30SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -570,9 +796,18 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_31SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -587,9 +822,18 @@ helper_.CheckAppInListNotLocallyInstalled("SiteA"); } +// TODO(crbug.com/1273666): Test failed on Mac. +// TODO(crbug.com/1281950): Browsers size failure on Mac. +#if BUILDFLAG(IS_MAC) +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + DISABLED_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#else +#define MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA \ + WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA +#endif IN_PROC_BROWSER_TEST_F( TwoClientWebAppsIntegrationTestMacWinLinux, - WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { + MAYBE_WebAppIntegration_47SiteA_24_12SiteA_40Client2_45SiteA_41_43SiteA_42_45SiteA) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported.
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java index 7ca6ca7..2b71ef4a 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteController.java
@@ -156,33 +156,13 @@ } /** - * Partially deletes an omnibox suggestion. - * This call should be used by compound suggestion types (such as carousel) that host multiple - * components inside (eg. MostVisitedTiles). - * @param matchIndex The position at which the match is located. - * @param elementIndex The element within the match that needs to be deleted. - */ - @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) - public void deleteMatchElement(int matchIndex, int elementIndex) { - if (mNativeController == 0) return; - if (!mAutocompleteResult.verifyCoherency(matchIndex, VerificationPoint.DELETE_MATCH)) { - return; - } - AutocompleteControllerJni.get().deleteMatchElement( - mNativeController, matchIndex, elementIndex); - } - - /** * Deletes an omnibox suggestion, if possible. - * @param matchIndex The position at which the match is located. + * @param position The position at which the suggestion is located. */ - @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) - public void deleteMatch(int matchIndex) { + void deleteSuggestion(int position) { if (mNativeController == 0) return; - if (!mAutocompleteResult.verifyCoherency(matchIndex, VerificationPoint.DELETE_MATCH)) { - return; - } - AutocompleteControllerJni.get().deleteMatch(mNativeController, matchIndex); + if (!mAutocompleteResult.verifyCoherency(position, VerificationPoint.DELETE_MATCH)) return; + AutocompleteControllerJni.get().deleteSuggestion(mNativeController, position); } @CalledByNative @@ -204,7 +184,7 @@ * Called whenever a navigation happens from the omnibox to record metrics about the user's * interaction with the omnibox. * - * @param matchIndex The index of the suggestion that was selected. + * @param selectedIndex The index of the suggestion that was selected. * @param disposition The window open disposition. * @param type The type of the selected suggestion. * @param currentPageUrl The URL of the current page. @@ -215,14 +195,14 @@ * @param webContents The web contents for the tab where the selected suggestion will be shown. */ @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) - public void onSuggestionSelected(int matchIndex, int disposition, int type, + public void onSuggestionSelected(int selectedIndex, int disposition, int type, @NonNull String currentPageUrl, int pageClassification, long elapsedTimeSinceModified, int completedLength, @Nullable WebContents webContents) { if (mNativeController == 0) return; - if (!mAutocompleteResult.verifyCoherency(matchIndex, VerificationPoint.SELECT_MATCH)) { + if (!mAutocompleteResult.verifyCoherency(selectedIndex, VerificationPoint.SELECT_MATCH)) { return; } - AutocompleteControllerJni.get().onSuggestionSelected(mNativeController, matchIndex, + AutocompleteControllerJni.get().onSuggestionSelected(mNativeController, selectedIndex, disposition, currentPageUrl, pageClassification, elapsedTimeSinceModified, completedLength, webContents); } @@ -249,15 +229,15 @@ * Updates aqs parameters on the selected match that we will navigate to and returns the * updated URL. * - * @param matchIndex The index of the autocomplete entry selected. + * @param selectedIndex The index of the autocomplete entry selected. * @param elapsedTimeSinceInputChange The number of ms between the time the user started * typing in the omnibox and the time the user has selected a suggestion. */ @Nullable GURL updateMatchDestinationUrlWithQueryFormulationTime( - int matchIndex, long elapsedTimeSinceInputChange) { + int selectedIndex, long elapsedTimeSinceInputChange) { return updateMatchDestinationUrlWithQueryFormulationTime( - matchIndex, elapsedTimeSinceInputChange, null, null); + selectedIndex, elapsedTimeSinceInputChange, null, null); } /** @@ -273,7 +253,7 @@ * "www.google.com/search?q=Politics+news&aqs=chrome.0.69i...l3.1409j0j9" * where ".1409j0j9" is the encoded elapsed time. * - * @param matchIndex The index of the autocomplete entry selected. + * @param selectedIndex The index of the autocomplete entry selected. * @param elapsedTimeSinceInputChange The number of ms between the time the user started * typing in the omnibox and the time the user has selected * a suggestion. @@ -283,16 +263,16 @@ * updated, if we are making a Google search query. */ @Nullable - GURL updateMatchDestinationUrlWithQueryFormulationTime(int matchIndex, + GURL updateMatchDestinationUrlWithQueryFormulationTime(int selectedIndex, long elapsedTimeSinceInputChange, @Nullable String newQueryText, @Nullable List<String> newQueryParams) { if (mNativeController == 0) return null; - if (!mAutocompleteResult.verifyCoherency(matchIndex, VerificationPoint.UPDATE_MATCH)) { + if (!mAutocompleteResult.verifyCoherency(selectedIndex, VerificationPoint.UPDATE_MATCH)) { return null; } return AutocompleteControllerJni.get() .updateMatchDestinationURLWithAdditionalAssistedQueryStats(mNativeController, - matchIndex, elapsedTimeSinceInputChange, newQueryText, + selectedIndex, elapsedTimeSinceInputChange, newQueryText, newQueryParams == null ? null : newQueryParams.toArray(new String[newQueryParams.size()])); @@ -303,14 +283,14 @@ * TODO(crbug.com/1266558): move this to AutocompleteMatch object when Tab is no longer part * of the //chrome/browser directory. * - * @param matchIndex Index of the suggestion to retrieve Tab info for. + * @param index Index of the suggestion to retrieve Tab info for. * @return Tab that hosts matching URL. */ @Nullable - Tab getMatchingTabForSuggestion(int matchIndex) { + Tab getMatchingTabForSuggestion(int index) { if (mNativeController == 0) return null; return AutocompleteControllerJni.get().getMatchingTabForSuggestion( - mNativeController, matchIndex); + mNativeController, index); } /** @@ -337,18 +317,16 @@ long nativeAutocompleteControllerAndroid, String text, boolean focusedFromFakebox); void stop(long nativeAutocompleteControllerAndroid, boolean clearResults); void resetSession(long nativeAutocompleteControllerAndroid); - void onSuggestionSelected(long nativeAutocompleteControllerAndroid, int matchIndex, + void onSuggestionSelected(long nativeAutocompleteControllerAndroid, int selectedIndex, int disposition, String currentPageUrl, int pageClassification, long elapsedTimeSinceModified, int completedLength, WebContents webContents); void onOmniboxFocused(long nativeAutocompleteControllerAndroid, String omniboxText, String currentUrl, int pageClassification, String currentTitle); - void deleteMatchElement( - long nativeAutocompleteControllerAndroid, int matchIndex, int elementIndex); - void deleteMatch(long nativeAutocompleteControllerAndroid, int matchIndex); + void deleteSuggestion(long nativeAutocompleteControllerAndroid, int selectedIndex); GURL updateMatchDestinationURLWithAdditionalAssistedQueryStats( - long nativeAutocompleteControllerAndroid, int matchIndex, + long nativeAutocompleteControllerAndroid, int selectedIndex, long elapsedTimeSinceInputChange, String newQueryText, String[] newQueryParams); - Tab getMatchingTabForSuggestion(long nativeAutocompleteControllerAndroid, int matchIndex); + Tab getMatchingTabForSuggestion(long nativeAutocompleteControllerAndroid, int index); void setVoiceMatches(long nativeAutocompleteControllerAndroid, String[] matches, float[] confidenceScores);
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java index 4c3c73a..b81991e 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinator.java
@@ -71,7 +71,6 @@ private final @NonNull ObservableSupplier<Profile> mProfileSupplier; private final @NonNull Callback<Profile> mProfileChangeCallback; private final @NonNull AutocompleteMediator mMediator; - private final @NonNull Supplier<ModalDialogManager> mModalDialogManagerSupplier; private @Nullable OmniboxSuggestionsDropdown mDropdown; public AutocompleteCoordinator(@NonNull ViewGroup parent, @@ -89,7 +88,6 @@ @NonNull ExploreIconProvider exploreIconProvider, @NonNull OmniboxPedalDelegate omniboxPedalDelegate) { mParent = parent; - mModalDialogManagerSupplier = modalDialogManagerSupplier; Context context = parent.getContext(); PropertyModel listModel = new PropertyModel(SuggestionListProperties.ALL_KEYS); @@ -418,10 +416,4 @@ public ModelList getSuggestionModelListForTest() { return mMediator.getSuggestionModelListForTest(); } - - @VisibleForTesting - public @NonNull ModalDialogManager getModalDialogManagerForTest() { - assert mModalDialogManagerSupplier.hasValue(); - return mModalDialogManagerSupplier.get(); - } }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java index 52fbb405..2718ff3 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteMediator.java
@@ -235,11 +235,11 @@ * in the underlying model. The index does not represent visibility due to the current scroll * position of the list. * - * @param matchIndex The index of the suggestion to fetch. + * @param index The index of the suggestion to fetch. * @return The suggestion at the given index. */ - public AutocompleteMatch getSuggestionAt(int matchIndex) { - return mAutocompleteResult.getSuggestionsList().get(matchIndex); + public AutocompleteMatch getSuggestionAt(int index) { + return mAutocompleteResult.getSuggestionsList().get(index); } /** @@ -386,22 +386,22 @@ /** * Triggered when the user selects one of the omnibox suggestions to navigate to. * @param suggestion The AutocompleteMatch which was selected. - * @param matchIndex Position of the suggestion in the drop down view. + * @param position Position of the suggestion in the drop down view. * @param url The URL associated with the suggestion. */ @Override public void onSuggestionClicked( - @NonNull AutocompleteMatch suggestion, int matchIndex, @NonNull GURL url) { + @NonNull AutocompleteMatch suggestion, int position, @NonNull GURL url) { if (mAutocompleteResult.isFromCachedResult() && (!mNativeInitialized || mAutocomplete == null)) { // clang-format off mDeferredLoadAction = () -> loadUrlForOmniboxMatch( - matchIndex, suggestion, url, mLastActionUpTimestamp, true); + position, suggestion, url, mLastActionUpTimestamp, true); // clang-format on return; } - loadUrlForOmniboxMatch(matchIndex, suggestion, url, mLastActionUpTimestamp, true); + loadUrlForOmniboxMatch(position, suggestion, url, mLastActionUpTimestamp, true); } /** @@ -434,10 +434,10 @@ } @Override - public void onSwitchToTab(AutocompleteMatch suggestion, int matchIndex) { - Tab tab = mAutocomplete.getMatchingTabForSuggestion(matchIndex); + public void onSwitchToTab(AutocompleteMatch suggestion, int position) { + Tab tab = mAutocomplete.getMatchingTabForSuggestion(position); if (tab == null || !mTabWindowManagerSupplier.hasValue()) { - onSuggestionClicked(suggestion, matchIndex, suggestion.getUrl()); + onSuggestionClicked(suggestion, position, suggestion.getUrl()); return; } @@ -453,7 +453,7 @@ // In the event the user deleted the tab as part during the interaction with the // Omnibox, reject the switch to tab action. if (tabIndex < 0) { - onSuggestionClicked(suggestion, matchIndex, suggestion.getUrl()); + onSuggestionClicked(suggestion, position, suggestion.getUrl()); return; } @@ -461,7 +461,7 @@ } else { mBringTabToFrontCallback.onResult(tab); } - recordMetrics(matchIndex, WindowOpenDisposition.SWITCH_TO_TAB, suggestion); + recordMetrics(position, WindowOpenDisposition.SWITCH_TO_TAB, suggestion); } @Override @@ -475,31 +475,13 @@ /** * Triggered when the user long presses the omnibox suggestion. * @param suggestion The suggestion selected. - * @param titleText The title to display in the delete dialog. - * @param matchIndex The position of the suggestion. + * @param position The position of the suggestion. + * + * TODO(crbug.com/1136107): revisit the event propagation here to make sure we do not try to + * execute an action before native is initialize. */ @Override - public void onDeleteMatch( - @NonNull AutocompleteMatch suggestion, @NonNull String titleText, int matchIndex) { - showDeleteDialog(suggestion, titleText, () -> mAutocomplete.deleteMatch(matchIndex)); - } - - /** - * Triggered when the user long presses the omnibox suggestion element (eg. a tile). - * @param suggestion The suggestion selected. - * @param titleText The title to display in the delete dialog. - * @param matchIndex The position of the suggestion. - * @param elementIndex The element of the suggestion to be deleted. - */ - @Override - public void onDeleteMatchElement(@NonNull AutocompleteMatch suggestion, - @NonNull String titleText, int matchIndex, int elementIndex) { - showDeleteDialog(suggestion, titleText, - () -> mAutocomplete.deleteMatchElement(matchIndex, elementIndex)); - } - - public void showDeleteDialog(@NonNull AutocompleteMatch suggestion, @NonNull String titleText, - Runnable deleteAction) { + public void onSuggestionLongClicked(@NonNull AutocompleteMatch suggestion, int position) { RecordUserAction.record("MobileOmniboxDeleteGesture"); if (!suggestion.isDeletable()) return; @@ -514,7 +496,7 @@ public void onClick(PropertyModel model, int buttonType) { if (buttonType == ModalDialogProperties.ButtonType.POSITIVE) { RecordUserAction.record("MobileOmniboxDeleteRequested"); - deleteAction.run(); + mAutocomplete.deleteSuggestion(position); manager.dismissDialog(model, DialogDismissalCause.POSITIVE_BUTTON_CLICKED); } else if (buttonType == ModalDialogProperties.ButtonType.NEGATIVE) { manager.dismissDialog(model, DialogDismissalCause.NEGATIVE_BUTTON_CLICKED); @@ -537,7 +519,7 @@ mDeleteDialogModel = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) .with(ModalDialogProperties.CONTROLLER, dialogController) - .with(ModalDialogProperties.TITLE, titleText) + .with(ModalDialogProperties.TITLE, suggestion.getDisplayText()) .with(ModalDialogProperties.TITLE_MAX_LINES, 1) .with(ModalDialogProperties.MESSAGE, resources.getString(dialogMessageId)) .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, resources, R.string.ok) @@ -580,13 +562,13 @@ * on regular web search URLs. * * @param suggestion The chosen omnibox suggestion. - * @param matchIndex The index of the chosen omnibox suggestion. + * @param selectedIndex The index of the chosen omnibox suggestion. * @param url The URL associated with the suggestion to navigate to. * @param skipCheck Whether to skip an out of bounds check. * @return The url to navigate to. */ - private GURL updateSuggestionUrlIfNeeded(@NonNull AutocompleteMatch suggestion, int matchIndex, - @NonNull GURL url, boolean skipCheck) { + private GURL updateSuggestionUrlIfNeeded(@NonNull AutocompleteMatch suggestion, + int selectedIndex, @NonNull GURL url, boolean skipCheck) { if (!mNativeInitialized || mAutocomplete == null) return url; if (suggestion.getType() == OmniboxSuggestionType.VOICE_SUGGEST || suggestion.getType() == OmniboxSuggestionType.TILE_SUGGESTION @@ -596,7 +578,7 @@ int verifiedIndex = SUGGESTION_NOT_FOUND; if (!skipCheck) { - verifiedIndex = findSuggestionInAutocompleteResult(suggestion, matchIndex); + verifiedIndex = findSuggestionInAutocompleteResult(suggestion, selectedIndex); } // If we do not have the suggestion as part of our results, skip the URL update. @@ -617,14 +599,14 @@ * called by all the methods that are dispatched rather than called directly. * * @param suggestion Suggestion to look for. - * @param matchIndex Last known position of the suggestion. + * @param index Last known position of the suggestion. * @return Current index of the supplied suggestion, or SUGGESTION_NOT_FOUND if it is no longer * part of the model. */ @SuppressWarnings("ReferenceEquality") - private int findSuggestionInAutocompleteResult(AutocompleteMatch suggestion, int matchIndex) { - if (getSuggestionCount() > matchIndex && getSuggestionAt(matchIndex) == suggestion) { - return matchIndex; + private int findSuggestionInAutocompleteResult(AutocompleteMatch suggestion, int position) { + if (getSuggestionCount() > position && getSuggestionAt(position) == suggestion) { + return position; } // Underlying omnibox results may have changed since the selection was made, @@ -769,13 +751,13 @@ /** * Loads the specified omnibox suggestion. * - * @param matchIndex The position of the selected omnibox suggestion. + * @param matchPosition The position of the selected omnibox suggestion. * @param suggestion The suggestion selected. * @param url The URL to load. * @param inputStart The timestamp the input was started. * @param inVisibleSuggestionList Whether the suggestion is in the visible suggestion list. */ - private void loadUrlForOmniboxMatch(int matchIndex, @NonNull AutocompleteMatch suggestion, + private void loadUrlForOmniboxMatch(int matchPosition, @NonNull AutocompleteMatch suggestion, @NonNull GURL url, long inputStart, boolean inVisibleSuggestionList) { SuggestionsMetrics.recordFocusToOpenTime(System.currentTimeMillis() - mUrlFocusTime); @@ -783,7 +765,7 @@ mDeferredLoadAction = null; mOmniboxFocusResultedInNavigation = true; - url = updateSuggestionUrlIfNeeded(suggestion, matchIndex, url, !inVisibleSuggestionList); + url = updateSuggestionUrlIfNeeded(suggestion, matchPosition, url, !inVisibleSuggestionList); // loadUrl modifies AutocompleteController's state clearing the native // AutocompleteResults needed by onSuggestionsSelected. Therefore, @@ -791,7 +773,7 @@ int transition = suggestion.getTransition(); int type = suggestion.getType(); - recordMetrics(matchIndex, WindowOpenDisposition.CURRENT_TAB, suggestion); + recordMetrics(matchPosition, WindowOpenDisposition.CURRENT_TAB, suggestion); if (((transition & PageTransition.CORE_MASK) == PageTransition.TYPED) && TextUtils.equals(url.getSpec(), mDataProvider.getCurrentUrl())) { // When the user hit enter on the existing permanent URL, treat it like a @@ -931,11 +913,11 @@ * Called whenever a navigation happens from the omnibox to record metrics about the user's * interaction with the omnibox. * - * @param matchIndex The index of the suggestion that was selected. + * @param matchPosition The index of the suggestion that was selected. * @param disposition The window open disposition. * @param suggestion The suggestion selected. */ - private void recordMetrics(int matchIndex, int disposition, AutocompleteMatch suggestion) { + private void recordMetrics(int matchPosition, int disposition, AutocompleteMatch suggestion) { SuggestionsMetrics.recordUsedSuggestionFromCache(mAutocompleteResult.isFromCachedResult()); // Do not attempt to record other metrics for cached suggestions if the source of the list @@ -952,7 +934,7 @@ WebContents webContents = mDataProvider.hasTab() ? mDataProvider.getTab().getWebContents() : null; - mAutocomplete.onSuggestionSelected(matchIndex, disposition, suggestion.getType(), + mAutocomplete.onSuggestionSelected(matchPosition, disposition, suggestion.getType(), currentPageUrl, pageClassification, elapsedTimeSinceModified, autocompleteLength, webContents); }
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/SuggestionHost.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/SuggestionHost.java index 84c809a..a030ed66 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/SuggestionHost.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/SuggestionHost.java
@@ -30,28 +30,11 @@ /** * Triggered when the user long presses the omnibox suggestion. - * Deletes the entire AutocompleteMatch. Execution of this method implies removal of the - * AutocompleteMatch. * * @param suggestion Long-pressed Suggestion. - * @param titleText The title to display in the delete dialog. * @param position The position of the suggestion on the list. */ - void onDeleteMatch( - @NonNull AutocompleteMatch suggestion, @NonNull String titleText, int position); - - /** - * Triggered when the user long presses the omnibox suggestion element (eg. tile). - * Performs partial deletion of an AutocompleteMatch, focusing on the supplied element. - * Execution of this method does not imply removal of the AutocompleteMatch. - * - * @param suggestion Long-pressed Suggestion. - * @param titleText The title to display in the delete dialog. - * @param position The position of the suggestion on the list. - * @param element Element of the suggestion to be deleted. - */ - void onDeleteMatchElement(@NonNull AutocompleteMatch suggestion, @NonNull String titleText, - int position, int element); + void onSuggestionLongClicked(@NonNull AutocompleteMatch suggestion, int position); /** * Triggered when the user selects a switch to tab action.
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewProcessor.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewProcessor.java index 2579766..d0b62df 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewProcessor.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/base/BaseSuggestionViewProcessor.java
@@ -145,7 +145,7 @@ * @param position Position of the suggestion on the list. */ protected void onSuggestionLongClicked(@NonNull AutocompleteMatch suggestion, int position) { - mSuggestionHost.onDeleteMatch(suggestion, suggestion.getDisplayText(), position); + mSuggestionHost.onSuggestionLongClicked(suggestion, position); } @Override
diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessor.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessor.java index 4a9f30e..22efd4f3 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessor.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/suggestions/mostvisited/MostVisitedTilesProcessor.java
@@ -96,7 +96,7 @@ } @Override - public boolean doesProcessSuggestion(AutocompleteMatch suggestion, int matchIndex) { + public boolean doesProcessSuggestion(AutocompleteMatch suggestion, int position) { return suggestion.getType() == OmniboxSuggestionType.TILE_NAVSUGGEST; } @@ -116,29 +116,22 @@ } @Override - public void populateModel(AutocompleteMatch suggestion, PropertyModel model, int matchIndex) { + public void populateModel(AutocompleteMatch suggestion, PropertyModel model, int position) { final List<AutocompleteMatch.NavsuggestTile> tiles = suggestion.getNavsuggestTiles(); final int tilesCount = tiles.size(); final List<ListItem> tileList = new ArrayList<>(tilesCount); final LargeIconBridge iconBridge = mIconBridgeSupplier.get(); - for (int elementIndex = 0; elementIndex < tilesCount; elementIndex++) { + for (int index = 0; index < tilesCount; index++) { final PropertyModel tileModel = new PropertyModel(TileViewProperties.ALL_KEYS); - final String title = tiles.get(elementIndex).title; - final GURL url = tiles.get(elementIndex).url; + final String title = tiles.get(index).title; + final GURL url = tiles.get(index).url; tileModel.set(TileViewProperties.TITLE, title); tileModel.set(TileViewProperties.TITLE_LINES, 1); tileModel.set(TileViewProperties.ON_FOCUS_VIA_SELECTION, () -> mSuggestionHost.setOmniboxEditingText(url.getSpec())); tileModel.set(TileViewProperties.ON_CLICK, - v -> mSuggestionHost.onSuggestionClicked(suggestion, matchIndex, url)); - - final int elementIndexForDeletion = elementIndex; - tileModel.set(TileViewProperties.ON_LONG_CLICK, v -> { - mSuggestionHost.onDeleteMatchElement( - suggestion, title, matchIndex, elementIndexForDeletion); - return true; - }); + v -> mSuggestionHost.onSuggestionClicked(suggestion, position, url)); tileModel.set(TileViewProperties.CONTENT_DESCRIPTION, mContext.getString(R.string.accessibility_omnibox_most_visited_tile, title, url.getHost())); @@ -154,7 +147,7 @@ if (TextUtils.equals(url.getSpec(), UrlConstants.EXPLORE_URL)) { setExploreSitesIcon(tileModel); } else if (iconBridge != null) { - iconBridge.getLargeIconForUrl(tiles.get(elementIndex).url, mDesiredFaviconWidthPx, + iconBridge.getLargeIconForUrl(tiles.get(index).url, mDesiredFaviconWidthPx, (Bitmap icon, int fallbackColor, boolean isFallbackColorDefault, int iconType) -> { if (icon == null) return;
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb index 30b9b98b..a3343763 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb
@@ -462,6 +462,7 @@ <translation id="3687645719033307815">Դուք նախադիտում եք այս էջը</translation> <translation id="3690369331356918524">Զգուշացնել, եթե տվյալների արտահոսքի արդյունքում իմ գաղտնաբառերը հայտնի դառնան կողմնակի անձանց</translation> <translation id="3692944402865947621">Չհաջողվեց ներբեռնել «<ph name="FILE_NAME" />» ֆայլը, քանի որ պահեստն անհասանելի է։</translation> +<translation id="3699022356773522638">Ներբեռնե՞լ ֆայլը</translation> <translation id="371230970611282515">Հայտնաբերում է վտանգավոր իրադարձություններն ու զգուշացնում դրանց մասին։</translation> <translation id="3714981814255182093">Բացել «Փնտրել» գոտին</translation> <translation id="3716182511346448902">Այս էջն օգտագործում էր չափազանց մեծ հիշողություն։ Chrome-ը դադարեցրեց այն։</translation>
diff --git a/chrome/browser/ui/app_list/search/omnibox_answer_result.cc b/chrome/browser/ui/app_list/search/omnibox_answer_result.cc index 8af1c1b..49b5fbbc 100644 --- a/chrome/browser/ui/app_list/search/omnibox_answer_result.cc +++ b/chrome/browser/ui/app_list/search/omnibox_answer_result.cc
@@ -146,11 +146,13 @@ Profile* profile, AppListControllerDelegate* list_controller, AutocompleteController* autocomplete_controller, - const AutocompleteMatch& match) + const AutocompleteMatch& match, + const std::u16string& query) : profile_(profile), list_controller_(list_controller), autocomplete_controller_(autocomplete_controller), - match_(match) { + match_(match), + query_(query) { if (match_.search_terms_args && autocomplete_controller_) { match_.search_terms_args->request_source = TemplateURLRef::CROS_APP_LIST; autocomplete_controller_->SetMatchDestinationURL(&match_); @@ -201,11 +203,14 @@ } void OmniboxAnswerResult::UpdateTitleAndDetails() { - // TODO(crbug.com/1250154): Simplify this and split into separate methods. if (IsCalculatorResult()) { + // Calculator results come in two forms: + // 1) Answer in |match.contents|, empty description, + // 2) Query in |match.contents|, answer in |match.description|. std::vector<TextItem> contents_vector = {CreateTextItem(match_.contents)}; if (match_.description.empty()) { SetTitleTextVector(contents_vector); + SetDetailsTextVector({CreateTextItem(query_)}); } else { SetTitleTextVector({CreateTextItem(match_.description)}); SetDetailsTextVector(contents_vector);
diff --git a/chrome/browser/ui/app_list/search/omnibox_answer_result.h b/chrome/browser/ui/app_list/search/omnibox_answer_result.h index d61ccd1..a121accc 100644 --- a/chrome/browser/ui/app_list/search/omnibox_answer_result.h +++ b/chrome/browser/ui/app_list/search/omnibox_answer_result.h
@@ -26,7 +26,8 @@ OmniboxAnswerResult(Profile* profile, AppListControllerDelegate* list_controller, AutocompleteController* autocomplete_controller, - const AutocompleteMatch& match); + const AutocompleteMatch& match, + const std::u16string& query); ~OmniboxAnswerResult() override; OmniboxAnswerResult(const OmniboxAnswerResult&) = delete; @@ -54,6 +55,7 @@ AppListControllerDelegate* list_controller_; AutocompleteController* autocomplete_controller_; AutocompleteMatch match_; + const std::u16string query_; std::unique_ptr<BitmapFetcher> bitmap_fetcher_; base::WeakPtrFactory<OmniboxAnswerResult> weak_factory_{this};
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.cc b/chrome/browser/ui/app_list/search/omnibox_provider.cc index 1ff8607..e4779c5 100644 --- a/chrome/browser/ui/app_list/search/omnibox_provider.cc +++ b/chrome/browser/ui/app_list/search/omnibox_provider.cc
@@ -107,7 +107,8 @@ void OmniboxProvider::Start(const std::u16string& query) { ClearResultsSilently(); - last_query_.emplace(query, TokenizedString::Mode::kCamelCase); + last_query_ = query; + last_tokenized_query_.emplace(query, TokenizedString::Mode::kCamelCase); controller_->Stop(false); query_finished_ = false; @@ -166,12 +167,12 @@ if (!is_zero_state_input_ && IsAnswer(match)) { new_results.emplace_back(std::make_unique<OmniboxAnswerResult>( - profile_, list_controller_, controller_.get(), match)); + profile_, list_controller_, controller_.get(), match, last_query_)); } else if (match.type == AutocompleteMatchType::OPEN_TAB) { - DCHECK(last_query_.has_value()); + DCHECK(last_tokenized_query_.has_value()); new_results.emplace_back(std::make_unique<OpenTabResult>( - profile_, list_controller_, &favicon_cache_, last_query_.value(), - match)); + profile_, list_controller_, &favicon_cache_, + last_tokenized_query_.value(), match)); } else { list_results.emplace_back(std::make_unique<OmniboxResult>( profile_, list_controller_, controller_.get(), &favicon_cache_,
diff --git a/chrome/browser/ui/app_list/search/omnibox_provider.h b/chrome/browser/ui/app_list/search/omnibox_provider.h index 653b6be..d1387ca 100644 --- a/chrome/browser/ui/app_list/search/omnibox_provider.h +++ b/chrome/browser/ui/app_list/search/omnibox_provider.h
@@ -51,7 +51,10 @@ // True if the input is empty for zero state suggestion. bool is_zero_state_input_ = false; AppListControllerDelegate* list_controller_; - absl::optional<chromeos::string_matching::TokenizedString> last_query_; + + std::u16string last_query_; + absl::optional<chromeos::string_matching::TokenizedString> + last_tokenized_query_; base::TimeTicks query_start_time_; AutocompleteInput input_;
diff --git a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc index f654660..86c7a39 100644 --- a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc +++ b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc
@@ -60,7 +60,13 @@ VIEW_TEST(MenuItemViewTestBasic1, SelectItem1) // If this flakes, disable and log details in http://crbug.com/523255. -VIEW_TEST(MenuItemViewTestBasic2, SelectItem2) +// Flake on Linux Tests (Wayland) builder. see http://crbug.com/523255. +#if BUILDFLAG(IS_LINUX) +#define MAYBE_SelectItem2 DISABLED_SelectItem2 +#else +#define MAYBE_SelectItem2 SelectItem2 +#endif +VIEW_TEST(MenuItemViewTestBasic2, MAYBE_SelectItem2) // Test class for inserting a menu item while the menu is open. template <int INSERT_INDEX, int SELECT_INDEX>
diff --git a/chrome/browser/ui/web_applications/app_browser_controller_browsertest.cc b/chrome/browser/ui/web_applications/app_browser_controller_browsertest.cc index 536bc1c3..d1748fe 100644 --- a/chrome/browser/ui/web_applications/app_browser_controller_browsertest.cc +++ b/chrome/browser/ui/web_applications/app_browser_controller_browsertest.cc
@@ -64,7 +64,7 @@ void Wait() { run_loop_.Run(); } - SkColor GetColorAtNavigation() { return color_at_navigation_; } + SkColor GetColorAtNavigation() const { return color_at_navigation_; } // TabStripModelObserver: void OnTabStripModelChanged(
diff --git a/chrome/browser/ui/web_applications/share_target_utils.cc b/chrome/browser/ui/web_applications/share_target_utils.cc index 06439d76..1ebf7c0 100644 --- a/chrome/browser/ui/web_applications/share_target_utils.cc +++ b/chrome/browser/ui/web_applications/share_target_utils.cc
@@ -171,9 +171,9 @@ names.push_back(shared_field.name); values.push_back(shared_field.value); is_value_file_uris.push_back(false); - filenames.push_back(std::string()); + filenames.emplace_back(std::string()); types.push_back("text/plain"); - data_pipe_getters.push_back( + data_pipe_getters.emplace_back( mojo::PendingRemote<network::mojom::DataPipeGetter>()); }
diff --git a/chrome/browser/ui/web_applications/system_web_app_ui_utils.h b/chrome/browser/ui/web_applications/system_web_app_ui_utils.h index c4b0966..a0ca5100 100644 --- a/chrome/browser/ui/web_applications/system_web_app_ui_utils.h +++ b/chrome/browser/ui/web_applications/system_web_app_ui_utils.h
@@ -74,7 +74,7 @@ // |profile|, or use content::TestNavigationObserver to wait the navigation. void LaunchSystemWebAppAsync( Profile* profile, - const SystemAppType type, + SystemAppType type, const SystemAppLaunchParams& params = SystemAppLaunchParams(), apps::mojom::WindowInfoPtr window_info = nullptr);
diff --git a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc index 9197341..6a0a012 100644 --- a/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc +++ b/chrome/browser/ui/web_applications/test/system_web_app_interactive_uitest.cc
@@ -515,7 +515,7 @@ class SystemWebAppManagerMultiDesktopLaunchBrowserTest : public ash::LoginManagerTest { public: - SystemWebAppManagerMultiDesktopLaunchBrowserTest() : ash::LoginManagerTest() { + SystemWebAppManagerMultiDesktopLaunchBrowserTest() { login_mixin_.AppendRegularUsers(2); account_id1_ = login_mixin_.users()[0].account_id; account_id2_ = login_mixin_.users()[1].account_id; @@ -860,7 +860,7 @@ url_handler_ = std::make_unique<crosapi::UrlHandlerAsh>(); } - ~SystemWebAppOpenInAshFromLacrosTests() { + ~SystemWebAppOpenInAshFromLacrosTests() override { OsUrlHandlerSystemWebAppDelegate::EnableDelegateForTesting(false); }
diff --git a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc index 031c4fc..dfef1fb8 100644 --- a/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_file_handling_browsertest.cc
@@ -560,7 +560,7 @@ class WebAppFileHandlingDisabledTest : public WebAppFileHandlingBrowserTest { public: - WebAppFileHandlingDisabledTest() : WebAppFileHandlingBrowserTest() { + WebAppFileHandlingDisabledTest() { feature_list_.InitWithFeatures({}, {blink::features::kFileHandlingAPI}); }
diff --git a/chrome/browser/ui/web_applications/web_app_launch_utils.h b/chrome/browser/ui/web_applications/web_app_launch_utils.h index 88aacef..9b77e86 100644 --- a/chrome/browser/ui/web_applications/web_app_launch_utils.h +++ b/chrome/browser/ui/web_applications/web_app_launch_utils.h
@@ -61,15 +61,14 @@ std::unique_ptr<AppBrowserController> MaybeCreateAppBrowserController( Browser* browser); -Browser* CreateWebApplicationWindow( - Profile* profile, - const std::string& app_id, - WindowOpenDisposition disposition, - int32_t restore_id, - bool omit_from_session_restore = false, - bool can_resize = true, - bool can_maximize = true, - const gfx::Rect initial_bounds = gfx::Rect()); +Browser* CreateWebApplicationWindow(Profile* profile, + const std::string& app_id, + WindowOpenDisposition disposition, + int32_t restore_id, + bool omit_from_session_restore = false, + bool can_resize = true, + bool can_maximize = true, + gfx::Rect initial_bounds = gfx::Rect()); content::WebContents* NavigateWebApplicationWindow( Browser* browser,
diff --git a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc index 4a6f855..fc80a53 100644 --- a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc +++ b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc
@@ -496,7 +496,7 @@ return true; } -const AppId WebAppUiManagerImpl::GetAppIdForBrowser(Browser* browser) { +AppId WebAppUiManagerImpl::GetAppIdForBrowser(Browser* browser) { return browser->app_controller()->app_id(); }
diff --git a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h index 8940e03..68c771a 100644 --- a/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h +++ b/chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
@@ -92,7 +92,7 @@ // Returns AppId of the Browser's installed App, |IsBrowserForInstalledApp| // must be true. - const AppId GetAppIdForBrowser(Browser* browser); + AppId GetAppIdForBrowser(Browser* browser); void OnExtensionSystemReady();
diff --git a/chrome/browser/ui/web_applications/web_app_ui_manager_impl_browsertest.cc b/chrome/browser/ui/web_applications/web_app_ui_manager_impl_browsertest.cc index ced3ae1..840a000 100644 --- a/chrome/browser/ui/web_applications/web_app_ui_manager_impl_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_app_ui_manager_impl_browsertest.cc
@@ -55,7 +55,7 @@ Profile* profile() { return browser()->profile(); } - const AppId InstallWebApp(const GURL& start_url) { + AppId InstallWebApp(const GURL& start_url) { auto web_app_info = std::make_unique<WebAppInstallInfo>(); web_app_info->start_url = start_url; web_app_info->user_display_mode = DisplayMode::kStandalone;
diff --git a/chrome/browser/ui/web_applications/web_share_target_browsertest.cc b/chrome/browser/ui/web_applications/web_share_target_browsertest.cc index abafb92..fcacd92e 100644 --- a/chrome/browser/ui/web_applications/web_share_target_browsertest.cc +++ b/chrome/browser/ui/web_applications/web_share_target_browsertest.cc
@@ -230,7 +230,7 @@ #if BUILDFLAG(IS_CHROMEOS_LACROS) void SetUpOnMainThread() override { - InProcessBrowserTest::SetUpOnMainThread(); + WebAppControllerBrowserTest::SetUpOnMainThread(); // If the lacros service or the sharesheet interface are not // available on this version of ash-chrome, this test suite will no-op.
diff --git a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc index 5d77773d..8f6e7eb 100644 --- a/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc +++ b/chrome/browser/ui/webui/settings/chromeos/crostini_handler.cc
@@ -811,9 +811,13 @@ } crostini::ContainerId container_id(args[0]); - // For now, we only can stop the whole VM. - crostini::CrostiniManager::GetForProfile(profile_)->StopVm( - container_id.vm_name, base::DoNothing()); + if (crostini::ShouldStopVm(profile_, container_id)) { + crostini::CrostiniManager::GetForProfile(profile_)->StopVm( + container_id.vm_name, base::DoNothing()); + } else { + crostini::CrostiniManager::GetForProfile(profile_)->StopLxdContainer( + container_id, base::DoNothing()); + } } } // namespace settings
diff --git a/chrome/browser/ui/webui/settings/chromeos/languages_section.cc b/chrome/browser/ui/webui/settings/chromeos/languages_section.cc index 943f7d3..d74a9dd 100644 --- a/chrome/browser/ui/webui/settings/chromeos/languages_section.cc +++ b/chrome/browser/ui/webui/settings/chromeos/languages_section.cc
@@ -452,12 +452,8 @@ html_source->AddBoolean("onDeviceGrammarCheckEnabled", base::FeatureList::IsEnabled( ::chromeos::features::kOnDeviceGrammarCheck)); - html_source->AddBoolean( - "languagePacksHandwritingEnabled", - base::FeatureList::IsEnabled( - ::chromeos::features::kHandwritingLegacyRecognition) || - base::FeatureList::IsEnabled( - ::chromeos::features::kHandwritingLegacyRecognitionAllLang)); + html_source->AddBoolean("languagePacksHandwritingEnabled", + ::chromeos::features::IsLanguagePacksEnabled()); } void LanguagesSection::AddHandlers(content::WebUI* web_ui) {
diff --git a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h index 3beb48a..34a2388 100644 --- a/chrome/browser/web_applications/app_service/web_app_publisher_helper.h +++ b/chrome/browser/web_applications/app_service/web_app_publisher_helper.h
@@ -315,7 +315,7 @@ // NotificationDisplayService::Observer overrides. void OnNotificationDisplayed( const message_center::Notification& notification, - const NotificationCommon::Metadata* const metadata) override; + const NotificationCommon::Metadata* metadata) override; void OnNotificationClosed(const std::string& notification_id) override; void OnNotificationDisplayServiceDestroyed( NotificationDisplayService* service) override; @@ -326,7 +326,7 @@ void OnRequestUpdate(int render_process_id, int render_frame_id, blink::mojom::MediaStreamType stream_type, - const content::MediaRequestState state) override; + content::MediaRequestState state) override; // apps::AppWebContentsData::Client: void OnWebContentsDestroyed(content::WebContents* contents) override; @@ -365,7 +365,7 @@ const std::string& notification_id); void MaybeAddWebPageNotifications( const message_center::Notification& notification, - const NotificationCommon::Metadata* const metadata); + const NotificationCommon::Metadata* metadata); // Returns whether the app should show a badge. bool ShouldShowBadge(const std::string& app_id,
diff --git a/chrome/browser/web_applications/app_service/web_apps_browsertest.cc b/chrome/browser/web_applications/app_service/web_apps_browsertest.cc index e3f66a13..317b1d7 100644 --- a/chrome/browser/web_applications/app_service/web_apps_browsertest.cc +++ b/chrome/browser/web_applications/app_service/web_apps_browsertest.cc
@@ -34,7 +34,7 @@ class WebAppsBrowserTest : public InProcessBrowserTest { public: - WebAppsBrowserTest() {} + WebAppsBrowserTest() = default; ~WebAppsBrowserTest() override = default; };
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 a86f06e..9d772df 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
@@ -148,7 +148,7 @@ return uninstall_external_web_app_urls_; } - size_t num_reparent_tab_calls() { return num_reparent_tab_calls_; } + size_t num_reparent_tab_calls() const { return num_reparent_tab_calls_; } // WebAppInstallFinalizer void FinalizeInstall(const WebAppInstallInfo& web_app_info,
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 ee1e441..1cf617d 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
@@ -162,13 +162,13 @@ DCHECK(!preempt_registration_callback_); } - size_t install_run_count() { return install_run_count_; } + size_t install_run_count() const { return install_run_count_; } const std::vector<ExternalInstallOptions>& install_options_list() { return install_options_list_; } - size_t registration_run_count() { return registration_run_count_; } + size_t registration_run_count() const { return registration_run_count_; } const GURL& last_registered_install_url() { return last_registered_install_url_;
diff --git a/chrome/browser/web_applications/manifest_update_task.cc b/chrome/browser/web_applications/manifest_update_task.cc index c18ebcb..d2f2d1a 100644 --- a/chrome/browser/web_applications/manifest_update_task.cc +++ b/chrome/browser/web_applications/manifest_update_task.cc
@@ -180,10 +180,10 @@ downloaded_sizes[apps::IconInfo::Purpose::kMonochrome] = std::vector<SquareSizePx>(); // Put each entry found into the right map (sort by purpose). - for (auto entry : disk_icon_info) { + for (const auto& entry : disk_icon_info) { on_disk_sizes[entry.purpose].push_back(entry.square_size_px.value_or(-1)); } - for (auto entry : downloaded_icon_info) { + for (const auto& entry : downloaded_icon_info) { downloaded_sizes[entry.purpose].push_back( entry.square_size_px.value_or(-1)); }
diff --git a/chrome/browser/web_applications/manifest_update_task.h b/chrome/browser/web_applications/manifest_update_task.h index 9ae840f..58a28d2 100644 --- a/chrome/browser/web_applications/manifest_update_task.h +++ b/chrome/browser/web_applications/manifest_update_task.h
@@ -107,11 +107,11 @@ // Returns true iff an icon change was detected (not matter how // insignificant). - bool mismatch() { return diff_results != NO_CHANGE_DETECTED; } + bool mismatch() const { return diff_results != NO_CHANGE_DETECTED; } // Returns true iff the mismatch should result in app identity dlg being // shown. - bool requires_app_identity_check() { + bool requires_app_identity_check() const { return ((diff_results & LAUNCHER_ICON_CHANGED) != 0) || ((diff_results & INSTALL_ICON_CHANGED) != 0); }
diff --git a/chrome/browser/web_applications/manifest_update_task_unittest.cc b/chrome/browser/web_applications/manifest_update_task_unittest.cc index ac137506..82f3416 100644 --- a/chrome/browser/web_applications/manifest_update_task_unittest.cc +++ b/chrome/browser/web_applications/manifest_update_task_unittest.cc
@@ -134,17 +134,17 @@ std::vector<apps::IconInfo> GenerateIconInfosFrom( const IconBitmaps& downloaded) { std::vector<apps::IconInfo> result; - for (auto entry : downloaded.any) { + for (const auto& entry : downloaded.any) { apps::IconInfo icon_info(GURL(), entry.first); icon_info.purpose = apps::IconInfo::Purpose::kAny; result.push_back(icon_info); } - for (auto entry : downloaded.maskable) { + for (const auto& entry : downloaded.maskable) { apps::IconInfo icon_info(GURL(), entry.first); icon_info.purpose = apps::IconInfo::Purpose::kMaskable; result.push_back(icon_info); } - for (auto entry : downloaded.monochrome) { + for (const auto& entry : downloaded.monochrome) { apps::IconInfo icon_info(GURL(), entry.first); icon_info.purpose = apps::IconInfo::Purpose::kMonochrome; result.push_back(icon_info);
diff --git a/chrome/browser/web_applications/os_integration/os_integration_manager.cc b/chrome/browser/web_applications/os_integration/os_integration_manager.cc index dac2878..8f4d27c 100644 --- a/chrome/browser/web_applications/os_integration/os_integration_manager.cc +++ b/chrome/browser/web_applications/os_integration/os_integration_manager.cc
@@ -333,7 +333,7 @@ return file_handler_manager_->GetEnabledFileHandlers(app_id); } -const absl::optional<GURL> OsIntegrationManager::GetMatchingFileHandlerURL( +absl::optional<GURL> OsIntegrationManager::GetMatchingFileHandlerURL( const AppId& app_id, const std::vector<base::FilePath>& launch_files) { DCHECK(file_handler_manager_);
diff --git a/chrome/browser/web_applications/os_integration/os_integration_manager.h b/chrome/browser/web_applications/os_integration/os_integration_manager.h index 5d122446..c631604 100644 --- a/chrome/browser/web_applications/os_integration/os_integration_manager.h +++ b/chrome/browser/web_applications/os_integration/os_integration_manager.h
@@ -153,7 +153,7 @@ // Proxy calls for WebAppFileHandlerManager. bool IsFileHandlingAPIAvailable(const AppId& app_id); const apps::FileHandlers* GetEnabledFileHandlers(const AppId& app_id) const; - const absl::optional<GURL> GetMatchingFileHandlerURL( + absl::optional<GURL> GetMatchingFileHandlerURL( const AppId& app_id, const std::vector<base::FilePath>& launch_files);
diff --git a/chrome/browser/web_applications/os_integration/url_handler_manager.h b/chrome/browser/web_applications/os_integration/url_handler_manager.h index 544115a7..6b08cf2 100644 --- a/chrome/browser/web_applications/os_integration/url_handler_manager.h +++ b/chrome/browser/web_applications/os_integration/url_handler_manager.h
@@ -25,13 +25,13 @@ class UrlHandlerManager { public: UrlHandlerManager() = delete; - explicit UrlHandlerManager(Profile* const profile); + explicit UrlHandlerManager(Profile* profile); virtual ~UrlHandlerManager(); UrlHandlerManager(const UrlHandlerManager&) = delete; UrlHandlerManager& operator=(const UrlHandlerManager&) = delete; - void SetSubsystems(WebAppRegistrar* const registrar); + void SetSubsystems(WebAppRegistrar* registrar); // Returns Result::kOk if registration succeeds, Result::kError otherwise. virtual void RegisterUrlHandlers(const AppId& app_id,
diff --git a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc index bbbebf0b..d236665 100644 --- a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc +++ b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.cc
@@ -188,7 +188,7 @@ : nullptr; } -const absl::optional<GURL> WebAppFileHandlerManager::GetMatchingFileHandlerURL( +absl::optional<GURL> WebAppFileHandlerManager::GetMatchingFileHandlerURL( const AppId& app_id, const std::vector<base::FilePath>& launch_files) { if (!IsFileHandlingAPIAvailable(app_id) || launch_files.empty() ||
diff --git a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h index 06cada90..8175c286 100644 --- a/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h +++ b/chrome/browser/web_applications/os_integration/web_app_file_handler_manager.h
@@ -48,7 +48,7 @@ // Returns |app_id|'s URL registered to handle |launch_files|'s extensions, or // nullopt otherwise. - const absl::optional<GURL> GetMatchingFileHandlerURL( + absl::optional<GURL> GetMatchingFileHandlerURL( const AppId& app_id, const std::vector<base::FilePath>& launch_files);
diff --git a/chrome/browser/web_applications/policy/web_app_policy_manager.cc b/chrome/browser/web_applications/policy/web_app_policy_manager.cc index b80947b..e0bb25ca 100644 --- a/chrome/browser/web_applications/policy/web_app_policy_manager.cc +++ b/chrome/browser/web_applications/policy/web_app_policy_manager.cc
@@ -52,7 +52,7 @@ bool IconInfosContainIconURL(const std::vector<apps::IconInfo>& icon_infos, const GURL& url) { - for (apps::IconInfo info : icon_infos) { + for (const apps::IconInfo& info : icon_infos) { if (info.url.EqualsIgnoringRef(url)) return true; }
diff --git a/chrome/browser/web_applications/preinstalled_web_app_manager.cc b/chrome/browser/web_applications/preinstalled_web_app_manager.cc index 568344a4..0bbc1f5 100644 --- a/chrome/browser/web_applications/preinstalled_web_app_manager.cc +++ b/chrome/browser/web_applications/preinstalled_web_app_manager.cc
@@ -98,14 +98,15 @@ std::vector<std::string> errors; }; -LoadedConfigs LoadConfigsBlocking(std::vector<base::FilePath> config_dirs) { +LoadedConfigs LoadConfigsBlocking( + const std::vector<base::FilePath>& config_dirs) { base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, base::BlockingType::MAY_BLOCK); LoadedConfigs result; base::FilePath::StringType extension(FILE_PATH_LITERAL(".json")); - for (auto config_dir : config_dirs) { + for (const auto& config_dir : config_dirs) { base::FileEnumerator json_files(config_dir, false, // Recursive. base::FileEnumerator::FILES);
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc index b91f8b6..d1b885208 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc +++ b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.cc
@@ -94,7 +94,7 @@ PreinstalledWebAppMigration::PreinstalledWebAppMigration() = default; PreinstalledWebAppMigration::PreinstalledWebAppMigration( - PreinstalledWebAppMigration&&) = default; + PreinstalledWebAppMigration&&) noexcept = default; PreinstalledWebAppMigration::~PreinstalledWebAppMigration() = default; std::vector<PreinstalledWebAppMigration> GetPreinstalledWebAppMigrations(
diff --git a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h index 2261ff8..6c2d84b 100644 --- a/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h +++ b/chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h
@@ -21,7 +21,7 @@ // A subset of ExternalInstallOptions pertaining to web app migration. struct PreinstalledWebAppMigration { PreinstalledWebAppMigration(); - PreinstalledWebAppMigration(PreinstalledWebAppMigration&&); + PreinstalledWebAppMigration(PreinstalledWebAppMigration&&) noexcept; ~PreinstalledWebAppMigration(); GURL install_url;
diff --git a/chrome/browser/web_applications/system_web_apps/system_web_app_delegate.h b/chrome/browser/web_applications/system_web_apps/system_web_app_delegate.h index cf7a8266..ecbf1c8 100644 --- a/chrome/browser/web_applications/system_web_apps/system_web_app_delegate.h +++ b/chrome/browser/web_applications/system_web_apps/system_web_app_delegate.h
@@ -46,13 +46,14 @@ // needed only for various legacy reasons, maps for tracking state, and // generating the AppId and things of that nature. SystemWebAppDelegate( - const SystemAppType type, + SystemAppType type, const std::string& internal_name, const GURL& install_url, Profile* profile, const OriginTrialsMap& origin_trials_map = OriginTrialsMap()); SystemWebAppDelegate(const SystemWebAppDelegate& other) = delete; + SystemWebAppDelegate& operator=(const SystemWebAppDelegate& other) = delete; virtual ~SystemWebAppDelegate(); SystemAppType GetType() const { return type_; }
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 6d5dd9c..a25d3b25 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
@@ -241,7 +241,7 @@ } void InitRegistrarWithSystemApps( - std::vector<SystemAppData> system_app_data_list) { + const std::vector<SystemAppData>& system_app_data_list) { DCHECK(controller().registrar().is_empty()); DCHECK(!system_app_data_list.empty()); @@ -1052,7 +1052,7 @@ WebAppInstallInfoFactory info_factory, absl::optional<base::TimeDelta> period, bool open_immediately) - : UnittestingSystemAppDelegate(type, name, url, info_factory), + : UnittestingSystemAppDelegate(type, name, url, std::move(info_factory)), period_(period), open_immediately_(open_immediately) {} absl::optional<SystemAppBackgroundTaskInfo> GetTimerInfo() const override; @@ -1092,30 +1092,38 @@ InitEmptyRegistrar(); // 1) Disabled app should not push to background tasks. - SystemAppMapType system_apps; - std::unique_ptr<TimerSystemAppDelegate> sys_app_delegate = - std::make_unique<TimerSystemAppDelegate>( - SystemAppType::SETTINGS, kSettingsAppInternalName, AppUrl1(), - GetApp1WebAppInfoFactory(), base::Seconds(60), false); + { + std::unique_ptr<TimerSystemAppDelegate> sys_app_delegate = + std::make_unique<TimerSystemAppDelegate>( + SystemAppType::SETTINGS, kSettingsAppInternalName, AppUrl1(), + GetApp1WebAppInfoFactory(), base::Seconds(60), false); - sys_app_delegate->SetIsAppEnabled(false); + sys_app_delegate->SetIsAppEnabled(false); - system_apps.emplace(SystemAppType::SETTINGS, std::move(sys_app_delegate)); - system_web_app_manager().SetSystemAppsForTesting(std::move(system_apps)); - StartAndWaitForAppsToSynchronize(); + SystemAppMapType system_apps; + system_apps.emplace(SystemAppType::SETTINGS, std::move(sys_app_delegate)); + system_web_app_manager().SetSystemAppsForTesting(std::move(system_apps)); + StartAndWaitForAppsToSynchronize(); - EXPECT_EQ(0u, system_web_app_manager().GetBackgroundTasksForTesting().size()); + EXPECT_EQ(0u, + system_web_app_manager().GetBackgroundTasksForTesting().size()); + } // 2) Enabled app should push to background tasks. - sys_app_delegate = std::make_unique<TimerSystemAppDelegate>( - SystemAppType::SETTINGS, kSettingsAppInternalName, AppUrl1(), - GetApp1WebAppInfoFactory(), base::Seconds(60), false); + { + std::unique_ptr<TimerSystemAppDelegate> sys_app_delegate = + std::make_unique<TimerSystemAppDelegate>( + SystemAppType::SETTINGS, kSettingsAppInternalName, AppUrl1(), + GetApp1WebAppInfoFactory(), base::Seconds(60), false); - system_apps.emplace(SystemAppType::SETTINGS, std::move(sys_app_delegate)); - system_web_app_manager().SetSystemAppsForTesting(std::move(system_apps)); - StartAndWaitForAppsToSynchronize(); + SystemAppMapType system_apps; + system_apps.emplace(SystemAppType::SETTINGS, std::move(sys_app_delegate)); + system_web_app_manager().SetSystemAppsForTesting(std::move(system_apps)); + StartAndWaitForAppsToSynchronize(); - EXPECT_EQ(1u, system_web_app_manager().GetBackgroundTasksForTesting().size()); + EXPECT_EQ(1u, + system_web_app_manager().GetBackgroundTasksForTesting().size()); + } } TEST_F(SystemWebAppManagerTimerTest, TestTimer) {
diff --git a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.cc b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.cc index 95d32367..f836018e 100644 --- a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.cc +++ b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.cc
@@ -59,7 +59,7 @@ DCHECK_EQ("://", spec.substr(p, 3)); p += 3; - size_t pos_after_host = spec.find("/", p); + size_t pos_after_host = spec.find('/', p); DCHECK(pos_after_host != std::string::npos); return spec.substr(p, pos_after_host - p); @@ -76,7 +76,7 @@ DCHECK_EQ("://", spec.substr(p, 3)); p += 3; - size_t pos_after_host = spec.find("/", p); + size_t pos_after_host = spec.find('/', p); DCHECK(pos_after_host != std::string::npos); // The Data Source name must include "/" after the host. @@ -92,7 +92,7 @@ const GURL& url, WebAppInstallInfoFactory info_factory) : web_app::SystemWebAppDelegate(type, name, url, nullptr), - info_factory_(info_factory) {} + info_factory_(std::move(info_factory)) {} UnittestingSystemAppDelegate::~UnittestingSystemAppDelegate() = default;
diff --git a/chrome/browser/web_applications/test/fake_install_finalizer.h b/chrome/browser/web_applications/test/fake_install_finalizer.h index 02bfc88..4fcd059 100644 --- a/chrome/browser/web_applications/test/fake_install_finalizer.h +++ b/chrome/browser/web_applications/test/fake_install_finalizer.h
@@ -80,7 +80,7 @@ return uninstall_external_web_app_urls_; } - int num_reparent_tab_calls() { return num_reparent_tab_calls_; } + int num_reparent_tab_calls() const { return num_reparent_tab_calls_; } private: void Finalize(const WebAppInstallInfo& web_app_info,
diff --git a/chrome/browser/web_applications/test/web_app_test_utils.h b/chrome/browser/web_applications/test/web_app_test_utils.h index 690cea3c..e1515212 100644 --- a/chrome/browser/web_applications/test/web_app_test_utils.h +++ b/chrome/browser/web_applications/test/web_app_test_utils.h
@@ -28,8 +28,7 @@ const GURL& start_url = GURL("https://example.com/path"), Source::Type source_type = Source::kSync); -std::unique_ptr<WebApp> CreateRandomWebApp(const GURL& base_url, - const uint32_t seed); +std::unique_ptr<WebApp> CreateRandomWebApp(const GURL& base_url, uint32_t seed); void TestAcceptDialogCallback( content::WebContents* initiator_web_contents, @@ -49,7 +48,7 @@ content::StoragePartition* storage_partition, content::ServiceWorkerCapability status); -void SetWebAppSettingsDictPref(Profile* profile, const base::StringPiece pref); +void SetWebAppSettingsDictPref(Profile* profile, base::StringPiece pref); } // namespace test } // namespace web_app
diff --git a/chrome/browser/web_applications/url_handler_launch_params.h b/chrome/browser/web_applications/url_handler_launch_params.h index 6a180d38..4d50f45 100644 --- a/chrome/browser/web_applications/url_handler_launch_params.h +++ b/chrome/browser/web_applications/url_handler_launch_params.h
@@ -38,7 +38,7 @@ UrlHandlerLaunchParams(const base::FilePath& profile_path, const AppId& app_id, const GURL& url, - const UrlHandlerSavedChoice saved_choice, + UrlHandlerSavedChoice saved_choice, const base::Time& saved_choice_timestamp); UrlHandlerLaunchParams(const UrlHandlerLaunchParams& other);
diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index fb79b59a..3601625 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h
@@ -249,8 +249,8 @@ return permissions_policy_; } - const absl::optional<webapps::WebappInstallSource> - install_source_for_metrics() const { + absl::optional<webapps::WebappInstallSource> install_source_for_metrics() + const { return install_source_for_metrics_; }
diff --git a/chrome/browser/web_applications/web_app_install_info.cc b/chrome/browser/web_applications/web_app_install_info.cc index d3b4fb61..46520fd 100644 --- a/chrome/browser/web_applications/web_app_install_info.cc +++ b/chrome/browser/web_applications/web_app_install_info.cc
@@ -127,8 +127,8 @@ WebAppShortcutsMenuItemInfo::Icon::Icon( const WebAppShortcutsMenuItemInfo::Icon&) = default; -WebAppShortcutsMenuItemInfo::Icon::Icon(WebAppShortcutsMenuItemInfo::Icon&&) = - default; +WebAppShortcutsMenuItemInfo::Icon::Icon( + WebAppShortcutsMenuItemInfo::Icon&&) noexcept = default; WebAppShortcutsMenuItemInfo::Icon::~Icon() = default;
diff --git a/chrome/browser/web_applications/web_app_install_info.h b/chrome/browser/web_applications/web_app_install_info.h index 5df9a612..3a387f51 100644 --- a/chrome/browser/web_applications/web_app_install_info.h +++ b/chrome/browser/web_applications/web_app_install_info.h
@@ -116,7 +116,7 @@ struct Icon { Icon(); Icon(const Icon&); - Icon(Icon&&); + Icon(Icon&&) noexcept; ~Icon(); Icon& operator=(const Icon&); Icon& operator=(Icon&&);
diff --git a/chrome/browser/web_applications/web_app_install_manager.cc b/chrome/browser/web_applications/web_app_install_manager.cc index 17442eb6..b11ce52 100644 --- a/chrome/browser/web_applications/web_app_install_manager.cc +++ b/chrome/browser/web_applications/web_app_install_manager.cc
@@ -693,7 +693,8 @@ WebAppInstallManager::PendingTask::PendingTask() = default; -WebAppInstallManager::PendingTask::PendingTask(PendingTask&&) = default; +WebAppInstallManager::PendingTask::PendingTask(PendingTask&&) noexcept = + default; WebAppInstallManager::PendingTask::~PendingTask() = default;
diff --git a/chrome/browser/web_applications/web_app_install_manager.h b/chrome/browser/web_applications/web_app_install_manager.h index e0387a5..7416efc 100644 --- a/chrome/browser/web_applications/web_app_install_manager.h +++ b/chrome/browser/web_applications/web_app_install_manager.h
@@ -212,7 +212,7 @@ // FIFO. This is a subset of |tasks_|. struct PendingTask { PendingTask(); - PendingTask(PendingTask&&); + PendingTask(PendingTask&&) noexcept; ~PendingTask(); raw_ptr<const WebAppInstallTask> task = nullptr;
diff --git a/chrome/browser/web_applications/web_app_install_task.h b/chrome/browser/web_applications/web_app_install_task.h index 144be12..9e530c7 100644 --- a/chrome/browser/web_applications/web_app_install_task.h +++ b/chrome/browser/web_applications/web_app_install_task.h
@@ -260,7 +260,7 @@ OsHooksErrors os_hooks_errors); void OnOsHooksCreated(DisplayMode user_display_mode, const AppId& app_id, - const OsHooksErrors os_hook_errors); + OsHooksErrors os_hook_errors); void RecordDownloadedIconsResultAndHttpStatusCodes( IconsDownloadedResult result,
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h index ef185e4..8920253 100644 --- a/chrome/browser/web_applications/web_app_provider.h +++ b/chrome/browser/web_applications/web_app_provider.h
@@ -148,7 +148,7 @@ } // Returns whether the app registry is ready. - bool is_registry_ready() { return is_registry_ready_; } + bool is_registry_ready() const { return is_registry_ready_; } PreinstalledWebAppManager& preinstalled_web_app_manager() { return *preinstalled_web_app_manager_;
diff --git a/chrome/browser/web_applications/web_app_registrar.cc b/chrome/browser/web_applications/web_app_registrar.cc index a7ca596..edb0059 100644 --- a/chrome/browser/web_applications/web_app_registrar.cc +++ b/chrome/browser/web_applications/web_app_registrar.cc
@@ -856,11 +856,11 @@ registrar_->registry_.end(), filter_); } -const WebAppRegistrar::AppSet WebAppRegistrar::GetAppsIncludingStubs() const { +WebAppRegistrar::AppSet WebAppRegistrar::GetAppsIncludingStubs() const { return AppSet(this, nullptr, /*empty=*/registry_profile_being_deleted_); } -const WebAppRegistrar::AppSet WebAppRegistrar::GetApps() const { +WebAppRegistrar::AppSet WebAppRegistrar::GetApps() const { return AppSet( this, [](const WebApp& web_app) { @@ -875,7 +875,7 @@ registry_ = std::move(registry); } -const WebAppRegistrar::AppSet WebAppRegistrar::FilterApps(Filter filter) const { +WebAppRegistrar::AppSet WebAppRegistrar::FilterApps(Filter filter) const { return AppSet(this, filter, /*empty=*/registry_profile_being_deleted_); }
diff --git a/chrome/browser/web_applications/web_app_registrar.h b/chrome/browser/web_applications/web_app_registrar.h index 23bdf36..9701ee2c 100644 --- a/chrome/browser/web_applications/web_app_registrar.h +++ b/chrome/browser/web_applications/web_app_registrar.h
@@ -338,7 +338,7 @@ filter_(filter) { FilterAndSkipApps(); } - Iter(Iter&&) = default; + Iter(Iter&&) noexcept = default; Iter(const Iter&) = delete; Iter& operator=(const Iter&) = delete; ~Iter() = default; @@ -390,11 +390,11 @@ }; // Returns all apps in the registry (a superset) including stubs. - const AppSet GetAppsIncludingStubs() const; + AppSet GetAppsIncludingStubs() const; // Returns all apps excluding stubs for apps in sync install. Apps in sync // install are being installed and should be hidden for most subsystems. This // is a subset of GetAppsIncludingStubs(). - const AppSet GetApps() const; + AppSet GetApps() const; protected: Profile* profile() const { return profile_; } @@ -404,7 +404,7 @@ Registry& registry() { return registry_; } void SetRegistry(Registry&& registry); - const AppSet FilterApps(Filter filter) const; + AppSet FilterApps(Filter filter) const; void CountMutation();
diff --git a/chrome/browser/web_applications/web_app_uninstall_job.cc b/chrome/browser/web_applications/web_app_uninstall_job.cc index 12bc9f5..ac43839 100644 --- a/chrome/browser/web_applications/web_app_uninstall_job.cc +++ b/chrome/browser/web_applications/web_app_uninstall_job.cc
@@ -38,7 +38,7 @@ WebAppUninstallJob::~WebAppUninstallJob() = default; void WebAppUninstallJob::Start(const AppId& app_id, - url::Origin app_origin, + const url::Origin& app_origin, webapps::WebappUninstallSource source, ModifyAppRegistry delete_option, UninstallCallback callback) { @@ -68,7 +68,7 @@ // Uninstall any sub-apps the app has. std::vector<AppId> sub_app_ids = registrar_->GetAllSubAppIds(app_id_); num_pending_sub_app_uninstalls_ = sub_app_ids.size(); - for (AppId sub_app_id : sub_app_ids) { + for (const AppId& sub_app_id : sub_app_ids) { if (registrar_->GetAppById(sub_app_id) == nullptr) continue; install_finalizer_->UninstallExternalWebApp(
diff --git a/chrome/browser/web_applications/web_app_uninstall_job.h b/chrome/browser/web_applications/web_app_uninstall_job.h index dd8de8e..e114992d 100644 --- a/chrome/browser/web_applications/web_app_uninstall_job.h +++ b/chrome/browser/web_applications/web_app_uninstall_job.h
@@ -64,7 +64,7 @@ }; // The given `app_id` must correspond to an app in the `registrar`. void Start(const AppId& app_id, - url::Origin app_origin, + const url::Origin& app_origin, webapps::WebappUninstallSource source, ModifyAppRegistry delete_option, UninstallCallback callback);
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index deca7709..cd8f431d 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1645963179-913c34eac8ee784ba8bb6c23e1a922923aac3934.profdata +chrome-linux-main-1646005090-b3f3c014f639618707bde1d2f0879a06019333d8.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index d323fdc..22c9b63f 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1645963179-dc5421006876180184983c42fbfa30f08f953fdd.profdata +chrome-mac-arm-main-1646005090-1793164e7ee12890a0f6fb2d7f0cf3b80c030319.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 8b2eed05..5d438ee 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1645963179-aea84330bbac08f3d5f1aebe7248609bc0cdb326.profdata +chrome-mac-main-1646005090-3c545353b7485623a654c535eec5056b666c76e1.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 3a3b50a..4812eed 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1645940535-17385823e37ee142da7e41842d27a7dca6c4fd0d.profdata +chrome-win32-main-1646016704-4b872e0f90ae6d4c78897fbbb48c17b162b5f705.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 10211c6..31debf3 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1645963179-5c38096cd6036d79b83a3ec25681b0bd7f0c7bb7.profdata +chrome-win64-main-1646005090-862243bff30065e6437632d514e3d2805c4c01cf.profdata
diff --git a/chrome/common/extensions/api/file_manager_private.idl b/chrome/common/extensions/api/file_manager_private.idl index a87d2f9..0ca172f 100644 --- a/chrome/common/extensions/api/file_manager_private.idl +++ b/chrome/common/extensions/api/file_manager_private.idl
@@ -368,9 +368,8 @@ }; // A file task represents an action that the file manager can perform over the -// currently selected files. See -// chrome/browser/chromeos/extensions/file_manager/file_tasks.h for details -// about how file tasks are handled. +// currently selected files. See chrome/browser/ash/file_manager/file_tasks.h +// for details about how file tasks are handled. dictionary FileTask { // Unique identifier for the task. FileTaskDescriptor descriptor; @@ -1648,6 +1647,10 @@ // Lists mountable Guest OSs. static void listMountableGuests(ListMountableGuestsCallback callback); + + // Starts and mounts the target Guest OS. + // |callback| + static void mountGuest(long id, SimpleCallback callback); }; // Events supported by fileManagerPrivate API. These events are broadcasted.
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS index 8a70ec3..066439c 100644 --- a/chrome/renderer/DEPS +++ b/chrome/renderer/DEPS
@@ -28,7 +28,7 @@ "+components/feed/feed_feature_list.h", "+components/grit", "+components/guest_view/renderer", - "+components/history_clusters/core/config.h", + "+components/history_clusters/core/features.h", "+components/metrics/child_call_stack_profile_collector.h", "+components/nacl/common", "+components/nacl/renderer",
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 6ba41fd..2292fe1 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -81,7 +81,7 @@ #include "components/error_page/common/localized_error.h" #include "components/feed/buildflags.h" #include "components/grit/components_scaled_resources.h" -#include "components/history_clusters/core/config.h" +#include "components/history_clusters/core/features.h" #include "components/network_hints/renderer/web_prescient_networking_impl.h" #include "components/no_state_prefetch/common/prerender_url_loader_throttle.h" #include "components/no_state_prefetch/renderer/no_state_prefetch_client.h" @@ -585,9 +585,8 @@ const bool search_result_extractor_enabled = base::FeatureList::IsEnabled(features::kContinuousSearch); #else - history_clusters::OverrideWithFinch(RenderThread::Get()->GetLocale()); const bool search_result_extractor_enabled = - history_clusters::GetConfig().is_journeys_enabled; + history_clusters::IsJourneysEnabled(RenderThread::Get()->GetLocale()); #endif if (render_frame->IsMainFrame() && search_result_extractor_enabled) { continuous_search::SearchResultExtractorImpl::Create(render_frame);
diff --git a/chromecast/browser/renderer_prelauncher.cc b/chromecast/browser/renderer_prelauncher.cc index 66bdd69..07cffc2 100644 --- a/chromecast/browser/renderer_prelauncher.cc +++ b/chromecast/browser/renderer_prelauncher.cc
@@ -10,6 +10,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/site_instance.h" #include "content/public/common/child_process_host.h" +#include "ipc/ipc_message.h" namespace chromecast {
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index e7eeef6..0f916ba 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14535.0.0 \ No newline at end of file +14537.0.0 \ No newline at end of file
diff --git a/chromeos/crosapi/mojom/browser_app_instance_registry_mojom_traits.h b/chromeos/crosapi/mojom/browser_app_instance_registry_mojom_traits.h index 28200d1..9a3ac05 100644 --- a/chromeos/crosapi/mojom/browser_app_instance_registry_mojom_traits.h +++ b/chromeos/crosapi/mojom/browser_app_instance_registry_mojom_traits.h
@@ -18,12 +18,12 @@ static bool Read(crosapi::mojom::BrowserWindowInstanceUpdateDataView input, apps::BrowserWindowInstanceUpdate* output); - static base::UnguessableToken id( + static const base::UnguessableToken& id( const apps::BrowserWindowInstanceUpdate& update) { return update.id; } - static std::string window_id( + static const std::string& window_id( const apps::BrowserWindowInstanceUpdate& update) { return update.window_id; } @@ -49,7 +49,7 @@ static bool Read(crosapi::mojom::BrowserAppInstanceUpdateDataView input, apps::BrowserAppInstanceUpdate* output); - static base::UnguessableToken id( + static const base::UnguessableToken& id( const apps::BrowserAppInstanceUpdate& update) { return update.id; } @@ -59,15 +59,17 @@ return update.type; } - static std::string app_id(const apps::BrowserAppInstanceUpdate& update) { + static const std::string& app_id( + const apps::BrowserAppInstanceUpdate& update) { return update.app_id; } - static std::string window_id(const apps::BrowserAppInstanceUpdate& update) { + static const std::string& window_id( + const apps::BrowserAppInstanceUpdate& update) { return update.window_id; } - static absl::optional<std::string> title( + static const std::string& title( const apps::BrowserAppInstanceUpdate& update) { return update.title; }
diff --git a/chromeos/services/machine_learning/public/mojom/model.mojom b/chromeos/services/machine_learning/public/mojom/model.mojom index b0f6a78..65156204a 100644 --- a/chromeos/services/machine_learning/public/mojom/model.mojom +++ b/chromeos/services/machine_learning/public/mojom/model.mojom
@@ -46,12 +46,31 @@ [MinVersion=1] ADAPTIVE_CHARGING_20211105 = 7, }; +// Graphics API to use with the GPU delegate. +[Stable, Extensible] +enum GpuDelegateApi { + // Unknown value or not specified. + [Default] UNKNOWN = 0, + + // Use OpenGL. + OPENGL = 1, + + // Use OpenCL. + OPENCL = 2, +}; + // Options for creating the executor. Options are used for testing and // development. They are not typically used in normal, production code. [Stable] struct GraphExecutorOptions { + // Use NNAPI delegate. bool use_nnapi = false; + + // Use GPU delegate. [MinVersion=1] bool use_gpu = false; + + // Graphics API to use with GPU delegate. + [MinVersion=2] GpuDelegateApi gpu_delegate_api = OPENGL; }; // These values are persisted to logs. Entries should not be renumbered and
diff --git a/chromeos/services/network_config/cros_network_config.cc b/chromeos/services/network_config/cros_network_config.cc index 32f2592..e1bad0e1 100644 --- a/chromeos/services/network_config/cros_network_config.cc +++ b/chromeos/services/network_config/cros_network_config.cc
@@ -63,6 +63,9 @@ const char kErrorNetworkUnavailable[] = "Error.NetworkUnavailable"; const char kErrorNotReady[] = "Error.NotReady"; +// IKEv2 string from Shill SupportedVPNType property. +const char kIKEv2VPNType[] = "ikev2"; + // WireGuard string from Shill SupportedVPNType property. const char kWireGuardVPNType[] = "wireguard"; @@ -3144,6 +3147,12 @@ base::SplitString(*value->GetIfString(), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); } + if (!base::FeatureList::IsEnabled(ash::features::kEnableIkev2Vpn)) { + auto iter = std::find(result.begin(), result.end(), kIKEv2VPNType); + if (iter != result.end()) { + result.erase(iter); + } + } if (!base::FeatureList::IsEnabled(ash::features::kEnableWireGuard)) { auto iter = std::find(result.begin(), result.end(), kWireGuardVPNType); if (iter != result.end()) {
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index 81f7e99..4f296f2 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -60,6 +60,9 @@ # crbug.com/1257474 "shelf.OpenCloseSwitchApps", + # crbug.com/1239838 + "graphics.FPS", + # crbug.com/1186991 "launcher.SearchBuiltInApps",
diff --git a/components/certificate_transparency/data/log_list.json b/components/certificate_transparency/data/log_list.json index 46bfd7f..68a4b3f 100644 --- a/components/certificate_transparency/data/log_list.json +++ b/components/certificate_transparency/data/log_list.json
@@ -1,6 +1,6 @@ { - "version": "5.34", - "log_list_timestamp": "2022-02-25T01:36:56Z", + "version": "5.36", + "log_list_timestamp": "2022-02-27T01:35:59Z", "operators": [ { "name": "Google",
diff --git a/components/drive/drive_pref_names.cc b/components/drive/drive_pref_names.cc index ca89abc6..c74083a 100644 --- a/components/drive/drive_pref_names.cc +++ b/components/drive/drive_pref_names.cc
@@ -29,5 +29,8 @@ const char kDriveFsWasLaunchedAtLeastOnce[] = "drivefs.was_launched_at_least_once"; +// A boolean pref toggling MirrorSync functionality. +const char kDriveFsEnableMirrorSync[] = "drivefs.enable_mirror_sync"; + } // namespace prefs } // namespace drive
diff --git a/components/drive/drive_pref_names.h b/components/drive/drive_pref_names.h index 33212f76..890b976 100644 --- a/components/drive/drive_pref_names.h +++ b/components/drive/drive_pref_names.h
@@ -16,6 +16,7 @@ extern const char kDriveFsProfileSalt[]; extern const char kDriveFsPinnedMigrated[]; extern const char kDriveFsWasLaunchedAtLeastOnce[]; +extern const char kDriveFsEnableMirrorSync[]; } // namespace prefs } // namespace drive
diff --git a/components/history_clusters/core/BUILD.gn b/components/history_clusters/core/BUILD.gn index fc926888..836ce2a5 100644 --- a/components/history_clusters/core/BUILD.gn +++ b/components/history_clusters/core/BUILD.gn
@@ -20,8 +20,6 @@ static_library("core") { sources = [ "clustering_backend.h", - "config.cc", - "config.h", "features.cc", "features.h", "history_clusters_db_tasks.cc", @@ -89,7 +87,7 @@ source_set("unit_tests") { testonly = true sources = [ - "config_unittest.cc", + "features_unittest.cc", "history_clusters_db_tasks_unittest.cc", "history_clusters_service_unittest.cc", "history_clusters_util_unittest.cc",
diff --git a/components/history_clusters/core/config.cc b/components/history_clusters/core/config.cc deleted file mode 100644 index af42d9e..0000000 --- a/components/history_clusters/core/config.cc +++ /dev/null
@@ -1,66 +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. - -#include "components/history_clusters/core/config.h" - -#include "base/containers/contains.h" -#include "base/feature_list.h" -#include "base/metrics/field_trial_params.h" -#include "base/strings/string_piece_forward.h" -#include "base/strings/string_split.h" -#include "build/build_config.h" -#include "components/history_clusters/core/features.h" -#include "components/history_clusters/core/on_device_clustering_features.h" -#include "ui/base/l10n/l10n_util.h" - -namespace history_clusters { - -static Config* s_config = nullptr; - -Config::Config() = default; -Config::Config(const Config& other) = default; -Config::~Config() = default; - -// Override any parameters that may be provided by Finch. -void OverrideWithFinch(const std::string& application_locale) { - if (s_config) - return; - - s_config = new Config; - - if (!base::FeatureList::IsEnabled(internal::kJourneys)) { - s_config->is_journeys_enabled = false; - } else { - // Default to "", because defaulting it to a specific locale makes it hard - // to allow all locales, since the FeatureParam code interprets an empty - // string as undefined, and instead returns the default value. - const base::FeatureParam<std::string> kLocaleOrLanguageAllowlist{ - &internal::kJourneys, "JourneysLocaleOrLanguageAllowlist", ""}; - - // Allow comma and colon as delimiters to the language list. - auto allowlist = - base::SplitString(kLocaleOrLanguageAllowlist.Get(), - ",:", base::WhitespaceHandling::TRIM_WHITESPACE, - base::SplitResult::SPLIT_WANT_NONEMPTY); - - // Allow any exact locale matches, and also allow any users where the - // primary language subtag, e.g. "en" from "en-US" to match any element of - // the list. - s_config->is_journeys_enabled = - allowlist.empty() || base::Contains(allowlist, application_locale) || - base::Contains(allowlist, l10n_util::GetLanguage(application_locale)); - } -} - -void ResetConfigForTesting() { - s_config = nullptr; -} - -const Config& GetConfig() { - DCHECK(s_config); - - return *s_config; -} - -} // namespace history_clusters \ No newline at end of file
diff --git a/components/history_clusters/core/config.h b/components/history_clusters/core/config.h deleted file mode 100644 index 4ce487cb..0000000 --- a/components/history_clusters/core/config.h +++ /dev/null
@@ -1,35 +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 COMPONENTS_HISTORY_CLUSTERS_CORE_CONFIG_H_ -#define COMPONENTS_HISTORY_CLUSTERS_CORE_CONFIG_H_ - -#include <string> - -namespace history_clusters { - -// The default configuration. Always use |GetConfig()| to get the current -// configuration. -struct Config { - // - bool is_journeys_enabled = false; - - Config(); - Config(const Config& other); - ~Config(); -}; - -// Gets the current configuration. OverrideWithFinch() must have been called -// before GetConfig() is called. -const Config& GetConfig(); - -// Override any parameters that may be provided by Finch. -void OverrideWithFinch(const std::string& application_locale); - -// Resets the static config object for testing. -void ResetConfigForTesting(); - -} // namespace history_clusters - -#endif // COMPONENTS_HISTORY_CLUSTERS_CORE_CONFIG_H_ \ No newline at end of file
diff --git a/components/history_clusters/core/config_unittest.cc b/components/history_clusters/core/config_unittest.cc deleted file mode 100644 index f056d93..0000000 --- a/components/history_clusters/core/config_unittest.cc +++ /dev/null
@@ -1,93 +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. - -#include "components/history_clusters/core/config.h" - -#include "base/test/scoped_feature_list.h" -#include "components/history_clusters/core/features.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace history_clusters { - -TEST(HistoryClustersConfigTest, PlainEnabled) { - const struct { - const std::string locale; - bool expected_is_journeys_enabled; - } kLocaleTestCases[] = {{"", false}, - {"en", false}, - {"fr", false}, - {"zh-TW", false}, - {" random junk ", false}}; - - for (const auto& test : kLocaleTestCases) { - ResetConfigForTesting(); - OverrideWithFinch(test.locale); - - EXPECT_EQ(test.expected_is_journeys_enabled, - GetConfig().is_journeys_enabled) - << test.locale; - } -} - -TEST(HistoryClustersConfigTest, OmniboxAction) { - base::test::ScopedFeatureList features; - features.InitWithFeatures({internal::kJourneys, kOmniboxAction}, {}); - - const struct { - const std::string locale; - bool expected_is_journeys_enabled; - } kLocaleTestCases[] = {{"", true}, - {"en", true}, - {"fr", true}, - {"zh-TW", true}, - {" random junk ", true}}; - - for (const auto& test : kLocaleTestCases) { - ResetConfigForTesting(); - OverrideWithFinch(test.locale); - - EXPECT_EQ(test.expected_is_journeys_enabled, - GetConfig().is_journeys_enabled) - << test.locale; - } -} - -TEST(HistoryClustersConfigTest, LocaleOrLanguageAllowlist) { - base::test::ScopedFeatureList features; - features.InitWithFeaturesAndParameters( - {{ - internal::kJourneys, - // Test that we're tolerant of spaces, colons, whole locales, as well - // as primary language subcodes. - {{"JourneysLocaleOrLanguageAllowlist", "en, fr:de:zh-TW"}}, - }, - {kOmniboxAction, {}}}, - {}); - - const struct { - const std::string locale; - bool expected_is_journeys_enabled; - } kLocaleTestCases[] = {{"", false}, - {"en", true}, - {"en-US", true}, - {"fr", true}, - {" random junk ", false}, - {"de", true}, - {"el", false}, - {"zh-TW", true}, - {"zh", false}, - {"zh-CN", false}}; - - for (const auto& test : kLocaleTestCases) { - ResetConfigForTesting(); - - OverrideWithFinch(test.locale); - - EXPECT_EQ(test.expected_is_journeys_enabled, - GetConfig().is_journeys_enabled) - << test.locale; - } -} - -} // namespace history_clusters
diff --git a/components/history_clusters/core/features.cc b/components/history_clusters/core/features.cc index 8395829..c234463 100644 --- a/components/history_clusters/core/features.cc +++ b/components/history_clusters/core/features.cc
@@ -25,6 +25,30 @@ } // namespace +bool IsJourneysEnabled(const std::string& locale) { + if (!base::FeatureList::IsEnabled(internal::kJourneys)) + return false; + + // Allow comma and colon as delimiters to the language list. + auto allowlist = + base::SplitString(kLocaleOrLanguageAllowlist.Get(), + ",:", base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); + if (allowlist.empty()) + return true; + + // Allow any exact locale matches, and also allow any users where the primary + // language subtag, e.g. "en" from "en-US" to match any element of the list. + return base::Contains(allowlist, locale) || + base::Contains(allowlist, l10n_util::GetLanguage(locale)); +} + +// Default to "", because defaulting it to a specific locale makes it hard to +// allow all locales, since the FeatureParam code interprets an empty string as +// undefined, and instead returns the default value. +const base::FeatureParam<std::string> kLocaleOrLanguageAllowlist{ + &internal::kJourneys, "JourneysLocaleOrLanguageAllowlist", ""}; + const base::FeatureParam<int> kMaxVisitsToCluster{ &internal::kJourneys, "JourneysMaxVisitsToCluster", 1000};
diff --git a/components/history_clusters/core/features.h b/components/history_clusters/core/features.h index f1fd5453..827f4aea 100644 --- a/components/history_clusters/core/features.h +++ b/components/history_clusters/core/features.h
@@ -13,6 +13,23 @@ // Params & helpers functions +// Returns true if Journeys in the Chrome History WebUI is enabled. +// Callers with access to `HistoryClustersService` should use +// `HistoryClustersService::IsJourneysEnabled` which has precomputed this value +// with the g_browser_process locale. Renderer process callers will have to +// use this function directly. +bool IsJourneysEnabled(const std::string& application_locale); + +// A comma (or colon) separated list of allowed locales and languages for which +// Journeys is enabled. If this string is empty, any application locale or +// language is allowed. If this string is non-empty, then the either the user's +// system locale or primary language subtag must match one of the elements for +// Journeys to be enabled. +// +// For example, "en,zh-TW" would mark English language users from any country, +// and Chinese language users from Taiwan as on the allowlist. +extern const base::FeatureParam<std::string> kLocaleOrLanguageAllowlist; + // The max number of visits to use for each clustering iteration. This limits // the number of visits sent to the clustering backend per batch. extern const base::FeatureParam<int> kMaxVisitsToCluster;
diff --git a/components/history_clusters/core/features_unittest.cc b/components/history_clusters/core/features_unittest.cc new file mode 100644 index 0000000..663e69aa --- /dev/null +++ b/components/history_clusters/core/features_unittest.cc
@@ -0,0 +1,53 @@ +// 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/history_clusters/core/features.h" + +#include "base/test/scoped_feature_list.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace history_clusters { + +TEST(HistoryClustersFeaturesTest, PlainEnabled) { + EXPECT_FALSE(IsJourneysEnabled("")); + EXPECT_FALSE(IsJourneysEnabled("en")); + EXPECT_FALSE(IsJourneysEnabled("fr")); + EXPECT_FALSE(IsJourneysEnabled("zh-TW")); + EXPECT_FALSE(IsJourneysEnabled(" random junk ")); + + base::test::ScopedFeatureList features; + features.InitWithFeatures({internal::kJourneys, kOmniboxAction}, {}); + + EXPECT_TRUE(IsJourneysEnabled("")); + EXPECT_TRUE(IsJourneysEnabled("en")); + EXPECT_TRUE(IsJourneysEnabled("fr")); + EXPECT_TRUE(IsJourneysEnabled("zh-TW")); + EXPECT_TRUE(IsJourneysEnabled(" random junk ")); +} + +TEST(HistoryClustersFeaturesTest, LocaleOrLanguageAllowlist) { + base::test::ScopedFeatureList features; + features.InitWithFeaturesAndParameters( + {{ + internal::kJourneys, + // Test that we're tolerant of spaces, colons, whole locales, as well + // as primary language subcodes. + {{"JourneysLocaleOrLanguageAllowlist", "en, fr:de:zh-TW"}}, + }, + {kOmniboxAction, {}}}, + {}); + + EXPECT_FALSE(IsJourneysEnabled("")); + EXPECT_TRUE(IsJourneysEnabled("en")); + EXPECT_TRUE(IsJourneysEnabled("en-US")); + EXPECT_TRUE(IsJourneysEnabled("fr")); + EXPECT_FALSE(IsJourneysEnabled(" random junk ")); + EXPECT_TRUE(IsJourneysEnabled("de")); + EXPECT_FALSE(IsJourneysEnabled("el")); + EXPECT_TRUE(IsJourneysEnabled("zh-TW")); + EXPECT_FALSE(IsJourneysEnabled("zh")); + EXPECT_FALSE(IsJourneysEnabled("zh-CN")); +} + +} // namespace history_clusters
diff --git a/components/history_clusters/core/history_clusters_service.cc b/components/history_clusters/core/history_clusters_service.cc index 5c07328..2ac8254 100644 --- a/components/history_clusters/core/history_clusters_service.cc +++ b/components/history_clusters/core/history_clusters_service.cc
@@ -30,7 +30,6 @@ #include "components/history/core/browser/history_database.h" #include "components/history/core/browser/history_db_task.h" #include "components/history/core/browser/history_types.h" -#include "components/history_clusters/core/config.h" #include "components/history_clusters/core/features.h" #include "components/history_clusters/core/history_clusters_buildflags.h" #include "components/history_clusters/core/history_clusters_db_tasks.h" @@ -191,9 +190,10 @@ optimization_guide::EntityMetadataProvider* entity_metadata_provider, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, site_engagement::SiteEngagementScoreProvider* engagement_score_provider) - : history_service_(history_service), visit_deletion_observer_(this) { - InitializeConfig(application_locale); - + : is_journeys_enabled_( + ::history_clusters::IsJourneysEnabled(application_locale)), + history_service_(history_service), + visit_deletion_observer_(this) { DCHECK(history_service_); visit_deletion_observer_.AttachToHistoryService(history_service); @@ -207,22 +207,12 @@ HistoryClustersService::~HistoryClustersService() = default; -// static -void HistoryClustersService::InitializeConfig( - const std::string& application_locale) { - OverrideWithFinch(application_locale); -} - base::WeakPtr<HistoryClustersService> HistoryClustersService::GetWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } void HistoryClustersService::Shutdown() {} -bool HistoryClustersService::IsJourneysEnabled() const { - return GetConfig().is_journeys_enabled; -} - void HistoryClustersService::AddObserver(Observer* obs) { observers_.AddObserver(obs); }
diff --git a/components/history_clusters/core/history_clusters_service.h b/components/history_clusters/core/history_clusters_service.h index 6c079184..f502362 100644 --- a/components/history_clusters/core/history_clusters_service.h +++ b/components/history_clusters/core/history_clusters_service.h
@@ -104,7 +104,7 @@ // Returns true if the Journeys feature is enabled for the current application // locale. This is a cached wrapper of `IsJourneysEnabled()` within features.h // that's already evaluated against the g_browser_process application locale. - bool IsJourneysEnabled() const; + bool IsJourneysEnabled() const { return is_journeys_enabled_; } // Used to add and remove observers. void AddObserver(Observer* obs); @@ -174,10 +174,6 @@ // Clears `all_keywords_cache_` and cancels any pending tasks to populate it. void ClearKeywordCache(); - // Initializes the history cluster config object if it has not been already - // initialized. - static void InitializeConfig(const std::string& application_locale); - private: friend class HistoryClustersServiceTestApi; @@ -206,6 +202,9 @@ QueryClustersCallback callback, std::vector<history::Cluster> clusters) const; + // True if the Journeys feature is enabled for the application locale. + const bool is_journeys_enabled_; + // Non-owning pointer, but never nullptr. history::HistoryService* const history_service_;
diff --git a/components/omnibox/browser/BUILD.gn b/components/omnibox/browser/BUILD.gn index e48c97fe..7995bce 100644 --- a/components/omnibox/browser/BUILD.gn +++ b/components/omnibox/browser/BUILD.gn
@@ -604,7 +604,6 @@ "//components/dom_distiller/core:core", "//components/favicon/core/test:test_support", "//components/history/core/test", - "//components/ntp_tiles:ntp_tiles", "//components/omnibox/common", "//components/open_from_clipboard:test_support", "//components/prefs:test_support",
diff --git a/components/omnibox/browser/android/javatests/src/org/chromium/components/omnibox/AutocompleteMatchBuilder.java b/components/omnibox/browser/android/javatests/src/org/chromium/components/omnibox/AutocompleteMatchBuilder.java index 90e9c06..520c1e5 100644 --- a/components/omnibox/browser/android/javatests/src/org/chromium/components/omnibox/AutocompleteMatchBuilder.java +++ b/components/omnibox/browser/android/javatests/src/org/chromium/components/omnibox/AutocompleteMatchBuilder.java
@@ -269,13 +269,4 @@ mOmniboxPedal = omniboxPedal; return this; } - - /** - * @param isDeletable Whether the match should be made deletable. - * @return Omnibox suggestion builder. - */ - public AutocompleteMatchBuilder setDeletable(boolean isDeletable) { - mIsDeletable = isDeletable; - return this; - } }
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc index b06df27..5e3ae82 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc
@@ -129,20 +129,6 @@ return top_match->rich_autocompletion_triggered; } -void RecordMatchDeletion(const AutocompleteMatch& match) { - if (match.deletable) { - // This formula combines provider and result type into a single enum as - // defined in OmniboxProviderAndResultType in enums.xml. - auto combined_type = match.provider->AsOmniboxEventProviderType() * 100 + - match.AsOmniboxEventResultType(); - // This histogram is defined in the internal histograms.xml. This is because - // the vast majority of OmniboxProviderAndResultType histograms are - // generated by internal tools, and we wish to keep them together. - base::UmaHistogramSparse("Omnibox.SuggestionDeleted.ProviderAndResultType", - combined_type); - } -} - } // namespace // static @@ -541,6 +527,11 @@ void AutocompleteController::DeleteMatch(const AutocompleteMatch& match) { DCHECK(match.SupportsDeletion()); + // This formula combines provider and result type into a single enum as + // defined in OmniboxProviderAndResultType in enums.xml. + auto combined_type = match.provider->AsOmniboxEventProviderType() * 100 + + match.AsOmniboxEventResultType(); + // Delete duplicate matches attached to the main match first. for (auto it(match.duplicate_matches.begin()); it != match.duplicate_matches.end(); ++it) { @@ -549,7 +540,11 @@ } if (match.deletable) { - RecordMatchDeletion(match); + // This histogram is defined in the internal histograms.xml. This is because + // the vast majority of OmniboxProviderAndResultType histograms are + // generated by internal tools, and we wish to keep them together. + base::UmaHistogramSparse("Omnibox.SuggestionDeleted.ProviderAndResultType", + combined_type); match.provider->DeleteMatch(match); } @@ -560,18 +555,6 @@ ExpireCopiedEntries(); } -void AutocompleteController::DeleteMatchElement(const AutocompleteMatch& match, - size_t element_index) { - DCHECK(match.SupportsDeletion()); - - if (match.deletable) { - RecordMatchDeletion(match); - match.provider->DeleteMatchElement(match, element_index); - } - - OnProviderUpdate(true); -} - void AutocompleteController::ExpireCopiedEntries() { // The first true makes UpdateResult() clear out the results and // regenerate them, thus ensuring that no results from the previous
diff --git a/components/omnibox/browser/autocomplete_controller.h b/components/omnibox/browser/autocomplete_controller.h index 3944e37..dad18b6 100644 --- a/components/omnibox/browser/autocomplete_controller.h +++ b/components/omnibox/browser/autocomplete_controller.h
@@ -139,15 +139,6 @@ // no query is running. void DeleteMatch(const AutocompleteMatch& match); - // Asks the relevant provider to partially delete match, and ensures observers - // are notified of resulting changes immediately. This should only be called - // when no query is running. - // Calling this method does not imply removal of the AutocompleteMatch. - // |element_index| parameter specifies which part of the match should be - // deleted. For cases where the entire AutocompleteMatch should be removed, - // please see |DeleteMatch| method. - void DeleteMatchElement(const AutocompleteMatch& match, size_t element_index); - // Removes any entries that were copied from the last result. This is used by // the popup to ensure it's not showing an out-of-date query. void ExpireCopiedEntries();
diff --git a/components/omnibox/browser/autocomplete_provider.cc b/components/omnibox/browser/autocomplete_provider.cc index 44fb680..2f42ef3 100644 --- a/components/omnibox/browser/autocomplete_provider.cc +++ b/components/omnibox/browser/autocomplete_provider.cc
@@ -164,12 +164,6 @@ << "' has not implemented DeleteMatch."; } -void AutocompleteProvider::DeleteMatchElement(const AutocompleteMatch& match, - size_t element_index) { - DLOG(WARNING) << "The AutocompleteProvider '" << GetName() - << "' has not implemented DeleteMatchElement."; -} - void AutocompleteProvider::AddProviderInfo(ProvidersInfo* provider_info) const { }
diff --git a/components/omnibox/browser/autocomplete_provider.h b/components/omnibox/browser/autocomplete_provider.h index efdfbe9..ee3afeb 100644 --- a/components/omnibox/browser/autocomplete_provider.h +++ b/components/omnibox/browser/autocomplete_provider.h
@@ -236,14 +236,6 @@ // responsibility of the caller to do so after calling us. virtual void DeleteMatch(const AutocompleteMatch& match); - // Called to delete an element of a match. This element should not appear - // again in this or future queries. Unlike DeleteMatch, this call does not - // delete the entire AutocompleteMatch, but focuses on just one part of it. - // NOTE: Do NOT call OnProviderUpdate() in this method, it is the - // responsibility of the caller to do so after calling us. - virtual void DeleteMatchElement(const AutocompleteMatch& match, - size_t element_index); - // Called when an omnibox event log entry is generated. This gives // a provider the opportunity to add diagnostic information to the // logs. A provider is expected to append a single entry of whatever
diff --git a/components/omnibox/browser/fake_autocomplete_provider_client.cc b/components/omnibox/browser/fake_autocomplete_provider_client.cc index 2f4b982..d016671 100644 --- a/components/omnibox/browser/fake_autocomplete_provider_client.cc +++ b/components/omnibox/browser/fake_autocomplete_provider_client.cc
@@ -107,12 +107,3 @@ const TabMatcher& FakeAutocompleteProviderClient::GetTabMatcher() const { return fake_tab_matcher_; } - -scoped_refptr<history::TopSites> FakeAutocompleteProviderClient::GetTopSites() { - return top_sites_; -} - -ntp_tiles::MostVisitedSites* -FakeAutocompleteProviderClient::GetNtpMostVisitedSites() { - return ntp_most_visited_sites_; -}
diff --git a/components/omnibox/browser/fake_autocomplete_provider_client.h b/components/omnibox/browser/fake_autocomplete_provider_client.h index 072273c..553a69b4 100644 --- a/components/omnibox/browser/fake_autocomplete_provider_client.h +++ b/components/omnibox/browser/fake_autocomplete_provider_client.h
@@ -57,22 +57,11 @@ scoped_refptr<ShortcutsBackend> GetShortcutsBackendIfExists() override; query_tiles::TileService* GetQueryTileService() const override; const TabMatcher& GetTabMatcher() const override; - scoped_refptr<history::TopSites> GetTopSites() override; - ntp_tiles::MostVisitedSites* GetNtpMostVisitedSites() override; - // Test-only setters void set_in_memory_url_index(std::unique_ptr<InMemoryURLIndex> index) { in_memory_url_index_ = std::move(index); } - void set_top_sites(scoped_refptr<history::TopSites> top_sites) { - top_sites_ = std::move(top_sites); - } - - void set_ntp_most_visited_sites(ntp_tiles::MostVisitedSites* ntp_mv_sites) { - ntp_most_visited_sites_ = ntp_mv_sites; - } - private: base::ScopedTempDir history_dir_; std::unique_ptr<bookmarks::BookmarkModel> bookmark_model_; @@ -84,8 +73,6 @@ scoped_refptr<ShortcutsBackend> shortcuts_backend_; std::unique_ptr<query_tiles::TileService> tile_service_; FakeTabMatcher fake_tab_matcher_; - scoped_refptr<history::TopSites> top_sites_{}; - ntp_tiles::MostVisitedSites* ntp_most_visited_sites_{}; }; #endif // COMPONENTS_OMNIBOX_BROWSER_FAKE_AUTOCOMPLETE_PROVIDER_CLIENT_H_
diff --git a/components/omnibox/browser/most_visited_sites_provider.cc b/components/omnibox/browser/most_visited_sites_provider.cc index 5a26c3e85..99654e5 100644 --- a/components/omnibox/browser/most_visited_sites_provider.cc +++ b/components/omnibox/browser/most_visited_sites_provider.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/bind.h" -#include "base/containers/cxx20_erase.h" #include "base/feature_list.h" #include "components/history/core/browser/top_sites.h" #include "components/ntp_tiles/most_visited_sites.h" @@ -37,7 +36,7 @@ const GURL& url, int relevance, AutocompleteMatchType::Type type) { - AutocompleteMatch match(provider, relevance, true, type); + AutocompleteMatch match(provider, relevance, false, type); match.destination_url = url; match.fill_into_edit += @@ -220,57 +219,3 @@ } void MostVisitedSitesProvider::OnIconMadeAvailable(const GURL& site_url) {} - -void MostVisitedSitesProvider::BlockURL(const GURL& site_url) { - scoped_refptr<history::TopSites> top_sites = client_->GetTopSites(); - if (top_sites) { - top_sites->AddBlockedUrl(site_url); - } - - if (most_visited_sites_) { - most_visited_sites_->DeleteCustomLink(site_url); - most_visited_sites_->AddOrRemoveBlockedUrl(site_url, /* add_url=*/true); - } -} - -void MostVisitedSitesProvider::DeleteMatch(const AutocompleteMatch& match) { - DCHECK_EQ(match.type, AutocompleteMatchType::NAVSUGGEST); - - BlockURL(match.destination_url); - for (auto i = matches_.begin(); i != matches_.end(); ++i) { - if (i->contents == match.contents) { - matches_.erase(i); - break; - } - } -} -void MostVisitedSitesProvider::DeleteMatchElement( - const AutocompleteMatch& source_match, - size_t element_index) { - DCHECK_EQ(source_match.type, AutocompleteMatchType::TILE_NAVSUGGEST); - DCHECK_GE(element_index, 0u); - DCHECK_LT((size_t)element_index, source_match.navsuggest_tiles.size()); - - // Attempt to modify the match in place. - DCHECK_EQ(matches_.size(), 1ul); - DCHECK_EQ(matches_[0].type, AutocompleteMatchType::TILE_NAVSUGGEST); - - if (source_match.type != AutocompleteMatchType::TILE_NAVSUGGEST || - element_index < 0u || - element_index >= source_match.navsuggest_tiles.size() || - matches_.size() != 1u || - matches_[0].type != AutocompleteMatchType::TILE_NAVSUGGEST) { - return; - } - - const auto& url_to_delete = source_match.navsuggest_tiles[element_index].url; - BlockURL(url_to_delete); - auto& tiles_to_update = matches_[0].navsuggest_tiles; - base::EraseIf(tiles_to_update, [&url_to_delete](const auto& tile) { - return tile.url == url_to_delete; - }); - - if (tiles_to_update.empty()) { - matches_.clear(); - } -}
diff --git a/components/omnibox/browser/most_visited_sites_provider.h b/components/omnibox/browser/most_visited_sites_provider.h index bf119da6..0fa9148 100644 --- a/components/omnibox/browser/most_visited_sites_provider.h +++ b/components/omnibox/browser/most_visited_sites_provider.h
@@ -30,9 +30,6 @@ void Start(const AutocompleteInput& input, bool minimal_changes) override; void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; - void DeleteMatch(const AutocompleteMatch& match) override; - void DeleteMatchElement(const AutocompleteMatch& match, - size_t element) override; private: FRIEND_TEST_ALL_PREFIXES(MostVisitedSitesProviderTest, @@ -60,7 +57,6 @@ const std::map<ntp_tiles::SectionType, ntp_tiles::NTPTilesVector>& sections) override; void OnIconMadeAvailable(const GURL& site_url) override; - void BlockURL(const GURL& site_url); raw_ptr<ntp_tiles::MostVisitedSites> most_visited_sites_{};
diff --git a/components/omnibox/browser/most_visited_sites_provider_unittest.cc b/components/omnibox/browser/most_visited_sites_provider_unittest.cc index c0f156a..6b035f8 100644 --- a/components/omnibox/browser/most_visited_sites_provider_unittest.cc +++ b/components/omnibox/browser/most_visited_sites_provider_unittest.cc
@@ -9,46 +9,29 @@ #include <memory> #include <string> -#include "base/test/scoped_feature_list.h" -#include "base/test/task_environment.h" #include "build/build_config.h" #include "components/history/core/browser/top_sites.h" -#include "components/ntp_tiles/icon_cacher.h" -#include "components/ntp_tiles/most_visited_sites.h" -#include "components/omnibox/browser/autocomplete_controller.h" #include "components/omnibox/browser/autocomplete_provider_listener.h" -#include "components/omnibox/browser/fake_autocomplete_provider_client.h" +#include "components/omnibox/browser/mock_autocomplete_provider_client.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/omnibox/browser/test_scheme_classifier.h" #include "components/omnibox/common/omnibox_features.h" #include "components/search_engines/omnibox_focus_type.h" -#include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/metrics_proto/omnibox_event.pb.h" namespace { -class FakeTopSites : public history::TopSites { +class FakeEmptyTopSites : public history::TopSites { public: - FakeTopSites() = default; - // history::TopSites: - void GetMostVisitedURLs(GetMostVisitedURLsCallback callback) override { - callbacks_.push_back(std::move(callback)); - } + void GetMostVisitedURLs(GetMostVisitedURLsCallback callback) override; void SyncWithHistory() override {} - - bool HasBlockedUrls() const override { return !blocked_urls_.empty(); } - void AddBlockedUrl(const GURL& url) override { - blocked_urls_.insert(url.spec()); - } - void RemoveBlockedUrl(const GURL& url) override { - blocked_urls_.erase(url.spec()); - } - bool IsBlocked(const GURL& url) override { - return blocked_urls_.count(url.spec()) > 0; - } - void ClearBlockedUrls() override { blocked_urls_.clear(); } + bool HasBlockedUrls() const override { return false; } + void AddBlockedUrl(const GURL& url) override {} + void RemoveBlockedUrl(const GURL& url) override {} + bool IsBlocked(const GURL& url) override { return false; } + void ClearBlockedUrls() override {} bool IsFull() override { return false; } bool loaded() const override { return false; } history::PrepopulatedPageList GetPrepopulatedPages() override { @@ -61,418 +44,240 @@ // Only runs a single callback, so that the test can specify a different // set per call. - // Returns true if there was a recipient to receive the URLs and the list was - // emitted, otherwise returns false. - bool EmitURLs() { - if (callbacks_.empty()) - return false; - std::move(callbacks_.front()).Run(std::move(urls_)); - callbacks_.pop_front(); - return true; + void RunACallback(const history::MostVisitedURLList& urls) { + DCHECK(!callbacks.empty()); + std::move(callbacks.front()).Run(urls); + callbacks.pop_front(); } - history::MostVisitedURLList& urls() { return urls_; } - const std::set<std::string>& blocked_urls() const { return blocked_urls_; } - protected: // A test-specific field for controlling when most visited callback is run // after top sites have been requested. - std::list<GetMostVisitedURLsCallback> callbacks_; - history::MostVisitedURLList urls_; - std::set<std::string> blocked_urls_; + std::list<GetMostVisitedURLsCallback> callbacks; - ~FakeTopSites() override = default; + ~FakeEmptyTopSites() override = default; }; -constexpr const auto* WEB_URL = u"https://example.com/"; -constexpr const auto* NTP_URL = u"chrome://newtab"; -constexpr const auto* SRP_URL = u"https://www.google.com/?q=flowers"; -constexpr const auto* FTP_URL = u"ftp://just.for.filtering.com"; +void FakeEmptyTopSites::GetMostVisitedURLs( + GetMostVisitedURLsCallback callback) { + callbacks.push_back(std::move(callback)); +} + +class FakeAutocompleteProviderClient : public MockAutocompleteProviderClient { + public: + FakeAutocompleteProviderClient() + : template_url_service_(new TemplateURLService(nullptr, 0)), + top_sites_(new FakeEmptyTopSites()) {} + FakeAutocompleteProviderClient(const FakeAutocompleteProviderClient&) = + delete; + FakeAutocompleteProviderClient& operator=( + const FakeAutocompleteProviderClient&) = delete; + + bool SearchSuggestEnabled() const override { return true; } + + scoped_refptr<history::TopSites> GetTopSites() override { return top_sites_; } + + TemplateURLService* GetTemplateURLService() override { + return template_url_service_.get(); + } + + TemplateURLService* GetTemplateURLService() const override { + return template_url_service_.get(); + } + + bool IsPersonalizedUrlDataCollectionActive() const override { return true; } + + void Classify( + const std::u16string& text, + bool prefer_keyword, + bool allow_exact_keyword_match, + metrics::OmniboxEventProto::PageClassification page_classification, + AutocompleteMatch* match, + GURL* alternate_nav_url) override { + // Populate enough of |match| to keep the MostVisitedSitesProvider happy. + match->type = AutocompleteMatchType::URL_WHAT_YOU_TYPED; + match->destination_url = GURL(text); + } + + const AutocompleteSchemeClassifier& GetSchemeClassifier() const override { + return scheme_classifier_; + } + + private: + std::unique_ptr<TemplateURLService> template_url_service_; + scoped_refptr<history::TopSites> top_sites_; + TestSchemeClassifier scheme_classifier_; +}; + } // namespace class MostVisitedSitesProviderTest : public testing::Test, public AutocompleteProviderListener { public: + MostVisitedSitesProviderTest() = default; + MostVisitedSitesProviderTest(const MostVisitedSitesProviderTest&) = delete; + MostVisitedSitesProviderTest& operator=(const MostVisitedSitesProviderTest&) = + delete; + void SetUp() override; protected: - // Construct AutocompleteInput object a hypothetical Omnibox session context. - // Does not run any validation on the supplied values, allowing any - // combination (including invalid ones) to be used to create AutocompleteInput - // context object. - AutocompleteInput BuildAutocompleteInput( - const std::u16string& input_url, - const std::u16string& current_url, - metrics::OmniboxEventProto::PageClassification page_class, - OmniboxFocusType focus_type) { - AutocompleteInput input(input_url, page_class, TestSchemeClassifier()); - input.set_focus_type(focus_type); - input.set_current_url(GURL(current_url)); - return input; - } - - // Helper method, constructing a valid AutocompleteInput object for a website - // visit. - AutocompleteInput BuildAutocompleteInputForWebOnFocus() { - return BuildAutocompleteInput(WEB_URL, WEB_URL, - metrics::OmniboxEventProto::OTHER, - OmniboxFocusType::ON_FOCUS); - } - - // Iterate over all matches offered by the Provider and verify these against - // the supplied list of History URLs. - void CheckMatchesEquivalentTo(const history::MostVisitedURLList& urls, - bool expect_tiles); - - // Returns total number of all NAVSUGGEST and TILE_NAVSUGGEST elements. - size_t NumMostVisitedMatches(); - - // Returns the N-th match of a particular type, skipping over all matches of - // other types. If match of that type does not exist, or there are not enough - // elements of that type, this call returns null. - const AutocompleteMatch* GetMatch(AutocompleteMatchType::Type type, - size_t index); - // AutocompleteProviderListener: void OnProviderUpdate(bool updated_matches) override; - base::test::TaskEnvironment task_environment_; - scoped_refptr<FakeTopSites> top_sites_; - scoped_refptr<FakeTopSites> top_sites_for_start_surface_; + std::unique_ptr<FakeAutocompleteProviderClient> client_; scoped_refptr<MostVisitedSitesProvider> provider_; - base::test::ScopedFeatureList features_; - sync_preferences::TestingPrefServiceSyncable pref_service_; - std::unique_ptr<ntp_tiles::MostVisitedSites> ntp_top_sites_; - std::unique_ptr<AutocompleteController> controller_; + + network::TestURLLoaderFactory* test_loader_factory() { + return client_->test_url_loader_factory(); + } + + GURL GetSuggestURL( + metrics::OmniboxEventProto::PageClassification page_classification) { + TemplateURLRef::SearchTermsArgs search_terms_args; + search_terms_args.page_classification = page_classification; + search_terms_args.focus_type = OmniboxFocusType::ON_FOCUS; + return RemoteSuggestionsService::EndpointUrl( + search_terms_args, client_->GetTemplateURLService()); + } + + AutocompleteInput CreateNTPOnFocusInputForRemoteNoUrl() { + // Use NTP as the page classification, since REMOTE_NO_URL is enabled by + // default for the NTP. + AutocompleteInput input( + std::u16string(), + metrics::OmniboxEventProto::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS, + TestSchemeClassifier()); + input.set_focus_type(OmniboxFocusType::ON_FOCUS); + return input; + } }; -size_t MostVisitedSitesProviderTest::NumMostVisitedMatches() { - const auto& result = controller_->result(); - size_t count = 0; - for (const auto& match : result) { - if ((match.type == AutocompleteMatchType::TILE_NAVSUGGEST) || - (match.type == AutocompleteMatchType::NAVSUGGEST)) { - ++count; - } - } - return count; -} - -const AutocompleteMatch* MostVisitedSitesProviderTest::GetMatch( - AutocompleteMatchType::Type type, - size_t index) { - const auto& result = controller_->result(); - for (const auto& match : result) { - if (match.type == type) { - if (!index) - return &match; - --index; - } - } - return nullptr; -} - -void MostVisitedSitesProviderTest::CheckMatchesEquivalentTo( - const history::MostVisitedURLList& urls, - bool expect_tiles) { - // Compare the AutocompleteResult against a set of URLs that we expect to see. - // Note that additional matches may be offered if other providers are also - // registered in the same category as MostVisitedSitesProvider. - // We ignore all matches that are not ours. - const auto& result = controller_->result(); - - size_t match_index = 0; - - if (expect_tiles) { - ASSERT_EQ(1ul, NumMostVisitedMatches()) - << "Expected only one TILE_NAVSUGGEST match"; - for (const auto& match : result) { - if (match.type != AutocompleteMatchType::TILE_NAVSUGGEST) - continue; - const auto& tiles = match.navsuggest_tiles; - ASSERT_EQ(urls.size(), tiles.size()) << "Wrong number of tiles reported"; - for (size_t index = 0u; index < urls.size(); index++) { - EXPECT_EQ(urls[index].url, tiles[index].url) - << "Invalid Tile URL at position " << index; - EXPECT_EQ(urls[index].title, tiles[index].title) - << "Invalid Tile Title at position " << index; - } - break; - } - } else { - ASSERT_EQ(urls.size(), NumMostVisitedMatches()) - << "Unexpected number of NAVSUGGEST matches"; - for (const auto& match : result) { - if (match.type != AutocompleteMatchType::NAVSUGGEST) - continue; - - EXPECT_EQ(urls[match_index].url, match.destination_url) - << "Invalid Match URL at position " << match_index; - EXPECT_EQ(urls[match_index].title, match.description) - << "Invalid Match Title at position " << match_index; - ++match_index; - } - } -} - void MostVisitedSitesProviderTest::SetUp() { - ntp_tiles::MostVisitedSites::RegisterProfilePrefs(pref_service_.registry()); - top_sites_ = new FakeTopSites(); - top_sites_for_start_surface_ = new FakeTopSites(); - - // Note: std::make_unique<> fails here because it is unable to deduce argument - // types. - ntp_top_sites_.reset(new ntp_tiles::MostVisitedSites( - &pref_service_, top_sites_for_start_surface_, {}, {}, {}, {}, true)); - auto client = std::make_unique<FakeAutocompleteProviderClient>(); - client->set_top_sites(top_sites_); - client->set_ntp_most_visited_sites(ntp_top_sites_.get()); - - // For tests requiring direct interaction with the Provider. - provider_ = new MostVisitedSitesProvider(client.get(), this); - - // For tests not requiring direct interaction with the Provider. - controller_ = std::make_unique<AutocompleteController>( - std::move(client), AutocompleteProvider::TYPE_MOST_VISITED_SITES); - - // Inject a few URLs to - std::array<history::MostVisitedURL, 5> test_data{{ - {GURL("http://www.a.art/"), u"A art"}, - {GURL("http://www.b.biz/"), u"B biz"}, - {GURL("http://www.c.com/"), u"C com"}, - {GURL("http://www.d.de/"), u"D de"}, - {GURL("http://www.e.edu/"), u"E edu"}, - }}; - - top_sites_->urls().assign(test_data.begin(), test_data.end()); - top_sites_for_start_surface_->urls().assign(test_data.rbegin(), - test_data.rend()); + client_ = std::make_unique<FakeAutocompleteProviderClient>(); + provider_ = new MostVisitedSitesProvider(client_.get(), this); } void MostVisitedSitesProviderTest::OnProviderUpdate(bool updated_matches) {} TEST_F(MostVisitedSitesProviderTest, AllowMostVisitedSitesSuggestions) { - features_.InitAndDisableFeature(omnibox::kMostVisitedTiles); - using OEP = metrics::OmniboxEventProto; - using OFT = OmniboxFocusType; + std::string input_url = "https://example.com/"; + std::string start_surface_url = "chrome://newtab"; + + AutocompleteInput prefix_input(base::ASCIIToUTF16(input_url), + metrics::OmniboxEventProto::OTHER, + TestSchemeClassifier()); + prefix_input.set_focus_type(OmniboxFocusType::DEFAULT); + + AutocompleteInput on_focus_input(base::ASCIIToUTF16(input_url), + metrics::OmniboxEventProto::OTHER, + TestSchemeClassifier()); + on_focus_input.set_current_url(GURL(input_url)); + on_focus_input.set_focus_type(OmniboxFocusType::ON_FOCUS); + + AutocompleteInput on_clobber_input(std::u16string(), + metrics::OmniboxEventProto::OTHER, + TestSchemeClassifier()); + on_clobber_input.set_current_url(GURL(input_url)); + on_clobber_input.set_focus_type(OmniboxFocusType::DELETED_PERMANENT_TEXT); + + AutocompleteInput start_surface_input( + std::u16string(), metrics::OmniboxEventProto::START_SURFACE_HOMEPAGE, + TestSchemeClassifier()); + start_surface_input.set_current_url(GURL(start_surface_url)); + start_surface_input.set_focus_type(OmniboxFocusType::ON_FOCUS); + + AutocompleteInput start_surface_new_tab_input( + std::u16string(), metrics::OmniboxEventProto::START_SURFACE_NEW_TAB, + TestSchemeClassifier()); + start_surface_new_tab_input.set_current_url(GURL()); + start_surface_new_tab_input.set_focus_type(OmniboxFocusType::ON_FOCUS); // MostVisited should never deal with prefix suggestions. - EXPECT_FALSE(provider_->AllowMostVisitedSitesSuggestions( - BuildAutocompleteInput(WEB_URL, WEB_URL, OEP::OTHER, OFT::DEFAULT))); + EXPECT_FALSE(provider_->AllowMostVisitedSitesSuggestions(prefix_input)); // This should always be true, as otherwise we will break MostVisited. - EXPECT_TRUE(provider_->AllowMostVisitedSitesSuggestions( - BuildAutocompleteInput(WEB_URL, WEB_URL, OEP::OTHER, OFT::ON_FOCUS))); - - // Verifies that non-permitted schemes are rejected. - EXPECT_FALSE(provider_->AllowMostVisitedSitesSuggestions( - BuildAutocompleteInput(FTP_URL, FTP_URL, OEP::OTHER, OFT::ON_FOCUS))); - - // Offer MV sites when the User is visiting a website and deletes text. - EXPECT_TRUE( - provider_->AllowMostVisitedSitesSuggestions(BuildAutocompleteInput( - WEB_URL, WEB_URL, OEP::OTHER, OFT::DELETED_PERMANENT_TEXT))); + EXPECT_TRUE(provider_->AllowMostVisitedSitesSuggestions(on_focus_input)); // Verifies that metrics::OmniboxEventProto::START_SURFACE_HOMEPAGE is allowed // for MostVisited. - EXPECT_TRUE( - provider_->AllowMostVisitedSitesSuggestions(BuildAutocompleteInput( - {}, NTP_URL, OEP::START_SURFACE_HOMEPAGE, OFT::ON_FOCUS))); + EXPECT_TRUE(provider_->AllowMostVisitedSitesSuggestions(start_surface_input)); // Verifies that metrics::OmniboxEventProto::START_SURFACE_NEW_TAB is allowed // for MostVisited. EXPECT_TRUE( - provider_->AllowMostVisitedSitesSuggestions(BuildAutocompleteInput( - {}, NTP_URL, OEP::START_SURFACE_NEW_TAB, OFT::ON_FOCUS))); + provider_->AllowMostVisitedSitesSuggestions(start_surface_new_tab_input)); } TEST_F(MostVisitedSitesProviderTest, TestMostVisitedCallback) { - features_.InitAndDisableFeature(omnibox::kMostVisitedTiles); - auto input = BuildAutocompleteInputForWebOnFocus(); - controller_->Start(input); - EXPECT_EQ(0u, NumMostVisitedMatches()); - EXPECT_TRUE(top_sites_->EmitURLs()); - CheckMatchesEquivalentTo(top_sites_->urls(), /* expect_tiles=*/false); - controller_->Stop(false); + std::string current_url("http://www.foxnews.com/"); + std::string input_url("http://www.cnn.com/"); + AutocompleteInput input(base::ASCIIToUTF16(input_url), + metrics::OmniboxEventProto::OTHER, + TestSchemeClassifier()); + input.set_current_url(GURL(current_url)); + input.set_focus_type(OmniboxFocusType::ON_FOCUS); + history::MostVisitedURLList urls; + history::MostVisitedURL url(GURL("http://foo.com/"), u"Foo"); + urls.push_back(url); - controller_->Start(input); - controller_->Stop(false); - EXPECT_EQ(0u, NumMostVisitedMatches()); + provider_->Start(input, false); + EXPECT_TRUE(provider_->matches().empty()); + scoped_refptr<history::TopSites> top_sites = client_->GetTopSites(); + static_cast<FakeEmptyTopSites*>(top_sites.get())->RunACallback(urls); + EXPECT_EQ(1U, provider_->matches().size()); + provider_->Stop(false, false); + provider_->Start(input, false); + provider_->Stop(false, false); + EXPECT_TRUE(provider_->matches().empty()); // Most visited results arriving after Stop() has been called, ensure they // are not displayed. - EXPECT_TRUE(top_sites_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); + static_cast<FakeEmptyTopSites*>(top_sites.get())->RunACallback(urls); + EXPECT_TRUE(provider_->matches().empty()); - controller_->Start(input); - controller_->Stop(false); - controller_->Start(input); - + history::MostVisitedURLList urls2; + urls2.push_back(history::MostVisitedURL(GURL("http://bar.com/"), u"Bar")); + urls2.push_back(history::MostVisitedURL(GURL("http://zinga.com/"), u"Zinga")); + provider_->Start(input, false); + provider_->Stop(false, false); + provider_->Start(input, false); + static_cast<FakeEmptyTopSites*>(top_sites.get())->RunACallback(urls); // Stale results should get rejected. - EXPECT_TRUE(top_sites_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - - // Results for the second Start() action should be recorded. - EXPECT_TRUE(top_sites_->EmitURLs()); - EXPECT_EQ(top_sites_->urls().size(), NumMostVisitedMatches()); - controller_->Stop(false); + EXPECT_TRUE(provider_->matches().empty()); + static_cast<FakeEmptyTopSites*>(top_sites.get())->RunACallback(urls2); + EXPECT_FALSE(provider_->matches().empty()); + provider_->Stop(false, false); } TEST_F(MostVisitedSitesProviderTest, TestMostVisitedNavigateToSearchPage) { - features_.InitAndDisableFeature(omnibox::kMostVisitedTiles); + std::string current_url("http://www.foxnews.com/"); + std::string input_url("http://www.cnn.com/"); + AutocompleteInput input(base::ASCIIToUTF16(input_url), + metrics::OmniboxEventProto::OTHER, + TestSchemeClassifier()); + input.set_current_url(GURL(current_url)); + input.set_focus_type(OmniboxFocusType::ON_FOCUS); + history::MostVisitedURLList urls; + history::MostVisitedURL url(GURL("http://foo.com/"), u"Foo"); + urls.push_back(url); - controller_->Start(BuildAutocompleteInputForWebOnFocus()); - EXPECT_EQ(0u, NumMostVisitedMatches()); + provider_->Start(input, false); + EXPECT_TRUE(provider_->matches().empty()); // Stop() doesn't always get called. - auto srp_input = BuildAutocompleteInput( - SRP_URL, SRP_URL, + std::string search_url("https://www.google.com/?q=flowers"); + AutocompleteInput srp_input( + base::ASCIIToUTF16(search_url), metrics::OmniboxEventProto::SEARCH_RESULT_PAGE_NO_SEARCH_TERM_REPLACEMENT, - OmniboxFocusType::ON_FOCUS); + TestSchemeClassifier()); + srp_input.set_current_url(GURL(search_url)); + srp_input.set_focus_type(OmniboxFocusType::ON_FOCUS); - controller_->Start(srp_input); - EXPECT_EQ(0u, NumMostVisitedMatches()); - + provider_->Start(srp_input, false); + EXPECT_TRUE(provider_->matches().empty()); // Most visited results arriving after a new request has been started. - EXPECT_TRUE(top_sites_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); -} - -TEST_F(MostVisitedSitesProviderTest, - TestStartSurfaceSourcingTilesFromItsSource) { - controller_->Start(BuildAutocompleteInput( - {}, NTP_URL, metrics::OmniboxEventProto::START_SURFACE_HOMEPAGE, - OmniboxFocusType::ON_FOCUS)); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Start surface should not be waiting for old top_sites. - EXPECT_FALSE(top_sites_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Start surface should use its dedicated source instead. - EXPECT_TRUE(top_sites_for_start_surface_->EmitURLs()); - CheckMatchesEquivalentTo(top_sites_for_start_surface_->urls(), - /* expect_tiles=*/true); -} - -TEST_F(MostVisitedSitesProviderTest, - TestDeleteMostVisitedElementForStartSurface) { - // Make a copy (intentional - we'll modify this later) - auto urls = top_sites_for_start_surface_->urls(); - controller_->Start(BuildAutocompleteInput( - {}, NTP_URL, metrics::OmniboxEventProto::START_SURFACE_HOMEPAGE, - OmniboxFocusType::ON_FOCUS)); - - EXPECT_TRUE(top_sites_for_start_surface_->EmitURLs()); - CheckMatchesEquivalentTo(urls, /* expect_tiles=*/true); - - // Delete tile #3 - auto* match = GetMatch(AutocompleteMatchType::TILE_NAVSUGGEST, 0); - ASSERT_NE(nullptr, match) << "No TILE_NAVSUGGEST Match found"; - controller_->DeleteMatchElement(*match, 2); - - // Observe that the URL is now blocked and removed from suggestion. - auto deleted_url = urls[2].url; - urls.erase(urls.begin() + 2); - CheckMatchesEquivalentTo(urls, /* expect_tiles=*/true); - // Note: when Start Surface is being used, we want to make sure we delete - // tiles from all sources. - EXPECT_TRUE(top_sites_->IsBlocked(deleted_url)); - EXPECT_TRUE(top_sites_for_start_surface_->IsBlocked(deleted_url)); -} - -class ParameterizedMostVisitedSitesProviderTest - : public MostVisitedSitesProviderTest, - public ::testing::WithParamInterface<bool> { - void SetUp() override { - MostVisitedSitesProviderTest::SetUp(); - features_.InitWithFeatureState(omnibox::kMostVisitedTiles, GetParam()); - } -}; - -INSTANTIATE_TEST_SUITE_P(All, - ParameterizedMostVisitedSitesProviderTest, - ::testing::Bool(), - [](const auto& info) { - return info.param ? "SingleMatchWithTiles" - : "IndividualMatches"; - }); - -TEST_P(ParameterizedMostVisitedSitesProviderTest, TestCreateMostVisitedMatch) { - controller_->Start(BuildAutocompleteInputForWebOnFocus()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Confirm that the StartSurface source is rejected. - EXPECT_FALSE(top_sites_for_start_surface_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Accept only direct TopSites data. - EXPECT_TRUE(top_sites_->EmitURLs()); - CheckMatchesEquivalentTo(top_sites_->urls(), GetParam()); -} - -TEST_P(ParameterizedMostVisitedSitesProviderTest, - NoMatchesWhenNoMostVisitedSites) { - // Start with no URLs. - top_sites_->urls().clear(); - controller_->Start(BuildAutocompleteInputForWebOnFocus()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Confirm that the StartSurface source is rejected. - EXPECT_FALSE(top_sites_for_start_surface_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Accept only direct TopSites data, confirm no matches are built. - EXPECT_TRUE(top_sites_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); -} - -TEST_P(ParameterizedMostVisitedSitesProviderTest, - TestDeleteMostVisitedElement) { - // Make a copy (intentional - we'll modify this later) - auto urls = top_sites_->urls(); - controller_->Start(BuildAutocompleteInputForWebOnFocus()); - // Confirm that the StartSurface source is rejected. - EXPECT_FALSE(top_sites_for_start_surface_->EmitURLs()); - EXPECT_EQ(0u, NumMostVisitedMatches()); - // Accept only direct TopSites data. - EXPECT_TRUE(top_sites_->EmitURLs()); - CheckMatchesEquivalentTo(urls, GetParam()); - - // Commence delete. - if (GetParam()) { - auto* match = GetMatch(AutocompleteMatchType::TILE_NAVSUGGEST, 0); - ASSERT_NE(nullptr, match) << "No TILE_NAVSUGGEST Match found"; - controller_->DeleteMatchElement(*match, 1); - } else { - auto* match = GetMatch(AutocompleteMatchType::NAVSUGGEST, 1); - ASSERT_NE(nullptr, match) << "No NAVSUGGEST Match found"; - controller_->DeleteMatch(*match); - } - - // Observe that the URL is now blocked and removed from suggestion. - auto deleted_url = urls[1].url; - urls.erase(urls.begin() + 1); - CheckMatchesEquivalentTo(urls, GetParam()); - EXPECT_TRUE(top_sites_->IsBlocked(deleted_url)); -} - -TEST_P(ParameterizedMostVisitedSitesProviderTest, - NoMatchesWhenLastURLIsDeleted) { - // Start with just one URL. - auto& urls = top_sites_->urls(); - urls.clear(); - urls.emplace_back(GURL("http://www.a.art/"), u"A art"); - - controller_->Start(BuildAutocompleteInputForWebOnFocus()); - EXPECT_TRUE(top_sites_->EmitURLs()); - CheckMatchesEquivalentTo(urls, GetParam()); - - // Commence delete of the only item that we have. - if (GetParam()) { - auto* match = GetMatch(AutocompleteMatchType::TILE_NAVSUGGEST, 0); - ASSERT_NE(nullptr, match) << "No TILE_NAVSUGGEST Match found"; - controller_->DeleteMatchElement(*match, 0); - } else { - auto* match = GetMatch(AutocompleteMatchType::NAVSUGGEST, 0); - ASSERT_NE(nullptr, match) << "No NAVSUGGEST Match found"; - controller_->DeleteMatch(*match); - } - - // Confirm no more NAVSUGGEST matches are offered. - EXPECT_EQ(0u, NumMostVisitedMatches()); + scoped_refptr<history::TopSites> top_sites = client_->GetTopSites(); + static_cast<FakeEmptyTopSites*>(top_sites.get())->RunACallback(urls); + EXPECT_TRUE(provider_->matches().empty()); }
diff --git a/components/performance_manager/performance_manager_tab_helper.cc b/components/performance_manager/performance_manager_tab_helper.cc index bc49462..433e7726 100644 --- a/components/performance_manager/performance_manager_tab_helper.cc +++ b/components/performance_manager/performance_manager_tab_helper.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/containers/contains.h" +#include "base/observer_list.h" #include "components/performance_manager/graph/frame_node_impl.h" #include "components/performance_manager/graph/page_node_impl.h" #include "components/performance_manager/graph/process_node_impl.h"
diff --git a/components/performance_manager/service_worker_context_adapter.cc b/components/performance_manager/service_worker_context_adapter.cc index 91fb362..0f88c05 100644 --- a/components/performance_manager/service_worker_context_adapter.cc +++ b/components/performance_manager/service_worker_context_adapter.cc
@@ -7,6 +7,7 @@ #include "base/check_op.h" #include "base/memory/raw_ptr.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/scoped_observation.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host_observer.h"
diff --git a/components/performance_manager/v8_memory/v8_detailed_memory.cc b/components/performance_manager/v8_memory/v8_detailed_memory.cc index ca98ceb..5861dd7a 100644 --- a/components/performance_manager/v8_memory/v8_detailed_memory.cc +++ b/components/performance_manager/v8_memory/v8_detailed_memory.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/check.h" +#include "base/observer_list.h" #include "base/threading/sequenced_task_runner_handle.h" #include "components/performance_manager/public/graph/frame_node.h" #include "components/performance_manager/public/graph/graph.h"
diff --git a/components/performance_manager/v8_memory/v8_detailed_memory_any_seq.cc b/components/performance_manager/v8_memory/v8_detailed_memory_any_seq.cc index 975f93e..0aecf34 100644 --- a/components/performance_manager/v8_memory/v8_detailed_memory_any_seq.cc +++ b/components/performance_manager/v8_memory/v8_detailed_memory_any_seq.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" +#include "base/observer_list.h" #include "base/threading/sequenced_task_runner_handle.h" #include "components/performance_manager/public/graph/frame_node.h" #include "components/performance_manager/public/graph/graph.h"
diff --git a/components/performance_manager/v8_memory/v8_detailed_memory_decorator.cc b/components/performance_manager/v8_memory/v8_detailed_memory_decorator.cc index 2d3e93e7..74164fd 100644 --- a/components/performance_manager/v8_memory/v8_detailed_memory_decorator.cc +++ b/components/performance_manager/v8_memory/v8_detailed_memory_decorator.cc
@@ -29,6 +29,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/process_type.h" +#include "mojo/public/cpp/bindings/remote.h" #include "third_party/blink/public/common/tokens/tokens.h" using blink::ExecutionContextToken;
diff --git a/components/permissions/bluetooth_delegate_impl.cc b/components/permissions/bluetooth_delegate_impl.cc index d151370b..6b9372b 100644 --- a/components/permissions/bluetooth_delegate_impl.cc +++ b/components/permissions/bluetooth_delegate_impl.cc
@@ -4,6 +4,7 @@ #include "components/permissions/bluetooth_delegate_impl.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "components/permissions/contexts/bluetooth_chooser_context.h" #include "content/public/browser/render_frame_host.h"
diff --git a/components/permissions/object_permission_context_base.cc b/components/permissions/object_permission_context_base.cc index 6a9262d..8ca7de28 100644 --- a/components/permissions/object_permission_context_base.cc +++ b/components/permissions/object_permission_context_base.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/containers/contains.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h"
diff --git a/components/permissions/permission_context_base.cc b/components/permissions/permission_context_base.cc index db1ab61..ad396a1c 100644 --- a/components/permissions/permission_context_base.cc +++ b/components/permissions/permission_context_base.cc
@@ -13,6 +13,7 @@ #include "base/callback.h" #include "base/logging.h" #include "base/metrics/field_trial_params.h" +#include "base/observer_list.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" #include "build/build_config.h"
diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc index 30d020a9..62acc92 100644 --- a/components/permissions/permission_request_manager.cc +++ b/components/permissions/permission_request_manager.cc
@@ -14,6 +14,7 @@ #include "base/feature_list.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" +#include "base/observer_list.h" #include "base/stl_util.h" #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h"
diff --git a/components/policy/core/browser/configuration_policy_pref_store.cc b/components/policy/core/browser/configuration_policy_pref_store.cc index c773f50c..88648aa0 100644 --- a/components/policy/core/browser/configuration_policy_pref_store.cc +++ b/components/policy/core/browser/configuration_policy_pref_store.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "components/policy/core/browser/browser_policy_connector_base.h" #include "components/policy/core/browser/configuration_policy_handler_list.h"
diff --git a/components/policy/core/common/cloud/cloud_policy_client.cc b/components/policy/core/common/cloud/cloud_policy_client.cc index da579f12..6badc5c 100644 --- a/components/policy/core/common/cloud/cloud_policy_client.cc +++ b/components/policy/core/common/cloud/cloud_policy_client.cc
@@ -6,8 +6,6 @@ #include <utility> -#include "build/build_config.h" - #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/contains.h" @@ -16,7 +14,9 @@ #include "base/json/json_reader.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "base/values.h" +#include "build/build_config.h" #include "components/policy/core/common/cloud/client_data_delegate.h" #include "components/policy/core/common/cloud/cloud_policy_util.h" #include "components/policy/core/common/cloud/cloud_policy_validator.h"
diff --git a/components/policy/core/common/cloud/cloud_policy_core.cc b/components/policy/core/common/cloud/cloud_policy_core.cc index 2a784b5..244794f 100644 --- a/components/policy/core/common/cloud/cloud_policy_core.cc +++ b/components/policy/core/common/cloud/cloud_policy_core.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/check.h" +#include "base/observer_list.h" #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" #include "components/policy/core/common/cloud/cloud_policy_service.h"
diff --git a/components/policy/core/common/cloud/cloud_policy_service.cc b/components/policy/core/common/cloud/cloud_policy_service.cc index 381b925..f8bd0d29 100644 --- a/components/policy/core/common/cloud/cloud_policy_service.cc +++ b/components/policy/core/common/cloud/cloud_policy_service.cc
@@ -9,6 +9,7 @@ #include "base/callback.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/time/time.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_util.h"
diff --git a/components/policy/core/common/cloud/cloud_policy_store.cc b/components/policy/core/common/cloud/cloud_policy_store.cc index a7faca94..bf3bbf9e 100644 --- a/components/policy/core/common/cloud/cloud_policy_store.cc +++ b/components/policy/core/common/cloud/cloud_policy_store.cc
@@ -5,6 +5,7 @@ #include "components/policy/core/common/cloud/cloud_policy_store.h" #include "base/check.h" +#include "base/observer_list.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/proto/device_management_backend.pb.h"
diff --git a/components/policy/core/common/configuration_policy_provider.cc b/components/policy/core/common/configuration_policy_provider.cc index 97b2669..61a208908 100644 --- a/components/policy/core/common/configuration_policy_provider.cc +++ b/components/policy/core/common/configuration_policy_provider.cc
@@ -6,6 +6,7 @@ #include "base/callback.h" #include "base/lazy_instance.h" +#include "base/observer_list.h" #include "build/build_config.h" #include "components/policy/core/common/external_data_fetcher.h" #include "components/policy/core/common/policy_map.h"
diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc index ee42a88f..8284c8b 100644 --- a/components/policy/core/common/policy_service_impl.cc +++ b/components/policy/core/common/policy_service_impl.cc
@@ -15,6 +15,7 @@ #include "base/feature_list.h" #include "base/location.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h"
diff --git a/components/policy/core/common/remote_commands/remote_commands_queue.cc b/components/policy/core/common/remote_commands/remote_commands_queue.cc index ad49617..3628be8 100644 --- a/components/policy/core/common/remote_commands/remote_commands_queue.cc +++ b/components/policy/core/common/remote_commands/remote_commands_queue.cc
@@ -10,6 +10,7 @@ #include "base/callback_helpers.h" #include "base/check.h" #include "base/location.h" +#include "base/observer_list.h" #include "base/time/clock.h" #include "base/time/default_clock.h" #include "base/time/default_tick_clock.h"
diff --git a/components/policy/core/common/schema_registry.cc b/components/policy/core/common/schema_registry.cc index e357fbe..3891636 100644 --- a/components/policy/core/common/schema_registry.cc +++ b/components/policy/core/common/schema_registry.cc
@@ -6,6 +6,7 @@ #include "base/check_op.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "extensions/buildflags/buildflags.h" namespace policy {
diff --git a/components/prefs/default_pref_store.cc b/components/prefs/default_pref_store.cc index 4104dd39..2c86687 100644 --- a/components/prefs/default_pref_store.cc +++ b/components/prefs/default_pref_store.cc
@@ -7,6 +7,7 @@ #include <utility> #include "base/check.h" +#include "base/observer_list.h" using base::Value;
diff --git a/components/prefs/in_memory_pref_store.cc b/components/prefs/in_memory_pref_store.cc index 662e7a1..1eb5e9f 100644 --- a/components/prefs/in_memory_pref_store.cc +++ b/components/prefs/in_memory_pref_store.cc
@@ -7,6 +7,7 @@ #include <memory> #include <utility> +#include "base/observer_list.h" #include "base/values.h" InMemoryPrefStore::InMemoryPrefStore() {}
diff --git a/components/prefs/json_pref_store.cc b/components/prefs/json_pref_store.cc index f84b662..40115a0 100644 --- a/components/prefs/json_pref_store.cc +++ b/components/prefs/json_pref_store.cc
@@ -19,6 +19,7 @@ #include "base/logging.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram.h" +#include "base/observer_list.h" #include "base/ranges/algorithm.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h"
diff --git a/components/prefs/overlay_user_pref_store.cc b/components/prefs/overlay_user_pref_store.cc index 4e5c460f..1b0299bf 100644 --- a/components/prefs/overlay_user_pref_store.cc +++ b/components/prefs/overlay_user_pref_store.cc
@@ -10,6 +10,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/raw_ptr.h" +#include "base/observer_list.h" #include "base/values.h" #include "components/prefs/in_memory_pref_store.h"
diff --git a/components/prefs/pref_notifier_impl.cc b/components/prefs/pref_notifier_impl.cc index a6001cacd..ee31db0 100644 --- a/components/prefs/pref_notifier_impl.cc +++ b/components/prefs/pref_notifier_impl.cc
@@ -8,6 +8,7 @@ #include "base/debug/dump_without_crashing.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "base/strings/strcat.h" #include "components/prefs/pref_service.h"
diff --git a/components/prefs/segregated_pref_store.cc b/components/prefs/segregated_pref_store.cc index d27ada8a..0f1ab05e 100644 --- a/components/prefs/segregated_pref_store.cc +++ b/components/prefs/segregated_pref_store.cc
@@ -10,6 +10,7 @@ #include "base/check_op.h" #include "base/containers/contains.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/values.h" SegregatedPrefStore::UnderlyingPrefStoreObserver::UnderlyingPrefStoreObserver(
diff --git a/components/prefs/value_map_pref_store.cc b/components/prefs/value_map_pref_store.cc index 5f44733..14fa1ee 100644 --- a/components/prefs/value_map_pref_store.cc +++ b/components/prefs/value_map_pref_store.cc
@@ -7,6 +7,7 @@ #include <algorithm> #include <utility> +#include "base/observer_list.h" #include "base/values.h" ValueMapPrefStore::ValueMapPrefStore() {}
diff --git a/components/privacy_sandbox/privacy_sandbox_settings.cc b/components/privacy_sandbox/privacy_sandbox_settings.cc index b0a8fb5..7fbfe04 100644 --- a/components/privacy_sandbox/privacy_sandbox_settings.cc +++ b/components/privacy_sandbox/privacy_sandbox_settings.cc
@@ -6,6 +6,7 @@ #include "base/feature_list.h" #include "base/json/values_util.h" +#include "base/observer_list.h" #include "base/ranges/algorithm.h" #include "base/time/time.h" #include "components/content_settings/core/browser/cookie_settings.h"
diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.cc b/components/proxy_config/pref_proxy_config_tracker_impl.cc index a3fa01b..a54f92f2 100644 --- a/components/proxy_config/pref_proxy_config_tracker_impl.cc +++ b/components/proxy_config/pref_proxy_config_tracker_impl.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/task/single_thread_task_runner.h" #include "base/values.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/components/query_tiles/internal/logger_impl.cc b/components/query_tiles/internal/logger_impl.cc index 91640a0c..af60125f 100644 --- a/components/query_tiles/internal/logger_impl.cc +++ b/components/query_tiles/internal/logger_impl.cc
@@ -4,6 +4,7 @@ #include "components/query_tiles/internal/logger_impl.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/values.h"
diff --git a/components/reading_list/core/reading_list_model.cc b/components/reading_list/core/reading_list_model.cc index 5381a1b..115f14c55 100644 --- a/components/reading_list/core/reading_list_model.cc +++ b/components/reading_list/core/reading_list_model.cc
@@ -5,6 +5,7 @@ #include "components/reading_list/core/reading_list_model.h" #include "base/check_op.h" +#include "base/observer_list.h" ReadingListModel::ReadingListModel() : current_batch_updates_count_(0) {}
diff --git a/components/reading_list/core/reading_list_model_impl.cc b/components/reading_list/core/reading_list_model_impl.cc index f91ac01f..88c2f2a 100644 --- a/components/reading_list/core/reading_list_model_impl.cc +++ b/components/reading_list/core/reading_list_model_impl.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/check_op.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/time/clock.h" #include "components/prefs/pref_service.h"
diff --git a/components/renderer_context_menu/render_view_context_menu_base.cc b/components/renderer_context_menu/render_view_context_menu_base.cc index 3dfc21f..0b1b12a 100644 --- a/components/renderer_context_menu/render_view_context_menu_base.cc +++ b/components/renderer_context_menu/render_view_context_menu_base.cc
@@ -11,6 +11,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "content/public/browser/global_routing_id.h"
diff --git a/components/safe_browsing/content/browser/ui_manager.cc b/components/safe_browsing/content/browser/ui_manager.cc index b25158c..ba29edb 100644 --- a/components/safe_browsing/content/browser/ui_manager.cc +++ b/components/safe_browsing/content/browser/ui_manager.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/threading/thread.h" #include "base/threading/thread_restrictions.h" #include "components/no_state_prefetch/browser/no_state_prefetch_contents.h"
diff --git a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc index e57ad07..f79d291 100644 --- a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc +++ b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc
@@ -12,6 +12,7 @@ #include "base/json/json_writer.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h"
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index 18bf8ac..33594fc 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -17,6 +17,7 @@ #include "base/format_macros.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/rand_util.h" #include "base/ranges/algorithm.h" #include "base/strings/string_split.h"
diff --git a/components/segmentation_platform/internal/service_proxy_impl.cc b/components/segmentation_platform/internal/service_proxy_impl.cc index 8d7852e..6eb9b54c 100644 --- a/components/segmentation_platform/internal/service_proxy_impl.cc +++ b/components/segmentation_platform/internal/service_proxy_impl.cc
@@ -7,6 +7,7 @@ #include <inttypes.h> #include <sstream> +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/time/time.h"
diff --git a/components/segmentation_platform/internal/signals/histogram_signal_handler.cc b/components/segmentation_platform/internal/signals/histogram_signal_handler.cc index 3427d5a..6ce7a721 100644 --- a/components/segmentation_platform/internal/signals/histogram_signal_handler.cc +++ b/components/segmentation_platform/internal/signals/histogram_signal_handler.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/metrics/metrics_hashes.h" +#include "base/observer_list.h" #include "components/segmentation_platform/internal/database/signal_database.h" namespace segmentation_platform {
diff --git a/components/send_tab_to_self/send_tab_to_self_bridge.cc b/components/send_tab_to_self/send_tab_to_self_bridge.cc index 6d574d7..fcee017 100644 --- a/components/send_tab_to_self/send_tab_to_self_bridge.cc +++ b/components/send_tab_to_self/send_tab_to_self_bridge.cc
@@ -12,6 +12,7 @@ #include "base/containers/cxx20_erase_vector.h" #include "base/guid.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/time/clock.h" #include "base/time/time.h"
diff --git a/components/send_tab_to_self/send_tab_to_self_model.cc b/components/send_tab_to_self/send_tab_to_self_model.cc index c2e4c88..26cc6cd 100644 --- a/components/send_tab_to_self/send_tab_to_self_model.cc +++ b/components/send_tab_to_self/send_tab_to_self_model.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/send_tab_to_self/send_tab_to_self_model.h" +#include "base/observer_list.h" namespace send_tab_to_self {
diff --git a/components/services/app_service/public/cpp/app_capability_access_cache.cc b/components/services/app_service/public/cpp/app_capability_access_cache.cc index c804a65..20f3a9a 100644 --- a/components/services/app_service/public/cpp/app_capability_access_cache.cc +++ b/components/services/app_service/public/cpp/app_capability_access_cache.cc
@@ -5,6 +5,7 @@ #include "components/services/app_service/public/cpp/app_capability_access_cache.h" #include <utility> +#include "base/observer_list.h" namespace apps {
diff --git a/components/services/app_service/public/cpp/app_registry_cache.cc b/components/services/app_service/public/cpp/app_registry_cache.cc index 426e5eb..804889c 100644 --- a/components/services/app_service/public/cpp/app_registry_cache.cc +++ b/components/services/app_service/public/cpp/app_registry_cache.cc
@@ -5,6 +5,7 @@ #include "components/services/app_service/public/cpp/app_registry_cache.h" #include "base/containers/contains.h" +#include "base/observer_list.h" #include "components/services/app_service/public/cpp/features.h" #include <utility>
diff --git a/components/services/app_service/public/cpp/app_update.cc b/components/services/app_service/public/cpp/app_update.cc index b58d412d..baeeeca 100644 --- a/components/services/app_service/public/cpp/app_update.cc +++ b/components/services/app_service/public/cpp/app_update.cc
@@ -367,6 +367,10 @@ } const std::string& AppUpdate::PublisherId() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_FALLBACK(publisher_id, base::EmptyString()) + } + if (mojom_delta_ && mojom_delta_->publisher_id.has_value()) { return mojom_delta_->publisher_id.value(); } @@ -376,10 +380,6 @@ return base::EmptyString(); } -const std::string& AppUpdate::GetPublisherId() const { - GET_VALUE_WITH_FALLBACK(publisher_id, base::EmptyString()) -} - bool AppUpdate::PublisherIdChanged() const { MAYBE_RETURN_OPTIONAL_VALUE_CHANGED(publisher_id) @@ -389,6 +389,10 @@ } const std::string& AppUpdate::Description() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_FALLBACK(description, base::EmptyString()) + } + if (mojom_delta_ && mojom_delta_->description.has_value()) { return mojom_delta_->description.value(); } @@ -398,10 +402,6 @@ return base::EmptyString(); } -const std::string& AppUpdate::GetDescription() const { - GET_VALUE_WITH_FALLBACK(description, base::EmptyString()) -} - bool AppUpdate::DescriptionChanged() const { MAYBE_RETURN_OPTIONAL_VALUE_CHANGED(description) @@ -411,6 +411,10 @@ } const std::string& AppUpdate::Version() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_FALLBACK(version, base::EmptyString()) + } + if (mojom_delta_ && mojom_delta_->version.has_value()) { return mojom_delta_->version.value(); } @@ -420,10 +424,6 @@ return base::EmptyString(); } -const std::string& AppUpdate::GetVersion() const { - GET_VALUE_WITH_FALLBACK(version, base::EmptyString()) -} - bool AppUpdate::VersionChanged() const { MAYBE_RETURN_OPTIONAL_VALUE_CHANGED(version) @@ -432,6 +432,11 @@ } std::vector<std::string> AppUpdate::AdditionalSearchTerms() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_CHECK_AND_DEFAULT_RETURN(additional_search_terms, empty, + std::vector<std::string>{}) + } + std::vector<std::string> additional_search_terms; if (mojom_delta_ && !mojom_delta_->additional_search_terms.empty()) { @@ -445,11 +450,6 @@ return additional_search_terms; } -std::vector<std::string> AppUpdate::GetAdditionalSearchTerms() const { - GET_VALUE_WITH_CHECK_AND_DEFAULT_RETURN(additional_search_terms, empty, - std::vector<std::string>{}) -} - bool AppUpdate::AdditionalSearchTermsChanged() const { if (ShouldUseNonMojom()) { IS_VALUE_CHANGED_WITH_CHECK(additional_search_terms, empty) @@ -489,6 +489,10 @@ } base::Time AppUpdate::LastLaunchTime() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_FALLBACK(last_launch_time, base::Time()) + } + if (mojom_delta_ && mojom_delta_->last_launch_time.has_value()) { return mojom_delta_->last_launch_time.value(); } @@ -498,10 +502,6 @@ return base::Time(); } -base::Time AppUpdate::GetLastLaunchTime() const { - GET_VALUE_WITH_FALLBACK(last_launch_time, base::Time()) -} - bool AppUpdate::LastLaunchTimeChanged() const { MAYBE_RETURN_OPTIONAL_VALUE_CHANGED(last_launch_time) @@ -511,6 +511,10 @@ } base::Time AppUpdate::InstallTime() const { + if (ShouldUseNonMojom()) { + GET_VALUE_WITH_FALLBACK(install_time, base::Time()) + } + if (mojom_delta_ && mojom_delta_->install_time.has_value()) { return mojom_delta_->install_time.value(); } @@ -520,10 +524,6 @@ return base::Time(); } -base::Time AppUpdate::GetInstallTime() const { - GET_VALUE_WITH_FALLBACK(install_time, base::Time()) -} - bool AppUpdate::InstallTimeChanged() const { MAYBE_RETURN_OPTIONAL_VALUE_CHANGED(install_time)
diff --git a/components/services/app_service/public/cpp/app_update.h b/components/services/app_service/public/cpp/app_update.h index f6f5b134..0b27444 100644 --- a/components/services/app_service/public/cpp/app_update.h +++ b/components/services/app_service/public/cpp/app_update.h
@@ -96,19 +96,15 @@ // contains the Android package name. May be empty if AppId() should be // considered as the canonical publisher ID. const std::string& PublisherId() const; - const std::string& GetPublisherId() const; bool PublisherIdChanged() const; const std::string& Description() const; - const std::string& GetDescription() const; bool DescriptionChanged() const; const std::string& Version() const; - const std::string& GetVersion() const; bool VersionChanged() const; std::vector<std::string> AdditionalSearchTerms() const; - std::vector<std::string> GetAdditionalSearchTerms() const; bool AdditionalSearchTermsChanged() const; apps::mojom::IconKeyPtr IconKey() const; @@ -116,11 +112,9 @@ bool IconKeyChanged() const; base::Time LastLaunchTime() const; - base::Time GetLastLaunchTime() const; bool LastLaunchTimeChanged() const; base::Time InstallTime() const; - base::Time GetInstallTime() const; bool InstallTimeChanged() const; std::vector<apps::mojom::PermissionPtr> Permissions() const;
diff --git a/components/services/app_service/public/cpp/app_update_unittest.cc b/components/services/app_service/public/cpp/app_update_unittest.cc index 7e1e10b..93c6e98 100644 --- a/components/services/app_service/public/cpp/app_update_unittest.cc +++ b/components/services/app_service/public/cpp/app_update_unittest.cc
@@ -178,16 +178,16 @@ EXPECT_EQ(expect_short_name_, u.ShortName()); EXPECT_EQ(expect_short_name_changed_, u.ShortNameChanged()); - EXPECT_EQ(expect_publisher_id_, u.GetPublisherId()); + EXPECT_EQ(expect_publisher_id_, u.PublisherId()); EXPECT_EQ(expect_publisher_id_changed_, u.PublisherIdChanged()); - EXPECT_EQ(expect_description_, u.GetDescription()); + EXPECT_EQ(expect_description_, u.Description()); EXPECT_EQ(expect_description_changed_, u.DescriptionChanged()); - EXPECT_EQ(expect_version_, u.GetVersion()); + EXPECT_EQ(expect_version_, u.Version()); EXPECT_EQ(expect_version_changed_, u.VersionChanged()); - EXPECT_EQ(expect_additional_search_terms_, u.GetAdditionalSearchTerms()); + EXPECT_EQ(expect_additional_search_terms_, u.AdditionalSearchTerms()); EXPECT_EQ(expect_additional_search_terms_changed_, u.AdditionalSearchTermsChanged()); @@ -199,10 +199,10 @@ } EXPECT_EQ(expect_icon_key_changed_, u.IconKeyChanged()); - EXPECT_EQ(expect_last_launch_time_, u.GetLastLaunchTime()); + EXPECT_EQ(expect_last_launch_time_, u.LastLaunchTime()); EXPECT_EQ(expect_last_launch_time_changed_, u.LastLaunchTimeChanged()); - EXPECT_EQ(expect_install_time_, u.GetInstallTime()); + EXPECT_EQ(expect_install_time_, u.InstallTime()); EXPECT_EQ(expect_install_time_changed_, u.InstallTimeChanged()); EXPECT_TRUE(IsEqual(expect_permissions_, u.GetPermissions()));
diff --git a/components/services/app_service/public/cpp/preferred_apps_list_handle.cc b/components/services/app_service/public/cpp/preferred_apps_list_handle.cc index 0ecde22..bfb51f64 100644 --- a/components/services/app_service/public/cpp/preferred_apps_list_handle.cc +++ b/components/services/app_service/public/cpp/preferred_apps_list_handle.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/services/app_service/public/cpp/preferred_apps_list_handle.h" +#include "base/observer_list.h" namespace apps {
diff --git a/components/sessions/core/tab_restore_service_helper.cc b/components/sessions/core/tab_restore_service_helper.cc index 8042d749..549262d4 100644 --- a/components/sessions/core/tab_restore_service_helper.cc +++ b/components/sessions/core/tab_restore_service_helper.cc
@@ -19,6 +19,7 @@ #include "base/metrics/histogram.h" #include "base/metrics/histogram_macros.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h"
diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc index 4d42cd7..7b14cdc 100644 --- a/components/signin/core/browser/about_signin_internals.cc +++ b/components/signin/core/browser/about_signin_internals.cc
@@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/hash/hash.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/strings/stringprintf.h" #include "base/time/time_to_iso8601.h" #include "base/trace_event/trace_event.h"
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc index b35e942..ca48fbc 100644 --- a/components/signin/core/browser/account_reconcilor.cc +++ b/components/signin/core/browser/account_reconcilor.cc
@@ -20,6 +20,7 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/components/signin/core/browser/signin_error_controller.cc b/components/signin/core/browser/signin_error_controller.cc index a43ca2fc..07c73ebd 100644 --- a/components/signin/core/browser/signin_error_controller.cc +++ b/components/signin/core/browser/signin_error_controller.cc
@@ -4,6 +4,7 @@ #include "components/signin/core/browser/signin_error_controller.h" +#include "base/observer_list.h" #include "components/signin/public/base/signin_metrics.h" SigninErrorController::SigninErrorController(
diff --git a/components/signin/internal/identity_manager/primary_account_manager.cc b/components/signin/internal/identity_manager/primary_account_manager.cc index 741a2b97..2568f796 100644 --- a/components/signin/internal/identity_manager/primary_account_manager.cc +++ b/components/signin/internal/identity_manager/primary_account_manager.cc
@@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.cc b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.cc index 2cd93ec..d73c7e1 100644 --- a/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.cc +++ b/components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.cc
@@ -4,6 +4,7 @@ #include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate.h" +#include "base/observer_list.h" #include "components/signin/internal/identity_manager/profile_oauth2_token_service_observer.h" #include "google_apis/gaia/oauth2_access_token_consumer.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/components/signin/public/identity_manager/identity_manager.cc b/components/signin/public/identity_manager/identity_manager.cc index d1bcddd..589ef0f4d 100644 --- a/components/signin/public/identity_manager/identity_manager.cc +++ b/components/signin/public/identity_manager/identity_manager.cc
@@ -7,6 +7,7 @@ #include <string> #include "base/bind.h" +#include "base/observer_list.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "components/signin/internal/identity_manager/account_fetcher_service.h"
diff --git a/components/site_engagement/content/site_engagement_service.cc b/components/site_engagement/content/site_engagement_service.cc index 4ae3fb1..800128c 100644 --- a/components/site_engagement/content/site_engagement_service.cc +++ b/components/site_engagement/content/site_engagement_service.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/memory/scoped_refptr.h" #include "base/metrics/field_trial.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/task/thread_pool.h" #include "base/threading/thread_restrictions.h"
diff --git a/components/soda/soda_installer.cc b/components/soda/soda_installer.cc index 37658048..113582e3 100644 --- a/components/soda/soda_installer.cc +++ b/components/soda/soda_installer.cc
@@ -6,6 +6,7 @@ #include "base/containers/contains.h" #include "base/feature_list.h" +#include "base/observer_list.h" #include "base/values.h" #include "build/chromeos_buildflags.h" #include "components/live_caption/pref_names.h"
diff --git a/components/spellcheck/renderer/spellcheck.cc b/components/spellcheck/renderer/spellcheck.cc index 54c7d9e..41ff8641 100644 --- a/components/spellcheck/renderer/spellcheck.cc +++ b/components/spellcheck/renderer/spellcheck.cc
@@ -15,6 +15,7 @@ #include "base/command_line.h" #include "base/location.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h"
diff --git a/components/subresource_filter/content/browser/ruleset_publisher_impl.cc b/components/subresource_filter/content/browser/ruleset_publisher_impl.cc index 450c132..8fbb290 100644 --- a/components/subresource_filter/content/browser/ruleset_publisher_impl.cc +++ b/components/subresource_filter/content/browser/ruleset_publisher_impl.cc
@@ -22,6 +22,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" +#include "ipc/ipc_channel_proxy.h" namespace subresource_filter {
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc index 8d566ac..3736e80 100644 --- a/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc +++ b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc
@@ -4,6 +4,7 @@ #include "components/subresource_filter/content/browser/subresource_filter_observer_manager.h" +#include "base/observer_list.h" #include "components/subresource_filter/core/mojom/subresource_filter.mojom.h" namespace subresource_filter {
diff --git a/components/subresource_filter/content/renderer/ad_resource_tracker.cc b/components/subresource_filter/content/renderer/ad_resource_tracker.cc index 89233a0..4783eaf 100644 --- a/components/subresource_filter/content/renderer/ad_resource_tracker.cc +++ b/components/subresource_filter/content/renderer/ad_resource_tracker.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/subresource_filter/content/renderer/ad_resource_tracker.h" +#include "base/observer_list.h" namespace subresource_filter {
diff --git a/components/sync/base/sync_prefs.cc b/components/sync/base/sync_prefs.cc index 1dafdfa..5eb73a92 100644 --- a/components/sync/base/sync_prefs.cc +++ b/components/sync/base/sync_prefs.cc
@@ -10,6 +10,7 @@ #include "base/check_op.h" #include "base/files/file_path.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/path_service.h" #include "base/values.h" #include "build/build_config.h"
diff --git a/components/sync/driver/backend_migrator.cc b/components/sync/driver/backend_migrator.cc index 70b2b4b3..89dd4c6 100644 --- a/components/sync/driver/backend_migrator.cc +++ b/components/sync/driver/backend_migrator.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/location.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/task/sequenced_task_runner.h" #include "base/threading/sequenced_task_runner_handle.h"
diff --git a/components/sync/driver/sync_service_impl.cc b/components/sync/driver/sync_service_impl.cc index 224b1a03..9c886bb4 100644 --- a/components/sync/driver/sync_service_impl.cc +++ b/components/sync/driver/sync_service_impl.cc
@@ -17,6 +17,7 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/time/time.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h"
diff --git a/components/sync/engine/cycle/sync_cycle.cc b/components/sync/engine/cycle/sync_cycle.cc index c57b4f87..ccc2b1b 100644 --- a/components/sync/engine/cycle/sync_cycle.cc +++ b/components/sync/engine/cycle/sync_cycle.cc
@@ -9,6 +9,7 @@ #include <vector> #include "base/logging.h" +#include "base/observer_list.h" #include "components/sync/engine/update_handler.h" namespace syncer {
diff --git a/components/sync/engine/cycle/sync_cycle_context.cc b/components/sync/engine/cycle/sync_cycle_context.cc index 4b1a3eab..935dab6 100644 --- a/components/sync/engine/cycle/sync_cycle_context.cc +++ b/components/sync/engine/cycle/sync_cycle_context.cc
@@ -4,6 +4,7 @@ #include "components/sync/engine/cycle/sync_cycle_context.h" +#include "base/observer_list.h" #include "components/sync/base/extensions_activity.h" namespace syncer {
diff --git a/components/sync/engine/net/server_connection_manager.cc b/components/sync/engine/net/server_connection_manager.cc index b7a215b..22cb64e 100644 --- a/components/sync/engine/net/server_connection_manager.cc +++ b/components/sync/engine/net/server_connection_manager.cc
@@ -9,6 +9,7 @@ #include <ostream> #include "base/metrics/histogram.h" +#include "base/observer_list.h" #include "build/build_config.h" #include "components/sync/engine/cancelation_signal.h" #include "components/sync/engine/net/url_translator.h"
diff --git a/components/sync/engine/sync_manager_impl.cc b/components/sync/engine/sync_manager_impl.cc index d2024ec9..129ccfe5 100644 --- a/components/sync/engine/sync_manager_impl.cc +++ b/components/sync/engine/sync_manager_impl.cc
@@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/feature_list.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h" #include "components/sync/base/model_type.h"
diff --git a/components/sync/engine/sync_scheduler_impl.cc b/components/sync/engine/sync_scheduler_impl.cc index b1cc3a3..3f73c0e 100644 --- a/components/sync/engine/sync_scheduler_impl.cc +++ b/components/sync/engine/sync_scheduler_impl.cc
@@ -11,6 +11,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/rand_util.h" #include "base/task/sequenced_task_runner.h" #include "base/threading/platform_thread.h"
diff --git a/components/sync/invalidations/fcm_handler.cc b/components/sync/invalidations/fcm_handler.cc index 6f792c0d..39f0df9 100644 --- a/components/sync/invalidations/fcm_handler.cc +++ b/components/sync/invalidations/fcm_handler.cc
@@ -9,6 +9,7 @@ #include "base/callback_helpers.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/time/time.h" #include "components/gcm_driver/gcm_driver.h" #include "components/gcm_driver/instance_id/instance_id_driver.h"
diff --git a/components/sync/trusted_vault/standalone_trusted_vault_client.cc b/components/sync/trusted_vault/standalone_trusted_vault_client.cc index f320840..691c791f 100644 --- a/components/sync/trusted_vault/standalone_trusted_vault_client.cc +++ b/components/sync/trusted_vault/standalone_trusted_vault_client.cc
@@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/memory/raw_ptr.h" #include "base/memory/ref_counted.h" +#include "base/observer_list.h" #include "base/task/sequenced_task_runner.h" #include "base/task/task_runner_util.h" #include "base/task/task_traits.h"
diff --git a/components/sync_device_info/device_info_sync_bridge.cc b/components/sync_device_info/device_info_sync_bridge.cc index ca76553..709b63f9 100644 --- a/components/sync_device_info/device_info_sync_bridge.cc +++ b/components/sync_device_info/device_info_sync_bridge.cc
@@ -17,6 +17,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/time/time.h" #include "components/sync/base/model_type.h"
diff --git a/components/sync_preferences/pref_model_associator.cc b/components/sync_preferences/pref_model_associator.cc index 12149a93..34433b9 100644 --- a/components/sync_preferences/pref_model_associator.cc +++ b/components/sync_preferences/pref_model_associator.cc
@@ -17,6 +17,7 @@ #include "base/location.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "build/chromeos_buildflags.h"
diff --git a/components/sync_preferences/pref_service_syncable.cc b/components/sync_preferences/pref_service_syncable.cc index c41aed9..c31691f 100644 --- a/components/sync_preferences/pref_service_syncable.cc +++ b/components/sync_preferences/pref_service_syncable.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "build/chromeos_buildflags.h" #include "components/pref_registry/pref_registry_syncable.h"
diff --git a/components/system_media_controls/linux/system_media_controls_linux.cc b/components/system_media_controls/linux/system_media_controls_linux.cc index d353ddbe..b84b4cb 100644 --- a/components/system_media_controls/linux/system_media_controls_linux.cc +++ b/components/system_media_controls/linux/system_media_controls_linux.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/observer_list.h" #include "base/process/process.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h"
diff --git a/components/translate/content/browser/content_translate_driver.cc b/components/translate/content/browser/content_translate_driver.cc index d4e3ca1b..1ccb20e4 100644 --- a/components/translate/content/browser/content_translate_driver.cc +++ b/components/translate/content/browser/content_translate_driver.cc
@@ -13,6 +13,7 @@ #include "base/feature_list.h" #include "base/location.h" #include "base/notreached.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/supports_user_data.h" #include "base/task/single_thread_task_runner.h"
diff --git a/components/translate/core/browser/translate_driver.cc b/components/translate/core/browser/translate_driver.cc index c492f887..11662a4 100644 --- a/components/translate/core/browser/translate_driver.cc +++ b/components/translate/core/browser/translate_driver.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "components/translate/core/browser/translate_driver.h" +#include "base/observer_list.h" namespace translate {
diff --git a/components/ui_devtools/dom_agent.cc b/components/ui_devtools/dom_agent.cc index 92153b89..5daf5744 100644 --- a/components/ui_devtools/dom_agent.cc +++ b/components/ui_devtools/dom_agent.cc
@@ -10,6 +10,7 @@ #include <utility> #include "base/containers/adapters.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "components/ui_devtools/devtools_server.h"
diff --git a/components/undo/undo_manager.cc b/components/undo/undo_manager.cc index 40590ed8..d40960e4 100644 --- a/components/undo/undo_manager.cc +++ b/components/undo/undo_manager.cc
@@ -11,6 +11,7 @@ #include "base/check_op.h" #include "base/containers/adapters.h" #include "base/memory/ptr_util.h" +#include "base/observer_list.h" #include "components/strings/grit/components_strings.h" #include "components/undo/undo_manager_observer.h" #include "components/undo/undo_operation.h"
diff --git a/components/unified_consent/url_keyed_data_collection_consent_helper.cc b/components/unified_consent/url_keyed_data_collection_consent_helper.cc index d8aec735..427e1ef 100644 --- a/components/unified_consent/url_keyed_data_collection_consent_helper.cc +++ b/components/unified_consent/url_keyed_data_collection_consent_helper.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/memory/raw_ptr.h" +#include "base/observer_list.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "components/sync/base/model_type.h"
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index 066a9631..87fe040 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc
@@ -20,6 +20,7 @@ #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/system/sys_info.h"
diff --git a/components/variations/synthetic_trial_registry.cc b/components/variations/synthetic_trial_registry.cc index 75f1bbdd..252fe64 100644 --- a/components/variations/synthetic_trial_registry.cc +++ b/components/variations/synthetic_trial_registry.cc
@@ -8,6 +8,7 @@ #include "base/containers/cxx20_erase.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "components/variations/hashing.h" #include "components/variations/variations_associated_data.h"
diff --git a/components/variations/variations_ids_provider.cc b/components/variations/variations_ids_provider.cc index 7073998..c786037 100644 --- a/components/variations/variations_ids_provider.cc +++ b/components/variations/variations_ids_provider.cc
@@ -9,6 +9,7 @@ #include "base/base64.h" #include "base/metrics/histogram_macros.h" #include "base/no_destructor.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h"
diff --git a/components/viz/host/host_frame_sink_manager.cc b/components/viz/host/host_frame_sink_manager.cc index a0f46ca..1ad1e78b 100644 --- a/components/viz/host/host_frame_sink_manager.cc +++ b/components/viz/host/host_frame_sink_manager.cc
@@ -10,6 +10,7 @@ #include "base/callback_helpers.h" #include "base/containers/contains.h" #include "base/containers/cxx20_erase.h" +#include "base/observer_list.h" #include "base/task/sequenced_task_runner.h" #include "base/task/single_thread_task_runner.h" #include "base/time/time.h"
diff --git a/components/viz/service/display/display.cc b/components/viz/service/display/display.cc index 0d1f35a..1349936 100644 --- a/components/viz/service/display/display.cc +++ b/components/viz/service/display/display.cc
@@ -12,6 +12,7 @@ #include "base/containers/contains.h" #include "base/debug/dump_without_crashing.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/timer/elapsed_timer.h" #include "base/trace_event/trace_event.h"
diff --git a/components/viz/service/display/display_damage_tracker.cc b/components/viz/service/display/display_damage_tracker.cc index 60b2c28e..2c477b6 100644 --- a/components/viz/service/display/display_damage_tracker.cc +++ b/components/viz/service/display/display_damage_tracker.cc
@@ -4,6 +4,7 @@ #include "components/viz/service/display/display_damage_tracker.h" +#include "base/observer_list.h" #include "base/trace_event/trace_event.h" #include "components/viz/common/surfaces/surface_info.h" #include "components/viz/service/display/surface_aggregator.h"
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl.cc b/components/viz/service/display_embedder/skia_output_surface_impl.cc index a07f5e4..c7c6553 100644 --- a/components/viz/service/display_embedder/skia_output_surface_impl.cc +++ b/components/viz/service/display_embedder/skia_output_surface_impl.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" #include "base/no_destructor.h" +#include "base/observer_list.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h"
diff --git a/components/viz/service/display_embedder/viz_process_context_provider.cc b/components/viz/service/display_embedder/viz_process_context_provider.cc index 57fbcb9..ed33d5f 100644 --- a/components/viz/service/display_embedder/viz_process_context_provider.cc +++ b/components/viz/service/display_embedder/viz_process_context_provider.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/lazy_instance.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/system/sys_info.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc index 632a807..0a4a21b 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.cc +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.cc
@@ -14,6 +14,7 @@ #include "base/containers/contains.h" #include "base/containers/queue.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "components/viz/common/surfaces/subtree_capture_id.h"
diff --git a/components/viz/service/frame_sinks/frame_sink_manager_impl.h b/components/viz/service/frame_sinks/frame_sink_manager_impl.h index 8d4bd49..833d23c8 100644 --- a/components/viz/service/frame_sinks/frame_sink_manager_impl.h +++ b/components/viz/service/frame_sinks/frame_sink_manager_impl.h
@@ -17,6 +17,7 @@ #include "base/containers/flat_set.h" #include "base/containers/unique_ptr_adapters.h" #include "base/memory/raw_ptr.h" +#include "base/observer_list.h" #include "base/strings/string_piece.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread_checker.h"
diff --git a/components/viz/service/gl/gpu_service_impl.cc b/components/viz/service/gl/gpu_service_impl.cc index 587c7a5..925c6b8 100644 --- a/components/viz/service/gl/gpu_service_impl.cc +++ b/components/viz/service/gl/gpu_service_impl.cc
@@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/no_destructor.h" +#include "base/observer_list.h" #include "base/task/post_task.h" #include "base/task/task_runner_util.h" #include "base/task/thread_pool.h"
diff --git a/components/viz/service/surfaces/surface_manager.cc b/components/viz/service/surfaces/surface_manager.cc index 33fd23c..43a0037 100644 --- a/components/viz/service/surfaces/surface_manager.cc +++ b/components/viz/service/surfaces/surface_manager.cc
@@ -14,6 +14,7 @@ #include "base/containers/cxx20_erase.h" #include "base/containers/queue.h" #include "base/logging.h" +#include "base/observer_list.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/default_tick_clock.h" #include "base/trace_event/trace_event.h"
diff --git a/components/webapps/browser/banners/app_banner_manager.cc b/components/webapps/browser/banners/app_banner_manager.cc index a7fb28d..2184636 100644 --- a/components/webapps/browser/banners/app_banner_manager.cc +++ b/components/webapps/browser/banners/app_banner_manager.cc
@@ -15,6 +15,7 @@ #include "base/feature_list.h" #include "base/memory/raw_ptr.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "components/back_forward_cache/back_forward_cache_disable.h"
diff --git a/components/zoom/zoom_controller.cc b/components/zoom/zoom_controller.cc index 6ea1638..66e8c24 100644 --- a/components/zoom/zoom_controller.cc +++ b/components/zoom/zoom_controller.cc
@@ -5,6 +5,7 @@ #include "components/zoom/zoom_controller.h" #include "base/bind.h" +#include "base/observer_list.h" #include "components/zoom/zoom_event_manager.h" #include "components/zoom/zoom_observer.h" #include "content/public/browser/browser_thread.h"
diff --git a/components/zoom/zoom_event_manager.cc b/components/zoom/zoom_event_manager.cc index 5614bbc..9d23689 100644 --- a/components/zoom/zoom_event_manager.cc +++ b/components/zoom/zoom_event_manager.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "base/observer_list.h" #include "components/zoom/zoom_event_manager_observer.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/attribution_reporting/attribution_manager_impl.cc b/content/browser/attribution_reporting/attribution_manager_impl.cc index 063b145..769bb4b 100644 --- a/content/browser/attribution_reporting/attribution_manager_impl.cc +++ b/content/browser/attribution_reporting/attribution_manager_impl.cc
@@ -12,6 +12,7 @@ #include "base/command_line.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/task/lazy_thread_pool_task_runner.h" #include "base/threading/sequence_bound.h" #include "base/time/time.h"
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc index 8eb67bc..566e33e 100644 --- a/content/browser/background_fetch/background_fetch_context.cc +++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/observer_list.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/background_fetch_job_controller.h" #include "content/browser/background_fetch/background_fetch_metrics.h"
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc index 7b1f7b02..7732a007 100644 --- a/content/browser/background_fetch/background_fetch_data_manager.cc +++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/containers/queue.h" +#include "base/observer_list.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" #include "components/services/storage/public/mojom/cache_storage_control.mojom.h"
diff --git a/content/browser/background_fetch/storage/create_metadata_task.cc b/content/browser/background_fetch/storage/create_metadata_task.cc index 1f0fa51..b11dc6c 100644 --- a/content/browser/background_fetch/storage/create_metadata_task.cc +++ b/content/browser/background_fetch/storage/create_metadata_task.cc
@@ -11,6 +11,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h"
diff --git a/content/browser/background_fetch/storage/database_task.cc b/content/browser/background_fetch/storage/database_task.cc index c947bf6..0fef4df 100644 --- a/content/browser/background_fetch/storage/database_task.cc +++ b/content/browser/background_fetch/storage/database_task.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/metrics/histogram_functions.h" +#include "base/observer_list.h" #include "content/browser/background_fetch/background_fetch_data_manager.h" #include "content/browser/background_fetch/background_fetch_data_manager_observer.h" #include "content/browser/background_fetch/storage/database_helpers.h"
diff --git a/content/browser/background_fetch/storage/mark_request_complete_task.cc b/content/browser/background_fetch/storage/mark_request_complete_task.cc index 9036ec9..32a818b 100644 --- a/content/browser/background_fetch/storage/mark_request_complete_task.cc +++ b/content/browser/background_fetch/storage/mark_request_complete_task.cc
@@ -7,6 +7,7 @@ #include "base/barrier_closure.h" #include "base/bind.h" #include "base/guid.h" +#include "base/observer_list.h" #include "base/trace_event/trace_event.h" #include "content/browser/background_fetch/background_fetch_cross_origin_filter.h" #include "content/browser/background_fetch/background_fetch_data_manager.h"
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc index d9dcf1b..b82aef11 100644 --- a/content/browser/browser_child_process_host_impl.cc +++ b/content/browser/browser_child_process_host_impl.cc
@@ -19,6 +19,7 @@ #include "base/metrics/histogram_macros.h" #include "base/metrics/persistent_histogram_allocator.h" #include "base/metrics/persistent_memory_allocator.h" +#include "base/observer_list.h" #include "base/strings/string_util.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread_task_runner_handle.h"
diff --git a/content/browser/browsing_data/browsing_data_remover_impl.cc b/content/browser/browsing_data/browsing_data_remover_impl.cc index 35ba7b7..bb7b69a 100644 --- a/content/browser/browsing_data/browsing_data_remover_impl.cc +++ b/content/browser/browsing_data/browsing_data_remover_impl.cc
@@ -18,6 +18,7 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" +#include "base/observer_list.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" #include "content/browser/browsing_data/browsing_data_filter_builder_impl.h"
diff --git a/content/browser/devtools/devtools_background_services_context_impl.cc b/content/browser/devtools/devtools_background_services_context_impl.cc index 698f8434..abd68f4 100644 --- a/content/browser/devtools/devtools_background_services_context_impl.cc +++ b/content/browser/devtools/devtools_background_services_context_impl.cc
@@ -8,6 +8,7 @@ #include "base/guid.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" #include "content/public/browser/browser_context.h"
diff --git a/content/browser/devtools/protocol/target_auto_attacher.cc b/content/browser/devtools/protocol/target_auto_attacher.cc index aa6f0de..f64edd7 100644 --- a/content/browser/devtools/protocol/target_auto_attacher.cc +++ b/content/browser/devtools/protocol/target_auto_attacher.cc
@@ -4,6 +4,7 @@ #include "content/browser/devtools/protocol/target_auto_attacher.h" +#include "base/observer_list.h" #include "content/browser/devtools/devtools_renderer_channel.h" #include "content/browser/devtools/render_frame_devtools_agent_host.h" #include "content/browser/renderer_host/frame_tree_node.h"
diff --git a/content/browser/devtools/service_worker_devtools_manager.cc b/content/browser/devtools/service_worker_devtools_manager.cc index c88de64..afd6bec 100644 --- a/content/browser/devtools/service_worker_devtools_manager.cc +++ b/content/browser/devtools/service_worker_devtools_manager.cc
@@ -5,6 +5,7 @@ #include "content/browser/devtools/service_worker_devtools_manager.h" #include "base/no_destructor.h" +#include "base/observer_list.h" #include "content/browser/devtools/devtools_instrumentation.h" #include "content/browser/devtools/protocol/network_handler.h" #include "content/browser/devtools/protocol/page_handler.h"
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index e8d3496..c721568f 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc
@@ -18,6 +18,7 @@ #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" +#include "base/observer_list.h" #include "base/strings/sys_string_conversions.h" #include "base/supports_user_data.h" #include "base/synchronization/lock.h"
diff --git a/content/browser/field_trial_synchronizer.cc b/content/browser/field_trial_synchronizer.cc index deddf1b..2243626 100644 --- a/content/browser/field_trial_synchronizer.cc +++ b/content/browser/field_trial_synchronizer.cc
@@ -14,6 +14,7 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" +#include "ipc/ipc_channel_proxy.h" #include "mojo/public/cpp/bindings/associated_remote.h" namespace content {
diff --git a/content/browser/idle/idle_polling_service.cc b/content/browser/idle/idle_polling_service.cc index ab8b52d..bb2445ffc 100644 --- a/content/browser/idle/idle_polling_service.cc +++ b/content/browser/idle/idle_polling_service.cc
@@ -5,6 +5,7 @@ #include "content/browser/idle/idle_polling_service.h" #include "base/no_destructor.h" +#include "base/observer_list.h" #include "content/public/browser/idle_time_provider.h" #include "ui/base/idle/idle.h"
diff --git a/content/browser/interest_group/debuggable_auction_worklet_tracker.cc b/content/browser/interest_group/debuggable_auction_worklet_tracker.cc index dc8b0078..e5a5061 100644 --- a/content/browser/interest_group/debuggable_auction_worklet_tracker.cc +++ b/content/browser/interest_group/debuggable_auction_worklet_tracker.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/no_destructor.h" +#include "base/observer_list.h" namespace content {
diff --git a/content/browser/renderer_host/cookie_browsertest.cc b/content/browser/renderer_host/cookie_browsertest.cc index 8da7c00..53770aa 100644 --- a/content/browser/renderer_host/cookie_browsertest.cc +++ b/content/browser/renderer_host/cookie_browsertest.cc
@@ -33,6 +33,7 @@ #include "net/cookies/cookie_access_result.h" #include "net/cookies/cookie_util.h" #include "net/dns/mock_host_resolver.h" +#include "net/http/alternative_service.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom-test-utils.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom.h" @@ -276,6 +277,58 @@ EXPECT_EQ("none=1", GetCookieFromJS(b_iframe)); } +IN_PROC_BROWSER_TEST_F(CookieBrowserTest, CookieTruncatingChar) { + using std::string_literals::operator""s; + + std::string cookie_string; + embedded_test_server()->RegisterRequestHandler(base::BindLambdaForTesting( + [&](const net::test_server::HttpRequest& request) + -> std::unique_ptr<net::test_server::HttpResponse> { + auto response = std::make_unique<net::test_server::BasicHttpResponse>(); + response->AddCustomHeader("Set-Cookie", cookie_string); + return std::move(response); + })); + + ASSERT_TRUE(embedded_test_server()->Start()); + + GURL http_url = embedded_test_server()->GetURL("/"); + base::HistogramTester histogram; + + // Test scenarios where a control char may appear at start, middle and end of + // a cookie line. Control char array with NULL (\x0), CR (\xD), and LF (xA) + char kTestChars[] = {'\x0', '\xD', '\xA'}; + + for (const auto& test : kTestChars) { + std::string ctl_string(1, test); + + // ctrl char at start of string + cookie_string = ctl_string + "foo=bar"s; + EXPECT_TRUE(NavigateToURL(shell(), http_url)); + + // ctrl char at middle of string + cookie_string = "foo=bar;"s + ctl_string + "httponly"s; + EXPECT_TRUE(NavigateToURL(shell(), http_url)); + + // ctrl char at end of string + cookie_string = "foo=bar;"s + "httponly;"s + ctl_string; + EXPECT_TRUE(NavigateToURL(shell(), http_url)); + } + // Test if there are multiple control characters that terminate. + cookie_string = "foo=bar;\xA\xDhttponly"s; + EXPECT_TRUE(NavigateToURL(shell(), http_url)); + + FetchHistogramsFromChildProcesses(); + histogram.ExpectBucketCount( + "Cookie.TruncatingCharacterInCookieString", + net::TruncatingCharacterInCookieStringType::kTruncatingCharNull, 0); + histogram.ExpectBucketCount( + "Cookie.TruncatingCharacterInCookieString", + net::TruncatingCharacterInCookieStringType::kTruncatingCharNewline, 0); + histogram.ExpectBucketCount( + "Cookie.TruncatingCharacterInCookieString", + net::TruncatingCharacterInCookieStringType::kTruncatingCharLineFeed, 0); +} + class RestrictedCookieManagerInterceptor : public network::mojom::RestrictedCookieManagerInterceptorForTesting { public:
diff --git a/content/public/browser/render_process_host.h b/content/public/browser/render_process_host.h index 22dfc92..c996661 100644 --- a/content/public/browser/render_process_host.h +++ b/content/public/browser/render_process_host.h
@@ -20,7 +20,7 @@ #include "base/tracing/protos/chrome_track_event.pbzero.h" #include "build/build_config.h" #include "content/common/content_export.h" -#include "ipc/ipc_channel_proxy.h" +#include "ipc/ipc_listener.h" #include "ipc/ipc_sender.h" #include "media/media_buildflags.h" #include "media/mojo/mojom/video_decode_perf_history.mojom-forward.h" @@ -65,6 +65,10 @@ class StorageKey; } // namespace blink +namespace IPC { +class ChannelProxy; +} // namespace IPC + namespace network { struct CrossOriginEmbedderPolicy; } // namespace network
diff --git a/content/web_test/browser/web_test_control_host.cc b/content/web_test/browser/web_test_control_host.cc index 3b50d6c..915d084 100644 --- a/content/web_test/browser/web_test_control_host.cc +++ b/content/web_test/browser/web_test_control_host.cc
@@ -84,6 +84,7 @@ #include "content/web_test/common/web_test_constants.h" #include "content/web_test/common/web_test_string_util.h" #include "content/web_test/common/web_test_switches.h" +#include "ipc/ipc_channel_proxy.h" #include "mojo/public/cpp/bindings/sync_call_restrictions.h" #include "services/network/public/cpp/features.h" #include "services/network/public/mojom/network_context.mojom.h"
diff --git a/courgette/encoded_program_unittest.cc b/courgette/encoded_program_unittest.cc index 39061b4..e043521 100644 --- a/courgette/encoded_program_unittest.cc +++ b/courgette/encoded_program_unittest.cc
@@ -10,7 +10,6 @@ #include <memory> #include <vector> -#include "base/cxx17_backports.h" #include "courgette/image_utils.h" #include "courgette/label_manager.h" #include "courgette/streams.h" @@ -109,7 +108,7 @@ 0xF8, 0xFF, 0xFF, 0xFF // REL32 from next line to base + 2 }; - EXPECT_TRUE(CompareSink(golden, base::size(golden), &assembled)); + EXPECT_TRUE(CompareSink(golden, std::size(golden), &assembled)); } // A larger test with multiple addresses. We encode the program and check the @@ -137,15 +136,13 @@ const uint8_t golden_abs32_indexes[] = { 0x03, 0x07, 0x03, 0x05 // 3 indexes: [7, 3, 5]. }; - EXPECT_TRUE(CompareSink(golden_abs32_indexes, - base::size(golden_abs32_indexes), + EXPECT_TRUE(CompareSink(golden_abs32_indexes, std::size(golden_abs32_indexes), sinks.stream(kStreamAbs32Indexes))); const uint8_t golden_rel32_indexes[] = { 0x03, 0x00, 0x03, 0x01 // 3 indexes: [0, 3, 1]. }; - EXPECT_TRUE(CompareSink(golden_rel32_indexes, - base::size(golden_rel32_indexes), + EXPECT_TRUE(CompareSink(golden_rel32_indexes, std::size(golden_rel32_indexes), sinks.stream(kStreamRel32Indexes))); // Addresses: [_, _, _, 2, _, 23, _, 11]. @@ -159,7 +156,7 @@ 0x00, 0x00, 0x00, 0x04, 0x00, 0x2A, 0x00, 0x17, }; EXPECT_TRUE(CompareSink(golden_abs32_addresses, - base::size(golden_abs32_addresses), + std::size(golden_abs32_addresses), sinks.stream(kStreamAbs32Addresses))); // Addresses: [16, 7, _, 32]. @@ -173,7 +170,7 @@ 0x20, 0x11, 0x00, 0x32, }; EXPECT_TRUE(CompareSink(golden_rel32_addresses, - base::size(golden_rel32_addresses), + std::size(golden_rel32_addresses), sinks.stream(kStreamRel32Addresses))); }
diff --git a/courgette/memory_allocator_unittest.cc b/courgette/memory_allocator_unittest.cc index bb922c0..e331b53 100644 --- a/courgette/memory_allocator_unittest.cc +++ b/courgette/memory_allocator_unittest.cc
@@ -8,14 +8,13 @@ #include <algorithm> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" TEST(MemoryAllocatorTest, NoThrowBuffer) { const size_t size_list[] = {0U, 1U, 2U, 11U, 15U, 16U}; // Repeat test for different sizes. - for (size_t idx = 0; idx < base::size(size_list); ++idx) { + for (size_t idx = 0; idx < std::size(size_list); ++idx) { size_t size = size_list[idx]; courgette::NoThrowBuffer<size_t> buf1;
diff --git a/courgette/third_party/bsdiff/bsdiff_search_unittest.cc b/courgette/third_party/bsdiff/bsdiff_search_unittest.cc index 0ab2d28..6482cb0 100644 --- a/courgette/third_party/bsdiff/bsdiff_search_unittest.cc +++ b/courgette/third_party/bsdiff/bsdiff_search_unittest.cc
@@ -6,7 +6,6 @@ #include <cstring> -#include "base/cxx17_backports.h" #include "courgette/third_party/bsdiff/paged_array.h" #include "courgette/third_party/divsufsort/divsufsort.h" #include "testing/gtest/include/gtest/gtest.h" @@ -57,7 +56,7 @@ {-1, 0, "(the"}, }; - for (size_t idx = 0; idx < base::size(test_cases); ++idx) { + for (size_t idx = 0; idx < std::size(test_cases); ++idx) { const auto& test_case = test_cases[idx]; int query_size = static_cast<int>(::strlen(test_case.query_str)); const unsigned char* query_buf = @@ -97,7 +96,7 @@ "elephantelephantelephantelephantelephant", "011010011001011010010110011010010", }; - for (size_t idx = 0; idx < base::size(test_cases); ++idx) { + for (size_t idx = 0; idx < std::size(test_cases); ++idx) { int size = static_cast<int>(::strlen(test_cases[idx])); const unsigned char* buf = reinterpret_cast<const unsigned char*>(test_cases[idx]);
diff --git a/crypto/ec_private_key_unittest.cc b/crypto/ec_private_key_unittest.cc index 20249aac..50ba4d5 100644 --- a/crypto/ec_private_key_unittest.cc +++ b/crypto/ec_private_key_unittest.cc
@@ -9,7 +9,6 @@ #include <memory> #include <vector> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" namespace { @@ -266,7 +265,7 @@ std::string raw_public_key; EXPECT_TRUE(keypair_openssl->ExportRawPublicKey(&raw_public_key)); EXPECT_EQ(std::string(reinterpret_cast<const char*>(kOpenSSLRawPublicKey), - base::size(kOpenSSLRawPublicKey)), + std::size(kOpenSSLRawPublicKey)), raw_public_key); }
diff --git a/crypto/encryptor_unittest.cc b/crypto/encryptor_unittest.cc index 95c9cc5..93f8447d 100644 --- a/crypto/encryptor_unittest.cc +++ b/crypto/encryptor_unittest.cc
@@ -9,7 +9,6 @@ #include <memory> #include <string> -#include "base/cxx17_backports.h" #include "base/strings/string_number_conversions.h" #include "crypto/symmetric_key.h" #include "testing/gtest/include/gtest/gtest.h" @@ -89,7 +88,7 @@ 0x48, 0x1D, 0x42, 0xB0, 0xBA, 0x21, 0xB2, 0x0C }; - ASSERT_EQ(base::size(expected_ciphertext), ciphertext.size()); + ASSERT_EQ(std::size(expected_ciphertext), ciphertext.size()); for (size_t i = 0; i < ciphertext.size(); ++i) { ASSERT_EQ(expected_ciphertext[i], static_cast<unsigned char>(ciphertext[i])); @@ -262,7 +261,7 @@ int kTestDecryptSizes[] = { 32, 16, 8 }; int offset = 0; - for (size_t i = 0; i < base::size(kTestDecryptSizes); ++i) { + for (size_t i = 0; i < std::size(kTestDecryptSizes); ++i) { std::string decrypted; size_t len = kTestDecryptSizes[i]; EXPECT_TRUE( @@ -276,33 +275,33 @@ } // namespace TEST(EncryptorTest, EncryptAES128CTR) { - TestAESCTREncrypt(kAES128CTRKey, base::size(kAES128CTRKey), - kAESCTRInitCounter, base::size(kAESCTRInitCounter), - kAESCTRPlaintext, base::size(kAESCTRPlaintext), - kAES128CTRCiphertext, base::size(kAES128CTRCiphertext)); + TestAESCTREncrypt(kAES128CTRKey, std::size(kAES128CTRKey), kAESCTRInitCounter, + std::size(kAESCTRInitCounter), kAESCTRPlaintext, + std::size(kAESCTRPlaintext), kAES128CTRCiphertext, + std::size(kAES128CTRCiphertext)); } TEST(EncryptorTest, EncryptAES256CTR) { - TestAESCTREncrypt(kAES256CTRKey, base::size(kAES256CTRKey), - kAESCTRInitCounter, base::size(kAESCTRInitCounter), - kAESCTRPlaintext, base::size(kAESCTRPlaintext), - kAES256CTRCiphertext, base::size(kAES256CTRCiphertext)); + TestAESCTREncrypt(kAES256CTRKey, std::size(kAES256CTRKey), kAESCTRInitCounter, + std::size(kAESCTRInitCounter), kAESCTRPlaintext, + std::size(kAESCTRPlaintext), kAES256CTRCiphertext, + std::size(kAES256CTRCiphertext)); } TEST(EncryptorTest, EncryptAES128CTR_MultipleDecrypt) { - TestAESCTRMultipleDecrypt(kAES128CTRKey, base::size(kAES128CTRKey), - kAESCTRInitCounter, base::size(kAESCTRInitCounter), - kAESCTRPlaintext, base::size(kAESCTRPlaintext), + TestAESCTRMultipleDecrypt(kAES128CTRKey, std::size(kAES128CTRKey), + kAESCTRInitCounter, std::size(kAESCTRInitCounter), + kAESCTRPlaintext, std::size(kAESCTRPlaintext), kAES128CTRCiphertext, - base::size(kAES128CTRCiphertext)); + std::size(kAES128CTRCiphertext)); } TEST(EncryptorTest, EncryptAES256CTR_MultipleDecrypt) { - TestAESCTRMultipleDecrypt(kAES256CTRKey, base::size(kAES256CTRKey), - kAESCTRInitCounter, base::size(kAESCTRInitCounter), - kAESCTRPlaintext, base::size(kAESCTRPlaintext), + TestAESCTRMultipleDecrypt(kAES256CTRKey, std::size(kAES256CTRKey), + kAESCTRInitCounter, std::size(kAESCTRInitCounter), + kAESCTRPlaintext, std::size(kAESCTRPlaintext), kAES256CTRCiphertext, - base::size(kAES256CTRCiphertext)); + std::size(kAES256CTRCiphertext)); } TEST(EncryptorTest, EncryptDecryptCTR) {
diff --git a/crypto/hmac_unittest.cc b/crypto/hmac_unittest.cc index 783aaf1..3fc0524 100644 --- a/crypto/hmac_unittest.cc +++ b/crypto/hmac_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "crypto/hmac.h" + #include <stddef.h> #include <string.h> #include <string> -#include "base/cxx17_backports.h" -#include "crypto/hmac.h" #include "testing/gtest/include/gtest/gtest.h" static const size_t kSHA1DigestSize = 20; @@ -146,7 +146,7 @@ "\xBB\xFF\x1A\x91" } }; - for (size_t i = 0; i < base::size(cases); ++i) { + for (size_t i = 0; i < std::size(cases); ++i) { crypto::HMAC hmac(crypto::HMAC::SHA1); ASSERT_TRUE(hmac.Init(reinterpret_cast<const unsigned char*>(cases[i].key), cases[i].key_len)); @@ -243,7 +243,7 @@ ASSERT_TRUE( hmac.Init(reinterpret_cast<const unsigned char*>(kSimpleKey), kSimpleKeyLength)); - for (size_t i = 0; i < base::size(kSimpleHmacCases); ++i) { + for (size_t i = 0; i < std::size(kSimpleHmacCases); ++i) { std::string data_string(kSimpleHmacCases[i].data, kSimpleHmacCases[i].data_len); unsigned char digest[kSHA1DigestSize]; @@ -258,7 +258,7 @@ hmac.Init(reinterpret_cast<const unsigned char*>(kSimpleKey), kSimpleKeyLength)); const char empty_digest[kSHA1DigestSize] = { 0 }; - for (size_t i = 0; i < base::size(kSimpleHmacCases); ++i) { + for (size_t i = 0; i < std::size(kSimpleHmacCases); ++i) { // Expected results EXPECT_TRUE(hmac.Verify( base::StringPiece(kSimpleHmacCases[i].data,
diff --git a/crypto/mock_apple_keychain.cc b/crypto/mock_apple_keychain.cc index f67b397..d37d732 100644 --- a/crypto/mock_apple_keychain.cc +++ b/crypto/mock_apple_keychain.cc
@@ -5,7 +5,6 @@ #include "crypto/mock_apple_keychain.h" #include "base/check_op.h" -#include "base/cxx17_backports.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" @@ -42,7 +41,7 @@ // The function to free this data is mocked so the cast is fine. *passwordData = const_cast<char*>(kPassword); DCHECK(passwordLength); - *passwordLength = base::size(kPassword); + *passwordLength = std::size(kPassword); password_data_count_++; }
diff --git a/crypto/sha2.cc b/crypto/sha2.cc index b69add6..33663c6d 100644 --- a/crypto/sha2.cc +++ b/crypto/sha2.cc
@@ -27,7 +27,7 @@ std::string SHA256HashString(base::StringPiece str) { std::string output(kSHA256Length, 0); - SHA256HashString(str, base::data(output), output.size()); + SHA256HashString(str, std::data(output), output.size()); return output; }
diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc index 64c79466..fed3a765 100644 --- a/extensions/browser/event_router.cc +++ b/extensions/browser/event_router.cc
@@ -45,6 +45,7 @@ #include "extensions/common/manifest_handlers/incognito_info.h" #include "extensions/common/mojom/event_dispatcher.mojom.h" #include "extensions/common/permissions/permissions_data.h" +#include "ipc/ipc_channel_proxy.h" using base::DictionaryValue; using base::ListValue;
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index e7a90aa..1570b68 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1693,6 +1693,7 @@ AUTOTESTPRIVATE_GETLOGINEVENTRECORDERLOGINEVENTS = 1630, AUTOTESTPRIVATE_ADDLOGINEVENTFORTESTING = 1631, OS_DIAGNOSTICS_RUNDISKREADROUTINE = 1632, + FILEMANAGERPRIVATE_MOUNTGUEST = 1633, // Last entry: Add new entries above, then run: // tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/browser/renderer_startup_helper.cc b/extensions/browser/renderer_startup_helper.cc index e1aa243..2b434bbb7 100644 --- a/extensions/browser/renderer_startup_helper.cc +++ b/extensions/browser/renderer_startup_helper.cc
@@ -34,6 +34,7 @@ #include "extensions/common/features/feature_session_type.h" #include "extensions/common/manifest_handlers/background_info.h" #include "extensions/common/permissions/permissions_data.h" +#include "ipc/ipc_channel_proxy.h" #include "ui/base/webui/web_ui_util.h" #include "url/origin.h"
diff --git a/extensions/common/mojom/event_dispatcher_mojom_traits.h b/extensions/common/mojom/event_dispatcher_mojom_traits.h index 9ba9ff3..aa5489a9 100644 --- a/extensions/common/mojom/event_dispatcher_mojom_traits.h +++ b/extensions/common/mojom/event_dispatcher_mojom_traits.h
@@ -14,11 +14,11 @@ template <> struct StructTraits<extensions::mojom::EventFilteringInfoDataView, extensions::EventFilteringInfo> { - static absl::optional<GURL> url( + static const absl::optional<GURL>& url( const extensions::EventFilteringInfo& filtering_info) { return filtering_info.url; } - static absl::optional<std::string> service_type( + static const absl::optional<std::string>& service_type( const extensions::EventFilteringInfo& filtering_info) { return filtering_info.service_type; } @@ -29,7 +29,7 @@ static int instance_id(const extensions::EventFilteringInfo& filtering_info) { return filtering_info.instance_id.value_or(0); } - static absl::optional<std::string> window_type( + static const absl::optional<std::string>& window_type( const extensions::EventFilteringInfo& filtering_info) { return filtering_info.window_type; }
diff --git a/gpu/ipc/common/gpu_info_mojom_traits.h b/gpu/ipc/common/gpu_info_mojom_traits.h index 85c61ba..112a25b3 100644 --- a/gpu/ipc/common/gpu_info_mojom_traits.h +++ b/gpu/ipc/common/gpu_info_mojom_traits.h
@@ -415,7 +415,7 @@ } #if BUILDFLAG(ENABLE_VULKAN) - static const absl::optional<gpu::VulkanInfo> vulkan_info( + static const absl::optional<gpu::VulkanInfo>& vulkan_info( const gpu::GPUInfo& input) { return input.vulkan_info; }
diff --git a/ios/chrome/app/strings/resources/ios_chromium_strings_hy.xtb b/ios/chrome/app/strings/resources/ios_chromium_strings_hy.xtb index b507605..8416d6de 100644 --- a/ios/chrome/app/strings/resources/ios_chromium_strings_hy.xtb +++ b/ios/chrome/app/strings/resources/ios_chromium_strings_hy.xtb
@@ -44,6 +44,7 @@ <translation id="3344973607274501920">Chromium-ին չհաջողվեց ստուգել ձեր գաղտնաբառերը։ Ստուգեք ինտերնետ կապը։</translation> <translation id="3472200483164753384">Չի աջակցվում Chromium Canary-ում</translation> <translation id="3639997914391704523">Chromium-ը կարող է ստուգել ձեր գաղտնաբառերը, երբ մտնեք Google հաշիվ։</translation> +<translation id="3650632991272923014">Օգտատերը (<ph name="USER_EMAIL1" />) օգտագործել է Chromium-ը, և այս սարքում պահպանվել են էջանիշներ, գաղտնաբառեր և այլ կարգավորումներ։</translation> <translation id="3805899903892079518">Chromium-ին հասանելի չեն ձեր լուսանկարները կամ տեսանյութերը: Անցեք iOS Կարգավորումներ > Գաղտնիություն > Լուսանկարներ (Settings > Privacy > Photos) և միացրեք մուտքի թույլտվությունը:</translation> <translation id="4043291146360695975">Գաղտնաբառերը պահվում են միայն այս սարքի Գաղտնաբառերի կառավարիչում</translation> <translation id="4099085513035183040">Չի աջակցվում Chromium-ի բետա տարբերակում</translation>
diff --git a/ios/chrome/app/strings/resources/ios_google_chrome_strings_hy.xtb b/ios/chrome/app/strings/resources/ios_google_chrome_strings_hy.xtb index 282a15c..e08db10 100644 --- a/ios/chrome/app/strings/resources/ios_google_chrome_strings_hy.xtb +++ b/ios/chrome/app/strings/resources/ios_google_chrome_strings_hy.xtb
@@ -50,6 +50,7 @@ <translation id="4099578267706723511">Աջակցեք Google Chrome-ի կատարելագործմանը՝ Google-ին ավտոմատ կերպով ուղարկելով օգտագործման վիճակագրություն և խափանումների մասին հաղորդագրություններ:</translation> <translation id="417201473131094001">Չի աջակցվում Chrome Canary-ում</translation> <translation id="4214277427269650960">Մուտք գործեք այս կայք և Chrome։ Համաժամացումը կարող եք ավելի ուշ միացնել։</translation> +<translation id="4233521129555661685">Օգտատերը (<ph name="USER_EMAIL1" />) օգտագործել է Chrome-ը, և այս սարքում պահպանվել են էջանիշներ, գաղտնաբառեր և այլ կարգավորումներ։</translation> <translation id="424864128008805179">Դուրս գա՞լ Chrome-ից:</translation> <translation id="4249068189593983585">Խորհուրդ Chrome-ից: Հպեք և պահեք գործիքագոտու «Ցուցադրել ներդիրները» կոճակը՝ այլ ընտրանքներ տեսնելու համար: Գործիքագոտին սովորաբար գտնվում է էկրանի վերևի կամ ներքևի հատվածում:</translation> <translation id="4523886039239821078">Որոշ հավելումներ առաջացնում են Chrome-ի աշխատանքի խափանում: Հեռացրեք դրանք՝</translation>
diff --git a/ios/chrome/app/strings/resources/ios_strings_hy.xtb b/ios/chrome/app/strings/resources/ios_strings_hy.xtb index 202e34f..2688f24 100644 --- a/ios/chrome/app/strings/resources/ios_strings_hy.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_hy.xtb
@@ -42,6 +42,7 @@ <translation id="1265739287306757398">Իմանալ ինչպես</translation> <translation id="1272079795634619415">Դադարեցնել</translation> <translation id="1275718070701477396">Ընտրված</translation> +<translation id="1281818060020671000">Տվյալների կառավարում</translation> <translation id="1282311502488501110">Մուտք չգործել</translation> <translation id="1283524564873030414">Վերջին 24 ժամվա</translation> <translation id="1285320974508926690">Երբեք չթարգմանել այս կայքը</translation> @@ -406,6 +407,7 @@ <translation id="4689564913179979534">Վճարման եղանակների կառավարում…</translation> <translation id="470966556546083668">Չմիացնել համաժամացումը</translation> <translation id="4731472194328757163">Տեսախցիկի և խոսափողի օգտագործումը թույլատրված է</translation> +<translation id="4737560986434232178">Որոնեք վերջին ներդիրներում</translation> <translation id="473775607612524610">Թարմացնել</translation> <translation id="4747097190499141774">Անցաբառով գաղտնագրումը չի կիրառվում վճարման եղանակների և Google Pay-ի հասցեների համար։ Միայն ձեր անցաբառն ունեցող օգտատերը կարող է կարդալ ձեր գաղտնագրված տվյալները: Անցաբառը չի ուղարկվում Google-ին, և Google-ը չի պահում այն: Անցաբառը մոռանալու դեպքում ձեզ անհրաժեշտ կլինի վերակայել համաժամացումը: <ph name="BEGIN_LINK" />Իմանալ ավելին<ph name="END_LINK" /></translation> <translation id="4751645464639803239">Նոր ինկոգնիտո ներդիր</translation>
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 0db4be4..80c0182 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 @@ -3ec6aada11a58fe5d6613970521b515239169777 \ No newline at end of file +6584f682c3b1ddce2c92c05f0b744be336cfdba2 \ 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 2bae553..33de995 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 @@ -f0b0bcd16d8fdd9b5f0a49f85e48b8ae69da410f \ No newline at end of file +fe8b7f4ea6d28b4f592bf65383169f74e25dd335 \ 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 2e738b37..e811e36 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 @@ -c5e105d6244ec3b6efffbd947d9b4fbc15251495 \ No newline at end of file +15f7d4100eee3aac03db9ff1c215f66a0c7cec31 \ 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 5f895fa..f3e0d78 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 @@ -8797b1b8b2a700d8a363b976fb9145eea5376a88 \ No newline at end of file +75f2605b4ac334b017dd710b5eb4004cf3fdf0c5 \ 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 6cdb38a..47ec025 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 @@ -76a9497ea48b5ebe60886da68e0202603855a699 \ No newline at end of file +6651c20f484e051a97672da56f799c0ff0b44300 \ 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 aff0f836..f7b2c843c 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 @@ -c330322134699a419a6b383f06cc0e7c141ab856 \ No newline at end of file +33ebf48fe3f3767717dfdbe577687a41b5de5188 \ 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 734ae75..bf03029 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 @@ -f180d1d29615700c7ce4987cba76dbde982ea360 \ No newline at end of file +6d9804b9b213a044fc1b90ea2c1108472261780e \ 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 35a9e21..fc696e0 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 @@ -ebc7c72d193aa115870ca9fe85ce66ac4820cc8b \ No newline at end of file +71e62477e09fa905f82935ffe415a225654cb14c \ 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 72ea1c4..d4d907b 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 @@ -4e01b0b66b478402cd95c1d62c05199051e3659c \ No newline at end of file +270effde81f11967443203ef6846204a77b3e444 \ 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 60630c5..201bb60 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 @@ -dc3faba6d7ea9d05c88e9e692ba3f713cb617390 \ No newline at end of file +d4bb231f54902c15ba2b3933fde5f17fab7a430c \ No newline at end of file
diff --git a/media/mojo/mojom/video_frame_metadata_mojom_traits.h b/media/mojo/mojom/video_frame_metadata_mojom_traits.h index b87508d..3f24664 100644 --- a/media/mojo/mojom/video_frame_metadata_mojom_traits.h +++ b/media/mojo/mojom/video_frame_metadata_mojom_traits.h
@@ -83,7 +83,7 @@ copy_mode, media::VideoFrameMetadata::CopyMode::kCopyToNewTexture) - static absl::optional<media::VideoTransformation> transformation( + static const absl::optional<media::VideoTransformation>& transformation( const media::VideoFrameMetadata& input) { return input.transformation; } @@ -96,17 +96,17 @@ GENERATE_OPT_SERIALIZATION(double, frame_rate, 0.0) GENERATE_OPT_SERIALIZATION(double, rtp_timestamp, 0.0) - static absl::optional<gfx::Rect> capture_update_rect( + static const absl::optional<gfx::Rect>& capture_update_rect( const media::VideoFrameMetadata& input) { return input.capture_update_rect; } - static absl::optional<gfx::Rect> region_capture_rect( + static const absl::optional<gfx::Rect>& region_capture_rect( const media::VideoFrameMetadata& input) { return input.region_capture_rect; } - static absl::optional<base::UnguessableToken> overlay_plane_id( + static const absl::optional<base::UnguessableToken>& overlay_plane_id( const media::VideoFrameMetadata& input) { return input.overlay_plane_id; }
diff --git a/net/base/host_mapping_rules.cc b/net/base/host_mapping_rules.cc index 81bd1ce..f77d064 100644 --- a/net/base/host_mapping_rules.cc +++ b/net/base/host_mapping_rules.cc
@@ -85,11 +85,11 @@ if (!RewriteHost(&host_port_pair)) return RewriteResult::kNoMatchingRule; - url::Replacements<char> replacements; + GURL::Replacements replacements; std::string port_str = base::NumberToString(host_port_pair.port()); - replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); + replacements.SetPortStr(port_str); std::string host_str = host_port_pair.HostForURL(); - replacements.SetHost(host_str.c_str(), url::Component(0, host_str.size())); + replacements.SetHostStr(host_str); GURL new_url = url.ReplaceComponents(replacements); if (!new_url.is_valid())
diff --git a/net/quic/dedicated_web_transport_http3_client.cc b/net/quic/dedicated_web_transport_http3_client.cc index 385c01f3..ed54a49 100644 --- a/net/quic/dedicated_web_transport_http3_client.cc +++ b/net/quic/dedicated_web_transport_http3_client.cc
@@ -700,7 +700,13 @@ const spdy::SpdyHeaderBlock& spdy_headers) { session_ready_ = true; http_response_info_ = std::make_unique<HttpResponseInfo>(); - SpdyHeadersToHttpResponse(spdy_headers, http_response_info_.get()); + const int rv = + SpdyHeadersToHttpResponse(spdy_headers, http_response_info_.get()); + if (rv != OK) { + SetErrorIfNecessary(ERR_QUIC_PROTOCOL_ERROR); + TransitionToState(WebTransportState::FAILED); + return; + } // TODO(vasilvv): add support for this header in downstream tests and remove // this. http_response_info_->headers->RemoveHeader("sec-webtransport-http3-draft");
diff --git a/services/network/public/cpp/cookie_manager_mojom_traits.h b/services/network/public/cpp/cookie_manager_mojom_traits.h index 907e377..9d560de 100644 --- a/services/network/public/cpp/cookie_manager_mojom_traits.h +++ b/services/network/public/cpp/cookie_manager_mojom_traits.h
@@ -272,7 +272,7 @@ static bool same_party(const net::CanonicalCookie& c) { return c.IsSameParty(); } - static absl::optional<net::CookiePartitionKey> partition_key( + static const absl::optional<net::CookiePartitionKey>& partition_key( const net::CanonicalCookie& c) { return c.PartitionKey(); }
diff --git a/services/network/public/cpp/isolation_info_mojom_traits.h b/services/network/public/cpp/isolation_info_mojom_traits.h index 11d75ab..6f6cac2 100644 --- a/services/network/public/cpp/isolation_info_mojom_traits.h +++ b/services/network/public/cpp/isolation_info_mojom_traits.h
@@ -55,7 +55,7 @@ return input.site_for_cookies(); } - static const absl::optional<std::set<net::SchemefulSite>> party_context( + static const absl::optional<std::set<net::SchemefulSite>>& party_context( const net::IsolationInfo& input) { return input.party_context_; }
diff --git a/services/network/public/cpp/url_loader_completion_status_mojom_traits.h b/services/network/public/cpp/url_loader_completion_status_mojom_traits.h index 5c0bcc3a..62a418136 100644 --- a/services/network/public/cpp/url_loader_completion_status_mojom_traits.h +++ b/services/network/public/cpp/url_loader_completion_status_mojom_traits.h
@@ -87,7 +87,7 @@ return status.ssl_info; } - static absl::optional<network::mojom::BlockedByResponseReason> + static const absl::optional<network::mojom::BlockedByResponseReason>& blocked_by_response_reason(const network::URLLoaderCompletionStatus& status) { return status.blocked_by_response_reason; }
diff --git a/services/viz/public/cpp/compositing/compositor_render_pass_mojom_traits.h b/services/viz/public/cpp/compositing/compositor_render_pass_mojom_traits.h index 0bbec22..d3c065e4 100644 --- a/services/viz/public/cpp/compositing/compositor_render_pass_mojom_traits.h +++ b/services/viz/public/cpp/compositing/compositor_render_pass_mojom_traits.h
@@ -55,7 +55,7 @@ return input->backdrop_filters; } - static absl::optional<gfx::RRectF> backdrop_filter_bounds( + static const absl::optional<gfx::RRectF>& backdrop_filter_bounds( const std::unique_ptr<viz::CompositorRenderPass>& input) { return input->backdrop_filter_bounds; }
diff --git a/skia/ext/convolver_unittest.cc b/skia/ext/convolver_unittest.cc index ba7fea7..1dd98ab 100644 --- a/skia/ext/convolver_unittest.cc +++ b/skia/ext/convolver_unittest.cc
@@ -2,17 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "skia/ext/convolver.h" + #include <stdint.h> #include <string.h> #include <time.h> + #include <algorithm> #include <numeric> #include <vector> -#include "base/cxx17_backports.h" #include "base/logging.h" #include "base/time/time.h" -#include "skia/ext/convolver.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColorPriv.h" @@ -146,7 +147,7 @@ // An all-zero filter is handled correctly, all factors ignored static const float factors1[] = { 0.0f, 0.0f, 0.0f }; - filter.AddFilter(11, factors1, base::size(factors1)); + filter.AddFilter(11, factors1, std::size(factors1)); ASSERT_EQ(0, filter.max_filter()); ASSERT_EQ(1, filter.num_values()); @@ -157,7 +158,7 @@ // Zeroes on the left are ignored static const float factors2[] = { 0.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - filter.AddFilter(22, factors2, base::size(factors2)); + filter.AddFilter(22, factors2, std::size(factors2)); ASSERT_EQ(4, filter.max_filter()); ASSERT_EQ(2, filter.num_values()); @@ -168,7 +169,7 @@ // Zeroes on the right are ignored static const float factors3[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f }; - filter.AddFilter(33, factors3, base::size(factors3)); + filter.AddFilter(33, factors3, std::size(factors3)); ASSERT_EQ(5, filter.max_filter()); ASSERT_EQ(3, filter.num_values()); @@ -179,7 +180,7 @@ // Zeroes in leading & trailing positions static const float factors4[] = { 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f }; - filter.AddFilter(44, factors4, base::size(factors4)); + filter.AddFilter(44, factors4, std::size(factors4)); ASSERT_EQ(5, filter.max_filter()); // No change from existing value. ASSERT_EQ(4, filter.num_values()); @@ -192,7 +193,7 @@ static const float factors5[] = { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f }; - filter.AddFilter(55, factors5, base::size(factors5)); + filter.AddFilter(55, factors5, std::size(factors5)); ASSERT_EQ(6, filter.max_filter()); ASSERT_EQ(5, filter.num_values()); @@ -203,7 +204,7 @@ // All-zero filters after the first one also work static const float factors6[] = { 0.0f }; - filter.AddFilter(66, factors6, base::size(factors6)); + filter.AddFilter(66, factors6, std::size(factors6)); ASSERT_EQ(6, filter.max_filter()); ASSERT_EQ(6, filter.num_values()); @@ -223,16 +224,15 @@ for (unsigned int p = 0; p < dest_width; ++p) { unsigned int offset = source_width * p / dest_width; EXPECT_LT(offset, source_width); - x_filter.AddFilter( - offset, filter, - std::min<int>(base::size(filter), source_width - offset)); + x_filter.AddFilter(offset, filter, + std::min<int>(std::size(filter), source_width - offset)); } x_filter.PaddingForSIMD(); for (unsigned int p = 0; p < dest_height; ++p) { unsigned int offset = source_height * p / dest_height; y_filter.AddFilter( offset, filter, - std::min<int>(base::size(filter), source_height - offset)); + std::min<int>(std::size(filter), source_height - offset)); } y_filter.PaddingForSIMD(); @@ -317,10 +317,10 @@ srand(static_cast<unsigned int>(time(0))); // Loop over some specific source and destination dimensions. - for (unsigned int i = 0; i < base::size(source_sizes); ++i) { + for (unsigned int i = 0; i < std::size(source_sizes); ++i) { unsigned int source_width = source_sizes[i][0]; unsigned int source_height = source_sizes[i][1]; - for (unsigned int j = 0; j < base::size(dest_sizes); ++j) { + for (unsigned int j = 0; j < std::size(dest_sizes); ++j) { unsigned int dest_width = dest_sizes[j][0]; unsigned int dest_height = dest_sizes[j][1]; VerifySIMD(source_width, source_height, dest_width, dest_height);
diff --git a/skia/ext/image_operations_bench.cc b/skia/ext/image_operations_bench.cc index e996cbbf..4f247cb 100644 --- a/skia/ext/image_operations_bench.cc +++ b/skia/ext/image_operations_bench.cc
@@ -19,7 +19,6 @@ #include <stdio.h> #include "base/command_line.h" -#include "base/cxx17_backports.h" #include "base/format_macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" @@ -51,7 +50,7 @@ // Returns true on success, false otherwise. bool StringToMethod(const std::string& arg, skia::ImageOperations::ResizeMethod* method) { - for (size_t i = 0; i < base::size(resize_methods); ++i) { + for (size_t i = 0; i < std::size(resize_methods); ++i) { if (base::EqualsCaseInsensitiveASCII(arg, resize_methods[i].name)) { *method = resize_methods[i].method; return true; @@ -61,7 +60,7 @@ } const char* MethodToString(skia::ImageOperations::ResizeMethod method) { - for (size_t i = 0; i < base::size(resize_methods); ++i) { + for (size_t i = 0; i < std::size(resize_methods); ++i) { if (method == resize_methods[i].method) { return resize_methods[i].name; } @@ -72,7 +71,7 @@ // Prints all supported resize methods void PrintMethods() { bool print_comma = false; - for (size_t i = 0; i < base::size(resize_methods); ++i) { + for (size_t i = 0; i < std::size(resize_methods); ++i) { if (print_comma) { printf(","); } else {
diff --git a/skia/ext/image_operations_unittest.cc b/skia/ext/image_operations_unittest.cc index cc565755..dff7174 100644 --- a/skia/ext/image_operations_unittest.cc +++ b/skia/ext/image_operations_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "skia/ext/image_operations.h" + #include <stddef.h> #include <stdint.h> @@ -11,11 +13,9 @@ #include <vector> #include "base/compiler_specific.h" -#include "base/cxx17_backports.h" #include "base/files/file_util.h" #include "base/numerics/math_constants.h" #include "base/strings/string_util.h" -#include "skia/ext/image_operations.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColorSpace.h" @@ -206,7 +206,7 @@ } // Types defined outside of the ResizeShouldAverageColors test to allow -// use of the base::size() macro. +// use of the std::size() macro. // // 'max_color_distance_override' is used in a max() call together with // the value of 'max_color_distance' defined in a TestedPixel instance. @@ -263,7 +263,7 @@ float max_observed_distance = 0.0f; bool all_pixels_ok = true; - for (size_t pixel_index = 0; pixel_index < base::size(tested_pixels); + for (size_t pixel_index = 0; pixel_index < std::size(tested_pixels); ++pixel_index) { const TestedPixel& tested_pixel = tested_pixels[pixel_index]; @@ -464,7 +464,7 @@ // Compute the expected (average) color const SkColor colors[] = { checker_color1, checker_color2 }; - const SkColor average_color = AveragePixel(colors, base::size(colors)); + const SkColor average_color = AveragePixel(colors, std::size(colors)); static const TestedResizeMethod tested_methods[] = { { skia::ImageOperations::RESIZE_GOOD, "GOOD", 0.0f }, @@ -486,7 +486,7 @@ // and check each tested pixel against the expected average color. bool all_methods_ok = true; - for (size_t method_index = 0; method_index < base::size(tested_methods); + for (size_t method_index = 0; method_index < std::size(tested_methods); ++method_index) { bool pass = true; CheckResizeMethodShouldAverageGrid(src,
diff --git a/skia/ext/skia_utils_ios.mm b/skia/ext/skia_utils_ios.mm index b0b35f6..dc29d04f 100644 --- a/skia/ext/skia_utils_ios.mm +++ b/skia/ext/skia_utils_ios.mm
@@ -5,11 +5,10 @@ #include "skia/ext/skia_utils_ios.h" #import <ImageIO/ImageIO.h> +#import <UIKit/UIKit.h> #include <stddef.h> #include <stdint.h> -#import <UIKit/UIKit.h> -#include "base/cxx17_backports.h" #include "base/ios/ios_util.h" #include "base/logging.h" #include "base/mac/scoped_cftyperef.h" @@ -21,10 +20,10 @@ // Returns whether the data encodes an ico image. bool EncodesIcoImage(NSData* image_data) { - if (image_data.length < base::size(kICOHeaderMagic)) + if (image_data.length < std::size(kICOHeaderMagic)) return false; return memcmp(kICOHeaderMagic, image_data.bytes, - base::size(kICOHeaderMagic)) == 0; + std::size(kICOHeaderMagic)) == 0; } } // namespace
diff --git a/skia/ext/test_fonts_mac.mm b/skia/ext/test_fonts_mac.mm index 5768fe64..a6e438f 100644 --- a/skia/ext/test_fonts_mac.mm +++ b/skia/ext/test_fonts_mac.mm
@@ -7,7 +7,6 @@ #include <AppKit/AppKit.h> #include <Foundation/Foundation.h> -#include "base/cxx17_backports.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/mac/foundation_util.h" @@ -21,7 +20,7 @@ "ChromiumAATTest.ttf"}; NSMutableArray* font_urls = [NSMutableArray array]; - for (unsigned i = 0; i < base::size(kFontFileNames); ++i) { + for (unsigned i = 0; i < std::size(kFontFileNames); ++i) { base::ScopedCFTypeRef<CFStringRef> file_name( base::SysUTF8ToCFStringRef(kFontFileNames[i])); NSURL* font_url = base::mac::FilePathToNSURL(
diff --git a/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc index a5c5349..97c4d3f 100644 --- a/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc +++ b/storage/browser/file_system/copy_or_move_operation_delegate_unittest.cc
@@ -659,7 +659,7 @@ }; helper.VerifyTestCaseFiles(dest, kMoveDirResultCases, - base::size(kMoveDirResultCases)); + std::size(kMoveDirResultCases)); } TEST(LocalFileSystemCopyOrMoveOperationTest, CopySingleFileNoValidator) {
diff --git a/storage/browser/file_system/dragged_file_util_unittest.cc b/storage/browser/file_system/dragged_file_util_unittest.cc index 22681a15..a226ea68 100644 --- a/storage/browser/file_system/dragged_file_util_unittest.cc +++ b/storage/browser/file_system/dragged_file_util_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "storage/browser/file_system/dragged_file_util.h" + #include <stddef.h> #include <map> @@ -12,7 +14,6 @@ #include "base/check.h" #include "base/containers/queue.h" -#include "base/cxx17_backports.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -20,7 +21,6 @@ #include "base/time/time.h" #include "build/build_config.h" #include "components/services/filesystem/public/mojom/types.mojom.h" -#include "storage/browser/file_system/dragged_file_util.h" #include "storage/browser/file_system/file_system_context.h" #include "storage/browser/file_system/file_system_operation_context.h" #include "storage/browser/file_system/isolated_context.h" @@ -260,7 +260,7 @@ // to simulate a drop with multiple directories. if (toplevel_root_map_.find(toplevel) == toplevel_root_map_.end()) { base::FilePath root = root_path().Append( - kRootPaths[(root_path_index++) % base::size(kRootPaths)]); + kRootPaths[(root_path_index++) % std::size(kRootPaths)]); toplevel_root_map_[toplevel] = root; toplevels.AddPath(root.Append(path), nullptr); } @@ -316,7 +316,7 @@ {false, FILE_PATH_LITERAL("bar"), 20}, }; - for (size_t i = 0; i < base::size(kUnregisteredCases); ++i) { + for (size_t i = 0; i < std::size(kUnregisteredCases); ++i) { SCOPED_TRACE(testing::Message() << "Creating kUnregisteredCases " << i); const FileSystemTestCaseRecord& test_case = kUnregisteredCases[i]; @@ -331,7 +331,7 @@ ASSERT_EQ(test_case.is_directory, info.is_directory); } - for (size_t i = 0; i < base::size(kUnregisteredCases); ++i) { + for (size_t i = 0; i < std::size(kUnregisteredCases); ++i) { SCOPED_TRACE(testing::Message() << "Creating kUnregisteredCases " << i); const FileSystemTestCaseRecord& test_case = kUnregisteredCases[i]; FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
diff --git a/storage/browser/file_system/external_mount_points_unittest.cc b/storage/browser/file_system/external_mount_points_unittest.cc index c4f0b7f..16c3b81 100644 --- a/storage/browser/file_system/external_mount_points_unittest.cc +++ b/storage/browser/file_system/external_mount_points_unittest.cc
@@ -8,7 +8,6 @@ #include <string> -#include "base/cxx17_backports.h" #include "base/files/file_path.h" #include "storage/browser/file_system/file_system_url.h" #include "storage/common/file_system/file_system_mount_option.h" @@ -121,7 +120,7 @@ } // Test that final mount point presence state is as expected. - for (size_t i = 0; i < base::size(kTestCases); ++i) { + for (size_t i = 0; i < std::size(kTestCases); ++i) { base::FilePath found_path; EXPECT_EQ(kTestCases[i].registered_path != nullptr, mount_points->GetRegisteredPath(kTestCases[i].name, &found_path)) @@ -329,7 +328,7 @@ #endif }; - for (size_t i = 0; i < base::size(kTestCases); ++i) { + for (size_t i = 0; i < std::size(kTestCases); ++i) { FileSystemURL cracked = mount_points->CreateCrackedFileSystemURL( kTestStorageKey, kFileSystemTypeExternal, base::FilePath(kTestCases[i].path)); @@ -412,7 +411,7 @@ #endif }; - for (size_t i = 0; i < base::size(kTestCases); ++i) { + for (size_t i = 0; i < std::size(kTestCases); ++i) { std::string cracked_name; FileSystemType cracked_type; std::string cracked_id;
diff --git a/storage/browser/file_system/file_system_context_unittest.cc b/storage/browser/file_system/file_system_context_unittest.cc index 339ba57..93bdccd5d 100644 --- a/storage/browser/file_system/file_system_context_unittest.cc +++ b/storage/browser/file_system/file_system_context_unittest.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_refptr.h" #include "base/strings/stringprintf.h" @@ -260,7 +259,7 @@ kFileSystemTypeUnknown, kFileSystemTypeUnknown, FPL(""), std::string()}, }; - for (size_t i = 0; i < base::size(kTestCases); ++i) { + for (size_t i = 0; i < std::size(kTestCases); ++i) { const base::FilePath virtual_path = base::FilePath::FromASCII(kTestCases[i].root) .Append(kVirtualPathNoRoot);
diff --git a/storage/browser/file_system/file_system_operation_impl_unittest.cc b/storage/browser/file_system/file_system_operation_impl_unittest.cc index 9cd93ac..cb58f96 100644 --- a/storage/browser/file_system/file_system_operation_impl_unittest.cc +++ b/storage/browser/file_system/file_system_operation_impl_unittest.cc
@@ -12,7 +12,6 @@ #include <utility> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/ptr_util.h" @@ -811,7 +810,7 @@ base::FilePath src_local_disk_file_path; base::CreateTemporaryFile(&src_local_disk_file_path); const char test_data[] = "foo"; - int data_size = base::size(test_data); + int data_size = std::size(test_data); base::WriteFile(src_local_disk_file_path, test_data, data_size); FileSystemURL dest_dir(CreateDirectory("dest")); @@ -841,7 +840,7 @@ base::FilePath src_local_disk_file_path; base::CreateTemporaryFile(&src_local_disk_file_path); const char test_data[] = "foo"; - base::WriteFile(src_local_disk_file_path, test_data, base::size(test_data)); + base::WriteFile(src_local_disk_file_path, test_data, std::size(test_data)); FileSystemURL dest_dir(CreateDirectory("dest"));
diff --git a/storage/browser/file_system/file_system_url_unittest.cc b/storage/browser/file_system/file_system_url_unittest.cc index d0c85a6..3a818c4 100644 --- a/storage/browser/file_system/file_system_url_unittest.cc +++ b/storage/browser/file_system/file_system_url_unittest.cc
@@ -8,7 +8,6 @@ #include <utility> -#include "base/cxx17_backports.h" #include "base/files/file_path.h" #include "storage/common/file_system/file_system_types.h" #include "storage/common/file_system/file_system_util.h" @@ -111,8 +110,8 @@ GURL("filesystem:https://chromium.org/temporary/dir a/file a")}; FileSystemURL::Comparator compare; - for (size_t i = 0; i < base::size(urls); ++i) { - for (size_t j = 0; j < base::size(urls); ++j) { + for (size_t i = 0; i < std::size(urls); ++i) { + for (size_t j = 0; j < std::size(urls); ++j) { SCOPED_TRACE(testing::Message() << i << " < " << j); EXPECT_EQ(urls[i] < urls[j], compare(FileSystemURL::CreateForTest(urls[i]),
diff --git a/storage/browser/file_system/file_writer_delegate_unittest.cc b/storage/browser/file_system/file_writer_delegate_unittest.cc index 6a1d967..e36d0fd 100644 --- a/storage/browser/file_system/file_writer_delegate_unittest.cc +++ b/storage/browser/file_system/file_writer_delegate_unittest.cc
@@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "storage/browser/file_system/file_writer_delegate.h" + #include <stdint.h> + #include <limits> #include <string> #include <utility> @@ -10,7 +13,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" -#include "base/cxx17_backports.h" #include "base/files/scoped_temp_dir.h" #include "base/location.h" #include "base/memory/weak_ptr.h" @@ -30,7 +32,6 @@ #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/file_system/file_system_context.h" #include "storage/browser/file_system/file_system_quota_util.h" -#include "storage/browser/file_system/file_writer_delegate.h" #include "storage/browser/file_system/sandbox_file_stream_writer.h" #include "storage/browser/quota/quota_manager_proxy.h" #include "storage/browser/test/async_file_test_helper.h" @@ -49,7 +50,7 @@ const FileSystemType kFileSystemType = kFileSystemTypeTest; const char kData[] = "The quick brown fox jumps over the lazy dog.\n"; -const int kDataSize = base::size(kData) - 1; +const int kDataSize = std::size(kData) - 1; class Result { public:
diff --git a/storage/browser/file_system/isolated_context_unittest.cc b/storage/browser/file_system/isolated_context_unittest.cc index 58f5fab..1d2e9b58 100644 --- a/storage/browser/file_system/isolated_context_unittest.cc +++ b/storage/browser/file_system/isolated_context_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "storage/browser/file_system/isolated_context.h" + #include <stddef.h> #include <string> -#include "base/cxx17_backports.h" #include "storage/browser/file_system/file_system_url.h" -#include "storage/browser/file_system/isolated_context.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/storage_key/storage_key.h" @@ -91,7 +91,7 @@ // See if the name of each registered kTestPaths (that is what we // register in SetUp() by RegisterDraggedFileSystem) is properly cracked as // a valid virtual path in the isolated filesystem. - for (size_t i = 0; i < base::size(kTestPaths); ++i) { + for (size_t i = 0; i < std::size(kTestPaths); ++i) { base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_).AppendASCII(names_[i]); std::string cracked_id; @@ -191,8 +191,8 @@ {FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS}, }; - for (size_t i = 0; i < base::size(kTestPaths); ++i) { - for (size_t j = 0; j < base::size(relatives); ++j) { + for (size_t i = 0; i < std::size(kTestPaths); ++i) { + for (size_t j = 0; j < std::size(relatives); ++j) { SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value() << " " << relatives[j].path); base::FilePath virtual_path = isolated_context() @@ -244,8 +244,8 @@ {FPL("foo/..\\baz"), SHOULD_FAIL_WITH_WIN_SEPARATORS}, }; - for (size_t i = 0; i < base::size(kTestPaths); ++i) { - for (size_t j = 0; j < base::size(relatives); ++j) { + for (size_t i = 0; i < std::size(kTestPaths); ++i) { + for (size_t j = 0; j < std::size(relatives); ++j) { SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value() << " " << relatives[j].path); base::FilePath virtual_path = isolated_context()
diff --git a/storage/browser/file_system/obfuscated_file_util_unittest.cc b/storage/browser/file_system/obfuscated_file_util_unittest.cc index 604674b..408808c 100644 --- a/storage/browser/file_system/obfuscated_file_util_unittest.cc +++ b/storage/browser/file_system/obfuscated_file_util_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "storage/browser/file_system/obfuscated_file_util.h" + #include <stddef.h> #include <stdint.h> @@ -14,7 +16,6 @@ #include "base/bind.h" #include "base/callback_helpers.h" -#include "base/cxx17_backports.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -33,7 +34,6 @@ #include "storage/browser/file_system/file_system_operation_context.h" #include "storage/browser/file_system/file_system_url.h" #include "storage/browser/file_system/file_system_usage_cache.h" -#include "storage/browser/file_system/obfuscated_file_util.h" #include "storage/browser/file_system/obfuscated_file_util_memory_delegate.h" #include "storage/browser/file_system/sandbox_directory_database.h" #include "storage/browser/file_system/sandbox_file_system_backend_delegate.h" @@ -372,7 +372,7 @@ EXPECT_EQ(!is_incognito(), FileExists(data_path)); const char data[] = "test data"; - const int length = base::size(data) - 1; + const int length = std::size(data) - 1; base::File file = ofu()->CreateOrOpen( context.get(), url, base::File::FLAG_WRITE | base::File::FLAG_OPEN); @@ -1342,7 +1342,7 @@ const int64_t kSourceLength = 5; const int64_t kDestLength = 50; - for (size_t i = 0; i < base::size(kCopyMoveTestCases); ++i) { + for (size_t i = 0; i < std::size(kCopyMoveTestCases); ++i) { SCOPED_TRACE(testing::Message() << "kCopyMoveTestCase " << i); const CopyMoveTestCaseRecord& test_case = kCopyMoveTestCases[i]; SCOPED_TRACE(testing::Message() @@ -1588,7 +1588,7 @@ std::set<blink::StorageKey> storage_keys_expected; storage_keys_expected.insert(storage_key()); - for (size_t i = 0; i < base::size(kOriginEnumerationTestRecords); ++i) { + for (size_t i = 0; i < std::size(kOriginEnumerationTestRecords); ++i) { SCOPED_TRACE(testing::Message() << "Validating kOriginEnumerationTestRecords " << i); const OriginEnumerationTestRecord& record = @@ -1802,7 +1802,7 @@ EXPECT_EQ(base::File::FILE_OK, AsyncFileTestHelper::ReadDirectory(file_system_context(), empty_path, &entries)); - EXPECT_EQ(base::size(kPath) - 1, entries.size()); + EXPECT_EQ(std::size(kPath) - 1, entries.size()); } TEST_P(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) {
diff --git a/storage/browser/file_system/sandbox_directory_database.cc b/storage/browser/file_system/sandbox_directory_database.cc index 9f6bb1b..7f66743 100644 --- a/storage/browser/file_system/sandbox_directory_database.cc +++ b/storage/browser/file_system/sandbox_directory_database.cc
@@ -13,7 +13,6 @@ #include <set> #include "base/containers/stack.h" -#include "base/cxx17_backports.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/location.h" @@ -305,8 +304,8 @@ if (!path_.AppendRelativePath(absolute_file_path, &relative_file_path)) return false; - if (std::find(kExcludes, kExcludes + base::size(kExcludes), - relative_file_path) != kExcludes + base::size(kExcludes)) + if (std::find(kExcludes, kExcludes + std::size(kExcludes), + relative_file_path) != kExcludes + std::size(kExcludes)) continue; if (find_info.IsDirectory()) {
diff --git a/storage/browser/file_system/sandbox_file_system_backend_unittest.cc b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc index 1367e290..9bd79e4f 100644 --- a/storage/browser/file_system/sandbox_file_system_backend_unittest.cc +++ b/storage/browser/file_system/sandbox_file_system_backend_unittest.cc
@@ -11,7 +11,6 @@ #include <vector> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/run_loop.h" @@ -173,8 +172,8 @@ "http://www.foo.com:8080/", "http://www.foo.com:80/", }; - size_t temporary_size = base::size(temporary_origins); - size_t persistent_size = base::size(persistent_origins); + size_t temporary_size = std::size(temporary_origins); + size_t persistent_size = std::size(persistent_origins); std::set<blink::StorageKey> temporary_set, persistent_set; for (size_t i = 0; i < temporary_size; ++i) { CreateOriginTypeDirectory(temporary_origins[i], kFileSystemTypeTemporary); @@ -211,12 +210,11 @@ } TEST_P(SandboxFileSystemBackendTest, GetRootPathCreateAndExamine) { - std::vector<base::FilePath> returned_root_path( - base::size(kRootPathTestCases)); + std::vector<base::FilePath> returned_root_path(std::size(kRootPathTestCases)); SetUpNewBackend(CreateAllowFileAccessOptions()); // Create a new root directory. - for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathTestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPath (create) #" << i << " " << kRootPathTestCases[i].expected_path); @@ -235,7 +233,7 @@ // Get the root directory with create=false and see if we get the // same directory. - for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathTestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPath (get) #" << i << " " << kRootPathTestCases[i].expected_path); @@ -250,8 +248,7 @@ TEST_P(SandboxFileSystemBackendTest, GetRootPathCreateAndExamineWithNewBackend) { - std::vector<base::FilePath> returned_root_path( - base::size(kRootPathTestCases)); + std::vector<base::FilePath> returned_root_path(std::size(kRootPathTestCases)); SetUpNewBackend(CreateAllowFileAccessOptions()); base::FilePath root_path1; @@ -270,7 +267,7 @@ SetUpNewBackend(CreateDisallowFileAccessOptions()); // Try to get a root directory without creating. - for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathTestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPath (create=false) #" << i << " " << kRootPathTestCases[i].expected_path); EXPECT_FALSE(GetRootPath(kRootPathTestCases[i].origin_url, @@ -283,7 +280,7 @@ SetUpNewBackend(CreateIncognitoFileSystemOptions()); // Try to get a root directory. - for (size_t i = 0; i < base::size(kRootPathTestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathTestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPath (incognito) #" << i << " " << kRootPathTestCases[i].expected_path); EXPECT_EQ(IsPersistentFileSystemEnabledIncognito() || @@ -296,7 +293,7 @@ TEST_P(SandboxFileSystemBackendTest, GetRootPathFileURI) { SetUpNewBackend(CreateDisallowFileAccessOptions()); - for (size_t i = 0; i < base::size(kRootPathFileURITestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathFileURITestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPathFileURI (disallow) #" << i << " " << kRootPathFileURITestCases[i].expected_path); @@ -308,7 +305,7 @@ TEST_P(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlag) { SetUpNewBackend(CreateAllowFileAccessOptions()); - for (size_t i = 0; i < base::size(kRootPathFileURITestCases); ++i) { + for (size_t i = 0; i < std::size(kRootPathFileURITestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPathFileURI (allow) #" << i << " " << kRootPathFileURITestCases[i].expected_path);
diff --git a/storage/browser/file_system/sandbox_origin_database_unittest.cc b/storage/browser/file_system/sandbox_origin_database_unittest.cc index 8f9c198..95fa91c 100644 --- a/storage/browser/file_system/sandbox_origin_database_unittest.cc +++ b/storage/browser/file_system/sandbox_origin_database_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "storage/browser/file_system/sandbox_origin_database.h" + #include <stddef.h> #include <algorithm> @@ -11,12 +13,10 @@ #include <string> #include <vector> -#include "base/cxx17_backports.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" -#include "storage/browser/file_system/sandbox_origin_database.h" #include "storage/browser/test/sandbox_database_test_helper.h" #include "storage/common/file_system/file_system_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -208,7 +208,7 @@ }; auto database = std::make_unique<SandboxOriginDatabase>(kFSDir, nullptr); - for (size_t i = 0; i < base::size(kOrigins); ++i) { + for (size_t i = 0; i < std::size(kOrigins); ++i) { base::FilePath path; EXPECT_FALSE(database->HasOriginPath(kOrigins[i])); EXPECT_TRUE(database->GetPathForOrigin(kOrigins[i], &path)); @@ -242,7 +242,7 @@ // Expect all but last added origin will be repaired back, and kOrigins[1] // should be dropped due to absence of backing directory. - EXPECT_EQ(base::size(kOrigins) - 2, origins_in_db.size()); + EXPECT_EQ(std::size(kOrigins) - 2, origins_in_db.size()); const std::string kOrigin("piyo.example.org"); EXPECT_FALSE(database->HasOriginPath(kOrigin));
diff --git a/storage/browser/quota/quota_database.cc b/storage/browser/quota/quota_database.cc index ef8f638..bb4fd345 100644 --- a/storage/browser/quota/quota_database.cc +++ b/storage/browser/quota/quota_database.cc
@@ -88,7 +88,7 @@ " last_modified INTEGER NOT NULL," " expiration INTEGER NOT NULL," " quota INTEGER NOT NULL)"}}; -const size_t QuotaDatabase::kTableCount = base::size(QuotaDatabase::kTables); +const size_t QuotaDatabase::kTableCount = std::size(QuotaDatabase::kTables); // static const QuotaDatabase::IndexSchema QuotaDatabase::kIndexes[] = { @@ -98,7 +98,7 @@ {"buckets_by_last_modified", kBucketTable, "(type, last_modified)", false}, {"buckets_by_expiration", kBucketTable, "(expiration)", false}, }; -const size_t QuotaDatabase::kIndexCount = base::size(QuotaDatabase::kIndexes); +const size_t QuotaDatabase::kIndexCount = std::size(QuotaDatabase::kIndexes); QuotaDatabase::BucketTableEntry::BucketTableEntry() = default; @@ -272,6 +272,37 @@ statement.ColumnInt(2)); } +QuotaErrorOr<BucketInfo> QuotaDatabase::GetBucketById(BucketId bucket_id) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + QuotaError open_error = EnsureOpened(EnsureOpenedMode::kFailIfNotFound); + if (open_error != QuotaError::kNone) + return open_error; + + static constexpr char kSql[] = + // clang-format off + "SELECT storage_key, type, name, expiration, quota " + "FROM buckets " + "WHERE id = ?"; + // clang-format on + sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); + statement.BindInt64(0, bucket_id.value()); + + if (!statement.Step()) { + return statement.Succeeded() ? QuotaError::kNotFound + : QuotaError::kDatabaseError; + } + + absl::optional<StorageKey> storage_key = + StorageKey::Deserialize(statement.ColumnString(0)); + if (!storage_key.has_value()) + return QuotaError::kNotFound; + + return BucketInfo(bucket_id, storage_key.value(), + static_cast<StorageType>(statement.ColumnInt(1)), + statement.ColumnString(2), statement.ColumnTime(3), + statement.ColumnInt(4)); +} + QuotaErrorOr<std::set<BucketLocator>> QuotaDatabase::GetBucketsForType( StorageType type) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/storage/browser/quota/quota_database.h b/storage/browser/quota/quota_database.h index 96915f6..193d3432 100644 --- a/storage/browser/quota/quota_database.h +++ b/storage/browser/quota/quota_database.h
@@ -134,6 +134,11 @@ const std::string& bucket_name, blink::mojom::StorageType storage_type); + // Retrieves BucketInfo of the bucket with `bucket_id`. + // Returns a QuotaError::kEntryNotFound if the bucket does not exist, or + // a QuotaError::kDatabaseError if the operation has failed. + QuotaErrorOr<BucketInfo> GetBucketById(BucketId bucket_id); + // Returns all buckets for `type` in the buckets table. Returns a QuotaError // if the operation has failed. QuotaErrorOr<std::set<BucketLocator>> GetBucketsForType(
diff --git a/storage/browser/quota/quota_database_unittest.cc b/storage/browser/quota/quota_database_unittest.cc index b6df8c2..6d760aa9 100644 --- a/storage/browser/quota/quota_database_unittest.cc +++ b/storage/browser/quota/quota_database_unittest.cc
@@ -314,6 +314,36 @@ EXPECT_EQ(result.error(), QuotaError::kNotFound); } +TEST_P(QuotaDatabaseTest, GetBucketById) { + QuotaDatabase db(use_in_memory_db() ? base::FilePath() : DbPath()); + EXPECT_TRUE(EnsureOpened(&db, EnsureOpenedMode::kCreateIfNotFound)); + + // Add a bucket entry into the bucket table. + StorageKey storage_key = + StorageKey::CreateFromStringForTesting("http://google/"); + std::string bucket_name = "google_bucket"; + QuotaErrorOr<BucketInfo> result = + db.CreateBucketForTesting(storage_key, bucket_name, kPerm); + ASSERT_TRUE(result.ok()); + + BucketInfo created_bucket = result.value(); + ASSERT_GT(created_bucket.id.value(), 0); + ASSERT_EQ(created_bucket.name, bucket_name); + ASSERT_EQ(created_bucket.storage_key, storage_key); + ASSERT_EQ(created_bucket.type, kPerm); + + result = db.GetBucketById(created_bucket.id); + ASSERT_TRUE(result.ok()); + EXPECT_EQ(result.value().name, created_bucket.name); + EXPECT_EQ(result.value().storage_key, created_bucket.storage_key); + ASSERT_EQ(result.value().type, created_bucket.type); + + constexpr BucketId kNonExistentBucketId(7777); + result = db.GetBucketById(BucketId(kNonExistentBucketId)); + ASSERT_FALSE(result.ok()); + EXPECT_EQ(result.error(), QuotaError::kNotFound); +} + TEST_P(QuotaDatabaseTest, GetBucketsForType) { QuotaDatabase db(use_in_memory_db() ? base::FilePath() : DbPath()); EXPECT_TRUE(EnsureOpened(&db, EnsureOpenedMode::kCreateIfNotFound));
diff --git a/storage/browser/quota/quota_manager_impl.cc b/storage/browser/quota/quota_manager_impl.cc index cada5f8..1de952cc 100644 --- a/storage/browser/quota/quota_manager_impl.cc +++ b/storage/browser/quota/quota_manager_impl.cc
@@ -47,6 +47,7 @@ #include "components/services/storage/public/mojom/quota_client.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "storage/browser/quota/client_usage_tracker.h" +#include "storage/browser/quota/quota_callbacks.h" #include "storage/browser/quota/quota_client_type.h" #include "storage/browser/quota/quota_features.h" #include "storage/browser/quota/quota_macros.h" @@ -136,6 +137,12 @@ return database->GetBucket(storage_key, bucket_name, type); } +QuotaErrorOr<BucketInfo> GetBucketByIdOnDBThread(BucketId bucket_id, + QuotaDatabase* database) { + DCHECK(database); + return database->GetBucketById(bucket_id); +} + QuotaErrorOr<std::set<StorageKey>> GetStorageKeysForTypeOnDBThread( StorageType type, QuotaDatabase* database) { @@ -1944,22 +1951,11 @@ DCHECK(callback); EnsureDatabaseOpened(); - if (callback) - std::move(callback).Run(); - - if (db_disabled_) - return; - - // TODO(crbug.com/1199417): Update bucket usage in UsageTracker once - // QuotaClient & UsageTracker operate by bucket. UsageTracker should be - // updated after ensuring there is a entry in the QuotaDatabase. - // Run `callback` on completion. - PostTaskAndReplyWithResultForDBThread( - base::BindOnce(&UpdateBucketModifiedTimeOnDBThread, bucket_id, - modification_time), - base::BindOnce(&QuotaManagerImpl::OnComplete, - weak_factory_.GetWeakPtr())); + base::BindOnce(&GetBucketByIdOnDBThread, bucket_id), + base::BindOnce(&QuotaManagerImpl::DidGetBucketForUsage, + weak_factory_.GetWeakPtr(), client_id, delta, + modification_time, std::move(callback))); } void QuotaManagerImpl::DumpQuotaTable(DumpQuotaTableCallback callback) {
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc index 96ab2a5..59fc4624 100644 --- a/storage/browser/quota/quota_manager_unittest.cc +++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -1695,6 +1695,55 @@ EXPECT_EQ(usage(), 4000 + 50000 + 900000000); } +TEST_F(QuotaManagerImplTest, GetUsage_WithBucketModification) { + static const ClientBucketData kData[] = { + {"http://foo.com/", kDefaultBucketName, kTemp, 1}, + {"http://foo.com/", kDefaultBucketName, kPerm, 50}, + {"http://bar.com/", "logs", kTemp, 100}, + }; + + MockQuotaClient* client = + CreateAndRegisterClient(QuotaClientType::kFileSystem, {kTemp, kPerm}); + RegisterClientBucketData(client, kData); + + auto global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 50); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); + + auto foo_temp_bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); + ASSERT_TRUE(foo_temp_bucket.ok()); + client->ModifyBucketAndNotify(foo_temp_bucket->id, 80000000); + + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 1 + 100 + 80000000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); + + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 50); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); + + auto foo_perm_bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kPerm); + ASSERT_TRUE(foo_perm_bucket.ok()); + client->ModifyBucketAndNotify(foo_perm_bucket->id, 200); + + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 50 + 200); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); + + GetHostUsageWithBreakdown("bar.com", kTemp); + EXPECT_EQ(usage(), 100); + + auto bar_temp_bucket = + GetBucket(ToStorageKey("http://bar.com/"), "logs", kTemp); + ASSERT_TRUE(bar_temp_bucket.ok()); + client->ModifyBucketAndNotify(bar_temp_bucket->id, 900000000); + + GetHostUsageWithBreakdown("bar.com", kTemp); + EXPECT_EQ(usage(), 100 + 900000000); +} + TEST_F(QuotaManagerImplTest, GetUsage_WithDeleteBucket) { static const ClientBucketData kData[] = { {"http://foo.com/", kDefaultBucketName, kTemp, 1},
diff --git a/storage/browser/test/file_system_test_file_set.cc b/storage/browser/test/file_system_test_file_set.cc index 2367bb3..f42de7c2 100644 --- a/storage/browser/test/file_system_test_file_set.cc +++ b/storage/browser/test/file_system_test_file_set.cc
@@ -9,7 +9,6 @@ #include <limits> #include <string> -#include "base/cxx17_backports.h" #include "base/files/file.h" #include "base/files/file_util.h" #include "base/rand_util.h" @@ -39,7 +38,7 @@ }; const size_t kRegularFileSystemTestCaseSize = - base::size(kRegularFileSystemTestCases); + std::size(kRegularFileSystemTestCases); void SetUpOneFileSystemTestCase(const base::FilePath& root_path, const FileSystemTestCaseRecord& test_case) { @@ -60,7 +59,7 @@ } void SetUpRegularFileSystemTestCases(const base::FilePath& root_path) { - for (size_t i = 0; i < base::size(kRegularFileSystemTestCases); ++i) { + for (size_t i = 0; i < std::size(kRegularFileSystemTestCases); ++i) { SCOPED_TRACE(testing::Message() << "Creating kRegularTestCases " << i); SetUpOneFileSystemTestCase(root_path, kRegularFileSystemTestCases[i]); }
diff --git a/storage/browser/test/mock_quota_client.cc b/storage/browser/test/mock_quota_client.cc index c67f480..23799ff 100644 --- a/storage/browser/test/mock_quota_client.cc +++ b/storage/browser/test/mock_quota_client.cc
@@ -64,6 +64,19 @@ base::SequencedTaskRunnerHandle::Get(), base::DoNothing()); } +void MockQuotaClient::ModifyBucketAndNotify(BucketId bucket_id, int64_t delta) { + auto it = std::find_if(bucket_data_.begin(), bucket_data_.end(), + [bucket_id](std::pair<BucketLocator, int64_t> entry) { + return entry.first.id == bucket_id; + }); + DCHECK(it != bucket_data_.end()); + it->second += delta; + DCHECK_GE(it->second, 0); + quota_manager_proxy_->NotifyBucketModified( + client_type_, bucket_id, delta, IncrementMockTime(), + base::SequencedTaskRunnerHandle::Get(), base::DoNothing()); +} + void MockQuotaClient::AddBucketToErrorSet(const BucketLocator& bucket) { error_buckets_.emplace(bucket); }
diff --git a/storage/browser/test/mock_quota_client.h b/storage/browser/test/mock_quota_client.h index 5756bdaf..020667c 100644 --- a/storage/browser/test/mock_quota_client.h +++ b/storage/browser/test/mock_quota_client.h
@@ -58,6 +58,7 @@ void ModifyStorageKeyAndNotify(const blink::StorageKey& storage_key, blink::mojom::StorageType type, int64_t delta); + void ModifyBucketAndNotify(BucketId bucket_id, int64_t delta); void AddBucketToErrorSet(const BucketLocator& bucket);
diff --git a/storage/common/database/database_identifier.cc b/storage/common/database/database_identifier.cc index 9e369f6..1b23ec9 100644 --- a/storage/common/database/database_identifier.cc +++ b/storage/common/database/database_identifier.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "url/url_canon.h" @@ -116,7 +115,7 @@ if (identifier.find("..") != std::string::npos) return DatabaseIdentifier(); static const char kForbidden[] = {'\\', '/', ':', '\0'}; - if (identifier.find_first_of(kForbidden, 0, base::size(kForbidden)) != + if (identifier.find_first_of(kForbidden, 0, std::size(kForbidden)) != std::string::npos) { return DatabaseIdentifier(); }
diff --git a/storage/common/database/database_identifier_unittest.cc b/storage/common/database/database_identifier_unittest.cc index 01597087..a71b52a 100644 --- a/storage/common/database/database_identifier_unittest.cc +++ b/storage/common/database/database_identifier_unittest.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" #include "url/origin.h" @@ -165,7 +164,7 @@ {"x\x80x", "__0", false}, }; - for (size_t i = 0; i < base::size(cases); ++i) { + for (size_t i = 0; i < std::size(cases); ++i) { GURL origin_url("http://" + cases[i].hostname); url::Origin origin = url::Origin::Create(origin_url); DatabaseIdentifier identifier_from_url =
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 9c83490..405767aa 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1778,7 +1778,7 @@ { "args": [], "cros_board": "atlas", - "cros_img": "atlas-release/R101-14535.0.0", + "cros_img": "atlas-release/R101-14537.0.0", "name": "lacros_all_tast_tests_ATLAS_LKGM", "resultdb": { "enable": true, @@ -1838,7 +1838,7 @@ { "args": [], "cros_board": "eve", - "cros_img": "eve-release/R101-14535.0.0", + "cros_img": "eve-release/R101-14537.0.0", "name": "lacros_all_tast_tests_EVE_LKGM", "resultdb": { "enable": true, @@ -1943,7 +1943,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "lacros_all_tast_tests_KEVIN_LKGM", "resultdb": { "enable": true, @@ -1958,7 +1958,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "lacros_all_tast_tests_HANA_LKGM", "resultdb": { "enable": true, @@ -1973,7 +1973,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "ozone_unittests_KEVIN_LKGM", "resultdb": { "enable": true, @@ -1987,7 +1987,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "ozone_unittests_HANA_LKGM", "resultdb": { "enable": true, @@ -2001,7 +2001,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "viz_unittests_KEVIN_LKGM", "resultdb": { "enable": true, @@ -2015,7 +2015,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "viz_unittests_HANA_LKGM", "resultdb": { "enable": true,
diff --git a/testing/buildbot/chromium.android.fyi.json b/testing/buildbot/chromium.android.fyi.json index 1e6f2be..1c0165c 100644 --- a/testing/buildbot/chromium.android.fyi.json +++ b/testing/buildbot/chromium.android.fyi.json
@@ -5230,7 +5230,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5398,7 +5398,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5482,7 +5482,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -5650,7 +5650,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index c5a7bfb..f35795e0 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -41650,7 +41650,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -41818,7 +41818,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -41902,7 +41902,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42070,7 +42070,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42158,7 +42158,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42326,7 +42326,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42410,7 +42410,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42578,7 +42578,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42733,7 +42733,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42901,7 +42901,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -42985,7 +42985,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43153,7 +43153,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43308,7 +43308,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43476,7 +43476,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43560,7 +43560,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M100", - "revision": "version:100.0.4896.15" + "revision": "version:100.0.4896.16" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}", @@ -43728,7 +43728,7 @@ { "cipd_package": "chromium/testing/weblayer-x86", "location": "weblayer_instrumentation_test_M99", - "revision": "version:99.0.4844.52" + "revision": "version:99.0.4844.53" }, { "cipd_package": "infra/tools/luci/logdog/butler/${platform}",
diff --git a/testing/buildbot/internal.chromeos.fyi.json b/testing/buildbot/internal.chromeos.fyi.json index 196cd46..3d59bbe8 100644 --- a/testing/buildbot/internal.chromeos.fyi.json +++ b/testing/buildbot/internal.chromeos.fyi.json
@@ -1125,7 +1125,7 @@ { "args": [], "cros_board": "octopus", - "cros_img": "octopus-release/R101-14535.0.0", + "cros_img": "octopus-release/R101-14537.0.0", "name": "lacros_fyi_tast_tests_OCTOPUS_LKGM", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -1169,7 +1169,7 @@ { "args": [], "cros_board": "octopus", - "cros_img": "octopus-release/R101-14535.0.0", + "cros_img": "octopus-release/R101-14537.0.0", "name": "ozone_unittests_OCTOPUS_LKGM", "swarming": {}, "test": "ozone_unittests", @@ -1217,7 +1217,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "lacros_all_tast_tests_KEVIN_LKGM", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -1228,7 +1228,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "lacros_all_tast_tests_HANA_LKGM", "swarming": {}, "tast_expr": "(\"group:mainline\" && \"dep:lacros\" && !informational)", @@ -1239,7 +1239,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "ozone_unittests_KEVIN_LKGM", "swarming": {}, "test": "ozone_unittests", @@ -1249,7 +1249,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "ozone_unittests_HANA_LKGM", "swarming": {}, "test": "ozone_unittests", @@ -1259,7 +1259,7 @@ { "args": [], "cros_board": "kevin", - "cros_img": "kevin-release/R101-14535.0.0", + "cros_img": "kevin-release/R101-14537.0.0", "name": "viz_unittests_KEVIN_LKGM", "swarming": {}, "test": "viz_unittests", @@ -1269,7 +1269,7 @@ { "args": [], "cros_board": "hana", - "cros_img": "hana-release/R101-14535.0.0", + "cros_img": "hana-release/R101-14537.0.0", "name": "viz_unittests_HANA_LKGM", "swarming": {}, "test": "viz_unittests",
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index bbbc418..fd38322d 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -387,7 +387,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M100', - 'revision': 'version:100.0.4896.15', + 'revision': 'version:100.0.4896.16', } ], }, @@ -411,7 +411,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M99', - 'revision': 'version:99.0.4844.52', + 'revision': 'version:99.0.4844.53', } ], }, @@ -459,7 +459,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M100', - 'revision': 'version:100.0.4896.15', + 'revision': 'version:100.0.4896.16', } ], }, @@ -483,7 +483,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M99', - 'revision': 'version:99.0.4844.52', + 'revision': 'version:99.0.4844.53', } ], }, @@ -531,7 +531,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M100', - 'revision': 'version:100.0.4896.15', + 'revision': 'version:100.0.4896.16', } ], }, @@ -555,7 +555,7 @@ { 'cipd_package': 'chromium/testing/weblayer-x86', 'location': 'weblayer_instrumentation_test_M99', - 'revision': 'version:99.0.4844.52', + 'revision': 'version:99.0.4844.53', } ], }, @@ -588,7 +588,7 @@ 'skylab': { 'cros_board': 'atlas', 'cros_chrome_version': '101.0.4907.0', - 'cros_img': 'atlas-release/R101-14535.0.0', + 'cros_img': 'atlas-release/R101-14537.0.0', }, 'enabled': True, 'identifier': 'ATLAS_LKGM', @@ -624,7 +624,7 @@ 'skylab': { 'cros_board': 'eve', 'cros_chrome_version': '101.0.4907.0', - 'cros_img': 'eve-release/R101-14535.0.0', + 'cros_img': 'eve-release/R101-14537.0.0', }, 'enabled': True, 'identifier': 'EVE_LKGM', @@ -660,7 +660,7 @@ 'skylab': { 'cros_board': 'kevin', 'cros_chrome_version': '101.0.4907.0', - 'cros_img': 'kevin-release/R101-14535.0.0', + 'cros_img': 'kevin-release/R101-14537.0.0', }, 'enabled': True, 'identifier': 'KEVIN_LKGM', @@ -669,7 +669,7 @@ 'skylab': { 'cros_board': 'hana', 'cros_chrome_version': '101.0.4907.0', - 'cros_img': 'hana-release/R101-14535.0.0', + 'cros_img': 'hana-release/R101-14537.0.0', }, 'enabled': True, 'identifier': 'HANA_LKGM', @@ -678,7 +678,7 @@ 'skylab': { 'cros_board': 'octopus', 'cros_chrome_version': '101.0.4907.0', - 'cros_img': 'octopus-release/R101-14535.0.0', + 'cros_img': 'octopus-release/R101-14537.0.0', }, 'enabled': True, 'identifier': 'OCTOPUS_LKGM',
diff --git a/third_party/blink/common/client_hints/client_hints.cc b/third_party/blink/common/client_hints/client_hints.cc index bb2426a..c0db2077 100644 --- a/third_party/blink/common/client_hints/client_hints.cc +++ b/third_party/blink/common/client_hints/client_hints.cc
@@ -7,7 +7,6 @@ #include <utility> #include <vector> -#include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/no_destructor.h" #include "base/strings/strcat.h" @@ -114,7 +113,7 @@ }; const size_t kWebEffectiveConnectionTypeMappingCount = - base::size(kWebEffectiveConnectionTypeMapping); + std::size(kWebEffectiveConnectionTypeMapping); bool IsClientHintSentByDefault(network::mojom::WebClientHintsType type) { switch (type) {
diff --git a/third_party/blink/common/custom_handlers/protocol_handler_utils.cc b/third_party/blink/common/custom_handlers/protocol_handler_utils.cc index c96daa1e..c9a75e1 100644 --- a/third_party/blink/common/custom_handlers/protocol_handler_utils.cc +++ b/third_party/blink/common/custom_handlers/protocol_handler_utils.cc
@@ -17,8 +17,8 @@ static constexpr const char kWebPrefix[] = "web+"; static constexpr const char kExtPrefix[] = "ext+"; - DCHECK_EQ(base::size(kWebPrefix), base::size(kExtPrefix)); - static constexpr const size_t kPrefixLength = base::size(kWebPrefix) - 1; + DCHECK_EQ(std::size(kWebPrefix), std::size(kExtPrefix)); + static constexpr const size_t kPrefixLength = std::size(kWebPrefix) - 1; if (base::StartsWith(scheme, kWebPrefix, base::CompareCase::INSENSITIVE_ASCII) || (allow_ext_prefix &&
diff --git a/third_party/blink/common/notifications/notification_mojom_traits_unittest.cc b/third_party/blink/common/notifications/notification_mojom_traits_unittest.cc index 3a58405..20bee3b 100644 --- a/third_party/blink/common/notifications/notification_mojom_traits_unittest.cc +++ b/third_party/blink/common/notifications/notification_mojom_traits_unittest.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/public/common/notifications/notification_mojom_traits.h" -#include "base/cxx17_backports.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -49,7 +48,7 @@ const int vibration_pattern[] = {500, 100, 30}; notification_data.vibration_pattern.assign( - vibration_pattern, vibration_pattern + base::size(vibration_pattern)); + vibration_pattern, vibration_pattern + std::size(vibration_pattern)); notification_data.timestamp = base::Time::FromJsTime(1513966159000.); notification_data.renotify = true; @@ -58,7 +57,7 @@ notification_data.show_trigger_timestamp = base::Time::Now(); const char data[] = "mock binary notification data"; - notification_data.data.assign(data, data + base::size(data)); + notification_data.data.assign(data, data + std::size(data)); notification_data.actions.resize(2); notification_data.actions[0] = blink::mojom::NotificationAction::New();
diff --git a/third_party/blink/common/origin_trials/trial_token_unittest.cc b/third_party/blink/common/origin_trials/trial_token_unittest.cc index e56a4c67..630d4f0 100644 --- a/third_party/blink/common/origin_trials/trial_token_unittest.cc +++ b/third_party/blink/common/origin_trials/trial_token_unittest.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/test/simple_test_clock.h" @@ -695,30 +694,30 @@ invalid_timestamp_(base::Time::FromDoubleT(kInvalidTimestamp)), expected_v2_signature_( std::string(reinterpret_cast<const char*>(kSampleTokenV2Signature), - base::size(kSampleTokenV2Signature))), + std::size(kSampleTokenV2Signature))), expected_v3_signature_( std::string(reinterpret_cast<const char*>(kSampleTokenV3Signature), - base::size(kSampleTokenV3Signature))), + std::size(kSampleTokenV3Signature))), expected_subdomain_signature_(std::string( reinterpret_cast<const char*>(kSampleSubdomainTokenSignature), - base::size(kSampleSubdomainTokenSignature))), + std::size(kSampleSubdomainTokenSignature))), expected_nonsubdomain_signature_(std::string( reinterpret_cast<const char*>(kSampleNonSubdomainTokenSignature), - base::size(kSampleNonSubdomainTokenSignature))), + std::size(kSampleNonSubdomainTokenSignature))), expected_third_party_signature_(std::string( reinterpret_cast<const char*>(kSampleThirdPartyTokenSignature), - base::size(kSampleThirdPartyTokenSignature))), + std::size(kSampleThirdPartyTokenSignature))), expected_non_third_party_signature_(std::string( reinterpret_cast<const char*>(kSampleNonThirdPartyTokenSignature), - base::size(kSampleNonThirdPartyTokenSignature))), + std::size(kSampleNonThirdPartyTokenSignature))), expected_third_party_usage_empty_signature_( std::string(reinterpret_cast<const char*>( kSampleThirdPartyUsageEmptyTokenSignature), - base::size(kSampleThirdPartyUsageEmptyTokenSignature))), - expected_third_party_usage_subset_signature_(std::string( - reinterpret_cast<const char*>( - kSampleThirdPartyUsageSubsetTokenSignature), - base::size(kSampleThirdPartyUsageSubsetTokenSignature))), + std::size(kSampleThirdPartyUsageEmptyTokenSignature))), + expected_third_party_usage_subset_signature_( + std::string(reinterpret_cast<const char*>( + kSampleThirdPartyUsageSubsetTokenSignature), + std::size(kSampleThirdPartyUsageSubsetTokenSignature))), correct_public_key_(kTestPublicKey), incorrect_public_key_(kTestPublicKey2) {} @@ -947,7 +946,7 @@ EXPECT_EQ(kVersion2, token_version); std::string expected_signature( std::string(reinterpret_cast<const char*>(kLargeValidTokenSignature), - base::size(kLargeValidTokenSignature))); + std::size(kLargeValidTokenSignature))); EXPECT_EQ(expected_signature, token_signature); }
diff --git a/third_party/blink/common/origin_trials/trial_token_validator_unittest.cc b/third_party/blink/common/origin_trials/trial_token_validator_unittest.cc index 1bb94be..b23e23e3 100644 --- a/third_party/blink/common/origin_trials/trial_token_validator_unittest.cc +++ b/third_party/blink/common/origin_trials/trial_token_validator_unittest.cc
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/containers/flat_set.h" -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" @@ -228,10 +227,10 @@ insecure_origin_(url::Origin::Create(GURL(kInsecureOrigin))), valid_token_signature_( std::string(reinterpret_cast<const char*>(kSampleTokenSignature), - base::size(kSampleTokenSignature))), + std::size(kSampleTokenSignature))), expired_token_signature_( std::string(reinterpret_cast<const char*>(kExpiredTokenSignature), - base::size(kExpiredTokenSignature))), + std::size(kExpiredTokenSignature))), response_headers_(new net::HttpResponseHeaders("")) { TrialTokenValidator::SetOriginTrialPolicyGetter( base::BindRepeating([](OriginTrialPolicy* policy) { return policy; },
diff --git a/third_party/blink/common/unique_name/unique_name_helper.cc b/third_party/blink/common/unique_name/unique_name_helper.cc index d1a5deb..c4591c4 100644 --- a/third_party/blink/common/unique_name/unique_name_helper.cc +++ b/third_party/blink/common/unique_name/unique_name_helper.cc
@@ -8,7 +8,6 @@ #include <utility> #include "base/check_op.h" -#include "base/cxx17_backports.h" #include "base/memory/raw_ptr.h" #include "base/notreached.h" #include "base/strings/string_number_conversions.h" @@ -164,9 +163,9 @@ std::string hashed_name; uint8_t result[crypto::kSHA256Length]; - crypto::SHA256HashString(name, result, base::size(result)); + crypto::SHA256HashString(name, result, std::size(result)); hashed_name += "<!--frameHash"; - hashed_name += base::HexEncode(result, base::size(result)); + hashed_name += base::HexEncode(result, std::size(result)); hashed_name += "-->"; return hashed_name; }
diff --git a/third_party/blink/public/common/context_menu_data/context_menu_mojom_traits.h b/third_party/blink/public/common/context_menu_data/context_menu_mojom_traits.h index 60fd177..0677a65 100644 --- a/third_party/blink/public/common/context_menu_data/context_menu_mojom_traits.h +++ b/third_party/blink/public/common/context_menu_data/context_menu_mojom_traits.h
@@ -28,26 +28,26 @@ static int y(const blink::UntrustworthyContextMenuParams& r) { return r.y; } - static const GURL link_url(const blink::UntrustworthyContextMenuParams& r) { + static const GURL& link_url(const blink::UntrustworthyContextMenuParams& r) { return r.link_url; } - static std::u16string link_text( + static const std::u16string& link_text( const blink::UntrustworthyContextMenuParams& r) { return r.link_text; } - static absl::optional<blink::Impression> impression( + static const absl::optional<blink::Impression>& impression( const blink::UntrustworthyContextMenuParams& r) { return r.impression; } - static const GURL unfiltered_link_url( + static const GURL& unfiltered_link_url( const blink::UntrustworthyContextMenuParams& r) { return r.unfiltered_link_url; } - static const GURL src_url(const blink::UntrustworthyContextMenuParams& r) { + static const GURL& src_url(const blink::UntrustworthyContextMenuParams& r) { return r.src_url; } @@ -60,32 +60,32 @@ return r.media_flags; } - static std::u16string selection_text( + static const std::u16string& selection_text( const blink::UntrustworthyContextMenuParams& r) { return r.selection_text; } - static std::u16string title_text( + static const std::u16string& title_text( const blink::UntrustworthyContextMenuParams& r) { return r.title_text; } - static std::u16string alt_text( + static const std::u16string& alt_text( const blink::UntrustworthyContextMenuParams& r) { return r.alt_text; } - static std::u16string suggested_filename( + static const std::u16string& suggested_filename( const blink::UntrustworthyContextMenuParams& r) { return r.suggested_filename; } - static std::u16string misspelled_word( + static const std::u16string& misspelled_word( const blink::UntrustworthyContextMenuParams& r) { return r.misspelled_word; } - static std::vector<std::u16string> dictionary_suggestions( + static const std::vector<std::u16string>& dictionary_suggestions( const blink::UntrustworthyContextMenuParams& r) { return r.dictionary_suggestions; } @@ -118,7 +118,7 @@ return r.edit_flags; } - static std::string frame_charset( + static const std::string& frame_charset( const blink::UntrustworthyContextMenuParams& r) { return r.frame_charset; } @@ -148,7 +148,7 @@ return r.input_field_type; } - static gfx::Rect selection_rect( + static const gfx::Rect& selection_rect( const blink::UntrustworthyContextMenuParams& r) { return r.selection_rect; }
diff --git a/third_party/blink/public/common/frame/frame_visual_properties_mojom_traits.h b/third_party/blink/public/common/frame/frame_visual_properties_mojom_traits.h index d612d71..e09a04cb 100644 --- a/third_party/blink/public/common/frame/frame_visual_properties_mojom_traits.h +++ b/third_party/blink/public/common/frame/frame_visual_properties_mojom_traits.h
@@ -84,7 +84,7 @@ return r.local_frame_size; } - static absl::optional<viz::LocalSurfaceId> local_surface_id( + static const viz::LocalSurfaceId& local_surface_id( const blink::FrameVisualProperties& r) { return r.local_surface_id; }
diff --git a/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h b/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h index d652df6f..5e26bd2 100644 --- a/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h +++ b/third_party/blink/public/common/user_agent/user_agent_mojom_traits.h
@@ -88,7 +88,7 @@ return data.ua_string_override; } - static const absl::optional<::blink::UserAgentMetadata> ua_metadata_override( + static const absl::optional<::blink::UserAgentMetadata>& ua_metadata_override( const ::blink::UserAgentOverride& data) { return data.ua_metadata_override; }
diff --git a/third_party/blink/public/common/widget/device_emulation_params_mojom_traits.h b/third_party/blink/public/common/widget/device_emulation_params_mojom_traits.h index 426e070..a073adf 100644 --- a/third_party/blink/public/common/widget/device_emulation_params_mojom_traits.h +++ b/third_party/blink/public/common/widget/device_emulation_params_mojom_traits.h
@@ -25,7 +25,7 @@ return r.screen_size; } - static absl::optional<gfx::Point> view_position( + static const absl::optional<gfx::Point>& view_position( const blink::DeviceEmulationParams& r) { return r.view_position; }
diff --git a/third_party/blink/public/common/widget/visual_properties_mojom_traits.h b/third_party/blink/public/common/widget/visual_properties_mojom_traits.h index f4a4c3e..44a4de7 100644 --- a/third_party/blink/public/common/widget/visual_properties_mojom_traits.h +++ b/third_party/blink/public/common/widget/visual_properties_mojom_traits.h
@@ -48,7 +48,7 @@ return r.compositor_viewport_pixel_rect; } - static absl::optional<cc::BrowserControlsParams> browser_controls_params( + static const cc::BrowserControlsParams& browser_controls_params( const blink::VisualProperties& r) { return r.browser_controls_params; } @@ -57,7 +57,7 @@ return r.scroll_focused_node_into_view; } - static absl::optional<viz::LocalSurfaceId> local_surface_id( + static const absl::optional<viz::LocalSurfaceId>& local_surface_id( const blink::VisualProperties& r) { return r.local_surface_id; }
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index 88228fb..03d1c6d 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3490,6 +3490,7 @@ kBlobStoreAccessAcrossTopLevelSite = 4169, kBlobStoreAccessUnknownTopLevelSite = 4170, kCrossOriginAccessBasedOnDocumentDomain = 4171, + kCookieWithTruncatingChar = 4172, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/mojom/widget/visual_properties.mojom b/third_party/blink/public/mojom/widget/visual_properties.mojom index 9ae9723..b92b43e 100644 --- a/third_party/blink/public/mojom/widget/visual_properties.mojom +++ b/third_party/blink/public/mojom/widget/visual_properties.mojom
@@ -48,7 +48,7 @@ // Browser controls params such as top and bottom controls heights, whether // controls shrink blink size etc. - cc.mojom.BrowserControlsParams? browser_controls_params; + cc.mojom.BrowserControlsParams browser_controls_params; // Whether or not the focused node should be scrolled into view after the // resize.
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc index f8311716..060690bb 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc +++ b/third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.cc
@@ -184,7 +184,7 @@ parameter_list[parameter_list_size++] = V8String(isolate, element && element->IsSVGElement() ? "evt" : "event"); } - DCHECK_LE(parameter_list_size, base::size(parameter_list)); + DCHECK_LE(parameter_list_size, std::size(parameter_list)); v8::Local<v8::Object> scopes[3]; size_t scopes_size = 0; @@ -200,7 +200,7 @@ scopes[scopes_size++] = ToV8(element, script_state_of_event_target).As<v8::Object>(); } - DCHECK_LE(scopes_size, base::size(scopes)); + DCHECK_LE(scopes_size, std::size(scopes)); v8::ScriptOrigin origin( isolate, V8String(isolate, source_url_), position_.line_.ZeroBasedInt(),
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc index f5a3c55..d50ecd9 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/v8_script_value_deserializer.cc
@@ -487,7 +487,7 @@ if (!ReadDouble(&d)) return nullptr; } - return DOMMatrix::CreateForSerialization(values, base::size(values)); + return DOMMatrix::CreateForSerialization(values, std::size(values)); } case kDOMMatrix2DReadOnlyTag: { double values[6]; @@ -496,7 +496,7 @@ return nullptr; } return DOMMatrixReadOnly::CreateForSerialization(values, - base::size(values)); + std::size(values)); } case kDOMMatrixTag: { double values[16]; @@ -504,7 +504,7 @@ if (!ReadDouble(&d)) return nullptr; } - return DOMMatrix::CreateForSerialization(values, base::size(values)); + return DOMMatrix::CreateForSerialization(values, std::size(values)); } case kDOMMatrixReadOnlyTag: { double values[16]; @@ -513,7 +513,7 @@ return nullptr; } return DOMMatrixReadOnly::CreateForSerialization(values, - base::size(values)); + std::size(values)); } case kMessagePortTag: { uint32_t index = 0;
diff --git a/third_party/blink/renderer/bindings/modules/v8/v8_context_snapshot_impl.cc b/third_party/blink/renderer/bindings/modules/v8/v8_context_snapshot_impl.cc index beda3232..150c099 100644 --- a/third_party/blink/renderer/bindings/modules/v8/v8_context_snapshot_impl.cc +++ b/third_party/blink/renderer/bindings/modules/v8/v8_context_snapshot_impl.cc
@@ -301,7 +301,7 @@ int indices[] = {kV8DOMWrapperObjectIndex, kV8DOMWrapperTypeIndex}; void* values[] = {nullptr, const_cast<WrapperTypeInfo*>(document_wrapper_type_info)}; - document_wrapper->SetAlignedPointerInInternalFields(base::size(indices), + document_wrapper->SetAlignedPointerInInternalFields(std::size(indices), indices, values); V8PrivateProperty::GetWindowDocumentCachedAccessor(isolate).Set( @@ -400,12 +400,12 @@ for (size_t world_index = 0; world_index < kNumOfWorlds; ++world_index) { scoped_refptr<DOMWrapperWorld> world = IndexToWorld(isolate, world_index); - for (size_t i = 0; i < base::size(type_info_table); ++i) { + for (size_t i = 0; i < std::size(type_info_table); ++i) { const auto& type_info = type_info_table[i]; v8::Local<v8::FunctionTemplate> interface_template = isolate ->GetDataFromSnapshotOnce<v8::FunctionTemplate>( - world_index * base::size(type_info_table) + i) + world_index * std::size(type_info_table) + i) .ToLocalChecked(); per_isolate_data->AddV8Template(*world, type_info.wrapper_type_info, interface_template); @@ -474,7 +474,7 @@ bindings::v8_context_snapshot::GetRefTableOfV8Window(), last_table, }; - DCHECK_EQ(base::size(tables), base::size(type_info_table) + 1); + DCHECK_EQ(std::size(tables), std::size(type_info_table) + 1); size_t size_bytes = 0; for (const auto& table : tables)
diff --git a/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc b/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc index b9fb20a..fa149b2 100644 --- a/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc +++ b/third_party/blink/renderer/bindings/modules/v8/v8_element_test.cc
@@ -13,8 +13,12 @@ protected: void SetUp() override { // Precondition: test strings should not be in the AtomicStringTable yet. - DCHECK(AtomicStringTable::Instance().WeakFind("test-attribute").IsNull()); - DCHECK(AtomicStringTable::Instance().WeakFind("test-value").IsNull()); + DCHECK(AtomicStringTable::Instance() + .WeakFindForTesting("test-attribute") + .IsNull()); + DCHECK(AtomicStringTable::Instance() + .WeakFindForTesting("test-value") + .IsNull()); } void TearDown() override { @@ -22,8 +26,12 @@ // Postcondition: test strings should have been released from the // AtomicStringTable - DCHECK(AtomicStringTable::Instance().WeakFind("test-attribute").IsNull()); - DCHECK(AtomicStringTable::Instance().WeakFind("test-value").IsNull()); + DCHECK(AtomicStringTable::Instance() + .WeakFindForTesting("test-attribute") + .IsNull()); + DCHECK(AtomicStringTable::Instance() + .WeakFindForTesting("test-value") + .IsNull()); } }; @@ -36,13 +44,15 @@ V8TestingScope scope; Eval("document.body.setAttribute('test-attribute', 'test-value')", scope); + EXPECT_FALSE(AtomicStringTable::Instance() + .WeakFindForTesting("test-attribute") + .IsNull()); EXPECT_FALSE( - AtomicStringTable::Instance().WeakFind("test-attribute").IsNull()); - EXPECT_FALSE(AtomicStringTable::Instance().WeakFind("test-value").IsNull()); + AtomicStringTable::Instance().WeakFindForTesting("test-value").IsNull()); #if DCHECK_IS_ON() AtomicString test_attribute("test-attribute"); - EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 10u); + EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 8u); AtomicString test_value("test-value"); EXPECT_EQ(test_value.Impl()->RefCountChangeCountForTesting(), 6u); #endif @@ -57,13 +67,15 @@ V8TestingScope scope; Eval("document.body.getAttribute('test-attribute')", scope); - EXPECT_FALSE( - AtomicStringTable::Instance().WeakFind("test-attribute").IsNull()); - EXPECT_TRUE(AtomicStringTable::Instance().WeakFind("test-value").IsNull()); + EXPECT_FALSE(AtomicStringTable::Instance() + .WeakFindForTesting("test-attribute") + .IsNull()); + EXPECT_TRUE( + AtomicStringTable::Instance().WeakFindForTesting("test-value").IsNull()); #if DCHECK_IS_ON() AtomicString test_attribute("test-attribute"); - EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 7u); + EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 5u); #endif // Trigger a low memory notification. This will signal V8 to clear its @@ -76,9 +88,11 @@ V8TestingScope scope; Eval("document.body.setAttribute('test-attribute', 'test-value')", scope); + EXPECT_FALSE(AtomicStringTable::Instance() + .WeakFindForTesting("test-attribute") + .IsNull()); EXPECT_FALSE( - AtomicStringTable::Instance().WeakFind("test-attribute").IsNull()); - EXPECT_FALSE(AtomicStringTable::Instance().WeakFind("test-value").IsNull()); + AtomicStringTable::Instance().WeakFindForTesting("test-value").IsNull()); #if DCHECK_IS_ON() AtomicString test_attribute("test-attribute"); @@ -90,7 +104,7 @@ Eval("document.body.getAttribute('test-attribute')", scope); #if DCHECK_IS_ON() - EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 6u); + EXPECT_EQ(test_attribute.Impl()->RefCountChangeCountForTesting(), 4u); EXPECT_EQ(test_value.Impl()->RefCountChangeCountForTesting(), 3u); #endif
diff --git a/third_party/blink/renderer/controller/highest_pmf_reporter.cc b/third_party/blink/renderer/controller/highest_pmf_reporter.cc index e0771025..44ddae0 100644 --- a/third_party/blink/renderer/controller/highest_pmf_reporter.cc +++ b/third_party/blink/renderer/controller/highest_pmf_reporter.cc
@@ -120,7 +120,7 @@ peak_resident_bytes_at_current_highest_pmf_ = 0.0; webpage_counts_at_current_highest_pmf_ = 0; report_count_++; - if (report_count_ >= base::size(time_to_report)) { + if (report_count_ >= std::size(time_to_report)) { // Stop observing the MemoryUsageMonitor once there's no more histogram to // report. MemoryUsageMonitor::Instance().RemoveObserver(this);
diff --git a/third_party/blink/renderer/core/accessibility/ax_object_cache.cc b/third_party/blink/renderer/core/accessibility/ax_object_cache.cc index 31f808c..2ebeff8 100644 --- a/third_party/blink/renderer/core/accessibility/ax_object_cache.cc +++ b/third_party/blink/renderer/core/accessibility/ax_object_cache.cc
@@ -30,7 +30,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "third_party/blink/public/web/web_ax_enums.h" #include "third_party/blink/renderer/core/dom/element.h" @@ -73,7 +72,7 @@ static ARIAWidgetSet* CreateARIARoleWidgetSet() { ARIAWidgetSet* widget_set = new HashSet<String, CaseFoldingHash>(); - for (size_t i = 0; i < base::size(g_aria_widgets); ++i) + for (size_t i = 0; i < std::size(g_aria_widgets); ++i) widget_set->insert(String(g_aria_widgets[i])); return widget_set; } @@ -107,8 +106,7 @@ }; bool HasInteractiveARIAAttribute(const Element& element) { - for (size_t i = 0; i < base::size(g_aria_interactive_widget_attributes); - ++i) { + for (size_t i = 0; i < std::size(g_aria_interactive_widget_attributes); ++i) { const char* attribute = g_aria_interactive_widget_attributes[i]; if (element.hasAttribute(attribute)) { return true;
diff --git a/third_party/blink/renderer/core/animation/animation_input_helpers.cc b/third_party/blink/renderer/core/animation/animation_input_helpers.cc index 8d713ff..75bba302 100644 --- a/third_party/blink/renderer/core/animation/animation_input_helpers.cc +++ b/third_party/blink/renderer/core/animation/animation_input_helpers.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/animation/animation_input_helpers.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/animation/property_handle.h" #include "third_party/blink/renderer/core/css/css_value_list.h" #include "third_party/blink/renderer/core/css/parser/css_parser.h" @@ -201,7 +200,7 @@ &svg_names::kYChannelSelectorAttr, &svg_names::kZAttr, }; - for (size_t i = 0; i < base::size(attributes); i++) { + for (size_t i = 0; i < std::size(attributes); i++) { DCHECK(!SVGElement::IsAnimatableCSSProperty(*attributes[i])); supported_attributes.Set(*attributes[i], attributes[i]); }
diff --git a/third_party/blink/renderer/core/content_capture/content_capture_test.cc b/third_party/blink/renderer/core/content_capture/content_capture_test.cc index 7b6c878..92a388c 100644 --- a/third_party/blink/renderer/core/content_capture/content_capture_test.cc +++ b/third_party/blink/renderer/core/content_capture/content_capture_test.cc
@@ -1100,7 +1100,7 @@ base::Milliseconds(500), base::Seconds(1), base::Seconds(2), base::Seconds(4), base::Seconds(8), base::Seconds(16), base::Seconds(32), base::Seconds(64), base::Seconds(128)}; - size_t expected_delays_size = base::size(expected_delays); + size_t expected_delays_size = std::size(expected_delays); // The first task has been scheduled but not run yet, the delay will be // increased until current task starts to run. Verifies the value is // unchanged.
diff --git a/third_party/blink/renderer/core/css/css_computed_style_declaration.cc b/third_party/blink/renderer/core/css/css_computed_style_declaration.cc index 746bcf66..f6f39c2f 100644 --- a/third_party/blink/renderer/core/css/css_computed_style_declaration.cc +++ b/third_party/blink/renderer/core/css/css_computed_style_declaration.cc
@@ -24,7 +24,6 @@ #include "third_party/blink/renderer/core/css/css_computed_style_declaration.h" -#include "base/cxx17_backports.h" #include "base/memory/values_equivalent.h" #include "third_party/blink/renderer/core/css/computed_style_css_value_mapping.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" @@ -83,7 +82,7 @@ if (properties.IsEmpty()) { CSSProperty::FilterWebExposedCSSPropertiesIntoVector( execution_context, kCSSComputableProperties, - base::size(kCSSComputableProperties), properties); + std::size(kCSSComputableProperties), properties); } return properties; }
diff --git a/third_party/blink/renderer/core/css/css_gradient_value.cc b/third_party/blink/renderer/core/css/css_gradient_value.cc index 63d0b08c..1e3d4c5 100644 --- a/third_party/blink/renderer/core/css/css_gradient_value.cc +++ b/third_party/blink/renderer/core/css/css_gradient_value.cc
@@ -30,7 +30,6 @@ #include <tuple> #include <utility> -#include "base/cxx17_backports.h" #include "base/memory/values_equivalent.h" #include "third_party/blink/renderer/core/css/css_color.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" @@ -1322,7 +1321,7 @@ unsigned corner_index = 0; float distance = (point - corners[corner_index]).Length(); - for (unsigned i = 1; i < base::size(corners); ++i) { + for (unsigned i = 1; i < std::size(corners); ++i) { float new_distance = (point - corners[i]).Length(); if (compare(new_distance, distance)) { corner_index = i;
diff --git a/third_party/blink/renderer/core/css/css_primitive_value.cc b/third_party/blink/renderer/core/css/css_primitive_value.cc index 7a6c8db..c382427 100644 --- a/third_party/blink/renderer/core/css/css_primitive_value.cc +++ b/third_party/blink/renderer/core/css/css_primitive_value.cc
@@ -92,6 +92,7 @@ UnitType type) { switch (type) { case UnitType::kNumber: + case UnitType::kInteger: return CSSPrimitiveValue::kUNumber; case UnitType::kPercentage: return CSSPrimitiveValue::kUPercent;
diff --git a/third_party/blink/renderer/core/css/css_primitive_value_test.cc b/third_party/blink/renderer/core/css/css_primitive_value_test.cc index f73f80fd..c4aae6c 100644 --- a/third_party/blink/renderer/core/css/css_primitive_value_test.cc +++ b/third_party/blink/renderer/core/css/css_primitive_value_test.cc
@@ -49,6 +49,11 @@ CSSPrimitiveValue::ValueRange::kNonNegative); } +UnitType ToCanonicalUnit(CSSPrimitiveValue::UnitType unit) { + return CSSPrimitiveValue::CanonicalUnitTypeForCategory( + CSSPrimitiveValue::UnitTypeToUnitCategory(unit)); +} + TEST_F(CSSPrimitiveValueTest, IsTime) { EXPECT_FALSE(Create({5.0, UnitType::kNumber})->IsTime()); EXPECT_FALSE(Create({5.0, UnitType::kDegrees})->IsTime()); @@ -202,5 +207,13 @@ Create({-std::numeric_limits<double>::infinity(), UnitType::kPixels}); EXPECT_EQ(std::numeric_limits<double>::lowest(), value->GetDoubleValue()); } + +TEST_F(CSSPrimitiveValueTest, TestCanonicalizingNumberUnitCategory) { + UnitType canonicalized_from_num = ToCanonicalUnit(UnitType::kNumber); + EXPECT_EQ(canonicalized_from_num, UnitType::kNumber); + + UnitType canonicalized_from_int = ToCanonicalUnit(UnitType::kInteger); + EXPECT_EQ(canonicalized_from_int, UnitType::kNumber); +} } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/core/css/css_selector.cc b/third_party/blink/renderer/core/css/css_selector.cc index e114c2b..332ce74 100644 --- a/third_party/blink/renderer/core/css/css_selector.cc +++ b/third_party/blink/renderer/core/css/css_selector.cc
@@ -29,7 +29,6 @@ #include <algorithm> #include <memory> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/css/css_markup.h" #include "third_party/blink/renderer/core/css/css_selector_list.h" #include "third_party/blink/renderer/core/css/parser/css_parser_context.h" @@ -519,11 +518,11 @@ if (has_arguments) { pseudo_type_map = kPseudoTypeWithArgumentsMap; pseudo_type_map_end = - kPseudoTypeWithArgumentsMap + base::size(kPseudoTypeWithArgumentsMap); + kPseudoTypeWithArgumentsMap + std::size(kPseudoTypeWithArgumentsMap); } else { pseudo_type_map = kPseudoTypeWithoutArgumentsMap; pseudo_type_map_end = kPseudoTypeWithoutArgumentsMap + - base::size(kPseudoTypeWithoutArgumentsMap); + std::size(kPseudoTypeWithoutArgumentsMap); } const NameToPseudoStruct* match = std::lower_bound( pseudo_type_map, pseudo_type_map_end, name,
diff --git a/third_party/blink/renderer/core/css/font_face_cache_test.cc b/third_party/blink/renderer/core/css/font_face_cache_test.cc index 7b72590..35b59b13 100644 --- a/third_party/blink/renderer/core/css/font_face_cache_test.cc +++ b/third_party/blink/renderer/core/css/font_face_cache_test.cc
@@ -3,7 +3,7 @@ // found in the LICENSE file. #include "third_party/blink/renderer/core/css/font_face_cache.h" -#include "base/cxx17_backports.h" + #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/core/css/css_font_face_src_value.h" #include "third_party/blink/renderer/core/css/css_font_family_value.h" @@ -72,7 +72,7 @@ *family_name), CSSPropertyValue(CSSPropertyName(CSSPropertyID::kSrc), *src_value_list)}; auto* font_face_descriptor = MakeGarbageCollected<MutableCSSPropertyValueSet>( - properties, static_cast<wtf_size_t>(base::size(properties))); + properties, static_cast<wtf_size_t>(std::size(properties))); font_face_descriptor->SetProperty(CSSPropertyID::kFontStretch, stretch); font_face_descriptor->SetProperty(CSSPropertyID::kFontStyle, style);
diff --git a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc index 4ded008..8a2d1a89 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/longhands_custom.cc
@@ -5535,7 +5535,7 @@ {PT_MARKERS, PT_NONE}, // kPaintOrderMarkersFillStroke {PT_MARKERS, PT_STROKE}, // kPaintOrderMarkersStrokeFill }; - DCHECK_LT(static_cast<size_t>(paint_order) - 1, base::size(canonical_form)); + DCHECK_LT(static_cast<size_t>(paint_order) - 1, std::size(canonical_form)); CSSValueList* list = CSSValueList::CreateSpaceSeparated(); for (const auto& keyword : canonical_form[paint_order - 1]) { const auto paint_order_type = static_cast<EPaintOrderType>(keyword);
diff --git a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc index 25dda6c..fcf127f 100644 --- a/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc +++ b/third_party/blink/renderer/core/css/properties/shorthands/shorthands_custom.cc
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/cxx17_backports.h" #include "base/memory/values_equivalent.h" #include "third_party/blink/renderer/core/css/css_content_distribution_value.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" @@ -444,7 +443,7 @@ static const CSSProperty* kProperties[3] = {&GetCSSPropertyBorderRight(), &GetCSSPropertyBorderBottom(), &GetCSSPropertyBorderLeft()}; - for (size_t i = 0; i < base::size(kProperties); ++i) { + for (size_t i = 0; i < std::size(kProperties); ++i) { const CSSValue* value_for_side = kProperties[i]->CSSValueFromComputedStyle( style, layout_object, allow_visited_style); if (!base::ValuesEquivalent(value, value_for_side)) {
diff --git a/third_party/blink/renderer/core/css/style_property_serializer.cc b/third_party/blink/renderer/core/css/style_property_serializer.cc index d0adffd..6a7bb8e 100644 --- a/third_party/blink/renderer/core/css/style_property_serializer.cc +++ b/third_party/blink/renderer/core/css/style_property_serializer.cc
@@ -25,7 +25,6 @@ #include <bitset> -#include "base/cxx17_backports.h" #include "base/memory/values_equivalent.h" #include "third_party/blink/renderer/core/animation/css/css_animation_data.h" #include "third_party/blink/renderer/core/css/css_custom_property_declaration.h" @@ -1434,7 +1433,7 @@ &GetCSSPropertyBorderImageSource(), &GetCSSPropertyBorderImageSlice(), &GetCSSPropertyBorderImageWidth(), &GetCSSPropertyBorderImageOutset(), &GetCSSPropertyBorderImageRepeat()}; - size_t length = base::size(properties); + size_t length = std::size(properties); for (size_t i = 0; i < length; ++i) { const CSSValue& value = *property_set_.GetPropertyCSSValue(*properties[i]); if (!result.IsEmpty())
diff --git a/third_party/blink/renderer/core/css/style_property_shorthand_custom.cc b/third_party/blink/renderer/core/css/style_property_shorthand_custom.cc index 076849b6..e6c4d47 100644 --- a/third_party/blink/renderer/core/css/style_property_shorthand_custom.cc +++ b/third_party/blink/renderer/core/css/style_property_shorthand_custom.cc
@@ -21,8 +21,6 @@ #include "third_party/blink/renderer/core/style_property_shorthand.h" -#include "base/cxx17_backports.h" - namespace blink { // The transition-property longhand appears last during parsing to prevent it @@ -36,7 +34,7 @@ &GetCSSPropertyTransitionDelay(), &GetCSSPropertyTransitionProperty()}; static StylePropertyShorthand transition_longhands( CSSPropertyID::kTransition, kTransitionProperties, - base::size(kTransitionProperties)); + std::size(kTransitionProperties)); return transition_longhands; }
diff --git a/third_party/blink/renderer/core/dom/element-hot.cc b/third_party/blink/renderer/core/dom/element-hot.cc index 483f4885..ead00bd 100644 --- a/third_party/blink/renderer/core/dom/element-hot.cc +++ b/third_party/blink/renderer/core/dom/element-hot.cc
@@ -19,15 +19,14 @@ namespace blink { WTF::AtomicStringTable::WeakResult Element::WeakLowercaseIfNecessary( - const StringView& name) const { + const AtomicString& name) const { if (LIKELY(IsHTMLElement() && IsA<HTMLDocument>(GetDocument()))) { - StringImpl* impl = name.SharedImpl(); - if (impl && impl->IsAtomic() && impl->IsLowerASCII()) - return WTF::AtomicStringTable::WeakResult(impl); - return WTF::AtomicStringTable::Instance().WeakFindLowercased(name); + if (name.IsEmpty() || name.IsLowerASCII()) + return WTF::AtomicStringTable::WeakResult(name); + return WTF::AtomicStringTable::Instance().WeakFindLowercase(name); } - return WTF::AtomicStringTable::Instance().WeakFind(name); + return WTF::AtomicStringTable::WeakResult(name); } // Note, SynchronizeAttributeHinted is safe to call between a WeakFind() and
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 855698b..170b73a 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -299,7 +299,7 @@ // https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name AtomicString LowercaseIfNecessary(AtomicString) const; WTF::AtomicStringTable::WeakResult WeakLowercaseIfNecessary( - const StringView&) const; + const AtomicString&) const; // NoncedElement implementation: this is only used by HTMLElement and // SVGElement, but putting the implementation here allows us to use
diff --git a/third_party/blink/renderer/core/editing/commands/editing_command_test.cc b/third_party/blink/renderer/core/editing/commands/editing_command_test.cc index eb863f9f..fff20cc 100644 --- a/third_party/blink/renderer/core/editing/commands/editing_command_test.cc +++ b/third_party/blink/renderer/core/editing/commands/editing_command_test.cc
@@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/cxx17_backports.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h" #include "third_party/blink/renderer/core/dom/focus_params.h" #include "third_party/blink/renderer/core/dom/static_range.h" @@ -33,7 +32,7 @@ }; // Test all commands except EditingCommandType::Invalid. static_assert( - base::size(kCommandNameEntries) + 1 == + std::size(kCommandNameEntries) + 1 == static_cast<size_t>(EditingCommandType::kNumberOfCommandTypes), "must test all valid EditingCommandType"); @@ -42,7 +41,7 @@ class EditingCommandTest : public EditingTestBase {}; TEST_F(EditingCommandTest, EditorCommandOrder) { - for (size_t i = 1; i < base::size(kCommandNameEntries); ++i) { + for (size_t i = 1; i < std::size(kCommandNameEntries); ++i) { EXPECT_GT(0, WTF::CodeUnitCompareIgnoringASCIICase( kCommandNameEntries[i - 1].name, kCommandNameEntries[i].name))
diff --git a/third_party/blink/renderer/core/editing/commands/editor_command.cc b/third_party/blink/renderer/core/editing/commands/editor_command.cc index fd5d5d99..4e3c679 100644 --- a/third_party/blink/renderer/core/editing/commands/editor_command.cc +++ b/third_party/blink/renderer/core/editing/commands/editor_command.cc
@@ -94,7 +94,7 @@ }; // Handles all commands except EditingCommandType::Invalid. static_assert( - base::size(kCommandNameEntries) + 1 == + std::size(kCommandNameEntries) + 1 == static_cast<size_t>(EditingCommandType::kNumberOfCommandTypes), "must handle all valid EditingCommandType"); @@ -1814,7 +1814,7 @@ }; // Handles all commands except EditingCommandType::Invalid. static_assert( - base::size(kEditorCommands) + 1 == + std::size(kEditorCommands) + 1 == static_cast<size_t>(EditingCommandType::kNumberOfCommandTypes), "must handle all valid EditingCommandType"); @@ -1825,7 +1825,7 @@ int command_index = static_cast<int>(command_type) - 1; DCHECK(command_index >= 0 && - command_index < static_cast<int>(base::size(kEditorCommands))); + command_index < static_cast<int>(std::size(kEditorCommands))); return &kEditorCommands[command_index]; }
diff --git a/third_party/blink/renderer/core/editing/editing_style.cc b/third_party/blink/renderer/core/editing/editing_style.cc index ae5634e..651a8c9 100644 --- a/third_party/blink/renderer/core/editing/editing_style.cc +++ b/third_party/blink/renderer/core/editing/editing_style.cc
@@ -103,7 +103,7 @@ if (properties.IsEmpty()) { CSSProperty::FilterWebExposedCSSPropertiesIntoVector( execution_context, kStaticEditingProperties, - base::size(kStaticEditingProperties), properties); + std::size(kStaticEditingProperties), properties); for (wtf_size_t index = 0; index < properties.size(); index++) { if (properties[index]->IDEquals(CSSPropertyID::kTextDecoration)) { properties.EraseAt(index); @@ -120,7 +120,7 @@ if (properties.IsEmpty()) { CSSProperty::FilterWebExposedCSSPropertiesIntoVector( execution_context, kStaticEditingProperties, - base::size(kStaticEditingProperties), properties); + std::size(kStaticEditingProperties), properties); for (wtf_size_t index = 0; index < properties.size();) { if (!properties[index]->IsInherited()) { properties.EraseAt(index); @@ -768,7 +768,7 @@ if (properties.IsEmpty()) { CSSProperty::FilterWebExposedCSSPropertiesIntoVector( execution_context, kStaticBlockProperties, - base::size(kStaticBlockProperties), properties); + std::size(kStaticBlockProperties), properties); } return properties; } @@ -910,7 +910,7 @@ }; if (should_ignore_text_only_properties == kIgnoreTextOnlyProperties) { difference->RemovePropertiesInSet(kTextOnlyProperties, - base::size(kTextOnlyProperties)); + std::size(kTextOnlyProperties)); } if (difference->IsEmpty())
diff --git a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc index 35a9ef3f..828a418 100644 --- a/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc +++ b/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc
@@ -27,7 +27,6 @@ #include "third_party/blink/renderer/core/editing/serializers/markup_formatter.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/dom/cdata_section.h" #include "third_party/blink/renderer/core/dom/comment.h" #include "third_party/blink/renderer/core/dom/document.h" @@ -122,7 +121,7 @@ WTF::VisitCharacters(source, [&](const auto* chars, unsigned) { AppendCharactersReplacingEntitiesInternal( result, source, chars, source.length(), kEntityMaps, - base::size(kEntityMaps), entity_mask); + std::size(kEntityMaps), entity_mask); }); }
diff --git a/third_party/blink/renderer/core/editing/state_machines/state_machine_util.cc b/third_party/blink/renderer/core/editing/state_machines/state_machine_util.cc index 044d610..69275d0 100644 --- a/third_party/blink/renderer/core/editing/state_machines/state_machine_util.cc +++ b/third_party/blink/renderer/core/editing/state_machines/state_machine_util.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/editing/state_machines/state_machine_util.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/text/character.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" #include "third_party/blink/renderer/platform/wtf/text/unicode.h" @@ -27,7 +26,7 @@ // Returns true if the code point has Indic_Syllabic_Category=Virama property. // See http://www.unicode.org/Public/9.0.0/ucd/IndicSyllabicCategory-9.0.0d2.txt bool IsIndicSyllabicCategoryVirama(uint32_t code_point) { - const int length = base::size(kIndicSyllabicCategoryViramaList); + const int length = std::size(kIndicSyllabicCategoryViramaList); return std::binary_search(kIndicSyllabicCategoryViramaList, kIndicSyllabicCategoryViramaList + length, code_point);
diff --git a/third_party/blink/renderer/core/events/input_event.cc b/third_party/blink/renderer/core/events/input_event.cc index 8abd93a8..70059df 100644 --- a/third_party/blink/renderer/core/events/input_event.cc +++ b/third_party/blink/renderer/core/events/input_event.cc
@@ -66,7 +66,7 @@ }; static_assert( - base::size(kInputTypeStringNameMap) == + std::size(kInputTypeStringNameMap) == static_cast<size_t>(InputEvent::InputType::kNumberOfInputTypes), "must handle all InputEvent::InputType");
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc index c0ce1bb..f8160f29 100644 --- a/third_party/blink/renderer/core/exported/web_view_test.cc +++ b/third_party/blink/renderer/core/exported/web_view_test.cc
@@ -28,14 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/public/web/web_view.h" - #include <limits> #include <memory> #include <string> #include "base/callback_helpers.h" -#include "base/cxx17_backports.h" #include "base/test/test_mock_time_task_runner.h" #include "base/time/time.h" #include "build/build_config.h" @@ -80,6 +77,7 @@ #include "third_party/blink/public/web/web_print_params.h" #include "third_party/blink/public/web/web_script_source.h" #include "third_party/blink/public/web/web_settings.h" +#include "third_party/blink/public/web/web_view.h" #include "third_party/blink/public/web/web_view_client.h" #include "third_party/blink/public/web/web_widget.h" #include "third_party/blink/renderer/bindings/core/v8/v8_document.h" @@ -1924,7 +1922,7 @@ Element* current_focus = nullptr; Element* next_focus = nullptr; int next_previous_flags; - for (size_t i = 0; i < base::size(focused_elements); ++i) { + for (size_t i = 0; i < std::size(focused_elements); ++i) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -1945,7 +1943,7 @@ EXPECT_EQ(current_focus, document->FocusedElement()); // Backward Navigation in form1 with PREVIOUS - for (size_t i = base::size(focused_elements); i-- > 0;) { + for (size_t i = std::size(focused_elements); i-- > 0;) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2164,7 +2162,7 @@ Element* current_focus = nullptr; Element* next_focus = nullptr; int next_previous_flags; - for (size_t i = 0; i < base::size(focused_elements); ++i) { + for (size_t i = 0; i < std::size(focused_elements); ++i) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2185,7 +2183,7 @@ EXPECT_EQ(current_focus, document->FocusedElement()); // Backward Navigation in form1 with PREVIOUS - for (size_t i = base::size(focused_elements); i-- > 0;) { + for (size_t i = std::size(focused_elements); i-- > 0;) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2269,7 +2267,7 @@ Element* current_focus = nullptr; Element* next_focus = nullptr; int next_previous_flags; - for (size_t i = 0; i < base::size(focused_elements); ++i) { + for (size_t i = 0; i < std::size(focused_elements); ++i) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2291,7 +2289,7 @@ // Backward Navigation in form with PREVIOUS which has tabindex attribute // which differs visual order. - for (size_t i = base::size(focused_elements); i-- > 0;) { + for (size_t i = std::size(focused_elements); i-- > 0;) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2363,7 +2361,7 @@ Element* current_focus = nullptr; Element* next_focus = nullptr; int next_previous_flags; - for (size_t i = 0; i < base::size(focused_elements); ++i) { + for (size_t i = 0; i < std::size(focused_elements); ++i) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags = @@ -2385,7 +2383,7 @@ // Backward Navigation in form with PREVIOUS which has has // disabled/enabled elements which will gets skipped during navigation. - for (size_t i = base::size(focused_elements); i-- > 0;) { + for (size_t i = std::size(focused_elements); i-- > 0;) { current_focus = document->getElementById(focused_elements[i].element_id); EXPECT_EQ(current_focus, document->FocusedElement()); next_previous_flags =
diff --git a/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc b/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc index 026b1b2..cad53f0 100644 --- a/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc +++ b/third_party/blink/renderer/core/fetch/fetch_data_loader_test.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/run_loop.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" @@ -66,7 +65,7 @@ "Quick brown fox\r\n" "--boundary--\r\n"; constexpr size_t kQuickBrownFoxFormDataLength = - base::size(kQuickBrownFoxFormData) - 1u; + std::size(kQuickBrownFoxFormData) - 1u; class FetchDataLoaderTest : public testing::Test { protected:
diff --git a/third_party/blink/renderer/core/fetch/fetch_header_list_test.cc b/third_party/blink/renderer/core/fetch/fetch_header_list_test.cc index 4ebde11..d4c97399 100644 --- a/third_party/blink/renderer/core/fetch/fetch_header_list_test.cc +++ b/third_party/blink/renderer/core/fetch/fetch_header_list_test.cc
@@ -6,7 +6,6 @@ #include <utility> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -25,7 +24,7 @@ std::make_pair("ConTenT-TyPe", "application/xml"), std::make_pair("ConTenT-TyPe", "foo"), std::make_pair("X-Foo", "bar"), }; - EXPECT_EQ(base::size(expectedHeaders), headerList->size()); + EXPECT_EQ(std::size(expectedHeaders), headerList->size()); size_t i = 0; for (const auto& header : headerList->List()) { EXPECT_EQ(expectedHeaders[i].first, header.first); @@ -48,7 +47,7 @@ std::make_pair("some-header", "some value"), std::make_pair("X-Foo", "bar"), }; - EXPECT_EQ(base::size(expectedHeaders), headerList->size()); + EXPECT_EQ(std::size(expectedHeaders), headerList->size()); size_t i = 0; for (const auto& header : headerList->List()) { EXPECT_EQ(expectedHeaders[i].first, header.first); @@ -70,7 +69,7 @@ const std::pair<String, String> expectedHeaders[] = { std::make_pair("X-Foo", "bar"), }; - EXPECT_EQ(base::size(expectedHeaders), headerList->size()); + EXPECT_EQ(std::size(expectedHeaders), headerList->size()); size_t i = 0; for (const auto& header : headerList->List()) { EXPECT_EQ(expectedHeaders[i].first, header.first); @@ -115,7 +114,7 @@ std::make_pair("x-foo", "bar")}; const Vector<FetchHeaderList::Header> sortedAndCombined = headerList->SortAndCombine(); - EXPECT_EQ(base::size(expectedHeaders), sortedAndCombined.size()); + EXPECT_EQ(std::size(expectedHeaders), sortedAndCombined.size()); size_t i = 0; for (const auto& headerPair : headerList->SortAndCombine()) { EXPECT_EQ(expectedHeaders[i].first, headerPair.first);
diff --git a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc index 826ce46e..d3f17c81 100644 --- a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc +++ b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h" -#include "base/cxx17_backports.h" #include "base/memory/scoped_refptr.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -157,12 +156,12 @@ TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromArrayBuffer) { constexpr unsigned char kData[] = {0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88}; - DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, base::size(kData)); + DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, std::size(kData)); auto result = (MakeGarbageCollected<BytesConsumerTestReader>( MakeGarbageCollected<FormDataBytesConsumer>(buffer))) ->Run(); Vector<char> expected; - expected.Append(kData, base::size(kData)); + expected.Append(kData, std::size(kData)); EXPECT_EQ(Result::kDone, result.first); EXPECT_EQ(expected, result.second); @@ -172,7 +171,7 @@ constexpr unsigned char kData[] = {0x21, 0xfe, 0x00, 0x00, 0xff, 0xa3, 0x42, 0x30, 0x42, 0x99, 0x88}; constexpr size_t kOffset = 1, kSize = 4; - DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, base::size(kData)); + DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, std::size(kData)); auto result = (MakeGarbageCollected<BytesConsumerTestReader>( MakeGarbageCollected<FormDataBytesConsumer>( DOMUint8Array::Create(buffer, kOffset, kSize))))
diff --git a/third_party/blink/renderer/core/fetch/multipart_parser.cc b/third_party/blink/renderer/core/fetch/multipart_parser.cc index 45642672..cd571768 100644 --- a/third_party/blink/renderer/core/fetch/multipart_parser.cc +++ b/third_party/blink/renderer/core/fetch/multipart_parser.cc
@@ -4,25 +4,24 @@ #include "third_party/blink/renderer/core/fetch/multipart_parser.h" -#include "base/cxx17_backports.h" +#include <algorithm> +#include <utility> + #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/network/http_names.h" #include "third_party/blink/renderer/platform/network/http_parsers.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" -#include <algorithm> -#include <utility> - namespace blink { namespace { constexpr char kCloseDelimiterSuffix[] = "--\r\n"; constexpr size_t kCloseDelimiterSuffixSize = - base::size(kCloseDelimiterSuffix) - 1u; + std::size(kCloseDelimiterSuffix) - 1u; constexpr size_t kDashBoundaryOffset = 2u; // The length of "\r\n". constexpr char kDelimiterSuffix[] = "\r\n"; -constexpr size_t kDelimiterSuffixSize = base::size(kDelimiterSuffix) - 1u; +constexpr size_t kDelimiterSuffixSize = std::size(kDelimiterSuffix) - 1u; } // namespace
diff --git a/third_party/blink/renderer/core/frame/deprecation.cc b/third_party/blink/renderer/core/frame/deprecation.cc index 6d8a2b9..faa07be 100644 --- a/third_party/blink/renderer/core/frame/deprecation.cc +++ b/third_party/blink/renderer/core/frame/deprecation.cc
@@ -732,6 +732,14 @@ "enabled by setting document.domain.", MilestoneString(kM106).Ascii().c_str())); + case WebFeature::kCookieWithTruncatingChar: + return DeprecationInfo::WithDetails( + "WebFeature::kCookieWithTruncatingChar", kM103, + String::Format( + "Cookies containing a '\\0', '\\r', or '\\n' character will be " + "rejected instead of truncated in %s.", + MilestoneString(kM106).Ascii().c_str())); + // Features that aren't deprecated don't have a deprecation message. default: return DeprecationInfo::WithDetails("NotDeprecated", kUnknown, String());
diff --git a/third_party/blink/renderer/core/frame/frame_content_as_text.cc b/third_party/blink/renderer/core/frame/frame_content_as_text.cc index ed3683a..d7ff6cbe 100644 --- a/third_party/blink/renderer/core/frame/frame_content_as_text.cc +++ b/third_party/blink/renderer/core/frame/frame_content_as_text.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/frame/frame_content_as_text.h" -#include "base/cxx17_backports.h" #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" @@ -37,7 +36,7 @@ // The separator between frames when the frames are converted to plain text. const LChar kFrameSeparator[] = {'\n', '\n'}; - const size_t frame_separator_length = base::size(kFrameSeparator); + const size_t frame_separator_length = std::size(kFrameSeparator); // Recursively walk the children. const FrameTree& frame_tree = frame->Tree();
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc index 21da4fe..a0a3925 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc
@@ -109,10 +109,10 @@ clock_(base::DefaultTickClock::GetInstance()), event_name_("Blink.UpdateTime") { // All of these are assumed to have one entry per sub-metric. - DCHECK_EQ(base::size(absolute_metric_records_), metrics_data().size()); - DCHECK_EQ(base::size(current_sample_.sub_metrics_counts), + DCHECK_EQ(std::size(absolute_metric_records_), metrics_data().size()); + DCHECK_EQ(std::size(current_sample_.sub_metrics_counts), metrics_data().size()); - DCHECK_EQ(base::size(current_sample_.sub_main_frame_counts), + DCHECK_EQ(std::size(current_sample_.sub_main_frame_counts), metrics_data().size()); // Record average and worst case for the primary metric. @@ -265,7 +265,7 @@ bool is_pre_fcp = (fcp_state_ != kHavePassedFCP); // Accumulate for UKM and record the UMA - DCHECK_LT(metric_index, base::size(absolute_metric_records_)); + DCHECK_LT(metric_index, std::size(absolute_metric_records_)); auto& record = absolute_metric_records_[metric_index]; record.interval_count += count; if (in_main_frame_update_)
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h index 49db6f3..bec7258 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h
@@ -201,7 +201,7 @@ {"ServiceDocumentUpdate", true}, {"UserDrivenDocumentUpdate", true}, {"ParseStyleSheet", true}}; - static_assert(base::size(data) == kCount, "Metrics data mismatch"); + static_assert(std::size(data) == kCount, "Metrics data mismatch"); return data; }
diff --git a/third_party/blink/renderer/core/frame/web_frame_test.cc b/third_party/blink/renderer/core/frame/web_frame_test.cc index 6c86609..39322b8 100644 --- a/third_party/blink/renderer/core/frame/web_frame_test.cc +++ b/third_party/blink/renderer/core/frame/web_frame_test.cc
@@ -28,15 +28,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/public/web/web_frame.h" - #include <initializer_list> #include <limits> #include <memory> #include <tuple> #include "base/callback_helpers.h" -#include "base/cxx17_backports.h" #include "base/strings/stringprintf.h" #include "base/unguessable_token.h" #include "build/build_config.h" @@ -87,6 +84,7 @@ #include "third_party/blink/public/web/web_document.h" #include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_form_element.h" +#include "third_party/blink/public/web/web_frame.h" #include "third_party/blink/public/web/web_frame_widget.h" #include "third_party/blink/public/web/web_history_item.h" #include "third_party/blink/public/web/web_local_frame.h" @@ -859,7 +857,7 @@ ->MainFrame() ->ToWebLocalFrame() ->RequestExecuteV8Function(context, function, v8::Undefined(isolate), - base::size(args), args, &callback_helper); + std::size(args), args, &callback_helper); RunPendingTasks(); EXPECT_TRUE(callback_helper.DidComplete()); EXPECT_EQ("hello", callback_helper.SingleStringValue()); @@ -2184,14 +2182,14 @@ "viewport-auto-initial-scale.html", "viewport-target-densitydpi-device-and-fixed-width.html"}; float page_scale_factors[] = {0.5f, 1.0f}; - for (size_t i = 0; i < base::size(pages); ++i) + for (size_t i = 0; i < std::size(pages); ++i) RegisterMockedHttpURLLoad(pages[i]); int viewport_width = 400; int viewport_height = 300; float enforced_page_scale_factor = 0.75f; - for (size_t i = 0; i < base::size(pages); ++i) { + for (size_t i = 0; i < std::size(pages); ++i) { for (int quirk_enabled = 0; quirk_enabled <= 1; ++quirk_enabled) { frame_test_helpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad(base_url_ + pages[i], nullptr, nullptr, @@ -2204,7 +2202,7 @@ web_view_helper.Resize(gfx::Size(viewport_width, viewport_height)); float expected_page_scale_factor = - quirk_enabled && i < base::size(page_scale_factors) + quirk_enabled && i < std::size(page_scale_factors) ? page_scale_factors[i] : enforced_page_scale_factor; EXPECT_EQ(expected_page_scale_factor, @@ -2830,7 +2828,7 @@ int viewport_width = 640; int viewport_height = 480; - for (size_t i = 0; i < base::size(device_scale_factors); ++i) { + for (size_t i = 0; i < std::size(device_scale_factors); ++i) { float device_scale_factor = device_scale_factors[i]; float device_dpi = device_scale_factor * 160.0f; @@ -2879,7 +2877,7 @@ int viewport_width = 640; int viewport_height = 480; - for (size_t i = 0; i < base::size(device_scale_factors); ++i) { + for (size_t i = 0; i < std::size(device_scale_factors); ++i) { frame_test_helpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad( base_url_ + "viewport-target-densitydpi-device.html", nullptr, nullptr, @@ -2930,7 +2928,7 @@ int viewport_width = 640; int viewport_height = 480; - for (size_t i = 0; i < base::size(device_scale_factors); ++i) { + for (size_t i = 0; i < std::size(device_scale_factors); ++i) { frame_test_helpers::WebViewHelper web_view_helper; web_view_helper.InitializeAndLoad( base_url_ + "viewport-target-densitydpi-device-and-fixed-width.html",
diff --git a/third_party/blink/renderer/core/html/html_document.cc b/third_party/blink/renderer/core/html/html_document.cc index f7ebe93f..fc2b950f 100644 --- a/third_party/blink/renderer/core/html/html_document.cc +++ b/third_party/blink/renderer/core/html/html_document.cc
@@ -53,7 +53,6 @@ #include "third_party/blink/renderer/core/html/html_document.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/bindings/core/v8/window_proxy.h" #include "third_party/blink/renderer/core/dom/document_init.h" @@ -142,7 +141,7 @@ &html_names::kTypeAttr, &html_names::kValignAttr, &html_names::kValuetypeAttr, &html_names::kVlinkAttr}; - attr_set->ReserveCapacityForSize(base::size(case_insensitive_attributes)); + attr_set->ReserveCapacityForSize(std::size(case_insensitive_attributes)); for (const QualifiedName* attr : case_insensitive_attributes) attr_set->insert(attr->LocalName().Impl());
diff --git a/third_party/blink/renderer/core/html/html_element.cc b/third_party/blink/renderer/core/html/html_element.cc index d79e280..aae2330 100644 --- a/third_party/blink/renderer/core/html/html_element.cc +++ b/third_party/blink/renderer/core/html/html_element.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/html/html_element.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h" #include "third_party/blink/renderer/bindings/core/v8/v8_union_stringtreatnullasemptystring_trustedscript.h" #include "third_party/blink/renderer/core/css/css_color.h" @@ -737,7 +736,7 @@ DEFINE_STATIC_LOCAL(AttributeToTriggerIndexMap, attribute_to_trigger_index_map, ()); if (!attribute_to_trigger_index_map.size()) { - for (uint32_t i = 0; i < base::size(attribute_triggers); ++i) + for (uint32_t i = 0; i < std::size(attribute_triggers); ++i) attribute_to_trigger_index_map.insert(attribute_triggers[i].attribute, i); }
diff --git a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc index c4d3d5b..584fd51 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc
@@ -613,7 +613,7 @@ cue_event_deltas_[cue_index].exit_time_delta = base::Seconds(diff_seconds); } - std::array<CueChangeEventTimeDelta, base::size(kTestCueData)> + std::array<CueChangeEventTimeDelta, std::size(kTestCueData)> cue_event_deltas_; };
diff --git a/third_party/blink/renderer/core/html/parser/text_resource_decoder_builder.cc b/third_party/blink/renderer/core/html/parser/text_resource_decoder_builder.cc index 58b0bd5..93314f98 100644 --- a/third_party/blink/renderer/core/html/parser/text_resource_decoder_builder.cc +++ b/third_party/blink/renderer/core/html/parser/text_resource_decoder_builder.cc
@@ -32,7 +32,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" @@ -81,7 +80,7 @@ url.Host().Split(".", tokens); if (!tokens.IsEmpty()) { auto tld = tokens.back(); - for (size_t i = 0; i < base::size(kEncodings); i++) { + for (size_t i = 0; i < std::size(kEncodings); i++) { if (tld == kEncodings[i].domain) return WTF::TextEncoding(kEncodings[i].encoding); }
diff --git a/third_party/blink/renderer/core/html/track/vtt/buffered_line_reader_test.cc b/third_party/blink/renderer/core/html/track/vtt/buffered_line_reader_test.cc index aefb905..45392285 100644 --- a/third_party/blink/renderer/core/html/track/vtt/buffered_line_reader_test.cc +++ b/third_party/blink/renderer/core/html/track/vtt/buffered_line_reader_test.cc
@@ -30,7 +30,6 @@ #include "third_party/blink/renderer/core/html/track/vtt/buffered_line_reader.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -173,12 +172,12 @@ const char* lines[] = {"aaaaaaaaaaaaaaaa", "bbbbbbbbbb", "ccccccccccccc", "", "dddddd", "", "eeeeeeeeee"}; const NewlineType kBreaks[] = {kLf, kLf, kLf, kLf, kLf, kLf, kLf}; - const size_t num_test_lines = base::size(lines); - static_assert(num_test_lines == base::size(kBreaks), + const size_t num_test_lines = std::size(lines); + static_assert(num_test_lines == std::size(kBreaks), "number of test lines and breaks should be the same"); String data = MakeTestData(lines, kBreaks, num_test_lines); - for (size_t k = 0; k < base::size(kBlockSizes); ++k) { + for (size_t k = 0; k < std::size(kBlockSizes); ++k) { size_t line_count = 0; BufferedLineReader reader; wtf_size_t block_size = kBlockSizes[k]; @@ -200,12 +199,12 @@ "aaaaaaaaaaaaaaaa", "bbbbbbbbbb", "ccccccccccccc", "", "dddddd", "eeeeeeeeee", "fffffffffffffffffff"}; const NewlineType kBreaks[] = {kCr, kLf, kCrLf, kCr, kLf, kCrLf, kLf}; - const size_t num_test_lines = base::size(lines); - static_assert(num_test_lines == base::size(kBreaks), + const size_t num_test_lines = std::size(lines); + static_assert(num_test_lines == std::size(kBreaks), "number of test lines and breaks should be the same"); String data = MakeTestData(lines, kBreaks, num_test_lines); - for (size_t k = 0; k < base::size(kBlockSizes); ++k) { + for (size_t k = 0; k < std::size(kBlockSizes); ++k) { size_t line_count = 0; BufferedLineReader reader; wtf_size_t block_size = kBlockSizes[k];
diff --git a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc index a930853..66ac7bf 100644 --- a/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc +++ b/third_party/blink/renderer/core/html/track/vtt/vtt_cue.cc
@@ -29,7 +29,6 @@ #include "third_party/blink/renderer/core/html/track/vtt/vtt_cue.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/v8_union_autokeyword_double.h" #include "third_party/blink/renderer/core/css/css_property_names.h" #include "third_party/blink/renderer/core/css_value_keywords.h" @@ -61,7 +60,7 @@ static const CSSValueID kDisplayWritingModeMap[] = {CSSValueID::kHorizontalTb, CSSValueID::kVerticalRl, CSSValueID::kVerticalLr}; -static_assert(base::size(kDisplayWritingModeMap) == +static_assert(std::size(kDisplayWritingModeMap) == VTTCue::kNumberOfWritingDirections, "displayWritingModeMap should have the same number of elements " "as VTTCue::NumberOfWritingDirections"); @@ -69,7 +68,7 @@ static const CSSValueID kDisplayAlignmentMap[] = { CSSValueID::kStart, CSSValueID::kCenter, CSSValueID::kEnd, CSSValueID::kLeft, CSSValueID::kRight}; -static_assert(base::size(kDisplayAlignmentMap) == VTTCue::kNumberOfAlignments, +static_assert(std::size(kDisplayAlignmentMap) == VTTCue::kNumberOfAlignments, "displayAlignmentMap should have the same number of elements as " "VTTCue::NumberOfAlignments");
diff --git a/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc b/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc index b393f15..5399068 100644 --- a/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_performance_agent.cc
@@ -6,7 +6,6 @@ #include <utility> -#include "base/cxx17_backports.h" #include "base/process/process.h" #include "base/process/process_metrics.h" #include "base/time/time_override.h" @@ -193,7 +192,7 @@ base::TimeTicks::Now().since_origin().InSecondsF()); // Renderer instance counters. - for (size_t i = 0; i < base::size(kInstanceCounterNames); ++i) { + for (size_t i = 0; i < std::size(kInstanceCounterNames); ++i) { AppendMetric(result.get(), kInstanceCounterNames[i], InstanceCounters::CounterValue( static_cast<InstanceCounters::CounterType>(i)));
diff --git a/third_party/blink/renderer/core/layout/layout_quote.cc b/third_party/blink/renderer/core/layout/layout_quote.cc index d3f5cb9..de3086b 100644 --- a/third_party/blink/renderer/core/layout/layout_quote.cc +++ b/third_party/blink/renderer/core/layout/layout_quote.cc
@@ -23,7 +23,6 @@ #include <algorithm> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/dom/pseudo_element.h" #include "third_party/blink/renderer/core/layout/layout_text_fragment.h" #include "third_party/blink/renderer/core/layout/layout_view.h" @@ -245,7 +244,7 @@ return nullptr; // This could be just a hash table, but doing that adds 200k to LayoutQuote.o - Language* languages_end = g_languages + base::size(g_languages); + Language* languages_end = g_languages + std::size(g_languages); std::string lowercase_lang = lang.LowerASCII().Utf8(); Language key = {lowercase_lang.c_str(), 0, 0, 0, 0, nullptr}; Language* match = std::lower_bound(g_languages, languages_end, key);
diff --git a/third_party/blink/renderer/core/layout/layout_text_combine.cc b/third_party/blink/renderer/core/layout/layout_text_combine.cc index 759d1e8..c56db33 100644 --- a/third_party/blink/renderer/core/layout/layout_text_combine.cc +++ b/third_party/blink/renderer/core/layout/layout_text_combine.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/core/layout/layout_text_combine.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" namespace blink { @@ -193,7 +192,7 @@ // Need to try compressed glyphs. static const FontWidthVariant kWidthVariants[] = {kHalfWidth, kThirdWidth, kQuarterWidth}; - for (size_t i = 0; i < base::size(kWidthVariants); ++i) { + for (size_t i = 0; i < std::size(kWidthVariants); ++i) { description.SetWidthVariant(kWidthVariants[i]); Font compressed_font(description, font_selector); float run_width = compressed_font.Width(run);
diff --git a/third_party/blink/renderer/core/layout/layout_text_control.cc b/third_party/blink/renderer/core/layout/layout_text_control.cc index fe6ea3d5..15b6e89 100644 --- a/third_party/blink/renderer/core/layout/layout_text_control.cc +++ b/third_party/blink/renderer/core/layout/layout_text_control.cc
@@ -22,7 +22,6 @@ #include "third_party/blink/renderer/core/layout/layout_text_control.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/css/style_change_reason.h" #include "third_party/blink/renderer/core/html/forms/html_text_area_element.h" #include "third_party/blink/renderer/core/html/forms/text_control_element.h" @@ -178,7 +177,7 @@ if (!font_families_with_invalid_char_width_map) { font_families_with_invalid_char_width_map = new HashSet<AtomicString>; - for (size_t i = 0; i < base::size(kFontFamiliesWithInvalidCharWidth); ++i) + for (size_t i = 0; i < std::size(kFontFamiliesWithInvalidCharWidth); ++i) font_families_with_invalid_char_width_map->insert( AtomicString(kFontFamiliesWithInvalidCharWidth[i])); }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc index 484d796..c577509 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_ink_overflow.cc
@@ -60,7 +60,7 @@ "outsets should be the size of a pointer"); single_ = source.single_; #if DCHECK_IS_ON() - for (wtf_size_t i = 0; i < base::size(outsets_); ++i) + for (wtf_size_t i = 0; i < std::size(outsets_); ++i) DCHECK_EQ(outsets_[i], source.outsets_[i]); #endif break; @@ -89,7 +89,7 @@ "outsets should be the size of a pointer"); single_ = source.single_; #if DCHECK_IS_ON() - for (wtf_size_t i = 0; i < base::size(outsets_); ++i) + for (wtf_size_t i = 0; i < std::size(outsets_); ++i) DCHECK_EQ(outsets_[i], source.outsets_[i]); #endif break;
diff --git a/third_party/blink/renderer/core/loader/cookie_jar.cc b/third_party/blink/renderer/core/loader/cookie_jar.cc index 9985c13..05c4d24 100644 --- a/third_party/blink/renderer/core/loader/cookie_jar.cc +++ b/third_party/blink/renderer/core/loader/cookie_jar.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/frame/local_frame.h" +#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" namespace blink { @@ -24,6 +25,13 @@ elapsed); } +// TODO(crbug.com/1276520): Remove after truncating characters are fully +// deprecated. +bool ContainsTruncatingChar(UChar c) { + // equivalent to '\x00', '\x0D', or '\x0A' + return c == '\0' || c == '\r' || c == '\n'; +} + } // namespace CookieJar::CookieJar(blink::Document* document) @@ -49,6 +57,12 @@ RuntimeEnabledFeatures::PartitionedCookiesEnabled( document_->GetExecutionContext())); LogCookieHistogram("Blink.SetCookieTime.", requested, timer.Elapsed()); + + // TODO(crbug.com/1276520): Remove after truncating characters are fully + // deprecated + if (value.Find(ContainsTruncatingChar) != kNotFound) { + document_->CountDeprecation(WebFeature::kCookieWithTruncatingChar); + } } String CookieJar::Cookies() {
diff --git a/third_party/blink/renderer/core/loader/cookie_jar_unittest.cc b/third_party/blink/renderer/core/loader/cookie_jar_unittest.cc index 398824e..97515ad1 100644 --- a/third_party/blink/renderer/core/loader/cookie_jar_unittest.cc +++ b/third_party/blink/renderer/core/loader/cookie_jar_unittest.cc
@@ -84,5 +84,11 @@ } } +TEST_F(CookieJarTest, CookieTruncatingChar) { + V8TestingScope scope; + GetDocument()->setCookie("foo=\0bar", scope.GetExceptionState()); + GetDocument()->IsUseCounted(WebFeature::kCookieWithTruncatingChar); +} + } // namespace } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/resource/multipart_image_resource_parser_test.cc b/third_party/blink/renderer/core/loader/resource/multipart_image_resource_parser_test.cc index bad2c4b..f8422c0 100644 --- a/third_party/blink/renderer/core/loader/resource/multipart_image_resource_parser_test.cc +++ b/third_party/blink/renderer/core/loader/resource/multipart_image_resource_parser_test.cc
@@ -8,7 +8,6 @@ #include <stdint.h> #include <string.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -48,7 +47,7 @@ {"\rLine", 0, 0}, {"Line\r\nLine", 4, 2}, {"Line\nLine", 4, 1}, {"Line\n\nLine", 4, 1}, {"Line\rLine", 4, 0}, {"Line\r\rLine", 4, 0}, }; - for (size_t i = 0; i < base::size(line_tests); ++i) { + for (size_t i = 0; i < std::size(line_tests); ++i) { Vector<char> input; input.Append(line_tests[i].input, static_cast<wtf_size_t>(strlen(line_tests[i].input))); @@ -69,7 +68,7 @@ {"foo", "bound", kNotFound}, {"bound", "--boundbound", 0}, }; - for (size_t i = 0; i < base::size(boundary_tests); ++i) { + for (size_t i = 0; i < std::size(boundary_tests); ++i) { Vector<char> boundary, data; boundary.Append(boundary_tests[i].boundary, static_cast<uint32_t>(strlen(boundary_tests[i].boundary)));
diff --git a/third_party/blink/renderer/core/loader/web_associated_url_loader_impl_test.cc b/third_party/blink/renderer/core/loader/web_associated_url_loader_impl_test.cc index abcc5dc..d865a1a 100644 --- a/third_party/blink/renderer/core/loader/web_associated_url_loader_impl_test.cc +++ b/third_party/blink/renderer/core/loader/web_associated_url_loader_impl_test.cc
@@ -28,11 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/public/web/web_associated_url_loader.h" - #include <memory> -#include "base/cxx17_backports.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h" @@ -42,6 +39,7 @@ #include "third_party/blink/public/platform/web_url_loader_mock_factory.h" #include "third_party/blink/public/platform/web_url_request.h" #include "third_party/blink/public/platform/web_url_response.h" +#include "third_party/blink/public/web/web_associated_url_loader.h" #include "third_party/blink/public/web/web_associated_url_loader_client.h" #include "third_party/blink/public/web/web_associated_url_loader_options.h" #include "third_party/blink/public/web/web_frame.h" @@ -99,7 +97,7 @@ "visible_iframe.html", "zero_sized_iframe.html", }; - for (size_t i = 0; i < base::size(iframe_support_files); ++i) { + for (size_t i = 0; i < std::size(iframe_support_files); ++i) { RegisterMockedUrl(url_root, iframe_support_files[i]); }
diff --git a/third_party/blink/renderer/core/paint/box_border_painter.cc b/third_party/blink/renderer/core/paint/box_border_painter.cc index 7cd70e9..99446bb 100644 --- a/third_party/blink/renderer/core/paint/box_border_painter.cc +++ b/third_party/blink/renderer/core/paint/box_border_painter.cc
@@ -6,7 +6,6 @@ #include <algorithm> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/paint/box_painter.h" #include "third_party/blink/renderer/core/paint/object_painter.h" #include "third_party/blink/renderer/core/paint/paint_auto_dark_mode.h" @@ -962,7 +961,7 @@ } void BoxBorderPainter::ComputeBorderProperties() { - for (unsigned i = 0; i < base::size(edges_); ++i) { + for (unsigned i = 0; i < std::size(edges_); ++i) { const BorderEdge& edge = edges_[i]; if (!edge.ShouldRender()) {
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index 38d8d3c..f689f88 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -1978,7 +1978,12 @@ // We set offset in container block instead of offset in |fragment| like // |NGBoxFragmentPainter::HitTestTextFragment()|. // See http://crbug.com/1043471 + DCHECK(!box_item_ || box_item_->BoxFragment() == &fragment); if (box_item_ && box_item_->IsInlineBox()) { + // Opaque fragments should be included only for list-based hit-testing. + if (fragment.IsOpaque() && + !hit_test.result->GetHitTestRequest().ListBased()) + return false; DCHECK(inline_box_cursor_); if (hit_test.AddNodeToResultWithContentOffset( fragment.NodeForHitTest(), @@ -2081,6 +2086,7 @@ const NGPhysicalLineBoxFragment& fragment, const NGInlineBackwardCursor& cursor, const PhysicalOffset& physical_offset) { + DCHECK_EQ(cursor.Current()->LineBoxFragment(), &fragment); PhysicalRect overflow_rect = cursor.Current().InkOverflow(); overflow_rect.Move(physical_offset); if (!hit_test.location.Intersects(overflow_rect)) @@ -2185,23 +2191,8 @@ } if (fragment.IsBlockInInline()) { - if (NGBoxFragmentPainter(fragment).NodeAtPoint(hit_test, - physical_offset)) { - return true; - } - if (!box_fragment_.IsInlineBox()) { - // fast/events/pointerevents/mouse-pointer-transition-events.html - // requires this. - return false; - } - // [1] and [2] reach here for hit test on empty <div> with size. - // [1] label-contains-other-interactive-content.html - // [2] svg/custom/use-event-retargeting.html - if (hit_test.action != kHitTestForeground) - return false; - return NGBoxFragmentPainter(fragment).NodeAtPoint( - *hit_test.result, hit_test.location, physical_offset, - kHitTestChildBlockBackgrounds); + return NGBoxFragmentPainter(fragment).NodeAtPoint(hit_test, + physical_offset); } // When traversing into a different inline formatting context, @@ -2409,7 +2400,7 @@ // inline, e.g. <span>a<div>b</div></span>. return false; } - return !item.IsBlockInInline(); + return true; } bool NGBoxFragmentPainter::HitTestItemsChildren(
diff --git a/third_party/blink/renderer/core/streams/readable_stream.cc b/third_party/blink/renderer/core/streams/readable_stream.cc index 3f631f3..2c78868 100644 --- a/third_party/blink/renderer/core/streams/readable_stream.cc +++ b/third_party/blink/renderer/core/streams/readable_stream.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/streams/readable_stream.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h" @@ -1882,10 +1881,10 @@ v8::Local<v8::Name> names[2] = {value_string, done_string}; v8::Local<v8::Value> values[2] = {value, done_value}; - static_assert(base::size(names) == base::size(values), + static_assert(std::size(names) == std::size(values), "names and values arrays must be the same size"); return v8::Object::New(isolate, v8::Null(isolate), names, values, - base::size(names)); + std::size(names)); } void ReadableStream::Error(ScriptState* script_state,
diff --git a/third_party/blink/renderer/core/streams/transferable_streams.cc b/third_party/blink/renderer/core/streams/transferable_streams.cc index ec728d1..eed0c41 100644 --- a/third_party/blink/renderer/core/streams/transferable_streams.cc +++ b/third_party/blink/renderer/core/streams/transferable_streams.cc
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/core/streams/transferable_streams.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/script_function.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h" #include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h" @@ -77,10 +76,10 @@ v8::Local<v8::Name> names[] = {V8AtomicString(isolate, key1), V8AtomicString(isolate, key2)}; v8::Local<v8::Value> values[] = {value1, value2}; - static_assert(base::size(names) == base::size(values), + static_assert(std::size(names) == std::size(values), "names and values arrays must be the same size"); return v8::Object::New(isolate, v8::Null(isolate), names, values, - base::size(names)); + std::size(names)); } // Unpacks an object created by CreateKeyValueObject(). |value1| and |value2|
diff --git a/third_party/blink/renderer/core/svg/svg_element.cc b/third_party/blink/renderer/core/svg/svg_element.cc index bd3fc31..72a1bba6 100644 --- a/third_party/blink/renderer/core/svg/svg_element.cc +++ b/third_party/blink/renderer/core/svg/svg_element.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/core/svg/svg_element.h" #include "base/auto_reset.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/js_event_handler_for_content_attribute.h" #include "third_party/blink/renderer/core/animation/document_animations.h" #include "third_party/blink/renderer/core/animation/effect_stack.h" @@ -454,7 +453,7 @@ &svg_names::kWordSpacingAttr, &svg_names::kWritingModeAttr, }; - for (size_t i = 0; i < base::size(attr_names); i++) { + for (size_t i = 0; i < std::size(attr_names); i++) { CSSPropertyID property_id = CssPropertyID(execution_context, attr_names[i]->LocalName()); DCHECK_GT(property_id, CSSPropertyID::kInvalid); @@ -749,7 +748,7 @@ {svg_names::kVisibilityAttr, kAnimatedString}, {svg_names::kWordSpacingAttr, kAnimatedLength}, }; - for (size_t i = 0; i < base::size(attr_to_types); i++) + for (size_t i = 0; i < std::size(attr_to_types); i++) css_property_map.Set(attr_to_types[i].attr, attr_to_types[i].prop_type); } auto it = css_property_map.find(attribute_name);
diff --git a/third_party/blink/renderer/core/svg/svg_length.cc b/third_party/blink/renderer/core/svg/svg_length.cc index 9170710..5a007bc 100644 --- a/third_party/blink/renderer/core/svg/svg_length.cc +++ b/third_party/blink/renderer/core/svg/svg_length.cc
@@ -52,7 +52,7 @@ {3, CAST_UNIT(kUserUnits)}, }; static_assert(static_cast<size_t>(SVGLength::Initial::kNumValues) == - base::size(g_initial_lengths_table), + std::size(g_initial_lengths_table), "the enumeration is synchronized with the value table"); static_assert(static_cast<size_t>(SVGLength::Initial::kNumValues) <= 1u << SVGLength::kInitialValueBits, @@ -63,7 +63,7 @@ const CSSPrimitiveValue& CreateInitialCSSValue( SVGLength::Initial initial_value) { size_t initial_value_index = static_cast<size_t>(initial_value); - DCHECK_LT(initial_value_index, base::size(g_initial_lengths_table)); + DCHECK_LT(initial_value_index, std::size(g_initial_lengths_table)); const auto& entry = g_initial_lengths_table[initial_value_index]; return *CSSNumericLiteralValue::Create( entry.value, static_cast<CSSPrimitiveValue::UnitType>(entry.unit));
diff --git a/third_party/blink/renderer/core/svg/svg_transform.cc b/third_party/blink/renderer/core/svg/svg_transform.cc index 6a657ae..1bb6f0c 100644 --- a/third_party/blink/renderer/core/svg/svg_transform.cc +++ b/third_party/blink/renderer/core/svg/svg_transform.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/core/svg/svg_transform.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "ui/gfx/geometry/vector2d_f.h" @@ -205,7 +204,7 @@ arguments[argument_count++] = angle_; break; } - DCHECK_LE(argument_count, base::size(arguments)); + DCHECK_LE(argument_count, std::size(arguments)); StringBuilder builder; builder.Append(TransformTypePrefixForParsing(transform_type_));
diff --git a/third_party/blink/renderer/core/svg/svg_transform_list.cc b/third_party/blink/renderer/core/svg/svg_transform_list.cc index 1a953c9..023181f 100644 --- a/third_party/blink/renderer/core/svg/svg_transform_list.cc +++ b/third_party/blink/renderer/core/svg/svg_transform_list.cc
@@ -23,7 +23,6 @@ #include "third_party/blink/renderer/core/svg/svg_transform_list.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/css/css_function_value.h" #include "third_party/blink/renderer/core/css/css_identifier_value.h" #include "third_party/blink/renderer/core/css/css_numeric_literal_value.h" @@ -59,11 +58,11 @@ "index of SVGTransformType::kSkewx has changed"); static_assert(static_cast<int>(SVGTransformType::kSkewy) == 6, "index of SVGTransformType::kSkewy has changed"); -static_assert(base::size(kRequiredValuesForType) - 1 == +static_assert(std::size(kRequiredValuesForType) - 1 == static_cast<int>(SVGTransformType::kSkewy), "the number of transform types have changed"); -static_assert(base::size(kRequiredValuesForType) == - base::size(kOptionalValuesForType), +static_assert(std::size(kRequiredValuesForType) == + std::size(kOptionalValuesForType), "the arrays should have the same number of elements"); const unsigned kMaxTransformArguments = 6;
diff --git a/third_party/blink/renderer/core/timing/background_tracing_helper.cc b/third_party/blink/renderer/core/timing/background_tracing_helper.cc index c799af0..7e666077 100644 --- a/third_party/blink/renderer/core/timing/background_tracing_helper.cc +++ b/third_party/blink/renderer/core/timing/background_tracing_helper.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/core/timing/background_tracing_helper.h" -#include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/hash/md5.h" #include "base/rand_util.h" @@ -96,7 +95,7 @@ String GenerateFullTrigger(const String& site, const String& mark_name) { DCHECK(MarkNameIsTrigger(mark_name)); - return site + "-" + mark_name.Substring(base::size(kTriggerPrefix) - 1); + return site + "-" + mark_name.Substring(std::size(kTriggerPrefix) - 1); } } // namespace
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc index 52bdbaa6..1c97b2a 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc +++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -1407,7 +1407,7 @@ return nullptr; constexpr size_t kSharedXhtmlEntityResultLength = - base::size(g_shared_xhtml_entity_result); + std::size(g_shared_xhtml_entity_result); size_t entity_length_in_utf8; // Unlike HTML parser, XML parser parses the content of named // entities. So we need to escape '&' and '<'.
diff --git a/third_party/blink/renderer/modules/crypto/crypto_key.cc b/third_party/blink/renderer/modules/crypto/crypto_key.cc index f11c7138..0b1f3d9d 100644 --- a/third_party/blink/renderer/modules/crypto/crypto_key.cc +++ b/third_party/blink/renderer/modules/crypto/crypto_key.cc
@@ -30,7 +30,6 @@ #include "third_party/blink/renderer/modules/crypto/crypto_key.h" -#include "base/cxx17_backports.h" #include "third_party/blink/public/platform/web_crypto_algorithm_params.h" #include "third_party/blink/public/platform/web_crypto_key_algorithm.h" #include "third_party/blink/public/platform/web_string.h" @@ -81,7 +80,7 @@ "keyUsageMappings needs to be updated"); const char* KeyUsageToString(WebCryptoKeyUsage usage) { - for (size_t i = 0; i < base::size(kKeyUsageMappings); ++i) { + for (size_t i = 0; i < std::size(kKeyUsageMappings); ++i) { if (kKeyUsageMappings[i].value == usage) return kKeyUsageMappings[i].name; } @@ -90,7 +89,7 @@ } WebCryptoKeyUsageMask KeyUsageStringToMask(const String& usage_string) { - for (size_t i = 0; i < base::size(kKeyUsageMappings); ++i) { + for (size_t i = 0; i < std::size(kKeyUsageMappings); ++i) { if (kKeyUsageMappings[i].name == usage_string) return kKeyUsageMappings[i].value; } @@ -159,7 +158,7 @@ // different). ScriptValue CryptoKey::usages(ScriptState* script_state) { Vector<String> result; - for (size_t i = 0; i < base::size(kKeyUsageMappings); ++i) { + for (size_t i = 0; i < std::size(kKeyUsageMappings); ++i) { WebCryptoKeyUsage usage = kKeyUsageMappings[i].value; if (key_.Usages() & usage) result.push_back(KeyUsageToString(usage));
diff --git a/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc b/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc index 7661761..b125394 100644 --- a/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc +++ b/third_party/blink/renderer/modules/crypto/normalize_algorithm.cc
@@ -33,7 +33,6 @@ #include <algorithm> #include <memory> -#include "base/cxx17_backports.h" #include "base/strings/char_traits.h" #include "third_party/blink/public/platform/web_crypto_algorithm_params.h" #include "third_party/blink/public/platform/web_string.h" @@ -91,7 +90,7 @@ // Reminder to update the table mapping names to IDs whenever adding a new // algorithm ID. static_assert(kWebCryptoAlgorithmIdLast + 1 == - base::size(kAlgorithmNameMappings), + std::size(kAlgorithmNameMappings), "algorithmNameMappings needs to be updated"); #if DCHECK_IS_ON() @@ -182,7 +181,7 @@ WebCryptoAlgorithmId& id) { const AlgorithmNameMapping* begin = kAlgorithmNameMappings; const AlgorithmNameMapping* end = - kAlgorithmNameMappings + base::size(kAlgorithmNameMappings); + kAlgorithmNameMappings + std::size(kAlgorithmNameMappings); #if DCHECK_IS_ON() DCHECK(VerifyAlgorithmNameMappings(begin, end)); @@ -817,7 +816,7 @@ {"P-521", kWebCryptoNamedCurveP521}}; // Reminder to update curveNameMappings when adding a new curve. -static_assert(kWebCryptoNamedCurveLast + 1 == base::size(kCurveNameMappings), +static_assert(kWebCryptoNamedCurveLast + 1 == std::size(kCurveNameMappings), "curveNameMappings needs to be updated"); bool ParseNamedCurve(const Dictionary& raw, @@ -831,7 +830,7 @@ return false; } - for (size_t i = 0; i < base::size(kCurveNameMappings); ++i) { + for (size_t i = 0; i < std::size(kCurveNameMappings); ++i) { if (kCurveNameMappings[i].name == named_curve_string) { named_curve = kCurveNameMappings[i].value; return true;
diff --git a/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc b/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc index 01bef83c..5ef41213 100644 --- a/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc +++ b/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc
@@ -10,7 +10,6 @@ #include <memory> #include <utility> -#include "base/cxx17_backports.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/to_v8_for_core.h" @@ -133,7 +132,7 @@ const UChar astral_character[2] = {high_surrogate.value(), *begin}; // Third argument is ignored, as above. *prefix = - encoder_->Encode(astral_character, base::size(astral_character), + encoder_->Encode(astral_character, std::size(astral_character), WTF::kNoUnencodables); ++begin; if (begin == end)
diff --git a/third_party/blink/renderer/modules/eventsource/event_source_parser.cc b/third_party/blink/renderer/modules/eventsource/event_source_parser.cc index 6ffdc8f..f26efac 100644 --- a/third_party/blink/renderer/modules/eventsource/event_source_parser.cc +++ b/third_party/blink/renderer/modules/eventsource/event_source_parser.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/modules/eventsource/event_source_parser.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/event_type_names.h" #include "third_party/blink/renderer/modules/eventsource/event_source.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -30,10 +29,10 @@ for (uint32_t i = 0; i < size && !is_stopped_; ++i) { // As kBOM contains neither CR nor LF, we can think BOM and the line // break separately. - if (is_recognizing_bom_ && line_.size() + (i - start) == base::size(kBOM)) { + if (is_recognizing_bom_ && line_.size() + (i - start) == std::size(kBOM)) { Vector<char> line = line_; line.Append(&bytes[start], i - start); - DCHECK_EQ(line.size(), base::size(kBOM)); + DCHECK_EQ(line.size(), std::size(kBOM)); is_recognizing_bom_ = false; if (memcmp(line.data(), kBOM, sizeof(kBOM)) == 0) { start = i;
diff --git a/third_party/blink/renderer/modules/manifest/manifest_parser.cc b/third_party/blink/renderer/modules/manifest/manifest_parser.cc index 9f358cb..056db0a 100644 --- a/third_party/blink/renderer/modules/manifest/manifest_parser.cc +++ b/third_party/blink/renderer/modules/manifest/manifest_parser.cc
@@ -1220,7 +1220,7 @@ const char kToken[] = "%s"; String user_url = protocol_handler->url.GetString(); String tokenless_url = protocol_handler->url.GetString(); - tokenless_url.Remove(user_url.Find(kToken), base::size(kToken) - 1); + tokenless_url.Remove(user_url.Find(kToken), std::size(kToken) - 1); KURL full_url(manifest_url_, tokenless_url); if (!VerifyCustomHandlerURLSyntax(full_url, manifest_url_, user_url,
diff --git a/third_party/blink/renderer/modules/media_controls/elements/media_control_playback_speed_list_element.cc b/third_party/blink/renderer/modules/media_controls/elements/media_control_playback_speed_list_element.cc index 9a54f87..b43a2fe6 100644 --- a/third_party/blink/renderer/modules/media_controls/elements/media_control_playback_speed_list_element.cc +++ b/third_party/blink/renderer/modules/media_controls/elements/media_control_playback_speed_list_element.cc
@@ -222,13 +222,13 @@ checked_item_ = nullptr; // Construct a menu for playback speeds. - for (unsigned i = 0; i < base::size(kPlaybackSpeeds); i++) { + for (unsigned i = 0; i < std::size(kPlaybackSpeeds); i++) { auto& playback_speed = kPlaybackSpeeds[i]; auto* playback_speed_item = CreatePlaybackSpeedListItem( playback_speed.display_name, playback_speed.playback_rate); playback_speed_item->setAttribute( html_names::kAriaSetsizeAttr, - WTF::AtomicString::Number(base::size(kPlaybackSpeeds) + 1)); + WTF::AtomicString::Number(std::size(kPlaybackSpeeds) + 1)); playback_speed_item->setAttribute(html_names::kAriaPosinsetAttr, WTF::AtomicString::Number(i + 1)); playback_speed_item->setAttribute(html_names::kRoleAttr,
diff --git a/third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.cc b/third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.cc index f56afee2..19040f2d 100644 --- a/third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.cc +++ b/third_party/blink/renderer/modules/mediarecorder/audio_track_opus_encoder.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/logging.h" #include "media/base/audio_sample_types.h" #include "media/base/audio_timestamp_helper.h" @@ -48,7 +47,7 @@ data_out->resize(kOpusMaxDataBytes); const opus_int32 result = opus_encode_float( opus_encoder, data_in, num_samples, - reinterpret_cast<uint8_t*>(base::data(*data_out)), kOpusMaxDataBytes); + reinterpret_cast<uint8_t*>(std::data(*data_out)), kOpusMaxDataBytes); if (result > 1) { // TODO(ajose): Investigate improving this. http://crbug.com/547918
diff --git a/third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.cc b/third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.cc index 3b74195..40694fa 100644 --- a/third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.cc +++ b/third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/modules/mediarecorder/audio_track_pcm_encoder.h" -#include "base/cxx17_backports.h" #include "base/logging.h" #include "media/base/audio_sample_types.h" #include "media/base/audio_timestamp_helper.h" @@ -41,7 +40,7 @@ std::string encoded_data_string; encoded_data_string.resize(input_bus->frames() * input_bus->channels() * sizeof(float)); - char* encoded_data_ptr = base::data(encoded_data_string); + char* encoded_data_ptr = std::data(encoded_data_string); input_bus->ToInterleaved<media::Float32SampleTypeTraits>( input_bus->frames(), reinterpret_cast<float*>(encoded_data_ptr));
diff --git a/third_party/blink/renderer/modules/mediarecorder/audio_track_recorder_unittest.cc b/third_party/blink/renderer/modules/mediarecorder/audio_track_recorder_unittest.cc index 8500b973..b8efb028d 100644 --- a/third_party/blink/renderer/modules/mediarecorder/audio_track_recorder_unittest.cc +++ b/third_party/blink/renderer/modules/mediarecorder/audio_track_recorder_unittest.cc
@@ -207,12 +207,12 @@ if (codec_ == AudioTrackRecorder::CodecId::kOpus) { // Decode |encoded_data| and check we get the expected number of frames // per buffer. - EXPECT_EQ(kDefaultSampleRate * kOpusBufferDurationMs / 1000, - opus_decode_float( - opus_decoder_, - reinterpret_cast<uint8_t*>(base::data(encoded_data)), - static_cast<wtf_size_t>(encoded_data.size()), - opus_buffer_.get(), kFramesPerBuffer, 0)); + EXPECT_EQ( + kDefaultSampleRate * kOpusBufferDurationMs / 1000, + opus_decode_float(opus_decoder_, + reinterpret_cast<uint8_t*>(std::data(encoded_data)), + static_cast<wtf_size_t>(encoded_data.size()), + opus_buffer_.get(), kFramesPerBuffer, 0)); } else if (codec_ == AudioTrackRecorder::CodecId::kPcm) { // Manually confirm that we're getting the same data out as what we // generated from the sine wave.
diff --git a/third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.cc b/third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.cc index 34ce20e..5980f99e 100644 --- a/third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.cc +++ b/third_party/blink/renderer/modules/mediarecorder/media_recorder_handler.cc
@@ -184,7 +184,7 @@ static const char* const kAudioCodecs[] = {"opus", "pcm"}; const char* const* codecs = video ? &kVideoCodecs[0] : &kAudioCodecs[0]; const int codecs_count = - video ? base::size(kVideoCodecs) : base::size(kAudioCodecs); + video ? std::size(kVideoCodecs) : std::size(kAudioCodecs); std::vector<std::string> codecs_list; media::SplitCodecs(web_codecs.Utf8(), &codecs_list);
diff --git a/third_party/blink/renderer/modules/mediarecorder/video_track_recorder.cc b/third_party/blink/renderer/modules/mediarecorder/video_track_recorder.cc index 2bdb30f4..68a5a539 100644 --- a/third_party/blink/renderer/modules/mediarecorder/video_track_recorder.cc +++ b/third_party/blink/renderer/modules/mediarecorder/video_track_recorder.cc
@@ -73,7 +73,7 @@ #endif }; -static_assert(base::size(kPreferredCodecIdAndVEAProfiles) == +static_assert(std::size(kPreferredCodecIdAndVEAProfiles) == static_cast<int>(CodecId::kLast), "|kPreferredCodecIdAndVEAProfiles| should consider all CodecIds");
diff --git a/third_party/blink/renderer/modules/notifications/notification_data_test.cc b/third_party/blink/renderer/modules/notifications/notification_data_test.cc index ae0359d2..3fd65a07 100644 --- a/third_party/blink/renderer/modules/notifications/notification_data_test.cc +++ b/third_party/blink/renderer/modules/notifications/notification_data_test.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/modules/notifications/notification_data.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/notifications/notification_constants.h" #include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" @@ -55,7 +54,7 @@ V8TestingScope scope(base_url); Vector<unsigned> vibration_pattern; - for (size_t i = 0; i < base::size(kNotificationVibration); ++i) + for (size_t i = 0; i < std::size(kNotificationVibration); ++i) vibration_pattern.push_back(kNotificationVibration[i]); auto* vibration_sequence = @@ -143,7 +142,7 @@ V8TestingScope scope; Vector<unsigned> vibration_pattern; - for (size_t i = 0; i < base::size(kNotificationVibration); ++i) + for (size_t i = 0; i < std::size(kNotificationVibration); ++i) vibration_pattern.push_back(kNotificationVibration[i]); auto* vibration_sequence = @@ -243,7 +242,7 @@ V8TestingScope scope; Vector<unsigned> unnormalized_pattern; - for (size_t i = 0; i < base::size(kNotificationVibrationUnnormalized); ++i) + for (size_t i = 0; i < std::size(kNotificationVibrationUnnormalized); ++i) unnormalized_pattern.push_back(kNotificationVibrationUnnormalized[i]); auto* vibration_sequence = @@ -261,7 +260,7 @@ EXPECT_FALSE(exception_state.HadException()); Vector<int> normalized_pattern; - for (size_t i = 0; i < base::size(kNotificationVibrationNormalized); ++i) + for (size_t i = 0; i < std::size(kNotificationVibrationNormalized); ++i) normalized_pattern.push_back(kNotificationVibrationNormalized[i]); ASSERT_EQ(normalized_pattern.size(),
diff --git a/third_party/blink/renderer/modules/payments/basic_card_helper.cc b/third_party/blink/renderer/modules/payments/basic_card_helper.cc index 62ac2ee..6db7562 100644 --- a/third_party/blink/renderer/modules/payments/basic_card_helper.cc +++ b/third_party/blink/renderer/modules/payments/basic_card_helper.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/modules/payments/basic_card_helper.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_basic_card_request.h" #include "third_party/blink/renderer/modules/payments/payment_request.h" @@ -49,7 +48,7 @@ } for (const String& network : basic_card->supportedNetworks()) { - for (size_t i = 0; i < base::size(kBasicCardNetworks); ++i) { + for (size_t i = 0; i < std::size(kBasicCardNetworks); ++i) { if (network == kBasicCardNetworks[i].name) { supported_networks_output.push_back(kBasicCardNetworks[i].code); break; @@ -60,7 +59,7 @@ } bool BasicCardHelper::IsNetworkName(const String& input) { - for (size_t i = 0; i < base::size(kBasicCardNetworks); ++i) { + for (size_t i = 0; i < std::size(kBasicCardNetworks); ++i) { if (input == kBasicCardNetworks[i].name) { return true; }
diff --git a/third_party/blink/renderer/modules/screen_orientation/screen_orientation.cc b/third_party/blink/renderer/modules/screen_orientation/screen_orientation.cc index 9d4ce88..2c48000 100644 --- a/third_party/blink/renderer/modules/screen_orientation/screen_orientation.cc +++ b/third_party/blink/renderer/modules/screen_orientation/screen_orientation.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" @@ -67,7 +66,7 @@ {portrait, device::mojom::blink::ScreenOrientationLockType::PORTRAIT}, {landscape, device::mojom::blink::ScreenOrientationLockType::LANDSCAPE}, {natural, device::mojom::blink::ScreenOrientationLockType::NATURAL}}; - length = base::size(orientation_map); + length = std::size(orientation_map); return orientation_map; }
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc b/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc index e8fba27..84c3f38 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc
@@ -28,7 +28,6 @@ #include "third_party/blink/renderer/modules/webdatabase/sql_transaction.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/modules/webdatabase/database.h" #include "third_party/blink/renderer/modules/webdatabase/database_authorizer.h" @@ -153,7 +152,7 @@ &SQLTransaction::DeliverSuccessCallback // 12. }; - DCHECK(base::size(kStateFunctions) == + DCHECK(std::size(kStateFunctions) == static_cast<int>(SQLTransactionState::kNumberOfStates)); DCHECK(state < SQLTransactionState::kNumberOfStates);
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc index b546425..083fb8ab 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.cc
@@ -30,7 +30,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/modules/webdatabase/database.h" #include "third_party/blink/renderer/modules/webdatabase/database_authorizer.h" #include "third_party/blink/renderer/modules/webdatabase/database_context.h" @@ -484,7 +483,7 @@ &SQLTransactionBackend::SendToFrontendState, }; - DCHECK(base::size(kStateFunctions) == + DCHECK(std::size(kStateFunctions) == static_cast<int>(SQLTransactionState::kNumberOfStates)); DCHECK_LT(state, SQLTransactionState::kNumberOfStates);
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc index 6135cd9..0bd53de 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/numerics/checked_math.h" #include "base/numerics/safe_conversions.h" #include "gpu/command_buffer/client/gles2_interface.h" @@ -174,7 +173,7 @@ graphics_info, requested_attributes, context_type) { - for (size_t i = 0; i < base::size(kSupportedInternalFormatsStorage); ++i) { + for (size_t i = 0; i < std::size(kSupportedInternalFormatsStorage); ++i) { supported_internal_formats_storage_.insert( kSupportedInternalFormatsStorage[i]); }
diff --git a/third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.cc b/third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.cc index d7f17d3..819c21b 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/modules/webgl/webgl_compressed_texture_astc.h" -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h" namespace blink { @@ -39,8 +38,7 @@ GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR - GL_COMPRESSED_RGBA_ASTC_4x4_KHR; for (size_t i = 0; - i < base::size(WebGLCompressedTextureASTC::kBlockSizeCompressASTC); - i++) { + i < std::size(WebGLCompressedTextureASTC::kBlockSizeCompressASTC); i++) { /* GL_COMPRESSED_RGBA_ASTC(0x93B0 ~ 0x93BD) */ context->AddCompressedTextureFormat( WebGLCompressedTextureASTC::kBlockSizeCompressASTC[i].compress_type);
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index 6a292e1..fd0f1f1f 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
@@ -28,7 +28,6 @@ #include <memory> #include <utility> -#include "base/cxx17_backports.h" #include "base/feature_list.h" #include "base/numerics/checked_math.h" #include "build/build_config.h" @@ -1066,9 +1065,9 @@ disabled_extensions_.insert(entry); } -#define ADD_VALUES_TO_SET(set, values) \ - for (size_t i = 0; i < base::size(values); ++i) { \ - set.insert(values[i]); \ +#define ADD_VALUES_TO_SET(set, values) \ + for (size_t i = 0; i < std::size(values); ++i) { \ + set.insert(values[i]); \ } ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedFormatsES2);
diff --git a/third_party/blink/renderer/platform/bindings/v8_cross_origin_property_support.cc b/third_party/blink/renderer/platform/bindings/v8_cross_origin_property_support.cc index 10a3013..c429e872 100644 --- a/third_party/blink/renderer/platform/bindings/v8_cross_origin_property_support.cc +++ b/third_party/blink/renderer/platform/bindings/v8_cross_origin_property_support.cc
@@ -77,7 +77,7 @@ v8::Symbol::GetIsConcatSpreadable(isolate), }; const uint32_t length = static_cast<uint32_t>( - attributes.size() + operations.size() + base::size(default_supported)); + attributes.size() + operations.size() + std::size(default_supported)); Vector<v8::Local<v8::Value>> elements; elements.ReserveCapacity(length); for (const auto& attribute : attributes)
diff --git a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h index dfa4da74..7ff3446e 100644 --- a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h +++ b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h
@@ -31,7 +31,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_DOM_WRAPPER_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_V8_DOM_WRAPPER_H_ -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/bindings/binding_security_for_platform.h" #include "third_party/blink/renderer/platform/bindings/custom_wrappable.h" #include "third_party/blink/renderer/platform/bindings/dom_data_store.h" @@ -109,7 +108,7 @@ DCHECK(wrapper_type_info); int indices[] = {kV8DOMWrapperObjectIndex, kV8DOMWrapperTypeIndex}; void* values[] = {wrappable, const_cast<WrapperTypeInfo*>(wrapper_type_info)}; - wrapper->SetAlignedPointerInInternalFields(base::size(indices), indices, + wrapper->SetAlignedPointerInInternalFields(std::size(indices), indices, values); } @@ -117,7 +116,7 @@ v8::Local<v8::Object> wrapper) { int indices[] = {kV8DOMWrapperObjectIndex, kV8DOMWrapperTypeIndex}; void* values[] = {nullptr, nullptr}; - wrapper->SetAlignedPointerInInternalFields(base::size(indices), indices, + wrapper->SetAlignedPointerInInternalFields(std::size(indices), indices, values); }
diff --git a/third_party/blink/renderer/platform/exported/web_crypto_algorithm.cc b/third_party/blink/renderer/platform/exported/web_crypto_algorithm.cc index d71c4d8..e48be7ca 100644 --- a/third_party/blink/renderer/platform/exported/web_crypto_algorithm.cc +++ b/third_party/blink/renderer/platform/exported/web_crypto_algorithm.cc
@@ -28,13 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/public/platform/web_crypto_algorithm.h" - #include <memory> #include <utility> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" +#include "third_party/blink/public/platform/web_crypto_algorithm.h" #include "third_party/blink/public/platform/web_crypto_algorithm_params.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" @@ -379,7 +377,7 @@ const WebCryptoAlgorithmInfo* WebCryptoAlgorithm::LookupAlgorithmInfo( WebCryptoAlgorithmId id) { const unsigned id_int = id; - if (id_int >= base::size(kAlgorithmIdToInfo)) + if (id_int >= std::size(kAlgorithmIdToInfo)) return nullptr; return &kAlgorithmIdToInfo[id]; }
diff --git a/third_party/blink/renderer/platform/exported/web_vector_test.cc b/third_party/blink/renderer/platform/exported/web_vector_test.cc index e25aee08..e455b947 100644 --- a/third_party/blink/renderer/platform/exported/web_vector_test.cc +++ b/third_party/blink/renderer/platform/exported/web_vector_test.cc
@@ -3,8 +3,6 @@ // found in the LICENSE file. #include "third_party/blink/public/platform/web_vector.h" - -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -61,8 +59,8 @@ TEST(WebVectorTest, Swap) { const int kFirstData[] = {1, 2, 3, 4, 5}; const int kSecondData[] = {6, 5, 8}; - const size_t kFirstDataLength = base::size(kFirstData); - const size_t kSecondDataLength = base::size(kSecondData); + const size_t kFirstDataLength = std::size(kFirstData); + const size_t kSecondDataLength = std::size(kSecondData); WebVector<int> first(kFirstData, kFirstDataLength); WebVector<int> second(kSecondData, kSecondDataLength); @@ -137,9 +135,9 @@ WebVector<WebString> vector; vector.reserve(1); WebUChar buffer[] = {'H', 'e', 'l', 'l', 'o', ' ', 'b', 'l', 'i', 'n', 'k'}; - vector.emplace_back(buffer, base::size(buffer)); + vector.emplace_back(buffer, std::size(buffer)); ASSERT_EQ(1U, vector.size()); - EXPECT_EQ(WebString(buffer, base::size(buffer)), vector[0]); + EXPECT_EQ(WebString(buffer, std::size(buffer)), vector[0]); } TEST(WebVectorTest, EmplaceBackElementPlacement) {
diff --git a/third_party/blink/renderer/platform/fonts/font_description_test.cc b/third_party/blink/renderer/platform/fonts/font_description_test.cc index fd62d182..c2b3637 100644 --- a/third_party/blink/renderer/platform/fonts/font_description_test.cc +++ b/third_party/blink/renderer/platform/fonts/font_description_test.cc
@@ -25,7 +25,6 @@ #include "third_party/blink/renderer/platform/fonts/font_description.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -50,11 +49,11 @@ FontDescription source; WTF::Vector<unsigned> hashes; - for (size_t i = 0; i < base::size(weights); i++) { + for (size_t i = 0; i < std::size(weights); i++) { source.SetWeight(weights[i]); - for (size_t j = 0; j < base::size(stretches); j++) { + for (size_t j = 0; j < std::size(stretches); j++) { source.SetStretch(stretches[j]); - for (size_t k = 0; k < base::size(slopes); k++) { + for (size_t k = 0; k < std::size(slopes); k++) { source.SetStyle(slopes[k]); unsigned hash = source.StyleHashWithoutFamilyList(); ASSERT_FALSE(hashes.Contains(hash));
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm index 6c1c1ad..d627067 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm
@@ -33,7 +33,6 @@ #import <Foundation/Foundation.h> #import <math.h> -#include "base/cxx17_backports.h" #include "base/mac/foundation_util.h" #include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_nsobject.h" @@ -113,7 +112,7 @@ }; size_t select_weight = roundf(font_weight / 100) - 1; DCHECK_GE(select_weight, 0ul); - DCHECK_LE(select_weight, base::size(ns_font_weights)); + DCHECK_LE(select_weight, std::size(ns_font_weights)); return ns_font_weights[select_weight]; } @@ -328,7 +327,7 @@ 12, // FontWeight900 }; DCHECK_GE(select_weight, 0ul); - DCHECK_LE(select_weight, base::size(app_kit_font_weights)); + DCHECK_LE(select_weight, std::size(app_kit_font_weights)); return app_kit_font_weights[select_weight]; }
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm index 384765f..1f71bcd 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
@@ -26,7 +26,6 @@ #import <AppKit/NSFont.h> #import <AvailabilityMacros.h> -#include "base/cxx17_backports.h" #import "base/mac/foundation_util.h" #import "base/mac/scoped_nsobject.h" #include "third_party/blink/public/platform/mac/web_sandbox_support.h" @@ -113,13 +112,13 @@ CTFontDescriptorCreateWithNameAndSize(CFSTR("LastResort"), 0)); const void* descriptors[] = {last_resort}; base::ScopedCFTypeRef<CFArrayRef> values_array( - CFArrayCreate(kCFAllocatorDefault, descriptors, base::size(descriptors), + CFArrayCreate(kCFAllocatorDefault, descriptors, std::size(descriptors), &kCFTypeArrayCallBacks)); const void* keys[] = {kCTFontCascadeListAttribute}; const void* values[] = {values_array}; attributes = CFDictionaryCreate( - kCFAllocatorDefault, keys, values, base::size(keys), + kCFAllocatorDefault, keys, values, std::size(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); return attributes; }
diff --git a/third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support_mpl.cc b/third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support_mpl.cc index f6f1c7e..83ed7cc 100644 --- a/third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support_mpl.cc +++ b/third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support_mpl.cc
@@ -6,11 +6,10 @@ * * ***** END LICENSE BLOCK ***** */ -#include "base/cxx17_backports.h" -#include "third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support.h" - #include <hb-ot.h> +#include "third_party/blink/renderer/platform/fonts/opentype/open_type_caps_support.h" + namespace blink { bool OpenTypeCapsSupport::SupportsOpenTypeFeature(hb_script_t script, @@ -32,7 +31,7 @@ // Get the OpenType tag(s) that match this script code DCHECK_EQ(HB_TAG_NONE, 0u); hb_tag_t script_tags[2] = {}; - unsigned num_returned_script_tags = base::size(script_tags); + unsigned num_returned_script_tags = std::size(script_tags); hb_ot_tags_from_script_and_language( static_cast<hb_script_t>(script), HB_LANGUAGE_INVALID, &num_returned_script_tags, script_tags, nullptr, nullptr);
diff --git a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc index 6d48b5c..f760e3f 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper_test.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/test/task_environment.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/fonts/font_cache.h" @@ -273,7 +272,7 @@ 0xDC73, 0xDB40, 0xDC63, 0xDB40, 0xDC74, 0xDB40, 0xDC7F, 0xD83C, 0xDFF4, 0xDB40, 0xDC67, 0xDB40, 0xDC62, 0xDB40, 0xDC65, 0xDB40, 0xDC6E, 0xDB40, 0xDC67, 0xDB40, 0xDC7F}; - TextRun text_run(kStr, base::size(kStr)); + TextRun text_run(kStr, std::size(kStr)); scoped_refptr<const ShapeResult> word_result; CachingWordShapeIterator iterator(cache.get(), text_run, &font);
diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc index 3c7138c..b5f2374 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper_test.cc
@@ -6,7 +6,6 @@ #include <unicode/uscript.h> -#include "base/cxx17_backports.h" #include "base/test/bind.h" #include "base/test/task_environment.h" #include "build/build_config.h" @@ -695,7 +694,7 @@ 0x0648, kZeroWidthSpaceCharacter, kZeroWidthSpaceCharacter}; - const unsigned length = base::size(string); + const unsigned length = std::size(string); HarfBuzzShaper shaper(String(string, length)); scoped_refptr<ShapeResult> result = ShapeWithParameter(&shaper); EXPECT_EQ(0u, result->StartIndex()); @@ -925,7 +924,7 @@ TextDirection direction = TextDirection::kLtr; HarfBuzzShaper shaper( - String(emoji_zwj_sequence, base::size(emoji_zwj_sequence))); + String(emoji_zwj_sequence, std::size(emoji_zwj_sequence))); scoped_refptr<ShapeResult> result = shaper.Shape(&font, direction); } @@ -1899,7 +1898,7 @@ Font emoji_font = CreateNotoColorEmoji(); scoped_refptr<ShapeResult> result = shaper.Shape(&emoji_font, TextDirection::kLtr); - CHECK_EQ(num_calls, base::size(expectations)); + CHECK_EQ(num_calls, std::size(expectations)); } // https://crbug.com/1255482
diff --git a/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator_test.cc b/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator_test.cc index e45d90b1..2aad5503 100644 --- a/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator_test.cc
@@ -6,7 +6,6 @@ #include <unicode/unistr.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/text/character.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" @@ -31,7 +30,7 @@ 0x00A9}; icu::UnicodeString class_examples_unicode_string = icu::UnicodeString::fromUTF32(class_examples_codepoints, - base::size(class_examples_codepoints)); + std::size(class_examples_codepoints)); char categories[] = {UTF16RagelIterator::COMBINING_ENCLOSING_KEYCAP, UTF16RagelIterator::COMBINING_ENCLOSING_CIRCLE_BACKSLASH, UTF16RagelIterator::ZWJ, @@ -58,7 +57,7 @@ reinterpret_cast<const UChar*>(class_examples_unicode_string.getBuffer()), class_examples_unicode_string.length(), class_examples_unicode_string.length() - 1); - size_t i = base::size(categories) - 1; + size_t i = std::size(categories) - 1; while (reverse_ragel_iterator.Cursor() > 0) { CHECK_EQ(categories[i], *reverse_ragel_iterator); i--; @@ -74,7 +73,7 @@ }; icu::UnicodeString class_examples_unicode_string = icu::UnicodeString::fromUTF32(class_examples_codepoints, - base::size(class_examples_codepoints)); + std::size(class_examples_codepoints)); UTF16RagelIterator ragel_iterator( reinterpret_cast<const UChar*>(class_examples_unicode_string.getBuffer()), @@ -117,7 +116,7 @@ kLeftSpeechBubbleCharacter}; icu::UnicodeString flags_unicode_string = icu::UnicodeString::fromUTF32( - flags_codepoints, base::size(flags_codepoints)); + flags_codepoints, std::size(flags_codepoints)); UTF16RagelIterator ragel_iterator( reinterpret_cast<const UChar*>(flags_unicode_string.getBuffer()), flags_unicode_string.length());
diff --git a/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc b/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc index d21664d..36c4db9 100644 --- a/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc +++ b/third_party/blink/renderer/platform/fonts/win/font_cache_skia_win.cc
@@ -29,17 +29,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/renderer/platform/fonts/font_cache.h" - -#include <ft2build.h> #include <freetype/freetype.h> +#include <ft2build.h> #include <unicode/uscript.h> +#include <windows.h> // For GetACP() #include <memory> #include <string> #include <utility> -#include "base/cxx17_backports.h" #include "base/debug/alias.h" #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" @@ -48,6 +46,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/web_font_prewarmer.h" #include "third_party/blink/renderer/platform/fonts/bitmap_glyphs_block_list.h" +#include "third_party/blink/renderer/platform/fonts/font_cache.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" #include "third_party/blink/renderer/platform/fonts/font_face_creation_params.h" #include "third_party/blink/renderer/platform/fonts/font_platform_data.h" @@ -60,9 +59,6 @@ #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/ports/SkTypeface_win.h" -// For GetACP() -#include <windows.h> - namespace blink { WebFontPrewarmer* FontCache::prewarmer_ = nullptr; @@ -325,10 +321,10 @@ int num_fonts = 0; if (script == USCRIPT_HAN) { pan_uni_fonts = kCjkFonts; - num_fonts = base::size(kCjkFonts); + num_fonts = std::size(kCjkFonts); } else { pan_uni_fonts = kCommonFonts; - num_fonts = base::size(kCommonFonts); + num_fonts = std::size(kCommonFonts); } // Font returned from getFallbackFamily may not cover |character| // because it's based on script to font mapping. This problem is @@ -556,7 +552,7 @@ {u" ultrabold", 10, FontSelectionValue(800)}, {u" black", 6, FontSelectionValue(900)}, {u" heavy", 6, FontSelectionValue(900)}}; - size_t num_variants = base::size(kVariantForSuffix); + size_t num_variants = std::size(kVariantForSuffix); for (size_t i = 0; i < num_variants; i++) { const FamilyWeightSuffix& entry = kVariantForSuffix[i]; if (family.EndsWith(entry.suffix, kTextCaseUnicodeInsensitive)) { @@ -593,7 +589,7 @@ {u" expanded", 9, ExpandedWidthValue()}, {u" extraexpanded", 14, ExtraExpandedWidthValue()}, {u" ultraexpanded", 14, UltraExpandedWidthValue()}}; - size_t num_variants = base::size(kVariantForSuffix); + size_t num_variants = std::size(kVariantForSuffix); for (size_t i = 0; i < num_variants; i++) { const FamilyStretchSuffix& entry = kVariantForSuffix[i]; if (family.EndsWith(entry.suffix, kTextCaseUnicodeInsensitive)) {
diff --git a/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc b/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc index 432c044..84498e85 100644 --- a/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc +++ b/third_party/blink/renderer/platform/fonts/win/font_fallback_win.cc
@@ -35,7 +35,6 @@ #include <limits> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/fonts/font_cache.h" #include "third_party/blink/renderer/platform/text/icu_error.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -383,13 +382,13 @@ static const UChar* math_font = 0; static bool initialized = false; if (!initialized) { - for (size_t i = 0; i < base::size(kEmojiFonts); i++) { + for (size_t i = 0; i < std::size(kEmojiFonts); i++) { if (IsFontPresent(kEmojiFonts[i], font_manager)) { emoji_font = kEmojiFonts[i]; break; } } - for (size_t i = 0; i < base::size(kMathFonts); i++) { + for (size_t i = 0; i < std::size(kMathFonts); i++) { if (IsFontPresent(kMathFonts[i], font_manager)) { math_font = kMathFonts[i]; break;
diff --git a/third_party/blink/renderer/platform/geometry/length.cc b/third_party/blink/renderer/platform/geometry/length.cc index eb9fdd3..82a07ce 100644 --- a/third_party/blink/renderer/platform/geometry/length.cc +++ b/third_party/blink/renderer/platform/geometry/length.cc
@@ -198,7 +198,7 @@ "MaxContent", "MinIntrinsic", "FillAvailable", "FitContent", "Calculated", "ExtendToZoom", "DeviceWidth", "DeviceHeight", "None", "Content"}; - if (type_ < base::size(kTypeNames)) + if (type_ < std::size(kTypeNames)) builder.Append(kTypeNames[type_]); else builder.Append("?");
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc index bf4909d..f22d35b 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc
@@ -154,7 +154,7 @@ for (unsigned channel = 0; channel < 4; channel++) { SECURITY_DCHECK(static_cast<size_t>(transfer_function[channel].type) < - base::size(call_effect)); + std::size(call_effect)); (*call_effect[transfer_function[channel].type])(tables[channel], transfer_function[channel]); }
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc index 2ba2e9f..99d0c9b 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer_test.cc
@@ -32,7 +32,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/memory/scoped_refptr.h" #include "components/viz/common/resources/release_callback.h" #include "components/viz/common/resources/transferable_resource.h" @@ -666,7 +665,7 @@ DepthStencilTestCase(true, true, 1, "both"), }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { SCOPED_TRACE(cases[i].test_case_name); auto gl = std::make_unique<DepthStencilTrackingGLES2Interface>(); DepthStencilTrackingGLES2Interface* tracking_gl = gl.get();
diff --git a/third_party/blink/renderer/platform/graphics/graphics_types.cc b/third_party/blink/renderer/platform/graphics/graphics_types.cc index a1dc326..92ca5af 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_types.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_types.cc
@@ -26,7 +26,6 @@ #include "third_party/blink/renderer/platform/graphics/graphics_types.h" -#include "base/cxx17_backports.h" #include "base/notreached.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -51,9 +50,8 @@ "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"}; -const int kNumCompositeOperatorNames = - base::size(kCanvasCompositeOperatorNames); -const int kNumBlendModeNames = base::size(kCanvasBlendModeNames); +const int kNumCompositeOperatorNames = std::size(kCanvasCompositeOperatorNames); +const int kNumBlendModeNames = std::size(kCanvasBlendModeNames); bool ParseCanvasCompositeAndBlendMode(const String& s, CompositeOperator& op,
diff --git a/third_party/blink/renderer/platform/graphics/logging_canvas.cc b/third_party/blink/renderer/platform/graphics/logging_canvas.cc index 8b791db8..23502fa 100644 --- a/third_party/blink/renderer/platform/graphics/logging_canvas.cc +++ b/third_party/blink/renderer/platform/graphics/logging_canvas.cc
@@ -32,7 +32,6 @@ #include <unicode/unistr.h> -#include "base/cxx17_backports.h" #include "base/logging.h" #include "base/sys_byteorder.h" #include "build/build_config.h" @@ -213,7 +212,7 @@ auto path_point_item = std::make_unique<JSONObject>(); path_point_item->SetString("verb", verb_params.name); DCHECK_LE(verb_params.point_count + verb_params.point_offset, - base::size(points)); + std::size(points)); path_point_item->SetArray( "points", ArrayForSkPoints(verb_params.point_count, points + verb_params.point_offset));
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc index ba2ba21175..2de61014 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item_raster_invalidator_test.cc
@@ -355,7 +355,7 @@ TEST_P(DisplayItemRasterInvalidatorTest, Incremental) { gfx::Rect initial_rect(100, 100, 100, 100); Persistent<FakeDisplayItemClient> clients[6]; - for (size_t i = 0; i < base::size(clients); i++) { + for (size_t i = 0; i < std::size(clients); i++) { clients[i] = MakeGarbageCollected<FakeDisplayItemClient>(String::Format("%zu", i)); } @@ -379,7 +379,7 @@ gfx::Rect(100, 100, 150, 100), gfx::Rect(100, 100, 100, 150), gfx::Rect(100, 100, 150, 80), gfx::Rect(100, 100, 80, 150), gfx::Rect(100, 100, 150, 150), gfx::Rect(100, 100, 80, 80)}; - for (size_t i = 0; i < base::size(clients); i++) { + for (size_t i = 0; i < std::size(clients); i++) { clients[i]->Invalidate(PaintInvalidationReason::kIncremental); DrawRect(context, *clients[i], kBackgroundType, gfx::Rect(visual_rects[i]));
diff --git a/third_party/blink/renderer/platform/graphics/placeholder_image.cc b/third_party/blink/renderer/platform/graphics/placeholder_image.cc index 634c8ec..cac014b 100644 --- a/third_party/blink/renderer/platform/graphics/placeholder_image.cc +++ b/third_party/blink/renderer/platform/graphics/placeholder_image.cc
@@ -6,7 +6,6 @@ #include <utility> -#include "base/cxx17_backports.h" #include "cc/paint/paint_flags.h" #include "third_party/blink/public/resources/grit/blink_image_resources.h" #include "third_party/blink/public/strings/grit/blink_strings.h" @@ -132,7 +131,7 @@ // Find the smallest unit that can represent |bytes| in 3 digits or less. // Round up to the next higher unit if possible when it would take 4 digits to // display the amount, e.g. 1000 KB will be rounded up to 1 MB. - for (; units < kUnitsResourceIds + (base::size(kUnitsResourceIds) - 1) && + for (; units < kUnitsResourceIds + (std::size(kUnitsResourceIds) - 1) && bytes >= denomenator * 1000; ++units, denomenator *= 1024) { }
diff --git a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc index a2a399b..3295bd38 100644 --- a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
@@ -189,7 +189,7 @@ } gfx::FloatToHalfFloat(rgba_pixels, reinterpret_cast<uint16_t*>(rgba_dest), - base::size(rgba_pixels)); + std::size(rgba_pixels)); } enum class ColorType { kMono, kColor };
diff --git a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc index b6fe96c..02ec77ef 100644 --- a/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder_test.cc
@@ -773,7 +773,7 @@ std::unique_ptr<ImageDecoder> decoder = CreateAVIFDecoder(); constexpr char kHeader[] = {0x00, 0x00, 0x00, 0x20, 0x66, 0x74, 0x79, 0x70}; auto buffer = SharedBuffer::Create(); - buffer->Append(kHeader, base::size(kHeader)); + buffer->Append(kHeader, std::size(kHeader)); decoder->SetData(buffer.get(), false); EXPECT_FALSE(decoder->ImageHasBothStillAndAnimatedSubImages()); }
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc index 252aa1e2..07b0edf 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc
@@ -32,7 +32,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" @@ -123,7 +122,7 @@ ImageFrame::kBlendAtopPreviousFrame, base::Milliseconds(1000), true}, }; - for (size_t i = 0; i < base::size(kFrameParameters); ++i) { + for (size_t i = 0; i < std::size(kFrameParameters); ++i) { const ImageFrame* const frame = decoder->DecodeFrameBufferAtIndex(i); EXPECT_EQ(ImageFrame::kFrameComplete, frame->GetStatus()); EXPECT_EQ(kCanvasWidth, frame->Bitmap().width()); @@ -139,7 +138,7 @@ EXPECT_EQ(kFrameParameters[i].has_alpha, frame->HasAlpha()); } - EXPECT_EQ(base::size(kFrameParameters), decoder->FrameCount()); + EXPECT_EQ(std::size(kFrameParameters), decoder->FrameCount()); EXPECT_EQ(kAnimationLoopInfinite, decoder->RepetitionCount()); } @@ -166,7 +165,7 @@ ImageFrame::kBlendAtopPreviousFrame, base::Milliseconds(1000), true}, }; - for (size_t i = 0; i < base::size(kFrameParameters); ++i) { + for (size_t i = 0; i < std::size(kFrameParameters); ++i) { const ImageFrame* const frame = decoder->DecodeFrameBufferAtIndex(i); EXPECT_EQ(ImageFrame::kFrameComplete, frame->GetStatus()); EXPECT_EQ(kCanvasWidth, frame->Bitmap().width()); @@ -182,7 +181,7 @@ EXPECT_EQ(kFrameParameters[i].has_alpha, frame->HasAlpha()); } - EXPECT_EQ(base::size(kFrameParameters), decoder->FrameCount()); + EXPECT_EQ(std::size(kFrameParameters), decoder->FrameCount()); EXPECT_EQ(kAnimationLoopInfinite, decoder->RepetitionCount()); } @@ -208,7 +207,7 @@ ImageFrame::kBlendAtopBgcolor, base::Milliseconds(1000), true}, }; - for (size_t i = 0; i < base::size(kFrameParameters); ++i) { + for (size_t i = 0; i < std::size(kFrameParameters); ++i) { const ImageFrame* const frame = decoder->DecodeFrameBufferAtIndex(i); EXPECT_EQ(ImageFrame::kFrameComplete, frame->GetStatus()); EXPECT_EQ(kCanvasWidth, frame->Bitmap().width()); @@ -224,7 +223,7 @@ EXPECT_EQ(kFrameParameters[i].has_alpha, frame->HasAlpha()); } - EXPECT_EQ(base::size(kFrameParameters), decoder->FrameCount()); + EXPECT_EQ(std::size(kFrameParameters), decoder->FrameCount()); EXPECT_EQ(kAnimationLoopInfinite, decoder->RepetitionCount()); }
diff --git a/third_party/blink/renderer/platform/json/json_parser_test.cc b/third_party/blink/renderer/platform/json/json_parser_test.cc index ba7b77e..f80e355 100644 --- a/third_party/blink/renderer/platform/json/json_parser_test.cc +++ b/third_party/blink/renderer/platform/json/json_parser_test.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/platform/json/json_parser.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/json/json_values.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -465,11 +464,11 @@ ASSERT_FALSE(root.get()); // U+00A0 NO-BREAK SPACE is not allowed UChar invalid_space_1[] = {0x5b, 0x00a0, 0x5d}; // [<U+00A0>] - root = ParseJSON(String(invalid_space_1, base::size(invalid_space_1))); + root = ParseJSON(String(invalid_space_1, std::size(invalid_space_1))); ASSERT_FALSE(root.get()); // U+3000 IDEOGRAPHIC SPACE is not allowed UChar invalid_space_2[] = {0x5b, 0x3000, 0x5d}; // [<U+3000>] - root = ParseJSON(String(invalid_space_2, base::size(invalid_space_2))); + root = ParseJSON(String(invalid_space_2, std::size(invalid_space_2))); ASSERT_FALSE(root.get()); // Test nesting @@ -592,14 +591,14 @@ EXPECT_EQ(JSONValue::kTypeString, root->GetType()); EXPECT_TRUE(root->AsString(&str_val)); UChar tmp2[] = {0x20ac, 0x33, 0x2c, 0x31, 0x34}; - EXPECT_EQ(String(tmp2, base::size(tmp2)), str_val); + EXPECT_EQ(String(tmp2, std::size(tmp2)), str_val); root = ParseJSON("\"\\ud83d\\udca9\\ud83d\\udc6c\""); ASSERT_TRUE(root.get()); EXPECT_EQ(JSONValue::kTypeString, root->GetType()); EXPECT_TRUE(root->AsString(&str_val)); UChar tmp3[] = {0xd83d, 0xdca9, 0xd83d, 0xdc6c}; - EXPECT_EQ(String(tmp3, base::size(tmp3)), str_val); + EXPECT_EQ(String(tmp3, std::size(tmp3)), str_val); // Invalid unicode in a string literal after applying escape sequences. root = ParseJSON("\n\n \"\\ud800\"", &error); @@ -611,7 +610,7 @@ // Invalid unicode in a JSON itself. UChar tmp4[] = {0x22, 0xd800, 0x22}; // "?" - root = ParseJSON(String(tmp4, base::size(tmp4)), &error); + root = ParseJSON(String(tmp4, std::size(tmp4)), &error); EXPECT_FALSE(root.get()); EXPECT_EQ( "Line: 1, column: 1, Unsupported encoding. JSON and all string literals " @@ -620,7 +619,7 @@ // Invalid unicode in a JSON itself. UChar tmp5[] = {0x7b, 0x22, 0xd800, 0x22, 0x3a, 0x31, 0x7d}; // {"?":1} - root = ParseJSON(String(tmp5, base::size(tmp5)), &error); + root = ParseJSON(String(tmp5, std::size(tmp5)), &error); EXPECT_FALSE(root.get()); EXPECT_EQ( "Line: 1, column: 2, Unsupported encoding. JSON and all string literals " @@ -653,7 +652,7 @@ "/* test *", "{\"foo\"", "{\"foo\":", " [", "\"\\u123g\"", "{\n\"eh:\n}", "////", "*/**/", "/**/", "/*/", "//**/", "\"\\"}; - for (size_t i = 0; i < base::size(kInvalidJson); ++i) { + for (size_t i = 0; i < std::size(kInvalidJson); ++i) { std::unique_ptr<JSONValue> result = ParseJSON(kInvalidJson[i]); EXPECT_FALSE(result.get()); }
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource.cc b/third_party/blink/renderer/platform/loader/fetch/resource.cc index fe10d2b..ac88afb8 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource.cc
@@ -30,7 +30,6 @@ #include <cassert> #include <memory> -#include "base/cxx17_backports.h" #include "base/task/single_thread_task_runner.h" #include "base/time/default_clock.h" #include "build/build_config.h" @@ -114,11 +113,11 @@ static inline bool ShouldUpdateHeaderAfterRevalidation( const AtomicString& header) { - for (size_t i = 0; i < base::size(kHeadersToIgnoreAfterRevalidation); i++) { + for (size_t i = 0; i < std::size(kHeadersToIgnoreAfterRevalidation); i++) { if (EqualIgnoringASCIICase(header, kHeadersToIgnoreAfterRevalidation[i])) return false; } - for (size_t i = 0; i < base::size(kHeaderPrefixesToIgnoreAfterRevalidation); + for (size_t i = 0; i < std::size(kHeaderPrefixesToIgnoreAfterRevalidation); i++) { if (header.StartsWithIgnoringASCIICase( kHeaderPrefixesToIgnoreAfterRevalidation[i]))
diff --git a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc index d8108073..19c31b94 100644 --- a/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc +++ b/third_party/blink/renderer/platform/loader/fetch/url_loader/web_url_loader_unittest.cc
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "third_party/blink/public/platform/web_url_loader.h" - #include <stdint.h> #include <string.h> @@ -11,7 +9,6 @@ #include <vector> #include "base/command_line.h" -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" @@ -381,9 +378,9 @@ body_handle_.reset(); base::RunLoop().RunUntilIdle(); network::URLLoaderCompletionStatus status(net::OK); - status.encoded_data_length = base::size(kTestData); - status.encoded_body_length = base::size(kTestData); - status.decoded_body_length = base::size(kTestData); + status.encoded_data_length = std::size(kTestData); + status.encoded_body_length = std::size(kTestData); + status.decoded_body_length = std::size(kTestData); peer()->OnCompletedRequest(status); EXPECT_TRUE(client()->did_finish()); // There should be no error. @@ -396,9 +393,9 @@ body_handle_.reset(); base::RunLoop().RunUntilIdle(); network::URLLoaderCompletionStatus status(net::ERR_FAILED); - status.encoded_data_length = base::size(kTestData); - status.encoded_body_length = base::size(kTestData); - status.decoded_body_length = base::size(kTestData); + status.encoded_data_length = std::size(kTestData); + status.encoded_body_length = std::size(kTestData); + status.decoded_body_length = std::size(kTestData); peer()->OnCompletedRequest(status); EXPECT_FALSE(client()->did_finish()); ASSERT_TRUE(client()->error());
diff --git a/third_party/blink/renderer/platform/loader/subresource_integrity.cc b/third_party/blink/renderer/platform/loader/subresource_integrity.cc index 4ea2e225..2df65e9 100644 --- a/third_party/blink/renderer/platform/loader/subresource_integrity.cc +++ b/third_party/blink/renderer/platform/loader/subresource_integrity.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/platform/loader/subresource_integrity.h" -#include "base/cxx17_backports.h" #include "services/network/public/mojom/fetch_api.mojom-blink.h" #include "third_party/blink/public/platform/web_crypto.h" #include "third_party/blink/public/platform/web_crypto_algorithm.h" @@ -226,7 +225,7 @@ // The last algorithm prefix is the ed25519 signature algorithm, which should // only be enabled if kSignatures is requested. We'll implement this by // adjusting the last_prefix index into the array. - size_t last_prefix = base::size(kPrefixes); + size_t last_prefix = std::size(kPrefixes); if (features != IntegrityFeatures::kSignatures) last_prefix--;
diff --git a/third_party/blink/renderer/platform/loader/subresource_integrity_test.cc b/third_party/blink/renderer/platform/loader/subresource_integrity_test.cc index 8ab7e40..1b2f5a2e 100644 --- a/third_party/blink/renderer/platform/loader/subresource_integrity_test.cc +++ b/third_party/blink/renderer/platform/loader/subresource_integrity_test.cc
@@ -4,7 +4,8 @@ #include "third_party/blink/renderer/platform/loader/subresource_integrity.h" -#include "base/cxx17_backports.h" +#include <algorithm> + #include "base/memory/scoped_refptr.h" #include "services/network/public/mojom/fetch_api.mojom-blink.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,8 +26,6 @@ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" -#include <algorithm> - namespace blink { static const char kBasicScript[] = "alert('test');"; @@ -402,7 +401,7 @@ "sha384-XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr " "sha512-tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+" "07yMK81ytlg0MPaIrPAjcHqba5csorDWtKg==", - valid_sha384_and_sha512, base::size(valid_sha384_and_sha512)); + valid_sha384_and_sha512, std::size(valid_sha384_and_sha512)); const IntegrityMetadata valid_sha256_and_sha256[] = { IntegrityMetadata("BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", @@ -411,7 +410,7 @@ }; ExpectParseMultipleHashes( "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-deadbeef", - valid_sha256_and_sha256, base::size(valid_sha256_and_sha256)); + valid_sha256_and_sha256, std::size(valid_sha256_and_sha256)); const IntegrityMetadata valid_sha256_and_invalid_sha256[] = { IntegrityMetadata("BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", @@ -420,7 +419,7 @@ ExpectParseMultipleHashes( "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-!!!!", valid_sha256_and_invalid_sha256, - base::size(valid_sha256_and_invalid_sha256)); + std::size(valid_sha256_and_invalid_sha256)); const IntegrityMetadata invalid_sha256_and_valid_sha256[] = { IntegrityMetadata("BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", @@ -429,7 +428,7 @@ ExpectParseMultipleHashes( "sha256-!!! sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", invalid_sha256_and_valid_sha256, - base::size(invalid_sha256_and_valid_sha256)); + std::size(invalid_sha256_and_valid_sha256)); ExpectParse("sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar", "BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=",
diff --git a/third_party/blink/renderer/platform/media/cache_util.cc b/third_party/blink/renderer/platform/media/cache_util.cc index 91e618b70..ace410c 100644 --- a/third_party/blink/renderer/platform/media/cache_util.cc +++ b/third_party/blink/renderer/platform/media/cache_util.cc
@@ -8,7 +8,6 @@ #include <string> -#include "base/cxx17_backports.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/time/time.h" @@ -63,7 +62,7 @@ base::Seconds(3600); // Arbitrary value. const char kMaxAgePrefix[] = "max-age="; - const size_t kMaxAgePrefixLen = base::size(kMaxAgePrefix) - 1; + const size_t kMaxAgePrefixLen = std::size(kMaxAgePrefix) - 1; if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) { int64_t max_age_seconds; base::StringToInt64( @@ -99,7 +98,7 @@ base::TimeDelta ret = base::Days(30); const char kMaxAgePrefix[] = "max-age="; - const size_t kMaxAgePrefixLen = base::size(kMaxAgePrefix) - 1; + const size_t kMaxAgePrefixLen = std::size(kMaxAgePrefix) - 1; if (cache_control_header.substr(0, kMaxAgePrefixLen) == kMaxAgePrefix) { int64_t max_age_seconds; base::StringToInt64(
diff --git a/third_party/blink/renderer/platform/media/cache_util_unittest.cc b/third_party/blink/renderer/platform/media/cache_util_unittest.cc index 754f261..df07690 100644 --- a/third_party/blink/renderer/platform/media/cache_util_unittest.cc +++ b/third_party/blink/renderer/platform/media/cache_util_unittest.cc
@@ -9,7 +9,6 @@ #include <string> -#include "base/cxx17_backports.h" #include "base/format_macros.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" @@ -70,7 +69,7 @@ {WebURLResponse::kHTTPVersion_1_1, 200, "cache-control: no-cache\ncache-control: no-store", kNoCache | kNoStore}, }; - for (size_t i = 0; i < base::size(tests); ++i) { + for (size_t i = 0; i < std::size(tests); ++i) { SCOPED_TRACE(base::StringPrintf("case: %" PRIuS ", version: %d, code: %d, headers: %s", i, tests[i].version, tests[i].status_code,
diff --git a/third_party/blink/renderer/platform/media/multi_buffer_data_source_unittest.cc b/third_party/blink/renderer/platform/media/multi_buffer_data_source_unittest.cc index 705387e..dd71a41 100644 --- a/third_party/blink/renderer/platform/media/multi_buffer_data_source_unittest.cc +++ b/third_party/blink/renderer/platform/media/multi_buffer_data_source_unittest.cc
@@ -11,7 +11,6 @@ #include <utility> #include "base/bind.h" -#include "base/cxx17_backports.h" #include "base/memory/scoped_refptr.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" @@ -915,7 +914,7 @@ InitializeWith206Response(); uint8_t buffer[256]; - data_source_->Read(kDataSize, base::size(buffer), buffer, + data_source_->Read(kDataSize, std::size(buffer), buffer, base::BindOnce(&MultiBufferDataSourceTest::ReadCallback, base::Unretained(this)));
diff --git a/third_party/blink/renderer/platform/network/http_parsers_test.cc b/third_party/blink/renderer/platform/network/http_parsers_test.cc index 48b844ef..d725071 100644 --- a/third_party/blink/renderer/platform/network/http_parsers_test.cc +++ b/third_party/blink/renderer/platform/network/http_parsers_test.cc
@@ -4,7 +4,6 @@ #include "third_party/blink/renderer/platform/network/http_parsers.h" -#include "base/cxx17_backports.h" #include "services/network/public/mojom/content_security_policy.mojom-blink-forward.h" #include "services/network/public/mojom/content_security_policy.mojom-blink.h" #include "services/network/public/mojom/parsed_headers.mojom-blink.h" @@ -306,7 +305,7 @@ {"Foo: bar\r\nBaz:\n", false, 0}, {"\r\n", true, 2}, }; - for (size_t i = 0; i < base::size(tests); ++i) { + for (size_t i = 0; i < std::size(tests); ++i) { ResourceResponse response; wtf_size_t end = 0; bool result = ParseMultipartHeadersFromBody(
diff --git a/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc b/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc index f46a756..50fb6e8 100644 --- a/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc +++ b/third_party/blink/renderer/platform/p2p/filtering_network_manager_test.cc
@@ -11,7 +11,6 @@ #include <vector> #include "base/check.h" -#include "base/cxx17_backports.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/notreached.h" @@ -291,7 +290,7 @@ {kMockNetworksChangedWithSameNetwork, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that multiple routes request is blocked and signaled right after @@ -318,7 +317,7 @@ {kStopUpdating, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that multiple routes request is blocked and signaled right after @@ -343,7 +342,7 @@ {kMockNetworksChangedWithNewNetwork, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that after permissions have been denied, a network change signal from @@ -363,7 +362,7 @@ {kStopUpdating, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that multiple routes request is granted and signaled right after @@ -390,7 +389,7 @@ {kMockNetworksChangedWithNewNetwork, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that multiple routes request is granted and signaled right after @@ -416,7 +415,7 @@ {kMockNetworksChangedWithNewNetwork, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that multiple routes request is granted and signaled right after @@ -440,7 +439,7 @@ {kMockNetworksChangedWithNewNetwork, kNoSignal}, }; - RunTests(tests, base::size(tests)); + RunTests(tests, std::size(tests)); } // Test that the networks provided by the GetNetworks() and @@ -459,7 +458,7 @@ // ENUMERATION_ALLOWED. {kStartUpdating, kSignalEnumerationAllowed}, }; - RunTests(setup_steps, base::size(setup_steps)); + RunTests(setup_steps, std::size(setup_steps)); NetworkList networks; network_manager_->GetNetworks(&networks);
diff --git a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc index 3264bba..5f488e4 100644 --- a/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc +++ b/third_party/blink/renderer/platform/peerconnection/rtc_video_encoder.cc
@@ -10,7 +10,6 @@ #include "base/callback_helpers.h" #include "base/command_line.h" -#include "base/cxx17_backports.h" #include "base/location.h" #include "base/logging.h" #include "base/memory/unsafe_shared_memory_region.h" @@ -188,7 +187,7 @@ webrtc::kMaxSpatialLayers >= media::VideoEncoderInfo::kMaxSpatialLayers, "webrtc::kMaxSpatiallayers is less than " "media::VideoEncoderInfo::kMaxSpatialLayers"); - for (size_t i = 0; i < base::size(enc_info.fps_allocation); ++i) { + for (size_t i = 0; i < std::size(enc_info.fps_allocation); ++i) { if (enc_info.fps_allocation[i].empty()) continue; info.fps_allocation[i] = @@ -1163,7 +1162,7 @@ static const char* const kErrorNames[] = { "kIllegalStateError", "kInvalidArgumentError", "kPlatformFailureError"}; static_assert( - base::size(kErrorNames) == media::VideoEncodeAccelerator::kErrorMax + 1, + std::size(kErrorNames) == media::VideoEncodeAccelerator::kErrorMax + 1, "Different number of errors and textual descriptions"); DLOG(ERROR) << location.ToString() << kErrorNames[error] << " - " << str; NotifyError(error);
diff --git a/third_party/blink/renderer/platform/text/bidi_resolver_test.cc b/third_party/blink/renderer/platform/text/bidi_resolver_test.cc index 79fe2c3..93f5174 100644 --- a/third_party/blink/renderer/platform/text/bidi_resolver_test.cc +++ b/third_party/blink/renderer/platform/text/bidi_resolver_test.cc
@@ -32,7 +32,6 @@ #include <fstream> -#include "base/cxx17_backports.h" #include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/text/bidi_test_harness.h" @@ -111,7 +110,7 @@ // Test broken surrogate: trail appearing before // lead. (U+10858 units reversed) {{0xDC58, 0xD802}, 2, TextDirection::kLtr, false}}; - for (size_t i = 0; i < base::size(kTestData); ++i) + for (size_t i = 0; i < std::size(kTestData); ++i) TestDirectionality(kTestData[i]); }
diff --git a/third_party/blink/renderer/platform/text/character.cc b/third_party/blink/renderer/platform/text/character.cc index a9ce549..bbd90192 100644 --- a/third_party/blink/renderer/platform/text/character.cc +++ b/third_party/blink/renderer/platform/text/character.cc
@@ -34,9 +34,9 @@ #include <unicode/ucptrie.h> #include <unicode/uobject.h> #include <unicode/uscript.h> + #include <algorithm> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/text/character_property_data.h" #include "third_party/blink/renderer/platform/text/icu_error.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -296,7 +296,7 @@ text_content != kArabicMathematicalOperatorHahWithDal && !std::binary_search(stretchy_operator_with_inline_axis, stretchy_operator_with_inline_axis + - base::size(stretchy_operator_with_inline_axis), + std::size(stretchy_operator_with_inline_axis), text_content); }
diff --git a/third_party/blink/renderer/platform/text/character_test.cc b/third_party/blink/renderer/platform/text/character_test.cc index cb8e8cf..18dc285 100644 --- a/third_party/blink/renderer/platform/text/character_test.cc +++ b/third_party/blink/renderer/platform/text/character_test.cc
@@ -433,11 +433,11 @@ } else if (test_char == kArabicMathematicalOperatorHahWithDal) { EXPECT_FALSE(Character::IsVerticalMathCharacter(test_char)); } else { - bool in_vertical = !std::binary_search( - stretchy_operator_with_inline_axis, - stretchy_operator_with_inline_axis + - base::size(stretchy_operator_with_inline_axis), - test_char); + bool in_vertical = + !std::binary_search(stretchy_operator_with_inline_axis, + stretchy_operator_with_inline_axis + + std::size(stretchy_operator_with_inline_axis), + test_char); EXPECT_TRUE(Character::IsVerticalMathCharacter(test_char) == in_vertical); } }
diff --git a/third_party/blink/renderer/platform/text/locale_icu.cc b/third_party/blink/renderer/platform/text/locale_icu.cc index 510913f8..b15d5e0c 100644 --- a/third_party/blink/renderer/platform/text/locale_icu.cc +++ b/third_party/blink/renderer/platform/text/locale_icu.cc
@@ -33,10 +33,10 @@ #include <unicode/udatpg.h> #include <unicode/udisplaycontext.h> #include <unicode/uloc.h> + #include <limits> #include <memory> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "third_party/blink/renderer/platform/wtf/date_math.h" #include "third_party/blink/renderer/platform/wtf/text/string_buffer.h" @@ -143,7 +143,7 @@ const UChar kGmtTimezone[3] = {'G', 'M', 'T'}; UErrorCode status = U_ZERO_ERROR; return udat_open(time_style, date_style, locale_.c_str(), kGmtTimezone, - base::size(kGmtTimezone), nullptr, -1, &status); + std::size(kGmtTimezone), nullptr, -1, &status); } // We cannot use udat_*Symbols API to get standalone month names to use in @@ -257,8 +257,8 @@ static std::unique_ptr<Vector<String>> CreateFallbackMonthLabels() { std::unique_ptr<Vector<String>> labels = std::make_unique<Vector<String>>(); - labels->ReserveCapacity(base::size(WTF::kMonthFullName)); - for (unsigned i = 0; i < base::size(WTF::kMonthFullName); ++i) + labels->ReserveCapacity(std::size(WTF::kMonthFullName)); + for (unsigned i = 0; i < std::size(WTF::kMonthFullName); ++i) labels->push_back(WTF::kMonthFullName[i]); return labels; } @@ -414,8 +414,8 @@ return short_month_labels_; } } - short_month_labels_.ReserveCapacity(base::size(WTF::kMonthName)); - for (unsigned i = 0; i < base::size(WTF::kMonthName); ++i) + short_month_labels_.ReserveCapacity(std::size(WTF::kMonthName)); + for (unsigned i = 0; i < std::size(WTF::kMonthName); ++i) short_month_labels_.push_back(WTF::kMonthName[i]); return short_month_labels_; }
diff --git a/third_party/blink/renderer/platform/text/locale_mac.mm b/third_party/blink/renderer/platform/text/locale_mac.mm index aecf6eaa..fa8d610 100644 --- a/third_party/blink/renderer/platform/text/locale_mac.mm +++ b/third_party/blink/renderer/platform/text/locale_mac.mm
@@ -34,7 +34,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "third_party/blink/renderer/platform/language.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" @@ -128,7 +127,7 @@ month_labels_.push_back(String(array[i])); return month_labels_; } - for (unsigned i = 0; i < base::size(WTF::kMonthFullName); ++i) + for (unsigned i = 0; i < std::size(WTF::kMonthFullName); ++i) month_labels_.push_back(WTF::kMonthFullName[i]); return month_labels_; } @@ -143,7 +142,7 @@ week_day_short_labels_.push_back(String(array[i])); return week_day_short_labels_; } - for (unsigned i = 0; i < base::size(WTF::kWeekdayName); ++i) { + for (unsigned i = 0; i < std::size(WTF::kWeekdayName); ++i) { // weekdayName starts with Monday. week_day_short_labels_.push_back(WTF::kWeekdayName[(i + 6) % 7]); } @@ -256,7 +255,7 @@ short_month_labels_.push_back(array[i]); return short_month_labels_; } - for (unsigned i = 0; i < base::size(WTF::kMonthName); ++i) + for (unsigned i = 0; i < std::size(WTF::kMonthName); ++i) short_month_labels_.push_back(WTF::kMonthName[i]); return short_month_labels_; }
diff --git a/third_party/blink/renderer/platform/text/locale_win.cc b/third_party/blink/renderer/platform/text/locale_win.cc index 9bc0f5e..31d3794 100644 --- a/third_party/blink/renderer/platform/text/locale_win.cc +++ b/third_party/blink/renderer/platform/text/locale_win.cc
@@ -33,7 +33,6 @@ #include <limits> #include <memory> -#include "base/cxx17_backports.h" #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" #include "third_party/blink/renderer/platform/language.h" @@ -152,13 +151,13 @@ LOCALE_SABBREVMONTHNAME9, LOCALE_SABBREVMONTHNAME10, LOCALE_SABBREVMONTHNAME11, LOCALE_SABBREVMONTHNAME12, }; - short_month_labels_.ReserveCapacity(base::size(kTypes)); - for (unsigned i = 0; i < base::size(kTypes); ++i) { + short_month_labels_.ReserveCapacity(std::size(kTypes)); + for (unsigned i = 0; i < std::size(kTypes); ++i) { short_month_labels_.push_back(GetLocaleInfoString(kTypes[i])); if (short_month_labels_.back().IsEmpty()) { short_month_labels_.Shrink(0); - short_month_labels_.ReserveCapacity(base::size(WTF::kMonthName)); - for (unsigned m = 0; m < base::size(WTF::kMonthName); ++m) + short_month_labels_.ReserveCapacity(std::size(WTF::kMonthName)); + for (unsigned m = 0; m < std::size(WTF::kMonthName); ++m) short_month_labels_.push_back(WTF::kMonthName[m]); return; } @@ -278,13 +277,13 @@ LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9, LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12, }; - month_labels_.ReserveCapacity(base::size(kTypes)); - for (unsigned i = 0; i < base::size(kTypes); ++i) { + month_labels_.ReserveCapacity(std::size(kTypes)); + for (unsigned i = 0; i < std::size(kTypes); ++i) { month_labels_.push_back(GetLocaleInfoString(kTypes[i])); if (month_labels_.back().IsEmpty()) { month_labels_.Shrink(0); - month_labels_.ReserveCapacity(base::size(WTF::kMonthFullName)); - for (unsigned m = 0; m < base::size(WTF::kMonthFullName); ++m) + month_labels_.ReserveCapacity(std::size(WTF::kMonthFullName)); + for (unsigned m = 0; m < std::size(WTF::kMonthFullName); ++m) month_labels_.push_back(WTF::kMonthFullName[m]); return; } @@ -299,13 +298,13 @@ LOCALE_SSHORTESTDAYNAME2, LOCALE_SSHORTESTDAYNAME3, LOCALE_SSHORTESTDAYNAME4, LOCALE_SSHORTESTDAYNAME5, LOCALE_SSHORTESTDAYNAME6}; - week_day_short_labels_.ReserveCapacity(base::size(kTypes)); - for (unsigned i = 0; i < base::size(kTypes); ++i) { + week_day_short_labels_.ReserveCapacity(std::size(kTypes)); + for (unsigned i = 0; i < std::size(kTypes); ++i) { week_day_short_labels_.push_back(GetLocaleInfoString(kTypes[i])); if (week_day_short_labels_.back().IsEmpty()) { week_day_short_labels_.Shrink(0); - week_day_short_labels_.ReserveCapacity(base::size(WTF::kWeekdayName)); - for (unsigned w = 0; w < base::size(WTF::kWeekdayName); ++w) { + week_day_short_labels_.ReserveCapacity(std::size(WTF::kWeekdayName)); + for (unsigned w = 0; w < std::size(WTF::kWeekdayName); ++w) { // weekdayName starts with Monday. week_day_short_labels_.push_back(WTF::kWeekdayName[(w + 6) % 7]); }
diff --git a/third_party/blink/renderer/platform/text/mathml_operator_dictionary.cc b/third_party/blink/renderer/platform/text/mathml_operator_dictionary.cc index 241bce4..1fc4c3f 100644 --- a/third_party/blink/renderer/platform/text/mathml_operator_dictionary.cc +++ b/third_party/blink/renderer/platform/text/mathml_operator_dictionary.cc
@@ -112,7 +112,7 @@ } else { // Perform a binary search for 2-ASCII-chars operators. const char** last = - operators_2_ascii_chars + base::size(operators_2_ascii_chars); + operators_2_ascii_chars + std::size(operators_2_ascii_chars); const char** entry = std::lower_bound( operators_2_ascii_chars, last, content, [](const char* lhs, const String& rhs) -> bool { @@ -156,7 +156,7 @@ // Perform a binary search on the compact dictionary. const EntryRange* entry_range = std::upper_bound( - compact_dictionary, compact_dictionary + base::size(compact_dictionary), + compact_dictionary, compact_dictionary + std::size(compact_dictionary), key, [](uint16_t lhs, EntryRange rhs) -> bool { return lhs < ExtractKey(rhs); });
diff --git a/third_party/blink/renderer/platform/text/mathml_operator_dictionary_test.cc b/third_party/blink/renderer/platform/text/mathml_operator_dictionary_test.cc index e2d5b43..565a558 100644 --- a/third_party/blink/renderer/platform/text/mathml_operator_dictionary_test.cc +++ b/third_party/blink/renderer/platform/text/mathml_operator_dictionary_test.cc
@@ -118,7 +118,7 @@ template <typename T, size_t N> bool IsInCategory(const T (&table)[N], UChar32 character) { - return std::binary_search(table, table + base::size(table), character); + return std::binary_search(table, table + std::size(table), character); } String FromUChar32(UChar32 c) {
diff --git a/third_party/blink/renderer/platform/text/text_break_iterator.cc b/third_party/blink/renderer/platform/text/text_break_iterator.cc index cd1074d33..d305427 100644 --- a/third_party/blink/renderer/platform/text/text_break_iterator.cc +++ b/third_party/blink/renderer/platform/text/text_break_iterator.cc
@@ -26,7 +26,6 @@ #include <unicode/uchar.h> #include <unicode/uvernum.h> -#include "base/cxx17_backports.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" @@ -224,11 +223,11 @@ #undef DI #undef AL -static_assert(base::size(kAsciiLineBreakTable) == +static_assert(std::size(kAsciiLineBreakTable) == kAsciiLineBreakTableLastChar - kAsciiLineBreakTableFirstChar + 1, "asciiLineBreakTable should be consistent"); -static_assert(base::size(kBreakAllLineBreakClassTable) == BA_LB_COUNT, +static_assert(std::size(kBreakAllLineBreakClassTable) == BA_LB_COUNT, "breakAllLineBreakClassTable should be consistent"); static inline bool ShouldBreakAfter(UChar last_ch, UChar ch, UChar next_ch) {
diff --git a/third_party/blink/renderer/platform/text/unicode_utilities_test.cc b/third_party/blink/renderer/platform/text/unicode_utilities_test.cc index 936a3c452..60f57cc 100644 --- a/third_party/blink/renderer/platform/text/unicode_utilities_test.cc +++ b/third_party/blink/renderer/platform/text/unicode_utilities_test.cc
@@ -32,7 +32,6 @@ #include <unicode/uchar.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" @@ -145,13 +144,13 @@ kRightSingleQuotationMarkCharacter, kSoftHyphenCharacter}; - String string_to_fold(kCharactersToFold, base::size(kCharactersToFold)); + String string_to_fold(kCharactersToFold, std::size(kCharactersToFold)); Vector<UChar> buffer; string_to_fold.AppendTo(buffer); FoldQuoteMarksAndSoftHyphens(string_to_fold); - const String folded_string("\"\"\"\'\'\'\0", base::size(kCharactersToFold)); + const String folded_string("\"\"\"\'\'\'\0", std::size(kCharactersToFold)); EXPECT_EQ(string_to_fold, folded_string); FoldQuoteMarksAndSoftHyphens(buffer.data(), buffer.size()); @@ -164,37 +163,37 @@ // Check that non-Kana letters will be skipped. EXPECT_TRUE(CheckOnlyKanaLettersInStrings( - kNonKanaString1, base::size(kNonKanaString1), kNonKanaString2, - base::size(kNonKanaString2))); + kNonKanaString1, std::size(kNonKanaString1), kNonKanaString2, + std::size(kNonKanaString2))); const UChar kKanaString[] = {'e', 'f', 'g', 0x3041}; EXPECT_FALSE(CheckOnlyKanaLettersInStrings( - kKanaString, base::size(kKanaString), kNonKanaString2, - base::size(kNonKanaString2))); + kKanaString, std::size(kKanaString), kNonKanaString2, + std::size(kNonKanaString2))); // Compare with self. - EXPECT_TRUE( - CheckOnlyKanaLettersInStrings(kKanaString, base::size(kKanaString), - kKanaString, base::size(kKanaString))); + EXPECT_TRUE(CheckOnlyKanaLettersInStrings(kKanaString, std::size(kKanaString), + kKanaString, + std::size(kKanaString))); UChar voiced_kana_string1[] = {0x3042, 0x3099}; UChar voiced_kana_string2[] = {0x3042, 0x309A}; // Comparing strings with different sound marks should fail. EXPECT_FALSE(CheckOnlyKanaLettersInStrings( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); // Now strings will be the same. voiced_kana_string2[1] = 0x3099; EXPECT_TRUE(CheckOnlyKanaLettersInStrings( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); voiced_kana_string2[0] = 0x3043; EXPECT_FALSE(CheckOnlyKanaLettersInStrings( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); } TEST(UnicodeUtilitiesTest, StringsWithKanaLettersTest) { @@ -202,53 +201,53 @@ const UChar kNonKanaString2[] = {'a', 'b', 'c'}; // Check that non-Kana letters will be compared. - EXPECT_TRUE( - CheckKanaStringsEqual(kNonKanaString1, base::size(kNonKanaString1), - kNonKanaString2, base::size(kNonKanaString2))); + EXPECT_TRUE(CheckKanaStringsEqual(kNonKanaString1, std::size(kNonKanaString1), + kNonKanaString2, + std::size(kNonKanaString2))); const UChar kKanaString[] = {'a', 'b', 'c', 0x3041}; - EXPECT_FALSE(CheckKanaStringsEqual(kKanaString, base::size(kKanaString), + EXPECT_FALSE(CheckKanaStringsEqual(kKanaString, std::size(kKanaString), kNonKanaString2, - base::size(kNonKanaString2))); + std::size(kNonKanaString2))); // Compare with self. - EXPECT_TRUE(CheckKanaStringsEqual(kKanaString, base::size(kKanaString), - kKanaString, base::size(kKanaString))); + EXPECT_TRUE(CheckKanaStringsEqual(kKanaString, std::size(kKanaString), + kKanaString, std::size(kKanaString))); const UChar kKanaString2[] = {'x', 'y', 'z', 0x3041}; // Comparing strings with different non-Kana letters should fail. - EXPECT_FALSE(CheckKanaStringsEqual(kKanaString, base::size(kKanaString), - kKanaString2, base::size(kKanaString2))); + EXPECT_FALSE(CheckKanaStringsEqual(kKanaString, std::size(kKanaString), + kKanaString2, std::size(kKanaString2))); const UChar kKanaString3[] = {'a', 'b', 'c', 0x3042, 0x3099, 'm', 'n', 'o'}; // Check that non-Kana letters after Kana letters will be compared. - EXPECT_TRUE(CheckKanaStringsEqual(kKanaString3, base::size(kKanaString3), - kKanaString3, base::size(kKanaString3))); + EXPECT_TRUE(CheckKanaStringsEqual(kKanaString3, std::size(kKanaString3), + kKanaString3, std::size(kKanaString3))); const UChar kKanaString4[] = {'a', 'b', 'c', 0x3042, 0x3099, 'm', 'n', 'o', 'p'}; // And now comparing should fail. - EXPECT_FALSE(CheckKanaStringsEqual(kKanaString3, base::size(kKanaString3), - kKanaString4, base::size(kKanaString4))); + EXPECT_FALSE(CheckKanaStringsEqual(kKanaString3, std::size(kKanaString3), + kKanaString4, std::size(kKanaString4))); UChar voiced_kana_string1[] = {0x3042, 0x3099}; UChar voiced_kana_string2[] = {0x3042, 0x309A}; // Comparing strings with different sound marks should fail. EXPECT_FALSE(CheckKanaStringsEqual( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); // Now strings will be the same. voiced_kana_string2[1] = 0x3099; EXPECT_TRUE(CheckKanaStringsEqual( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); voiced_kana_string2[0] = 0x3043; EXPECT_FALSE(CheckKanaStringsEqual( - voiced_kana_string1, base::size(voiced_kana_string1), voiced_kana_string2, - base::size(voiced_kana_string2))); + voiced_kana_string1, std::size(voiced_kana_string1), voiced_kana_string2, + std::size(voiced_kana_string2))); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc index b9c8736..e5a949b 100644 --- a/third_party/blink/renderer/platform/transforms/transform_operations_test.cc +++ b/third_party/blink/renderer/platform/transforms/transform_operations_test.cc
@@ -24,7 +24,6 @@ #include "third_party/blink/renderer/platform/transforms/transform_operations.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/transforms/interpolated_transform_operation.h" #include "third_party/blink/renderer/platform/transforms/matrix_3d_transform_operation.h" @@ -121,8 +120,8 @@ // [0,1]. float progress[][2] = {{0, 1}, {-.25, 1.25}}; - for (size_t i = 0; i < base::size(test_transforms); ++i) { - for (size_t j = 0; j < base::size(progress); ++j) { + for (size_t i = 0; i < std::size(test_transforms); ++i) { + for (size_t j = 0; j < std::size(progress); ++j) { TransformOperations from_ops; TransformOperations to_ops; from_ops.Operations().push_back(TranslateTransformOperation::Create( @@ -179,8 +178,8 @@ // [0,1]. float progress[][2] = {{0, 1}, {-.25f, 1.25f}}; - for (size_t i = 0; i < base::size(test_transforms); ++i) { - for (size_t j = 0; j < base::size(progress); ++j) { + for (size_t i = 0; i < std::size(test_transforms); ++i) { + for (size_t j = 0; j < std::size(progress); ++j) { TransformOperations from_ops; TransformOperations to_ops; from_ops.Operations().push_back(TranslateTransformOperation::Create( @@ -280,9 +279,9 @@ EXPECT_BOXF_EQ(box, bounds); } -// This would have been best as anonymous structs, but |base::size| +// This would have been best as anonymous structs, but |std::size| // does not get along with anonymous structs once we support C++11 -// base::size will automatically support anonymous structs. +// std::size will automatically support anonymous structs. struct ProblematicAxisTest { double x; @@ -310,7 +309,7 @@ {0, 1, 1, gfx::BoxF(-1, dim1, dim1, 2, dim2, dim2)}, {1, 0, 1, gfx::BoxF(dim1, -1, dim1, dim2, 2, dim2)}}; - for (size_t i = 0; i < base::size(tests); ++i) { + for (size_t i = 0; i < std::size(tests); ++i) { float x = tests[i].x; float y = tests[i].y; float z = tests[i].z; @@ -341,9 +340,9 @@ float progress[][2] = {{0, 1}, {-0.25f, 1.25f}}; - for (size_t i = 0; i < base::size(axes); ++i) { - for (size_t j = 0; j < base::size(angles); ++j) { - for (size_t k = 0; k < base::size(progress); ++k) { + for (size_t i = 0; i < std::size(axes); ++i) { + for (size_t j = 0; j < std::size(angles); ++j) { + for (size_t k = 0; k < std::size(progress); ++k) { float x = axes[i][0]; float y = axes[i][1]; float z = axes[i][2]; @@ -387,8 +386,8 @@ float progress[][2] = {{0, 1}, {-0.1f, 1.1f}}; - for (size_t i = 0; i < base::size(depths); ++i) { - for (size_t j = 0; j < base::size(progress); ++j) { + for (size_t i = 0; i < std::size(depths); ++i) { + for (size_t j = 0; j < std::size(progress); ++j) { TransformOperations from_ops; TransformOperations to_ops;
diff --git a/third_party/blink/renderer/platform/weborigin/kurl_test.cc b/third_party/blink/renderer/platform/weborigin/kurl_test.cc index 474a295..200bc58 100644 --- a/third_party/blink/renderer/platform/weborigin/kurl_test.cc +++ b/third_party/blink/renderer/platform/weborigin/kurl_test.cc
@@ -35,7 +35,6 @@ #include <stdint.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" @@ -89,7 +88,7 @@ "xn--6qqa088eba", 0, "", nullptr, "/", nullptr, nullptr, nullptr, false}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { const GetterCase& c = cases[i]; const String& url = String::FromUTF8(c.url); @@ -180,7 +179,7 @@ nullptr, "http://goo.com:92/#b"}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { KURL kurl(cases[i].url); kurl.SetProtocol(cases[i].protocol); @@ -236,7 +235,7 @@ {"%e4%bd%a0%e5%a5%bd", "\xe4\xbd\xa0\xe5\xa5\xbd"}, }; - for (size_t i = 0; i < base::size(decode_cases); i++) { + for (size_t i = 0; i < std::size(decode_cases); i++) { String input(decode_cases[i].input); String str = DecodeURLEscapeSequences(input, DecodeURLMode::kUTF8OrIsomorphic); @@ -252,7 +251,7 @@ String decoded = DecodeURLEscapeSequences("%e6%bc%a2%e5%ad%97", DecodeURLMode::kUTF8OrIsomorphic); const UChar kDecodedExpected[] = {0x6F22, 0x5b57}; - EXPECT_EQ(String(kDecodedExpected, base::size(kDecodedExpected)), decoded); + EXPECT_EQ(String(kDecodedExpected, std::size(kDecodedExpected)), decoded); // Test the error behavior for invalid UTF-8 (we differ from WebKit here). // %e4 %a0 are invalid for UTF-8, but %e5%a5%bd is valid. @@ -283,7 +282,7 @@ {"pqrstuvwxyz{|}~\x7f", "pqrstuvwxyz%7B%7C%7D~%7F"}, }; - for (size_t i = 0; i < base::size(encode_cases); i++) { + for (size_t i = 0; i < std::size(encode_cases); i++) { String input(encode_cases[i].input); String expected_output(encode_cases[i].output); String output = EncodeWithURLEscapeSequences(input);
diff --git a/third_party/blink/renderer/platform/weborigin/security_origin_test.cc b/third_party/blink/renderer/platform/weborigin/security_origin_test.cc index 6fb911d0..6cddf06 100644 --- a/third_party/blink/renderer/platform/weborigin/security_origin_test.cc +++ b/third_party/blink/renderer/platform/weborigin/security_origin_test.cc
@@ -32,7 +32,6 @@ #include <stdint.h> -#include "base/cxx17_backports.h" #include "base/test/scoped_command_line.h" #include "base/unguessable_token.h" #include "net/base/url_util.h" @@ -76,7 +75,7 @@ TEST_F(SecurityOriginTest, ValidPortsCreateTupleOrigins) { uint16_t ports[] = {0, 80, 443, 5000, kMaxAllowedPort}; - for (size_t i = 0; i < base::size(ports); ++i) { + for (size_t i = 0; i < std::size(ports); ++i) { scoped_refptr<const SecurityOrigin> origin = SecurityOrigin::CreateFromValidTuple("http", "example.com", ports[i]); EXPECT_FALSE(origin->IsOpaque()) @@ -128,7 +127,7 @@ {false, "file:///", "file://localhost/"}, }; - for (size_t i = 0; i < base::size(tests); ++i) { + for (size_t i = 0; i < std::size(tests); ++i) { scoped_refptr<const SecurityOrigin> origin1 = SecurityOrigin::CreateFromString(tests[i].origin1); scoped_refptr<const SecurityOrigin> origin2 = @@ -235,7 +234,7 @@ {false, "https://foobar.com", "https://bazbar.com"}, }; - for (size_t i = 0; i < base::size(tests); ++i) { + for (size_t i = 0; i < std::size(tests); ++i) { scoped_refptr<const SecurityOrigin> origin = SecurityOrigin::CreateFromString(tests[i].origin); blink::KURL url(tests[i].url);
diff --git a/third_party/blink/renderer/platform/wtf/date_math.cc b/third_party/blink/renderer/platform/wtf/date_math.cc index 86430e6..0386e68 100644 --- a/third_party/blink/renderer/platform/wtf/date_math.cc +++ b/third_party/blink/renderer/platform/wtf/date_math.cc
@@ -75,11 +75,13 @@ #include <math.h> #include <stdlib.h> #include <time.h> +#include <unicode/basictz.h> +#include <unicode/timezone.h> + #include <algorithm> #include <limits> #include <memory> -#include "base/cxx17_backports.h" #include "build/build_config.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" @@ -87,9 +89,6 @@ #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" -#include <unicode/basictz.h> -#include <unicode/timezone.h> - #if BUILDFLAG(IS_WIN) #include <windows.h> #else @@ -618,7 +617,7 @@ have_tz = true; } else { date_wtf_string = String(date_string); - for (size_t i = 0; i < base::size(known_zones); ++i) { + for (size_t i = 0; i < std::size(known_zones); ++i) { if (date_wtf_string.StartsWithIgnoringASCIICase( known_zones[i].tz_name)) { offset = known_zones[i].tz_offset;
diff --git a/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc b/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc index 71440e0..a453396d 100644 --- a/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc +++ b/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc
@@ -265,8 +265,8 @@ const SharedBuffer::Iterator iters[] = { it0, it1, it126, it127, it128, it4222, it4223, it4224, it4351, }; - for (size_t i = 0; i < base::size(iters); ++i) { - for (size_t j = 0; j < base::size(iters); ++j) { + for (size_t i = 0; i < std::size(iters); ++i) { + for (size_t j = 0; j < std::size(iters); ++j) { EXPECT_EQ(i == j, iters[i] == iters[j]); } }
diff --git a/third_party/blink/renderer/platform/wtf/text/atomic_string_table.cc b/third_party/blink/renderer/platform/wtf/text/atomic_string_table.cc index 33dd0fb..f6f8a3ba 100644 --- a/third_party/blink/renderer/platform/wtf/text/atomic_string_table.cc +++ b/third_party/blink/renderer/platform/wtf/text/atomic_string_table.cc
@@ -168,50 +168,68 @@ // Allows lookups of the ASCII-lowercase version of a string without actually // allocating memory to store it. Instead, the translator computes the results -// of hash and equality computations as if we had done so. -struct LowercaseStringViewLookupTranslator { +// of hash and equality computations as if we had done so. Strings reaching +// these methods are expected to not be lowercase. + +class HashTranslatorLowercaseBuffer { + public: + explicit HashTranslatorLowercaseBuffer(const StringImpl* impl) : impl_(impl) { + // We expect already lowercase strings to take another path in + // Element::WeakLowercaseIfNecessary. + DCHECK(!impl_->IsLowerASCII()); + if (impl_->Is8Bit()) { + hash_ = + StringHasher::ComputeHashAndMaskTop8Bits<LChar, + ToASCIILowerUChar<LChar>>( + impl_->Characters8(), impl_->length()); + } else { + hash_ = + StringHasher::ComputeHashAndMaskTop8Bits<UChar, + ToASCIILowerUChar<UChar>>( + impl_->Characters16(), impl_->length()); + } + } + + const StringImpl* impl() const { return impl_; } + unsigned hash() const { return hash_; } + + private: template <typename CharType> static UChar ToASCIILowerUChar(CharType ch) { return ToASCIILower(ch); } + const StringImpl* impl_; + unsigned hash_; +}; +struct LowercaseLookupTranslator { // Computes the hash that |query| would have if it were first converted to // ASCII lowercase. - static unsigned GetHash(const StringView& query) { - // If possible, use cached hash if the string is lowercased. - StringImpl* shared_impl = query.SharedImpl(); - if (LIKELY(shared_impl && query.IsLowerASCII())) - return shared_impl->GetHash(); - - if (query.Is8Bit()) { - return StringHasher::ComputeHashAndMaskTop8Bits<LChar, - ToASCIILowerUChar<LChar>>( - query.Characters8(), query.length()); - } else { - return StringHasher::ComputeHashAndMaskTop8Bits<UChar, - ToASCIILowerUChar<UChar>>( - query.Characters16(), query.length()); - } + static unsigned GetHash(const HashTranslatorLowercaseBuffer& buf) { + return buf.hash(); } // Returns true if the hashtable |bucket| contains a string which is the ASCII // lowercase version of |query|. - static bool Equal(StringImpl* const& bucket, const StringView& query) { + static bool Equal(StringImpl* const& bucket, + const HashTranslatorLowercaseBuffer& buf) { // This is similar to EqualIgnoringASCIICase, but not the same. // In particular, it validates that |bucket| is a lowercase version of - // |query|. + // |buf.impl()|. // // Unlike EqualIgnoringASCIICase, it returns false if they are equal // ignoring ASCII case but |bucket| contains an uppercase ASCII character. // // However, similar optimizations are used here as there, so these should // have generally similar correctness and performance constraints. - if (bucket->length() != query.length()) + const StringImpl* query = buf.impl(); + if (bucket->length() != query->length()) return false; - if (bucket->Bytes() == query.Bytes() && bucket->Is8Bit() == query.Is8Bit()) - return query.IsLowerASCII(); + if (bucket->Bytes() == query->Bytes() && + bucket->Is8Bit() == query->Is8Bit()) + return query->IsLowerASCII(); return WTF::VisitCharacters(*bucket, [&](const auto* bch, wtf_size_t) { - return WTF::VisitCharacters(query, [&](const auto* qch, wtf_size_t len) { + return WTF::VisitCharacters(*query, [&](const auto* qch, wtf_size_t len) { for (wtf_size_t i = 0; i < len; ++i) { if (bch[i] != ToASCIILower(qch[i])) return false; @@ -339,16 +357,7 @@ HashAndUTF8CharactersTranslator>(buffer); } -AtomicStringTable::WeakResult AtomicStringTable::WeakFindSlow( - StringImpl* string) { - DCHECK(string->length()); - const auto& it = table_.find(string); - if (it == table_.end()) - return WeakResult(); - return WeakResult(*it); -} - -AtomicStringTable::WeakResult AtomicStringTable::WeakFindSlow( +AtomicStringTable::WeakResult AtomicStringTable::WeakFindSlowForTesting( const StringView& string) { DCHECK(string.length()); const auto& it = table_.Find<StringViewLookupTranslator>(string); @@ -357,10 +366,13 @@ return WeakResult(*it); } -AtomicStringTable::WeakResult AtomicStringTable::WeakFindLowercasedSlow( - const StringView& string) { +AtomicStringTable::WeakResult AtomicStringTable::WeakFindLowercase( + const AtomicString& string) { + DCHECK(!string.IsEmpty()); + DCHECK(!string.IsLowerASCII()); DCHECK(string.length()); - const auto& it = table_.Find<LowercaseStringViewLookupTranslator>(string); + HashTranslatorLowercaseBuffer buffer(string.Impl()); + const auto& it = table_.Find<LowercaseLookupTranslator>(buffer); if (it == table_.end()) return WeakResult(); DCHECK(StringView(*it).IsLowerASCII()); @@ -368,40 +380,6 @@ return WeakResult(*it); } -AtomicStringTable::WeakResult AtomicStringTable::WeakFind(const LChar* chars, - unsigned length) { - if (!chars) - return WeakResult(); - - // Mirror the empty logic in Add(). - if (!length) - return WeakResult(StringImpl::empty_); - - LCharBuffer buffer(chars, length); - const auto& it = table_.Find<LCharBufferTranslator>(buffer); - if (it == table_.end()) - return WeakResult(); - - return WeakResult(*it); -} - -AtomicStringTable::WeakResult AtomicStringTable::WeakFind(const UChar* chars, - unsigned length) { - if (!chars) - return WeakResult(); - - // Mirror the empty logic in Add(). - if (!length) - return WeakResult(StringImpl::empty_); - - UCharBuffer buffer(chars, length); - const auto& it = table_.Find<UCharBufferTranslator>(buffer); - if (it == table_.end()) - return WeakResult(); - - return WeakResult(*it); -} - bool AtomicStringTable::ReleaseAndRemoveIfNeeded(StringImpl* string) { DCHECK(string->IsAtomic()); // Double check that the refcount is still 0. Because Add() could
diff --git a/third_party/blink/renderer/platform/wtf/text/atomic_string_table.h b/third_party/blink/renderer/platform/wtf/text/atomic_string_table.h index 9b6dfd6..cc03c40 100644 --- a/third_party/blink/renderer/platform/wtf/text/atomic_string_table.h +++ b/third_party/blink/renderer/platform/wtf/text/atomic_string_table.h
@@ -48,8 +48,8 @@ scoped_refptr<StringImpl> AddUTF8(const char* characters_start, const char* characters_end); - // Returned as part of the WeakFind() APIs below. Represents the result of - // the non-creating lookup within the AtomicStringTable. See the WeakFind() + // Returned as part of the WeakFind*() APIs below. Represents the result of + // the non-creating lookup within the AtomicStringTable. See the WeakFind*() // documentation for a description of how it can be used. class WeakResult { public: @@ -59,6 +59,9 @@ CHECK(!str || str->IsAtomic() || str == StringImpl::empty_); } + explicit WeakResult(const AtomicString& str) + : ptr_value_((reinterpret_cast<uintptr_t>(str.Impl()))) {} + bool IsNull() const { return ptr_value_ == 0; } private: @@ -74,25 +77,15 @@ // unnecessarily creating an AtomicString. Useful to optimize fast-path // non-existence checks inside collections of AtomicStrings. // - // Specifically, if WeakFind() returns an IsNull() WeakResult, then a + // Specifically, if WeakFind*() returns an IsNull() WeakResult, then a // collection search can be skipped because the AtomicString cannot exist - // in the collection. If WeakFind() returns a non-null WeakResult, then + // in the collection. If WeakFind*() returns a non-null WeakResult, then // assuming the target collection has no concurrent access, this lookup // can be reused to check for existence in the collection without // requiring either an AtomicString collection or another lookup within // the AtomicStringTable. - WeakResult WeakFind(StringImpl* string) { - // Mirror the empty logic in Add(). - if (UNLIKELY(!string->length())) - return WeakResult(StringImpl::empty_); - if (LIKELY(string->IsAtomic())) - return WeakResult(string); - - return WeakFindSlow(string); - } - - WeakResult WeakFind(const StringView& string) { + WeakResult WeakFindForTesting(const StringView& string) { // Mirror the empty logic in Add(). if (UNLIKELY(!string.length())) return WeakResult(StringImpl::empty_); @@ -100,23 +93,10 @@ if (LIKELY(string.IsAtomic())) return WeakResult(string.SharedImpl()); - return WeakFindSlow(string); + return WeakFindSlowForTesting(string); } - WeakResult WeakFind(const LChar* chars, unsigned length); - WeakResult WeakFind(const UChar* chars, unsigned length); - - WeakResult WeakFindLowercased(const StringView& string) { - // Mirror the empty logic in Add(). - if (UNLIKELY(!string.length())) - return WeakResult(StringImpl::empty_); - - if (LIKELY(string.IsAtomic() && string.IsLowerASCII())) - return WeakResult(string.SharedImpl()); - - return WeakFindLowercasedSlow(string); - } - + WeakResult WeakFindLowercase(const AtomicString& string); // This is for ~StringImpl to unregister a string before destruction since // the table is holding weak pointers. It should not be used directly. bool ReleaseAndRemoveIfNeeded(StringImpl*); @@ -127,9 +107,7 @@ StringImpl* AddNoLock(StringImpl*); - WeakResult WeakFindSlow(StringImpl*); - WeakResult WeakFindSlow(const StringView&); - WeakResult WeakFindLowercasedSlow(const StringView& string); + WeakResult WeakFindSlowForTesting(const StringView&); HashSet<StringImpl*> table_; };
diff --git a/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc b/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc index c22fc7b..f6adc82 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc +++ b/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc
@@ -31,7 +31,6 @@ #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -120,7 +119,7 @@ EXPECT_EQ(3U, builder_for_u_char32_append.length()); const UChar result_array[] = {U16_LEAD(fraktur_a_char), U16_TRAIL(fraktur_a_char), 'A'}; - ExpectBuilderContent(String(result_array, base::size(result_array)), + ExpectBuilderContent(String(result_array, std::size(result_array)), builder_for_u_char32_append); }
diff --git a/third_party/blink/renderer/platform/wtf/text/text_codec_replacement_test.cc b/third_party/blink/renderer/platform/wtf/text/text_codec_replacement_test.cc index 7fb3d7a..dbec2e08 100644 --- a/third_party/blink/renderer/platform/wtf/text/text_codec_replacement_test.cc +++ b/third_party/blink/renderer/platform/wtf/text/text_codec_replacement_test.cc
@@ -6,7 +6,6 @@ #include <memory> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/text_codec.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" @@ -50,7 +49,7 @@ // "Kanji" in Chinese characters. const UChar kTestCase[] = {0x6F22, 0x5B57}; - wtf_size_t test_case_size = base::size(kTestCase); + wtf_size_t test_case_size = std::size(kTestCase); std::string result = codec->Encode(kTestCase, test_case_size, kEntitiesForUnencodables);
diff --git a/third_party/blink/renderer/platform/wtf/text/wtf_string_test.cc b/third_party/blink/renderer/platform/wtf/text/wtf_string_test.cc index 31e07fd..2f433144 100644 --- a/third_party/blink/renderer/platform/wtf/text/wtf_string_test.cc +++ b/third_party/blink/renderer/platform/wtf/text/wtf_string_test.cc
@@ -27,7 +27,6 @@ #include <limits> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/hash_traits.h" @@ -343,7 +342,7 @@ 0x30C8}; // "Test" in Japanese. EXPECT_EQ("\"\\u30C6\\u30B9\\u30C8\"", ToStdStringThroughPrinter( - String(kUnicodeSample, base::size(kUnicodeSample)))); + String(kUnicodeSample, std::size(kUnicodeSample)))); } class TestMatcher {
diff --git a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py index 3c335a9..7b7145b 100755 --- a/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py +++ b/third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
@@ -113,7 +113,6 @@ 'absl::nullopt_t', 'base::ranges::.+', 'base::sequence_manager::TaskTimeObserver', - 'base::size', 'base::span', 'logging::GetVlogLevel', 'logging::SetLogItems', @@ -1212,7 +1211,7 @@ 'third_party/blink/renderer/modules/mediarecorder/', ], 'allowed': [ - 'base::data', + 'std::data', # TODO(crbug.com/960665): Remove base::queue once it is replaced with a WTF equivalent. 'base::queue', 'base::SharedMemory',
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0f7ea39..3e10a37 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -7613,6 +7613,3 @@ crbug.com/1299946 [ Mac ] external/wpt/css/css-sizing/min-content-negative-margin-crash.html [ Pass Timeout ] crbug.com/1299948 [ Mac ] external/wpt/css/css-tables/crashtests/textarea-intrinsic-size-crash.html [ Pass Timeout ] crbug.com/1299972 [ Linux ] screen_orientation/screenorientation-unsupported-no-crash.html [ Failure Pass Timeout ] - -# Sheriff 2022-02-23 -crbug.com/1300256 [ Mac ] virtual/fenced-frame-mparch/wpt_internal/fenced_frame/navigate-ancestor.https.html [ Skip ]
diff --git a/third_party/blink/web_tests/external/wpt/css/CSS2/normal-flow/block-in-inline-hittest-float-002.html b/third_party/blink/web_tests/external/wpt/css/CSS2/normal-flow/block-in-inline-hittest-float-002.html new file mode 100644 index 0000000..91f8e44 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/CSS2/normal-flow/block-in-inline-hittest-float-002.html
@@ -0,0 +1,77 @@ +<!DOCTYPE html> +<link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-document-elementfrompoint"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +section { + display: flow-root; +} +.float { + float: left; + width: 200px; + height: 20px; + background: orange; +} +.normal { + height: 10px; + background: blue; +} +</style> +<body> + <section> + <a href="#"> + <div> + <div class="float"></div> + <div class="normal"></div> + </div> + </a> + </section> + <section title="with background"> + <a href="#" style="background: purple"> + <div> + <div class="float"></div> + <div class="normal"></div> + </div> + </a> + </section> + <section title="with padding"> + <a href="#" style="padding: 1px"> + <div> + <div class="float"></div> + <div class="normal"></div> + </div> + </a> + </section> + <section title="floats before block-in-inline"> + <div class="float"></div> + <div> + <a href="#"> + <div class="normal"></div> + </a> + </div> + </section> + <section title="floats before block-in-inline with background"> + <div class="float"></div> + <div> + <a href="#" style="background: purple"> + <div class="normal"></div> + </a> + </div> + </section> +<script> +document.body.offsetTop; +for (const section of document.getElementsByTagName('section')) { + test(() => { + const float_element = section.querySelector('.float'); + const float_bounds = float_element.getBoundingClientRect(); + const normal_element = section.querySelector('.normal'); + const normal_bounds = normal_element.getBoundingClientRect(); + const x = float_bounds.x + (float_bounds.width / 2); + const y = normal_bounds.y + (normal_bounds.height / 2); + const result = document.elementFromPoint(x, y); + assert_equals(result, float_element); + }, section.title); +} +</script> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-fenced-frame.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-fenced-frame.https.html new file mode 100644 index 0000000..ec41fe8 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-fenced-frame.https.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>Test navigating an ancestor frame from a nested fenced frame</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/utils.js"></script> +<script src="resources/navigate-ancestor-helper.js"></script> + +<body> +<script> +promise_test(async t => { + await runNavigateAncestorTest("nested fenced frame", "parent"); +}, "Nested fenced frames that navigate _parent end up navigating themselves"); + +promise_test(async t => { + await runNavigateAncestorTest("nested fenced frame", "top"); +}, "Nested fenced frames that navigate _top end up navigating themselves"); +</script> + +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-iframe.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-iframe.https.html new file mode 100644 index 0000000..977eae174 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-nested-iframe.https.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>Test navigating an ancestor frame from a iframe in a fenced frame</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/utils.js"></script> +<script src="resources/navigate-ancestor-helper.js"></script> + +<body> +<script> +promise_test(async t => { + await runNavigateAncestorTest("nested iframe", "parent"); +}, "Iframes nested in fenced frames fail to navigate _parent"); + +promise_test(async t => { + await runNavigateAncestorTest("nested iframe", "top"); +}, "Iframes nested in fenced frames fail to navigate _top"); +</script> + +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-top-level-fenced-frame.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-top-level-fenced-frame.https.html new file mode 100644 index 0000000..9907f25 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor-top-level-fenced-frame.https.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>Test navigating an ancestor frame from a fenced frame</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/utils.js"></script> +<script src="resources/navigate-ancestor-helper.js"></script> + +<body> +<script> +promise_test(async t => { + await runNavigateAncestorTest("top-level fenced frame", "parent"); +}, "Top-level fenced frames that navigate _parent end up navigating themselves"); + +promise_test(async t => { + await runNavigateAncestorTest("top-level fenced frame", "top"); +}, "Top-level fenced frames that navigate _top end up navigating themselves"); +</script> + +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor.https.html deleted file mode 100644 index 664c9dc..0000000 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/navigate-ancestor.https.html +++ /dev/null
@@ -1,83 +0,0 @@ -<!DOCTYPE html> -<title>Test navigating an ancestor frame</title> -<meta name="timeout" content="long"> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="resources/utils.js"></script> -<script src="/common/utils.js"></script> - -<body> -<script> - async function runTest(test_type, ancestor_type) { - // See documentation in `resources/navigate-ancestor-test-runner.https.html`. - // For each test type here, this document opens a new auxiliary window that - // runs the actual test. The tests in some way or another, direct a frame - // *inside* a fenced frame to navigate an ancestor frame via an - // <a target="_parent|_top"></a>. We need to run the real test in a new window - // so that if that window ends up navigating unexpectedly (because the fenced - // frame can accidentally navigated its embedder, for example) we can detect - // it from ths page, which never navigates away. - const navigate_ancestor_key = token(); - const navigate_ancestor_from_nested_key = token(); - - const win = window.open(generateURL( - "resources/navigate-ancestor-test-runner.https.html", - [navigate_ancestor_key, navigate_ancestor_from_nested_key])); - await new Promise(resolve => { - win.onload = resolve; - }); - - const unloadPromise = new Promise(resolve => { - win.onunload = resolve; - }); - - try { - await win.runTest(test_type, ancestor_type); - win.close(); - await unloadPromise; - } catch (error) { - // If the test failed, then the destination page will still be navigated to - // and post a message to the server. We have to clean up this message so - // that it is not lingering around and the next test picks it up. - await nextValueFromServer(navigate_ancestor_key); - - win.close(); - await unloadPromise; - // It is possible that we have a lingering message on the server from this - // key, but not guaranteed. We need to clear it if it exists. - await readValueFromServer(navigate_ancestor_from_nested_key); - - // Re-throw the error so that the test fails. - throw error; - } -} - -promise_test(async t => { - await runTest("top-level fenced frame", "parent"); -}, "Top-level fenced frames that navigate _parent end up navigating themselves"); - -promise_test(async t => { - await runTest("top-level fenced frame", "top"); -}, "Top-level fenced frames that navigate _top end up navigating themselves"); - -promise_test(async t => { - await runTest("nested fenced frame", "parent"); -}, "Nested fenced frames that navigate _parent end up navigating themselves"); - -promise_test(async t => { - await runTest("nested fenced frame", "top"); -}, "Nested fenced frames that navigate _top end up navigating themselves"); - -promise_test(async t => { - await runTest("nested iframe", "parent"); -}, "Iframes nested in fenced frames that navigate _parent end up navigating " + - "the fenced frame"); - -promise_test(async t => { - await runTest("nested iframe", "top"); -}, "Iframes nested in fenced frames that navigate _top end up navigating the " + - "fenced frame"); - -</script> - -</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/navigate-ancestor-helper.js b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/navigate-ancestor-helper.js new file mode 100644 index 0000000..6178ea7 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/navigate-ancestor-helper.js
@@ -0,0 +1,28 @@ + +async function runNavigateAncestorTest(test_type, ancestor_type) { + // See documentation in `resources/navigate-ancestor-test-runner.https.html`. + // For each test type here, this document opens a new auxiliary window that + // runs the actual test. The tests in some way or another, direct a frame + // *inside* a fenced frame to navigate an ancestor frame via an + // <a target="_parent|_top"></a>. We need to run the real test in a new window + // so that if that window ends up navigating unexpectedly (because the fenced + // frame can accidentally navigated its embedder, for example) we can detect + // it from ths page, which never navigates away. + const navigate_ancestor_key = token(); + const navigate_ancestor_from_nested_key = token(); + + const win = window.open(generateURL( + "resources/navigate-ancestor-test-runner.https.html", + [navigate_ancestor_key, navigate_ancestor_from_nested_key])); + await new Promise(resolve => { + win.onload = resolve; + }); + + const unloadPromise = new Promise(resolve => { + win.onunload = resolve; + }); + + await win.runTest(test_type, ancestor_type); + win.close(); + await unloadPromise; +}
diff --git a/third_party/closure_compiler/externs/file_manager_private.js b/third_party/closure_compiler/externs/file_manager_private.js index afad5c7..8d1461d 100644 --- a/third_party/closure_compiler/externs/file_manager_private.js +++ b/third_party/closure_compiler/externs/file_manager_private.js
@@ -1202,6 +1202,15 @@ chrome.fileManagerPrivate.listMountableGuests = function(callback) {}; /** + * Starts and mounts target guest + * @param {!number} id Id of the mount provider to use + * @param {function()} callback Callback called after the requests completes + * (either successfully or with an error). + * chrome.runtime.lastError will be set if there was an error. + */ +chrome.fileManagerPrivate.mountGuest = function(id, callback) {}; + +/** * Shares paths with crostini container. * @param {string} vmName VM to share path with. * @param {!Array<!Entry>} entries Entries of the files and directories to
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 2ddadcb..56cb50c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -31776,6 +31776,7 @@ <int value="1630" label="AUTOTESTPRIVATE_GETLOGINEVENTRECORDERLOGINEVENTS"/> <int value="1631" label="AUTOTESTPRIVATE_ADDLOGINEVENTFORTESTING"/> <int value="1632" label="OS_DIAGNOSTICS_RUNDISKREADROUTINE"/> + <int value="1633" label="FILEMANAGERPRIVATE_MOUNTGUEST"/> </enum> <enum name="ExtensionIconState"> @@ -37323,6 +37324,7 @@ <int value="4169" label="BlobStoreAccessAcrossTopLevelSite"/> <int value="4170" label="BlobStoreAccessUnknownTopLevelSite"/> <int value="4171" label="CrossOriginAccessBasedOnDocumentDomain"/> + <int value="4172" label="CookieWithTruncatingChar"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -51512,6 +51514,7 @@ <int value="-2030255112" label="Bruschetta:disabled"/> <int value="-2030217301" label="password-export:disabled"/> <int value="-2029912304" label="StaleWhileRevalidate2:enabled"/> + <int value="-2028402892" label="EnableIkev2Vpn:enabled"/> <int value="-2028336995" label="VirtualKeyboardDarkMode:disabled"/> <int value="-2028232016" label="spurious-power-button-lid-angle-change"/> <int value="-2028202891" @@ -54487,6 +54490,7 @@ <int value="27507364" label="apps-keep-chrome-alive"/> <int value="29212695" label="OfflineIndicator:enabled"/> <int value="31693434" label="ExtendedOpenVpnSettings:enabled"/> + <int value="31776417" label="EnableIkev2Vpn:disabled"/> <int value="31848187" label="ViewsTaskManager:disabled"/> <int value="32057053" label="EnterpriseReportingInBrowser:disabled"/> <int value="32242305" label="NtpRecipeTasksModule:enabled"/>
diff --git a/ui/accessibility/mojom/ax_assistant_structure_mojom_traits.h b/ui/accessibility/mojom/ax_assistant_structure_mojom_traits.h index 9ea96026..1029f89 100644 --- a/ui/accessibility/mojom/ax_assistant_structure_mojom_traits.h +++ b/ui/accessibility/mojom/ax_assistant_structure_mojom_traits.h
@@ -40,10 +40,11 @@ const std::unique_ptr<ui::AssistantNode>& node) { return node->children_indices; } - static gfx::Rect rect(const std::unique_ptr<ui::AssistantNode>& node) { + static const gfx::Rect& rect(const std::unique_ptr<ui::AssistantNode>& node) { return node->rect; } - static std::u16string text(const std::unique_ptr<ui::AssistantNode>& node) { + static const std::u16string& text( + const std::unique_ptr<ui::AssistantNode>& node) { return node->text; } static float text_size(const std::unique_ptr<ui::AssistantNode>& node) { @@ -67,15 +68,15 @@ static bool line_through(const std::unique_ptr<ui::AssistantNode>& node) { return node->line_through; } - static absl::optional<gfx::Range> selection( + static const absl::optional<gfx::Range>& selection( const std::unique_ptr<ui::AssistantNode>& node) { return node->selection; } - static std::string class_name( + static const std::string& class_name( const std::unique_ptr<ui::AssistantNode>& node) { return node->class_name; } - static absl::optional<std::string> role( + static const absl::optional<std::string>& role( const std::unique_ptr<ui::AssistantNode>& node) { return node->role; }
diff --git a/ui/file_manager/file_manager/background/js/file_operation_handler.js b/ui/file_manager/file_manager/background/js/file_operation_handler.js index 53223bc..ba42bed 100644 --- a/ui/file_manager/file_manager/background/js/file_operation_handler.js +++ b/ui/file_manager/file_manager/background/js/file_operation_handler.js
@@ -419,12 +419,14 @@ switch (type) { case chrome.fileManagerPrivate.IOTaskType.COPY: return ProgressItemType.COPY; + case chrome.fileManagerPrivate.IOTaskType.DELETE: + return ProgressItemType.DELETE; + case chrome.fileManagerPrivate.IOTaskType.EXTRACT: + return ProgressItemType.EXTRACT; case chrome.fileManagerPrivate.IOTaskType.MOVE: return ProgressItemType.MOVE; case chrome.fileManagerPrivate.IOTaskType.ZIP: return ProgressItemType.ZIP; - case chrome.fileManagerPrivate.IOTaskType.DELETE: - return ProgressItemType.DELETE; default: console.error('Unknown operation type: ' + type); return ProgressItemType.TRANSFER;
diff --git a/ui/file_manager/file_manager/common/js/api.js b/ui/file_manager/file_manager/common/js/api.js index c6500dd..ee304bc0 100644 --- a/ui/file_manager/file_manager/common/js/api.js +++ b/ui/file_manager/file_manager/common/js/api.js
@@ -108,6 +108,15 @@ return promisify(chrome.fileManagerPrivate.listMountableGuests); } +/** + * Lists Guest OSs which support having their files mounted. + * @param {number} id Id of the guest to mount. + * @return {!Promise<void>} + */ +export async function mountGuest(id) { + return promisify(chrome.fileManagerPrivate.mountGuest, id); +} + /* * FileSystemEntry helpers */
diff --git a/ui/file_manager/file_manager/common/js/files_app_entry_types.js b/ui/file_manager/file_manager/common/js/files_app_entry_types.js index d427eb1..8dad588c 100644 --- a/ui/file_manager/file_manager/common/js/files_app_entry_types.js +++ b/ui/file_manager/file_manager/common/js/files_app_entry_types.js
@@ -702,15 +702,15 @@ export class GuestOsPlaceholder extends FakeEntryImpl { /** * @param {string} label Translated text to be displayed to user. - * @param {number} id Id of the guest + * @param {number} guest_id Id of the guest */ - constructor(label, id) { + constructor(label, guest_id) { super(label, VolumeManagerCommon.RootType.GUEST_OS, undefined, undefined); /** * @public {number} The id of this guest */ - this.id = id; + this.guest_id = guest_id; /** * @public {string} the class name for this class. It's workaround for the
diff --git a/ui/file_manager/file_manager/common/js/progress_center_common.js b/ui/file_manager/file_manager/common/js/progress_center_common.js index 3816fe3..66edf56 100644 --- a/ui/file_manager/file_manager/common/js/progress_center_common.js +++ b/ui/file_manager/file_manager/common/js/progress_center_common.js
@@ -21,10 +21,12 @@ export const ProgressItemType = { // The item is file copy operation. COPY: 'copy', - // The item is file move operation. - MOVE: 'move', // The item is file delete operation. DELETE: 'delete', + // The item is file extract operation. + EXTRACT: 'extract', + // The item is file move operation. + MOVE: 'move', // The item is file zip operation. ZIP: 'zip', // The item is drive sync operation.
diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js index a84ab568..ebbf642 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_contents.js +++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
@@ -5,6 +5,7 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {dispatchSimpleEvent} from 'chrome://resources/js/cr.m.js'; import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js'; +import {mountGuest} from '../../common/js/api.js'; import {AsyncUtil} from '../../common/js/async_util.js'; import {metrics} from '../../common/js/metrics.js'; @@ -37,7 +38,7 @@ * successfully. * @param {function(DOMError)} errorCallback Called an error occurs. */ - scan(entriesCallback, successCallback, errorCallback) {} + async scan(entriesCallback, successCallback, errorCallback) {} /** * Request cancelling of the running scan. When the cancelling is done, @@ -64,7 +65,7 @@ * Starts to read the entries in the directory. * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { if (!this.entry_ || !this.entry_.createReader) { // If entry is not specified or if entry doesn't implement createReader, // we cannot read it. @@ -94,6 +95,7 @@ }, errorCallback); }; readEntries(); + return; } } @@ -111,7 +113,7 @@ * Starts to search on Drive File System. * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { // Let's give another search a chance to cancel us before we begin. setTimeout(() => { // Check cancelled state before read the entries. @@ -151,6 +153,7 @@ successCallback(); }); }, DriveSearchContentScanner.SCAN_DELAY_); + return; } } @@ -190,7 +193,7 @@ * Starts the file name search. * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { util.readEntriesRecursively(assert(this.entry_), (entries) => { const matchEntries = entries.filter( entry => entry.name.toLowerCase().indexOf(this.query_) >= 0); @@ -198,6 +201,7 @@ entriesCallback(matchEntries); } }, successCallback, errorCallback, () => this.cancelled_); + return; } } @@ -218,7 +222,7 @@ * Starts to metadata-search on Drive File System. * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { chrome.fileManagerPrivate.searchDriveMetadata( {query: '', types: this.searchType_, maxResults: 100}, results => { if (chrome.runtime.lastError) { @@ -244,6 +248,7 @@ } successCallback(); }); + return; } } @@ -277,7 +282,7 @@ /** * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { chrome.fileManagerPrivate.getRecentFiles( this.sourceRestriction_, this.recentFileType_, entries => { if (chrome.runtime.lastError) { @@ -292,6 +297,7 @@ } successCallback(); }); + return; } } @@ -318,7 +324,7 @@ * files in directories recursively. * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { // To provide flatten view of files, this media-view scanner retrieves files // in directories inside the media's root entry recursively. util.readEntriesRecursively( @@ -345,7 +351,7 @@ /** * @override */ - scan(entriesCallback, successCallback, errorCallback) { + async scan(entriesCallback, successCallback, errorCallback) { chrome.fileManagerPrivate.mountCrostini(() => { if (chrome.runtime.lastError) { console.error( @@ -356,6 +362,45 @@ } successCallback(); }); + return; + } +} + +/** + * Shows an empty list and spinner whilst starting and mounting a Guest OS's + * shared files. + * + * When FilesApp starts, the related placeholder root entry is shown which uses + * this GuestOsMounter as its ContentScanner. When the mount succeeds it will + * show up as a disk volume. NavigationListModel.reorderNavigationItems_ will + * detect thew new volume and hide the placeholder root item while the disk + * volume exists. + */ +export class GuestOsMounter extends ContentScanner { + /** + * @param {number} guest_id The id of the GuestOsMountProvider to use + */ + constructor(guest_id) { + super(); + + /** @private @const {number} */ + this.guest_id_ = guest_id; + } + + /** + * @override + */ + async scan(entriesCallback, successCallback, errorCallback) { + try { + await mountGuest(this.guest_id_); + successCallback(); + } catch (error) { + console.error('mountGuest error: ', error); + errorCallback(util.createDOMError( + // TODO(crbug/1293229): Strings + constants.CROSTINI_CONNECT_ERR, error)); + } + return; } }
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js index f0a4c59f..f52788a 100644 --- a/ui/file_manager/file_manager/foreground/js/directory_model.js +++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -9,6 +9,7 @@ import {ListSingleSelectionModel} from 'chrome://resources/js/cr/ui/list_single_selection_model.m.js'; import {AsyncUtil} from '../../common/js/async_util.js'; +import {GuestOsPlaceholder} from '../../common/js/files_app_entry_types.js'; import {metrics} from '../../common/js/metrics.js'; import {util} from '../../common/js/util.js'; import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; @@ -19,7 +20,7 @@ import {VolumeManager} from '../../externs/volume_manager.js'; import {constants} from './constants.js'; -import {ContentScanner, CrostiniMounter, DirectoryContents, DirectoryContentScanner, DriveMetadataSearchContentScanner, DriveSearchContentScanner, FileFilter, FileListContext, LocalSearchContentScanner, MediaViewContentScanner, RecentContentScanner} from './directory_contents.js'; +import {ContentScanner, CrostiniMounter, DirectoryContents, DirectoryContentScanner, DriveMetadataSearchContentScanner, DriveSearchContentScanner, FileFilter, FileListContext, GuestOsMounter, LocalSearchContentScanner, MediaViewContentScanner, RecentContentScanner} from './directory_contents.js'; import {FileListModel} from './file_list_model.js'; import {FileWatcher} from './file_watcher.js'; import {MetadataModel} from './metadata/metadata_model.js'; @@ -1411,6 +1412,12 @@ return new CrostiniMounter(); }; } + if (entry.rootType == VolumeManagerCommon.RootType.GUEST_OS) { + return () => { + const placeholder = /** @type {!GuestOsPlaceholder} */ (entry); + return new GuestOsMounter(placeholder.guest_id); + }; + } if (entry.rootType == VolumeManagerCommon.RootType.MY_FILES) { return () => { return new DirectoryContentScanner(
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index 4a8e5539..08a7b639c 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -19,7 +19,6 @@ import {ProgressItemState} from '../../common/js/progress_center_common.js'; import {str, util} from '../../common/js/util.js'; import {AllowedPaths, VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; -import {xfm} from '../../common/js/xfm.js'; import {Crostini} from '../../externs/background/crostini.js'; import {FileBrowserBackgroundFull} from '../../externs/background/file_browser_background_full.js'; import {FileOperationManager} from '../../externs/background/file_operation_manager.js'; @@ -57,7 +56,6 @@ import {LaunchParam} from './launch_param.js'; import {ListThumbnailLoader} from './list_thumbnail_loader.js'; import {MainWindowComponent} from './main_window_component.js'; -import {ContentMetadataProvider} from './metadata/content_metadata_provider.js'; import {MetadataModel} from './metadata/metadata_model.js'; import {ThumbnailModel} from './metadata/thumbnail_model.js'; import {MetadataBoxController} from './metadata_box_controller.js';
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js index 79c495c..0e2ada0 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands.js
@@ -2082,8 +2082,22 @@ */ CommandHandler.COMMANDS_['extract-all'] = new class extends FilesCommand { execute(event, fileManager) { - // TODO(crbug.com/953256) wire up IOTask for extraction. + const dirEntry = fileManager.getCurrentDirectoryEntry(); + if (!dirEntry || + !fileManager.getSelection().entries.every( + CommandUtil.shouldShowMenuItemsForEntry.bind( + null, fileManager.volumeManager))) { + return; + } + + const selectionEntries = fileManager.getSelection().entries; + if (util.isExtractArchiveEnabled()) { + chrome.fileManagerPrivate.startIOTask( + chrome.fileManagerPrivate.IOTaskType.EXTRACT, selectionEntries, + {destinationFolder: /** @type {!DirectoryEntry} */ (dirEntry)}); + } } + /** @override */ canExecute(event, fileManager) { if (!util.isExtractArchiveEnabled()) { @@ -2136,6 +2150,16 @@ const dirEntry = fileManager.getCurrentDirectoryEntry(); const selection = fileManager.getSelection(); + // Hide ZIP selection for single ZIP file selected. + if (util.isExtractArchiveEnabled()) { + if (selection.entries.length === 1 && + FileType.getExtension(selection.entries[0]) === '.zip') { + event.command.setHidden(true); + event.canExecute = false; + return; + } + } + if (!selection.entries.every(CommandUtil.shouldShowMenuItemsForEntry.bind( null, fileManager.volumeManager))) { event.canExecute = false;
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager_commands_unittest.m.js b/ui/file_manager/file_manager/foreground/js/file_manager_commands_unittest.m.js index e637f14..b60179c 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager_commands_unittest.m.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager_commands_unittest.m.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {assertArrayEquals, assertEquals, assertNotEquals, assertTrue} from 'chrome://test/chai_assert.js'; +import {assertArrayEquals, assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://test/chai_assert.js'; import {MockVolumeManager} from '../../background/js/mock_volume_manager.js'; import {installMockChrome} from '../../common/js/mock_chrome.js'; @@ -240,3 +240,118 @@ done(); } + +/** + * Checks that the 'extract-all' command is enabled or disabled + * dependent on the current selection. + */ +export async function testExtractAllCommand(done) { + // Check: `extract-all` command exists. + const command = CommandHandler.getCommand('extract-all'); + assertNotEquals(command, undefined); + + // Enable the extract all feature and provide strings. + loadTimeData.resetForTesting({ + EXTRACT_ARCHIVE: true, + EXTRACT_ALL_BUTTON_LABEL: 'Extract all', + }); + loadTimeData.getString = id => { + return loadTimeData.data_[id] || id; + }; + + let startIOTaskCalled = false; + + /** + * Mock chrome startIOTask API. + * @type {Object} + */ + const mockChrome = { + fileManagerPrivate: { + startIOTask: () => { + startIOTaskCalled = true; + }, + }, + + runtime: {}, + }; + installMockChrome(mockChrome); + + // Mock volume manager. + const volumeManager = new MockVolumeManager(); + + // Create `DOWNLOADS` volume. + const downloadsVolumeInfo = volumeManager.createVolumeInfo( + VolumeManagerCommon.VolumeType.DOWNLOADS, 'downloadsVolumeId', + 'Downloads volume'); + const downloadsFileSystem = downloadsVolumeInfo.fileSystem; + + // Mock file entries. + const folderEntry = MockDirectoryEntry.create(downloadsFileSystem, '/folder'); + const textFileEntry = new MockEntry(downloadsFileSystem, '/file.txt'); + const zipFileEntry = new MockEntry(downloadsFileSystem, '/archive.zip'); + + // Mock `Event`. + const event = { + canExecute: true, + command: { + hidden: false, + setHidden: (hidden) => { + event.command.hidden = hidden; + }, + }, + }; + + // The current selection for testing. + const currentSelection = { + entries: [], + iconType: 'none', + totalCount: 0, + }; + + // Mock `FileManager`. + const fileManager = { + directoryModel: { + isOnNative: () => true, + isReadOnly: () => false, + }, + getCurrentDirectoryEntry: () => folderEntry, + getSelection: () => currentSelection, + volumeManager: volumeManager, + }; + + // Check: canExecute is false and command is hidden with no selection. + command.canExecute(event, fileManager); + assertFalse(event.canExecute); + assertTrue(event.command.hidden); + + // Check: canExecute is true and command is visible with a single ZIP file. + currentSelection.entries = [zipFileEntry]; + currentSelection.iconType = 'archive'; + currentSelection.totalCount = 1; + command.canExecute(event, fileManager); + assertTrue(event.canExecute); + assertFalse(event.command.hidden); + + // Check: `zip-selection` command exists. + const zipCommand = CommandHandler.getCommand('zip-selection'); + assertNotEquals(command, undefined); + + // Check: ZIP canExecute is false and command hidden with a single ZIP file. + zipCommand.canExecute(event, fileManager); + assertFalse(event.canExecute); + assertTrue(event.command.hidden); + + // Check: canExecute is false and command hidden for multiple selection. + currentSelection.entries = [zipFileEntry, textFileEntry]; + currentSelection.totalCount = 2; + command.canExecute(event, fileManager); + assertFalse(event.canExecute); + assertTrue(event.command.hidden); + + // Check: ZIP canExecute is true and command visible for multiple selection. + zipCommand.canExecute(event, fileManager); + assertTrue(event.canExecute); + assertFalse(event.command.hidden); + + done(); +}
diff --git a/ui/file_manager/integration_tests/file_manager/guest_os.js b/ui/file_manager/integration_tests/file_manager/guest_os.js index cff0001b..4ca972aa 100644 --- a/ui/file_manager/integration_tests/file_manager/guest_os.js +++ b/ui/file_manager/integration_tests/file_manager/guest_os.js
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {ENTRIES, RootPath, sendTestMessage} from '../test_util.js'; +import {ENTRIES, RootPath} from '../test_util.js'; import {testcase} from '../testcase.js'; -import {mountCrostini, remoteCall, setupAndWaitUntilReady} from './background.js'; +import {IGNORE_APP_ERRORS, remoteCall, setupAndWaitUntilReady} from './background.js'; /** * Tests that Guest OS entries don't show up if the flag controlling guest os + @@ -33,4 +33,31 @@ // listed. const query = '#directory-tree [root-type-icon=guest_os]'; await remoteCall.waitForElementsCount(appId, [query], 2); -}; \ No newline at end of file +}; + +/** + * Tests that clicking on a Guest OS entry in the sidebar triggers a mount + * event, and an error is returned. + * TODO(crbug/1293229): Scan errors don't seem to show up in the UI any more. + * Need to fix that, then update this test to check for the expected error. + */ +testcase.mountGuestError = async () => { + // Open the files app. + const appId = + await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.hello], []); + + // Browsertest base registers some mock Guest OSs, wait for one to appear and + // click it. + const query = '#directory-tree [root-type-icon=guest_os]'; + await remoteCall.waitAndClickElement(appId, query); + + // Check that the Guest is selected. Guests are listed alphabetically so + // Electra should be first. + // TODO(crbug/1293229): It looks like scan errors are no longer surfaced in + // the UI, I remember they used to be? Need to figure out surfacing errors and + // then we check that instead. + await remoteCall.waitForElement(appId, '#breadcrumbs[path=Electra]'); + + // We expect there to be an error, from the mount failure. + return IGNORE_APP_ERRORS; +};
diff --git a/ui/gfx/color_analysis.cc b/ui/gfx/color_analysis.cc index 8a74f0b..759061a 100644 --- a/ui/gfx/color_analysis.cc +++ b/ui/gfx/color_analysis.cc
@@ -816,152 +816,4 @@ filter.is_null() ? base::BindRepeating(&IsInterestingColor) : filter); } -gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap) { - // First need basic stats to normalize each channel separately. - gfx::Matrix3F covariance = gfx::Matrix3F::Zeros(); - if (!bitmap.getPixels()) - return covariance; - - // Assume ARGB_8888 format. - DCHECK(bitmap.colorType() == kN32_SkColorType); - - int64_t r_sum = 0; - int64_t g_sum = 0; - int64_t b_sum = 0; - int64_t rr_sum = 0; - int64_t gg_sum = 0; - int64_t bb_sum = 0; - int64_t rg_sum = 0; - int64_t rb_sum = 0; - int64_t gb_sum = 0; - - for (int y = 0; y < bitmap.height(); ++y) { - SkPMColor* current_color = static_cast<uint32_t*>(bitmap.getAddr32(0, y)); - for (int x = 0; x < bitmap.width(); ++x, ++current_color) { - SkColor c = SkUnPreMultiply::PMColorToColor(*current_color); - SkColor r = SkColorGetR(c); - SkColor g = SkColorGetG(c); - SkColor b = SkColorGetB(c); - - r_sum += r; - g_sum += g; - b_sum += b; - rr_sum += r * r; - gg_sum += g * g; - bb_sum += b * b; - rg_sum += r * g; - rb_sum += r * b; - gb_sum += g * b; - } - } - - // Covariance (not normalized) is E(X*X.t) - m * m.t and this is how it - // is calculated below. - // Each row below represents a row of the matrix describing (co)variances - // of R, G and B channels with (R, G, B) - int pixel_n = bitmap.width() * bitmap.height(); - covariance.set( - static_cast<float>( - static_cast<double>(rr_sum) / pixel_n - - static_cast<double>(r_sum * r_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(rg_sum) / pixel_n - - static_cast<double>(r_sum * g_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(rb_sum) / pixel_n - - static_cast<double>(r_sum * b_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(rg_sum) / pixel_n - - static_cast<double>(r_sum * g_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(gg_sum) / pixel_n - - static_cast<double>(g_sum * g_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(gb_sum) / pixel_n - - static_cast<double>(g_sum * b_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(rb_sum) / pixel_n - - static_cast<double>(r_sum * b_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(gb_sum) / pixel_n - - static_cast<double>(g_sum * b_sum) / pixel_n / pixel_n), - static_cast<float>( - static_cast<double>(bb_sum) / pixel_n - - static_cast<double>(b_sum * b_sum) / pixel_n / pixel_n)); - return covariance; -} - -bool ApplyColorReduction(const SkBitmap& source_bitmap, - const gfx::Vector3dF& color_transform, - bool fit_to_range, - SkBitmap* target_bitmap) { - DCHECK(target_bitmap); - DCHECK(source_bitmap.getPixels()); - DCHECK(target_bitmap->getPixels()); - DCHECK_EQ(kN32_SkColorType, source_bitmap.colorType()); - DCHECK_EQ(kAlpha_8_SkColorType, target_bitmap->colorType()); - DCHECK_EQ(source_bitmap.height(), target_bitmap->height()); - DCHECK_EQ(source_bitmap.width(), target_bitmap->width()); - DCHECK(!source_bitmap.empty()); - - // Elements of color_transform are explicitly off-loaded to local values for - // efficiency reasons. Note that in practice images may correspond to entire - // tab captures. - float t0 = 0.0; - float tr = color_transform.x(); - float tg = color_transform.y(); - float tb = color_transform.z(); - - if (fit_to_range) { - // We will figure out min/max in a preprocessing step and adjust - // actual_transform as required. - float max_val = std::numeric_limits<float>::min(); - float min_val = std::numeric_limits<float>::max(); - for (int y = 0; y < source_bitmap.height(); ++y) { - const SkPMColor* source_color_row = static_cast<SkPMColor*>( - source_bitmap.getAddr32(0, y)); - for (int x = 0; x < source_bitmap.width(); ++x) { - SkColor c = SkUnPreMultiply::PMColorToColor(source_color_row[x]); - uint8_t r = SkColorGetR(c); - uint8_t g = SkColorGetG(c); - uint8_t b = SkColorGetB(c); - float gray_level = tr * r + tg * g + tb * b; - max_val = std::max(max_val, gray_level); - min_val = std::min(min_val, gray_level); - } - } - - // Adjust the transform so that the result is scaling. - float scale = 0.0; - t0 = -min_val; - if (max_val > min_val) - scale = 255.0f / (max_val - min_val); - t0 *= scale; - tr *= scale; - tg *= scale; - tb *= scale; - } - - for (int y = 0; y < source_bitmap.height(); ++y) { - const SkPMColor* source_color_row = static_cast<SkPMColor*>( - source_bitmap.getAddr32(0, y)); - uint8_t* target_color_row = target_bitmap->getAddr8(0, y); - for (int x = 0; x < source_bitmap.width(); ++x) { - SkColor c = SkUnPreMultiply::PMColorToColor(source_color_row[x]); - uint8_t r = SkColorGetR(c); - uint8_t g = SkColorGetG(c); - uint8_t b = SkColorGetB(c); - - float gl = t0 + tr * r + tg * g + tb * b; - if (gl < 0) - gl = 0; - if (gl > 0xFF) - gl = 0xFF; - target_color_row[x] = static_cast<uint8_t>(gl); - } - } - - return true; -} - } // color_utils
diff --git a/ui/gfx/color_analysis.h b/ui/gfx/color_analysis.h index 35c22589..9de9a817 100644 --- a/ui/gfx/color_analysis.h +++ b/ui/gfx/color_analysis.h
@@ -11,7 +11,6 @@ #include "base/memory/ref_counted.h" #include "base/memory/ref_counted_memory.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/gfx/geometry/matrix3_f.h" #include "ui/gfx/gfx_export.h" class SkBitmap; @@ -192,20 +191,6 @@ gfx::Rect* region, ColorSwatchFilter filter); -// Compute color covariance matrix for the input bitmap. -GFX_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap); - -// Apply a color reduction transform defined by |color_transform| vector to -// |source_bitmap|. The result is put into |target_bitmap|, which is expected -// to be initialized to the required size and type (SkBitmap::kA8_Config). -// If |fit_to_range|, result is transfored linearly to fit 0-0xFF range. -// Otherwise, data is clipped. -// Returns true if the target has been computed. -GFX_EXPORT bool ApplyColorReduction(const SkBitmap& source_bitmap, - const gfx::Vector3dF& color_transform, - bool fit_to_range, - SkBitmap* target_bitmap); - } // namespace color_utils #endif // UI_GFX_COLOR_ANALYSIS_H_
diff --git a/ui/gfx/color_analysis_unittest.cc b/ui/gfx/color_analysis_unittest.cc index bbf1e87..fb72be2 100644 --- a/ui/gfx/color_analysis_unittest.cc +++ b/ui/gfx/color_analysis_unittest.cc
@@ -145,26 +145,6 @@ return (abs(expected - static_cast<int>(channel)) <= 1); } -// Compute minimal and maximal graylevel (or alphalevel) of the input |bitmap|. -// |bitmap| has to be allocated and configured to kA8_Config. -void Calculate8bitBitmapMinMax(const SkBitmap& bitmap, - uint8_t* min_gl, - uint8_t* max_gl) { - DCHECK(bitmap.getPixels()); - DCHECK_EQ(bitmap.colorType(), kAlpha_8_SkColorType); - DCHECK(min_gl); - DCHECK(max_gl); - *min_gl = std::numeric_limits<uint8_t>::max(); - *max_gl = std::numeric_limits<uint8_t>::min(); - for (int y = 0; y < bitmap.height(); ++y) { - uint8_t* current_color = bitmap.getAddr8(0, y); - for (int x = 0; x < bitmap.width(); ++x, ++current_color) { - *min_gl = std::min(*min_gl, *current_color); - *max_gl = std::max(*max_gl, *current_color); - } - } -} - class ColorAnalysisTest : public testing::Test { }; @@ -357,146 +337,6 @@ EXPECT_TRUE(ChannelApproximatelyEqual(200, SkColorGetB(color))); } -TEST_F(ColorAnalysisTest, ComputeColorCovarianceTrivial) { - SkBitmap bitmap; - bitmap.setInfo(SkImageInfo::MakeN32Premul(100, 200)); - - EXPECT_EQ(gfx::Matrix3F::Zeros(), ComputeColorCovariance(bitmap)); - bitmap.allocPixels(); - bitmap.eraseARGB(255, 50, 150, 200); - gfx::Matrix3F covariance = ComputeColorCovariance(bitmap); - // The answer should be all zeros. - EXPECT_TRUE(covariance == gfx::Matrix3F::Zeros()); -} - -TEST_F(ColorAnalysisTest, ComputeColorCovarianceWithCanvas) { - gfx::Canvas canvas(gfx::Size(250, 200), 1.0f, true); - // The image consists of vertical stripes, with color bands set to 100 - // in overlapping stripes 150 pixels wide. - canvas.FillRect(gfx::Rect(0, 0, 50, 200), SkColorSetRGB(100, 0, 0)); - canvas.FillRect(gfx::Rect(50, 0, 50, 200), SkColorSetRGB(100, 100, 0)); - canvas.FillRect(gfx::Rect(100, 0, 50, 200), SkColorSetRGB(100, 100, 100)); - canvas.FillRect(gfx::Rect(150, 0, 50, 200), SkColorSetRGB(0, 100, 100)); - canvas.FillRect(gfx::Rect(200, 0, 50, 200), SkColorSetRGB(0, 0, 100)); - - gfx::Matrix3F covariance = ComputeColorCovariance(canvas.GetBitmap()); - - gfx::Matrix3F expected_covariance = gfx::Matrix3F::Zeros(); - expected_covariance.set(2400, 400, -1600, - 400, 2400, 400, - -1600, 400, 2400); - EXPECT_EQ(expected_covariance, covariance); -} - -TEST_F(ColorAnalysisTest, ApplyColorReductionSingleColor) { - // The test runs color reduction on a single-colot image, where results are - // bound to be uninteresting. This is an important edge case, though. - SkBitmap source, result; - source.allocN32Pixels(300, 200); - result.allocPixels(SkImageInfo::MakeA8(300, 200)); - - source.eraseARGB(255, 50, 150, 200); - - gfx::Vector3dF transform(1.0f, .5f, 0.1f); - // This transform, if not scaled, should result in GL=145. - EXPECT_TRUE(ApplyColorReduction(source, transform, false, &result)); - - uint8_t min_gl = 0; - uint8_t max_gl = 0; - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(145, min_gl); - EXPECT_EQ(145, max_gl); - - // Now scan requesting rescale. Expect all 0. - EXPECT_TRUE(ApplyColorReduction(source, transform, true, &result)); - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(0, min_gl); - EXPECT_EQ(0, max_gl); - - // Test cliping to upper limit. - transform.set_z(1.1f); - EXPECT_TRUE(ApplyColorReduction(source, transform, false, &result)); - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(0xFF, min_gl); - EXPECT_EQ(0xFF, max_gl); - - // Test cliping to upper limit. - transform.Scale(-1.0f); - EXPECT_TRUE(ApplyColorReduction(source, transform, false, &result)); - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(0x0, min_gl); - EXPECT_EQ(0x0, max_gl); -} - -TEST_F(ColorAnalysisTest, ApplyColorReductionBlackAndWhite) { - // Check with images with multiple colors. This is really different only when - // the result is scaled. - gfx::Canvas canvas(gfx::Size(300, 200), 1.0f, true); - - // The image consists of vertical non-overlapping stripes 150 pixels wide. - canvas.FillRect(gfx::Rect(0, 0, 150, 200), SkColorSetRGB(0, 0, 0)); - canvas.FillRect(gfx::Rect(150, 0, 150, 200), SkColorSetRGB(255, 255, 255)); - SkBitmap source = canvas.GetBitmap(); - SkBitmap result; - result.allocPixels(SkImageInfo::MakeA8(300, 200)); - - gfx::Vector3dF transform(1.0f, 0.5f, 0.1f); - EXPECT_TRUE(ApplyColorReduction(source, transform, true, &result)); - uint8_t min_gl = 0; - uint8_t max_gl = 0; - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - - EXPECT_EQ(0, min_gl); - EXPECT_EQ(255, max_gl); - EXPECT_EQ(min_gl, SkColorGetA(result.getColor(0, 0))); - EXPECT_EQ(max_gl, SkColorGetA(result.getColor(299, 199))); - - // Reverse test. - transform.Scale(-1.0f); - EXPECT_TRUE(ApplyColorReduction(source, transform, true, &result)); - min_gl = 0; - max_gl = 0; - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - - EXPECT_EQ(0, min_gl); - EXPECT_EQ(255, max_gl); - EXPECT_EQ(max_gl, SkColorGetA(result.getColor(0, 0))); - EXPECT_EQ(min_gl, SkColorGetA(result.getColor(299, 199))); -} - -TEST_F(ColorAnalysisTest, ApplyColorReductionMultiColor) { - // Check with images with multiple colors. This is really different only when - // the result is scaled. - gfx::Canvas canvas(gfx::Size(300, 200), 1.0f, true); - - // The image consists of vertical non-overlapping stripes 100 pixels wide. - canvas.FillRect(gfx::Rect(0, 0, 100, 200), SkColorSetRGB(100, 0, 0)); - canvas.FillRect(gfx::Rect(100, 0, 100, 200), SkColorSetRGB(0, 255, 0)); - canvas.FillRect(gfx::Rect(200, 0, 100, 200), SkColorSetRGB(0, 0, 128)); - SkBitmap source = canvas.GetBitmap(); - SkBitmap result; - result.allocPixels(SkImageInfo::MakeA8(300, 200)); - - gfx::Vector3dF transform(1.0f, 0.5f, 0.1f); - EXPECT_TRUE(ApplyColorReduction(source, transform, false, &result)); - uint8_t min_gl = 0; - uint8_t max_gl = 0; - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(12, min_gl); - EXPECT_EQ(127, max_gl); - EXPECT_EQ(min_gl, SkColorGetA(result.getColor(299, 199))); - EXPECT_EQ(max_gl, SkColorGetA(result.getColor(150, 0))); - EXPECT_EQ(100U, SkColorGetA(result.getColor(0, 0))); - - EXPECT_TRUE(ApplyColorReduction(source, transform, true, &result)); - Calculate8bitBitmapMinMax(result, &min_gl, &max_gl); - EXPECT_EQ(0, min_gl); - EXPECT_EQ(255, max_gl); - EXPECT_EQ(min_gl, SkColorGetA(result.getColor(299, 199))); - EXPECT_EQ(max_gl, SkColorGetA(result.getColor(150, 0))); - EXPECT_EQ(193U, SkColorGetA(result.getColor(0, 0))); -} - TEST_F(ColorAnalysisTest, ComputeProminentColors) { LumaRange lumas[] = {LumaRange::DARK, LumaRange::NORMAL, LumaRange::LIGHT}; SaturationRange saturations[] = {SaturationRange::VIBRANT,
diff --git a/url/gurl_unittest.cc b/url/gurl_unittest.cc index b9b0f61..4be6e41 100644 --- a/url/gurl_unittest.cc +++ b/url/gurl_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "url/gurl.h" + #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#include "url/gurl.h" #include "url/gurl_abstract_tests.h" #include "url/origin.h" #include "url/url_canon.h" @@ -222,7 +222,7 @@ "http:/path", "http:path", }; - for (size_t i = 0; i < base::size(valid_cases); i++) { + for (size_t i = 0; i < std::size(valid_cases); i++) { EXPECT_TRUE(GURL(valid_cases[i]).is_valid()) << "Case: " << valid_cases[i]; } @@ -237,7 +237,7 @@ "://google.com", "path", }; - for (size_t i = 0; i < base::size(invalid_cases); i++) { + for (size_t i = 0; i < std::size(invalid_cases); i++) { EXPECT_FALSE(GURL(invalid_cases[i]).is_valid()) << "Case: " << invalid_cases[i]; } @@ -346,7 +346,7 @@ {"file:///some/dir/", "://host", true, "file:///some/dir/://host"}, }; - for (size_t i = 0; i < base::size(resolve_cases); i++) { + for (size_t i = 0; i < std::size(resolve_cases); i++) { // 8-bit code path. GURL input(resolve_cases[i].base); GURL output = input.Resolve(resolve_cases[i].relative); @@ -383,7 +383,7 @@ {"blob:null/guid-goes-here", ""}, {"blob:http://origin/guid-goes-here", "" /* should be http://origin/ */}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); GURL origin = url.DeprecatedGetOriginAsURL(); EXPECT_EQ(cases[i].expected, origin.spec()); @@ -406,7 +406,7 @@ {"file:///tmp/test.html", ""}, {"https://www.google.com", "https://www.google.com/"}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); GURL origin = url.GetAsReferrer(); EXPECT_EQ(cases[i].expected, origin.spec()); @@ -425,7 +425,7 @@ {"filesystem:file:///temporary/bar.html?baz=22", "filesystem:file:///temporary/"}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); GURL empty_path = url.GetWithEmptyPath(); EXPECT_EQ(cases[i].expected, empty_path.spec()); @@ -471,7 +471,7 @@ {"foobar", ""}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); GURL without_filename = url.GetWithoutFilename(); EXPECT_EQ(cases[i].expected, without_filename.spec()) << i; @@ -636,7 +636,7 @@ "/foo/bar.html?query", "/temporary"}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); EXPECT_EQ(cases[i].expected, url.PathForRequest()); EXPECT_EQ(cases[i].expected, url.PathForRequestPiece()); @@ -682,7 +682,7 @@ {"filesystem:file:///t/foo", PORT_UNSPECIFIED}, }; - for (size_t i = 0; i < base::size(port_tests); i++) { + for (size_t i = 0; i < std::size(port_tests); i++) { GURL url(port_tests[i].spec); EXPECT_EQ(port_tests[i].expected_int_port, url.EffectiveIntPort()); } @@ -703,7 +703,7 @@ {"some random input!", false}, }; - for (size_t i = 0; i < base::size(ip_tests); i++) { + for (size_t i = 0; i < std::size(ip_tests); i++) { GURL url(ip_tests[i].spec); EXPECT_EQ(ip_tests[i].expected_ip, url.HostIsIPAddress()); } @@ -728,7 +728,7 @@ {"http://]/", "]", "]"}, {"", "", ""}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { GURL url(cases[i].input); EXPECT_EQ(cases[i].expected_host, url.host()); EXPECT_EQ(cases[i].expected_plainhost, url.HostNoBrackets());
diff --git a/url/scheme_host_port_unittest.cc b/url/scheme_host_port_unittest.cc index b7804ee..f49bd59 100644 --- a/url/scheme_host_port_unittest.cc +++ b/url/scheme_host_port_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "url/scheme_host_port.h" + #include <stddef.h> #include <stdint.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -#include "url/scheme_host_port.h" #include "url/url_util.h" namespace { @@ -262,10 +262,10 @@ {"https", "b", 81}, }; - for (size_t i = 0; i < base::size(tuples); i++) { + for (size_t i = 0; i < std::size(tuples); i++) { url::SchemeHostPort current(tuples[i].scheme, tuples[i].host, tuples[i].port); - for (size_t j = i; j < base::size(tuples); j++) { + for (size_t j = i; j < std::size(tuples); j++) { url::SchemeHostPort to_compare(tuples[j].scheme, tuples[j].host, tuples[j].port); EXPECT_EQ(i < j, current < to_compare) << i << " < " << j;
diff --git a/url/url_canon_icu_unittest.cc b/url/url_canon_icu_unittest.cc index 0365dbe..eb9a8cf 100644 --- a/url/url_canon_icu_unittest.cc +++ b/url/url_canon_icu_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "url/url_canon_icu.h" + #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/logging.h" #include "base/memory/raw_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/icu/source/common/unicode/ucnv.h" #include "url/url_canon.h" -#include "url/url_canon_icu.h" #include "url/url_canon_stdstring.h" #include "url/url_test_utils.h" @@ -60,7 +60,7 @@ "hello\xa7\x41%26%231758%3B\xa6\x6eworld"}, }; - for (size_t i = 0; i < base::size(icu_cases); i++) { + for (size_t i = 0; i < std::size(icu_cases); i++) { UConvScoper conv(icu_cases[i].encoding); ASSERT_TRUE(conv.converter() != NULL); ICUCharsetConverter converter(conv.converter()); @@ -118,7 +118,7 @@ "?q=Chinese%26%2365319%3B"}, }; - for (size_t i = 0; i < base::size(query_cases); i++) { + for (size_t i = 0; i < std::size(query_cases); i++) { Component out_comp; UConvScoper conv(query_cases[i].encoding);
diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc index 23e91cf..f6ac9d4 100644 --- a/url/url_canon_unittest.cc +++ b/url/url_canon_unittest.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "url/url_canon.h" + #include <errno.h> #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/strings/string_piece.h" #include "base/strings/utf_string_conversions.h" #include "base/test/gtest_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/third_party/mozilla/url_parse.h" -#include "url/url_canon.h" #include "url/url_canon_internal.h" #include "url/url_canon_stdstring.h" #include "url/url_test_utils.h" @@ -116,7 +116,7 @@ {0x10FFFF, "\xF4\x8F\xBF\xBF"}, }; std::string out_str; - for (size_t i = 0; i < base::size(utf_cases); i++) { + for (size_t i = 0; i < std::size(utf_cases); i++) { out_str.clear(); StdStringCanonOutput output(&out_str); AppendUTF8Value(utf_cases[i].input, &output); @@ -168,7 +168,7 @@ }; std::string out_str; - for (size_t i = 0; i < base::size(utf_cases); i++) { + for (size_t i = 0; i < std::size(utf_cases); i++) { if (utf_cases[i].input8) { out_str.clear(); StdStringCanonOutput output(&out_str); @@ -239,7 +239,7 @@ std::string out_str; - for (size_t i = 0; i < base::size(scheme_cases); i++) { + for (size_t i = 0; i < std::size(scheme_cases); i++) { int url_len = static_cast<int>(strlen(scheme_cases[i].input)); Component in_comp(0, url_len); Component out_comp; @@ -504,7 +504,7 @@ // CanonicalizeHost() non-verbose. std::string out_str; - for (size_t i = 0; i < base::size(host_cases); i++) { + for (size_t i = 0; i < std::size(host_cases); i++) { // Narrow version. if (host_cases[i].input8) { int host_len = static_cast<int>(strlen(host_cases[i].input8)); @@ -552,7 +552,7 @@ } // CanonicalizeHostVerbose() - for (size_t i = 0; i < base::size(host_cases); i++) { + for (size_t i = 0; i < std::size(host_cases); i++) { // Narrow version. if (host_cases[i].input8) { int host_len = static_cast<int>(strlen(host_cases[i].input8)); @@ -869,7 +869,7 @@ {"[::1 hello]", L"[::1 hello]", "", Component(), CanonHostInfo::BROKEN, -1, ""}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { // 8-bit version. Component component(0, static_cast<int>(strlen(cases[i].input8))); @@ -995,7 +995,7 @@ {"ftp://me\\mydomain:pass@foo.com/", "", Component(0, -1), Component(0, -1), true}, }; - for (size_t i = 0; i < base::size(user_info_cases); i++) { + for (size_t i = 0; i < std::size(user_info_cases); i++) { int url_len = static_cast<int>(strlen(user_info_cases[i].input)); Parsed parsed; ParseStandardURL(user_info_cases[i].input, url_len, &parsed); @@ -1064,7 +1064,7 @@ {"80", PORT_UNSPECIFIED, ":80", Component(1, 2), true}, }; - for (size_t i = 0; i < base::size(port_cases); i++) { + for (size_t i = 0; i < std::size(port_cases); i++) { int url_len = static_cast<int>(strlen(port_cases[i].input)); Component in_comp(0, url_len); Component out_comp; @@ -1249,7 +1249,7 @@ } TEST(URLCanonTest, Path) { - DoPathTest(kCommonPathCases, base::size(kCommonPathCases), CanonicalizePath, + DoPathTest(kCommonPathCases, std::size(kCommonPathCases), CanonicalizePath, CanonicalizePath); // Manual test: embedded NULLs should be escaped and the URL should be marked @@ -1272,9 +1272,9 @@ {"", L"", "", Component(0, 0), true}, }; - DoPathTest(kCommonPathCases, base::size(kCommonPathCases), + DoPathTest(kCommonPathCases, std::size(kCommonPathCases), CanonicalizePartialPath, CanonicalizePartialPath); - DoPathTest(partial_path_cases, base::size(partial_path_cases), + DoPathTest(partial_path_cases, std::size(partial_path_cases), CanonicalizePartialPath, CanonicalizePartialPath); } @@ -1304,7 +1304,7 @@ {"q=\"asdf\"", L"q=\"asdf\"", "?q=%22asdf%22"}, }; - for (size_t i = 0; i < base::size(query_cases); i++) { + for (size_t i = 0; i < std::size(query_cases); i++) { Component out_comp; if (query_cases[i].input8) { @@ -1376,7 +1376,7 @@ {"#asdf", L"#asdf", "##asdf", Component(1, 5), true}, }; - for (size_t i = 0; i < base::size(ref_cases); i++) { + for (size_t i = 0; i < std::size(ref_cases); i++) { // 8-bit input if (ref_cases[i].input8) { int len = static_cast<int>(strlen(ref_cases[i].input8)); @@ -1491,7 +1491,7 @@ {R"(HTTP:S/5%\../>%41)", "http://s/%3EA", true}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseStandardURL(cases[i].input, url_len, &parsed); @@ -1532,7 +1532,7 @@ "filesystem://a:b@google.com:22/foo?baz@cat"}, }; - for (size_t i = 0; i < base::size(replace_cases); i++) { + for (size_t i = 0; i < std::size(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; int base_len = static_cast<int>(strlen(cur.base)); Parsed parsed; @@ -1632,7 +1632,7 @@ nullptr, nullptr, nullptr, "file:///C:/gaba?query#ref"}, }; - for (size_t i = 0; i < base::size(replace_cases); i++) { + for (size_t i = 0; i < std::size(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; SCOPED_TRACE(cur.base); int base_len = static_cast<int>(strlen(cur.base)); @@ -1701,7 +1701,7 @@ "filesystem:http://bar.com:40/t/gaba?query#ref"}, }; - for (size_t i = 0; i < base::size(replace_cases); i++) { + for (size_t i = 0; i < std::size(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; int base_len = static_cast<int>(strlen(cur.base)); Parsed parsed; @@ -1745,7 +1745,7 @@ nullptr, nullptr, "data:"}, }; - for (size_t i = 0; i < base::size(replace_cases); i++) { + for (size_t i = 0; i < std::size(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; int base_len = static_cast<int>(strlen(cur.base)); Parsed parsed; @@ -1796,7 +1796,7 @@ {"mailto:addr1", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "BLAH", "mailto:addr1"}, }; - for (size_t i = 0; i < base::size(replace_cases); i++) { + for (size_t i = 0; i < std::size(replace_cases); i++) { const ReplaceCase& cur = replace_cases[i]; int base_len = static_cast<int>(strlen(cur.base)); Parsed parsed; @@ -1909,7 +1909,7 @@ #endif // _WIN32 }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseFileURL(cases[i].input, url_len, &parsed); @@ -1958,7 +1958,7 @@ {"FilEsysteM:htTp:E=/.", "filesystem:http://e%3D//", false}, }; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); Parsed parsed; ParseFileSystemURL(cases[i].input, url_len, &parsed); @@ -1997,7 +1997,7 @@ {"javascript:\uFFFF", "javascript:%EF%BF%BD"}, }; - for (size_t i = 0; i < base::size(path_cases); i++) { + for (size_t i = 0; i < std::size(path_cases); i++) { int url_len = static_cast<int>(strlen(path_cases[i].input)); Parsed parsed; ParsePathURL(path_cases[i].input, url_len, true, &parsed); @@ -2035,7 +2035,7 @@ {"\uFFFF", L"\uFFFF", "%EF%BF%BD"}, }; - for (size_t i = 0; i < base::size(path_cases); i++) { + for (size_t i = 0; i < std::size(path_cases); i++) { // 8-bit string input std::string out_str; StdStringCanonOutput output(&out_str); @@ -2129,7 +2129,7 @@ Parsed parsed; Parsed out_parsed; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { int url_len = static_cast<int>(strlen(cases[i].input)); if (i == 0) { // The first test case purposely has a '\0' in it -- don't count it @@ -2399,7 +2399,7 @@ {"about:blank", false, false, "content://content.Provider/", true, false, true, ""}, }; - for (size_t i = 0; i < base::size(rel_cases); i++) { + for (size_t i = 0; i < std::size(rel_cases); i++) { const RelativeCase& cur_case = rel_cases[i]; Parsed parsed;
diff --git a/url/url_parse_unittest.cc b/url/url_parse_unittest.cc index c3362a2..9a8bb57 100644 --- a/url/url_parse_unittest.cc +++ b/url/url_parse_unittest.cc
@@ -2,11 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "url/third_party/mozilla/url_parse.h" - #include <stddef.h> -#include "base/cxx17_backports.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/third_party/mozilla/url_parse.h" @@ -137,7 +134,7 @@ "http://user@", "http:", }; - for (size_t i = 0; i < base::size(length_cases); i++) { + for (size_t i = 0; i < std::size(length_cases); i++) { int true_length = static_cast<int>(strlen(length_cases[i])); Parsed parsed; @@ -196,7 +193,7 @@ {"file:///c:/foo", Parsed::HOST, true, 7}, {"file:///c:/foo", Parsed::PATH, true, 7}, }; - for (size_t i = 0; i < base::size(count_cases); i++) { + for (size_t i = 0; i < std::size(count_cases); i++) { int length = static_cast<int>(strlen(count_cases[i].url)); // Simple test to distinguish file and standard URLs. @@ -314,7 +311,7 @@ // Declared outside for loop to try to catch cases in init() where we forget // to reset something that is reset by the constructor. Parsed parsed; - for (size_t i = 0; i < base::size(cases); i++) { + for (size_t i = 0; i < std::size(cases); i++) { const char* url = cases[i].input; ParseStandardURL(url, static_cast<int>(strlen(url)), &parsed); int port = ParsePort(url, parsed.port); @@ -349,7 +346,7 @@ // Declared outside for loop to try to catch cases in init() where we forget // to reset something that is reset by the constructor. Parsed parsed; - for (size_t i = 0; i < base::size(path_cases); i++) { + for (size_t i = 0; i < std::size(path_cases); i++) { const char* url = path_cases[i].input; ParsePathURL(url, static_cast<int>(strlen(url)), false, &parsed); @@ -448,7 +445,7 @@ // Declared outside for loop to try to catch cases in init() where we forget // to reset something that is reset by the construtor. Parsed parsed; - for (size_t i = 0; i < base::size(file_cases); i++) { + for (size_t i = 0; i < std::size(file_cases); i++) { const char* url = file_cases[i].input; ParseFileURL(url, static_cast<int>(strlen(url)), &parsed); int port = ParsePort(url, parsed.port); @@ -509,7 +506,7 @@ {"http://www.google.com/foo;bar;html", "foo"}, }; - for (size_t i = 0; i < base::size(extract_cases); i++) { + for (size_t i = 0; i < std::size(extract_cases); i++) { const char* url = extract_cases[i].input; int len = static_cast<int>(strlen(url)); @@ -617,7 +614,7 @@ // Declared outside for loop to try to catch cases in init() where we forget // to reset something that is reset by the constructor. Parsed parsed; - for (size_t i = 0; i < base::size(mailto_cases); ++i) { + for (size_t i = 0; i < std::size(mailto_cases); ++i) { const char* url = mailto_cases[i].input; ParseMailtoURL(url, static_cast<int>(strlen(url)), &parsed); int port = ParsePort(url, parsed.port); @@ -649,7 +646,7 @@ // Declared outside for loop to try to catch cases in init() where we forget // to reset something that is reset by the constructor. Parsed parsed; - for (size_t i = 0; i < base::size(filesystem_cases); i++) { + for (size_t i = 0; i < std::size(filesystem_cases); i++) { const FileSystemURLParseCase* parsecase = &filesystem_cases[i]; const char* url = parsecase->input; ParseFileSystemURL(url, static_cast<int>(strlen(url)), &parsed);
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc index a71c7951..a394e74 100644 --- a/url/url_util_unittest.cc +++ b/url/url_util_unittest.cc
@@ -6,7 +6,6 @@ #include <stddef.h> -#include "base/cxx17_backports.h" #include "base/strings/string_piece.h" #include "build/build_config.h" #include "testing/gtest/include/gtest/gtest-message.h" @@ -251,7 +250,7 @@ {"%e4%bd%a0%e5%a5%bd", "\xe4\xbd\xa0\xe5\xa5\xbd"}, }; - for (size_t i = 0; i < base::size(decode_cases); i++) { + for (size_t i = 0; i < std::size(decode_cases); i++) { const char* input = decode_cases[i].input; RawCanonOutputT<char16_t> output; DecodeURLEscapeSequences(input, strlen(input), @@ -333,7 +332,7 @@ "pqrstuvwxyz%7B%7C%7D~%7F"}, }; - for (size_t i = 0; i < base::size(encode_cases); i++) { + for (size_t i = 0; i < std::size(encode_cases); i++) { const char* input = encode_cases[i].input; RawCanonOutputT<char> buffer; EncodeURIComponent(input, strlen(input), &buffer); @@ -410,7 +409,7 @@ // adding the requested dot doesn't seem wrong either. {"aaa://a\\", "aaa:.", true, "aaa://a\\."}}; - for (size_t i = 0; i < base::size(resolve_non_standard_cases); i++) { + for (size_t i = 0; i < std::size(resolve_non_standard_cases); i++) { const ResolveRelativeCase& test_data = resolve_non_standard_cases[i]; Parsed base_parsed; ParsePathURL(test_data.base, strlen(test_data.base), false, &base_parsed);
diff --git a/weblayer/browser/page_specific_content_settings_delegate.cc b/weblayer/browser/page_specific_content_settings_delegate.cc index d57cc76..eadfe91 100644 --- a/weblayer/browser/page_specific_content_settings_delegate.cc +++ b/weblayer/browser/page_specific_content_settings_delegate.cc
@@ -10,6 +10,8 @@ #include "components/permissions/permission_decision_auto_blocker.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h" +#include "ipc/ipc_channel_proxy.h" +#include "mojo/public/cpp/bindings/associated_remote.h" #include "weblayer/browser/browser_context_impl.h" #include "weblayer/browser/content_settings_manager_delegate.h" #include "weblayer/browser/host_content_settings_map_factory.h"