diff --git a/DEPS b/DEPS index 9f0aa209..a3c222c 100644 --- a/DEPS +++ b/DEPS
@@ -237,7 +237,7 @@ # # CQ_INCLUDE_TRYBOTS=luci.chrome.try:lacros-amd64-generic-chrome-skylab # CQ_INCLUDE_TRYBOTS=luci.chrome.try:lacros-arm-generic-chrome-skylab - 'lacros_sdk_version': '15465.0.0', + 'lacros_sdk_version': '15489.0.0', # Generate location tag metadata to include in tests result data uploaded # to ResultDB. This isn't needed on some configs and the tool that generates @@ -300,19 +300,19 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'src_internal_revision': 'c71002ce45140bc59f297a629123968b7368dc5b', + 'src_internal_revision': 'fcc909fa8bd2865580b4372d3741017cf48d4e83', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'e8a71c76b88f44e08806d7661d474718a81ad5dd', + 'skia_revision': '4065e92bf577474b948d4f6affeb924edcc3a559', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '14e2ac94ae54e70c139e4f67f4bd53c67d47a6e9', + 'v8_revision': '4925beaf82f3738cf897814fb8b835820906579d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '6e40ce0071228c189506b986b6702b95ef0c2ac0', + 'angle_revision': '721c15efaa705ba6b377ffc4d44ade8717331023', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -320,7 +320,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. - 'pdfium_revision': 'd00660e5cfc65d6c772a334f1e4e98fc19f5461a', + 'pdfium_revision': 'c261a6cb2c93357bcb8cd77a69282853d4efa74b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling BoringSSL # and whatever else without interference from each other. @@ -375,7 +375,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'db0de40862fdaa08759fcb5516367c3b67bdc05c', + 'catapult_revision': 'dc627ec37b5e130481ac0f51703e5d2ccf87f09a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling CrossBench # and whatever else without interference from each other. @@ -431,7 +431,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '77ef59593a387a00da6deee0c86fe2a6b269f4e1', + 'dawn_revision': 'cff18f3ec89141714c1e93ab325a290f21b7bc3e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -1001,7 +1001,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'iYjHXTBxKD0S9CuLGLN6QESvNkURfGdqURQSUDrnai0C', + 'version': 'Bn7l0JHK5-lBSYIBMjQ8Qf1TcxvBRHvZjk9i9WPKFbgC', }, ], 'condition': 'checkout_android', @@ -1704,7 +1704,7 @@ Var('chromium_git') + '/external/github.com/cisco/openh264' + '@' + '09a4f3ec842a8932341b195c5b01e141c8a16eb7', 'src/third_party/openscreen/src': - Var('chromium_git') + '/openscreen' + '@' + 'ff6c5c90428d0c747d9bac2350aef3edb4e5f26c', + Var('chromium_git') + '/openscreen' + '@' + '73c9e2c3c0b89b1997aaa7b507dcfa9c9d3e42ca', 'src/third_party/openxr/src': { 'url': Var('chromium_git') + '/external/github.com/KhronosGroup/OpenXR-SDK' + '@' + '58a00cf85c39ad5ec4dc43a769624e420c06179a', @@ -1900,7 +1900,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '480edec387e8cd5bf5934680050c59a3f7a01438', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '1e04d61f21627f227d7b4d515bd1bfe8e704e9d3', + Var('webrtc_git') + '/src.git' + '@' + 'e00a12fb30fc492f833bebc31339d48c5b5f3c6d', # Wuffs' canonical repository is at github.com/google/wuffs, but we use # Skia's mirror of Wuffs, the same as in upstream Skia's DEPS file. @@ -1957,7 +1957,7 @@ 'packages': [ { 'package': 'skia/tools/goldctl/windows-amd64', - 'version': 'wveYksSfL51dPfdRZ5474IFmCMkL8gg6ygZxxPdBezAC', + 'version': 'VWg6iFKkt4rAdHxGoJNLVlgsRlbT-Woz_41P6cFybmYC', }, ], 'dep_type': 'cipd', @@ -2014,7 +2014,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/eche_app/app', - 'version': 'f1hXXbK55nXgnpNLOinFIhUFhDbbIDKWvhOUff0vO2gC', + 'version': 'k7xonW_WNZwSrxN7tuRU321LUBL--Y0vy6PIthiYv88C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -4194,7 +4194,7 @@ 'src/ios_internal': { 'url': Var('chrome_git') + '/chrome/ios_internal.git' + '@' + - 'c0b142181922bd9f626aeec47b854af0ec97ce5f', + '9e28a494e727a202e69022979c8827a3b52b5db9', 'condition': 'checkout_ios and checkout_src_internal', },
diff --git a/android_webview/browser/tracing/aw_background_tracing_metrics_provider.cc b/android_webview/browser/tracing/aw_background_tracing_metrics_provider.cc index a2a804e..dfa0b14 100644 --- a/android_webview/browser/tracing/aw_background_tracing_metrics_provider.cc +++ b/android_webview/browser/tracing/aw_background_tracing_metrics_provider.cc
@@ -6,6 +6,7 @@ #include "android_webview/browser/metrics/aw_metrics_service_client.h" #include "android_webview/browser/tracing/background_tracing_field_trial.h" +#include "base/metrics/histogram_functions.h" #include "base/strings/string_piece.h" #include "base/task/thread_pool.h" #include "components/metrics/field_trials_provider.h" @@ -17,25 +18,21 @@ namespace { -// Compresses |serialized_trace| and returns the result. If the compressed trace -// does not fit into the upload limit or if there are zlib errors, returns -// nullopt. -// TODO(b/247824653): consider truncating the trace so that we have at least -// some data. -absl::optional<std::string> Compress(std::string&& serialized_trace) { - std::string deflated; - deflated.resize(kCompressedUploadLimitBytes); - size_t compressed_size; - - if (compression::GzipCompress(serialized_trace, - reinterpret_cast<char*>(deflated.data()), - kCompressedUploadLimitBytes, &compressed_size, - /* malloc_fn= */ nullptr, - /* free_fn= */ nullptr)) { - deflated.resize(compressed_size); - return deflated; - } else { - return absl::nullopt; +void OnProvideEmbedderMetrics(base::OnceCallback<void(bool)> done_callback, + bool success) { + // TODO(crbug/1052796): Remove the UMA timer code, which is currently used to + // determine if it is worth to finalize independent logs in the background + // by measuring the time it takes to execute the callback + // MetricsService::PrepareProviderMetricsLogDone(). + base::TimeTicks start_time = base::TimeTicks::Now(); + std::move(done_callback).Run(success); + if (success) { + // We don't use the SCOPED_UMA_HISTOGRAM_TIMER macro because we want to + // measure the time it takes to finalize an independent log, and that only + // happens when |success| is true. + base::UmaHistogramTimes( + "UMA.IndependentLog.AwBackgroundTracingMetricsProvider.FinalizeTime", + base::TimeTicks::Now() - start_time); } } @@ -60,37 +57,46 @@ } void AwBackgroundTracingMetricsProvider::ProvideEmbedderMetrics( - metrics::ChromeUserMetricsExtension& uma_proto, + metrics::ChromeUserMetricsExtension* uma_proto, std::string&& serialized_trace, - metrics::TraceLog& log, + metrics::TraceLog* log, base::HistogramSnapshotManager* snapshot_manager, base::OnceCallback<void(bool)> done_callback) { base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::TaskPriority::BEST_EFFORT}, - base::BindOnce(&Compress, std::move(serialized_trace)), - base::BindOnce(&AwBackgroundTracingMetricsProvider::OnTraceCompressed, - weak_factory_.GetWeakPtr(), std::ref(uma_proto), - std::ref(log), std::move(done_callback))); + base::BindOnce(&AwBackgroundTracingMetricsProvider::Compress, + std::move(serialized_trace), uma_proto, log), + base::BindOnce(&OnProvideEmbedderMetrics, std::move(done_callback))); } -void AwBackgroundTracingMetricsProvider::OnTraceCompressed( - metrics::ChromeUserMetricsExtension& uma_proto, - metrics::TraceLog& log, - base::OnceCallback<void(bool)> done_callback, - absl::optional<std::string> compressed_trace) { - if (!compressed_trace) { - std::move(done_callback).Run(false); - return; +// static +bool AwBackgroundTracingMetricsProvider::Compress( + std::string&& serialized_trace, + metrics::ChromeUserMetricsExtension* uma_proto, + metrics::TraceLog* log) { + std::string deflated; + deflated.resize(kCompressedUploadLimitBytes); + size_t compressed_size; + + if (!compression::GzipCompress(serialized_trace, + reinterpret_cast<char*>(deflated.data()), + kCompressedUploadLimitBytes, &compressed_size, + /* malloc_fn= */ nullptr, + /* free_fn= */ nullptr)) { + return false; } - SetTrace(log, std::move(*compressed_trace)); - log.set_compression_type(metrics::TraceLog::COMPRESSION_TYPE_ZLIB); + deflated.resize(compressed_size); + + SetTrace(log, std::move(deflated)); + log->set_compression_type(metrics::TraceLog::COMPRESSION_TYPE_ZLIB); // Remove the package name according to the privacy requirements. // See go/public-webview-trace-collection. - auto* system_profile = uma_proto.mutable_system_profile(); + auto* system_profile = uma_proto->mutable_system_profile(); system_profile->clear_app_package_name(); - std::move(done_callback).Run(true); + + return true; } } // namespace tracing
diff --git a/android_webview/browser/tracing/aw_background_tracing_metrics_provider.h b/android_webview/browser/tracing/aw_background_tracing_metrics_provider.h index d69b7d58..c08ef82 100644 --- a/android_webview/browser/tracing/aw_background_tracing_metrics_provider.h +++ b/android_webview/browser/tracing/aw_background_tracing_metrics_provider.h
@@ -34,16 +34,20 @@ private: // BackgroundTracingMetricsProvider: void ProvideEmbedderMetrics( - metrics::ChromeUserMetricsExtension& uma_proto, + metrics::ChromeUserMetricsExtension* uma_proto, std::string&& serialized_trace, - metrics::TraceLog& log, + metrics::TraceLog* log, base::HistogramSnapshotManager* snapshot_manager, base::OnceCallback<void(bool)> done_callback) override; - void OnTraceCompressed(metrics::ChromeUserMetricsExtension& uma_proto, - metrics::TraceLog& log, - base::OnceCallback<void(bool)> done_callback, - absl::optional<std::string> serialized_trace); + // Compresses |serialized_trace|. If the compressed trace does not fit into + // the upload limit or if there are zlib errors, returns false. Otherwise, + // writes the result to |log| and returns true. + // TODO(b/247824653): consider truncating the trace so that we have at least + // some data. + static bool Compress(std::string&& serialized_trace, + metrics::ChromeUserMetricsExtension* uma_proto, + metrics::TraceLog* log); base::WeakPtrFactory<AwBackgroundTracingMetricsProvider> weak_factory_{this}; };
diff --git a/android_webview/js_sandbox/BUILD.gn b/android_webview/js_sandbox/BUILD.gn index 100a493..81bf1f0 100644 --- a/android_webview/js_sandbox/BUILD.gn +++ b/android_webview/js_sandbox/BUILD.gn
@@ -13,6 +13,7 @@ } android_library("js_sandbox_service_java") { + srcjar_deps = [ ":js_sandbox_jni_headers" ] sources = [ "java/src/org/chromium/android_webview/js_sandbox/service/JsSandboxIsolate.java", "java/src/org/chromium/android_webview/js_sandbox/service/JsSandboxIsolateCallback.java", @@ -30,6 +31,4 @@ "//third_party/androidx_javascriptengine:javascriptengine_common_java", "//third_party/androidx_javascriptengine:js_sandbox_aidl_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] }
diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/NetworkFetcherTask.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/NetworkFetcherTask.java index 066e7c9..a65d66d 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/NetworkFetcherTask.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/nonembedded/NetworkFetcherTask.java
@@ -222,7 +222,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { void callProgressCallback(long weakPtr, long taskRunner, long current); void callResponseStartedCallback(
diff --git a/android_webview/test/embedded_test_server/BUILD.gn b/android_webview/test/embedded_test_server/BUILD.gn index 912e812..6549905 100644 --- a/android_webview/test/embedded_test_server/BUILD.gn +++ b/android_webview/test/embedded_test_server/BUILD.gn
@@ -8,6 +8,7 @@ android_library("aw_net_java_test_support") { testonly = true + srcjar_deps = [ ":aw_net_jni_headers" ] sources = [ "java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java", "java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java", @@ -21,7 +22,6 @@ "//net/android:net_java_test_support", "//net/android:net_java_test_support_provider", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("aw_net_jni_headers") {
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 37b5857..312a299 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2032,6 +2032,8 @@ "system/unified/buttons.h", "system/unified/camera_mic_tray_item_view.cc", "system/unified/camera_mic_tray_item_view.h", + "system/unified/classroom_bubble_view.cc", + "system/unified/classroom_bubble_view.h", "system/unified/collapse_button.cc", "system/unified/collapse_button.h", "system/unified/current_locale_view.cc", @@ -2057,6 +2059,8 @@ "system/unified/glanceable_tray_bubble.h", "system/unified/glanceable_tray_bubble_view.cc", "system/unified/glanceable_tray_bubble_view.h", + "system/unified/glanceable_tray_child_bubble.cc", + "system/unified/glanceable_tray_child_bubble.h", "system/unified/ime_mode_view.cc", "system/unified/ime_mode_view.h", "system/unified/managed_device_tray_item_view.cc",
diff --git a/ash/components/arc/arc_features.cc b/ash/components/arc/arc_features.cc index e5d7741..0e7e3497 100644 --- a/ash/components/arc/arc_features.cc +++ b/ash/components/arc/arc_features.cc
@@ -30,10 +30,6 @@ "ArcDocumentsProviderUnknownSize", base::FEATURE_DISABLED_BY_DEFAULT); -// Controls whether an Android VPN (ArcHostVpn) should be started when a host -// VPN is started. -BASE_FEATURE(kEnableArcHostVpn, "ArcHostVpn", base::FEATURE_ENABLED_BY_DEFAULT); - // Controls whether we automatically send ARCVM into Doze mode // when it is mostly idle - even if Chrome is still active. BASE_FEATURE(kEnableArcIdleManager,
diff --git a/ash/components/arc/arc_features.h b/ash/components/arc/arc_features.h index b5d741b..0625eb2 100644 --- a/ash/components/arc/arc_features.h +++ b/ash/components/arc/arc_features.h
@@ -17,7 +17,6 @@ BASE_DECLARE_FEATURE(kBootCompletedBroadcastFeature); BASE_DECLARE_FEATURE(kCustomTabsExperimentFeature); BASE_DECLARE_FEATURE(kDocumentsProviderUnknownSizeFeature); -BASE_DECLARE_FEATURE(kEnableArcHostVpn); BASE_DECLARE_FEATURE(kEnableArcIdleManager); extern const base::FeatureParam<bool> kEnableArcIdleManagerIgnoreBatteryForPLT; BASE_DECLARE_FEATURE(kEnableArcNearbyShareFuseBox);
diff --git a/ash/components/arc/mojom/net.mojom b/ash/components/arc/mojom/net.mojom index 1c73346..03a61af1 100644 --- a/ash/components/arc/mojom/net.mojom +++ b/ash/components/arc/mojom/net.mojom
@@ -679,12 +679,8 @@ enum Flag { [Default] UNKNOWN = 0, - // Chrome Finch flag kEnableArcHostVpn. If true, ARC should start the - // ArcHostVpn service when a builtin VPN client is started. This flag value - // can be toggled at any time, but ARC will only use the latest value when a - // builtin VPN network is detected and sent to ARC as part of an - // ActiveNetworksChanged call. - ENABLE_ARC_HOST_VPN = 1, + // Launched and deprecated, b/257889534 + DEPRECATED_ENABLE_ARC_HOST_VPN = 1, }; // The band to start an AP on.
diff --git a/ash/components/arc/net/arc_net_host_impl.cc b/ash/components/arc/net/arc_net_host_impl.cc index 2c7d9734..8a44fcb 100644 --- a/ash/components/arc/net/arc_net_host_impl.cc +++ b/ash/components/arc/net/arc_net_host_impl.cc
@@ -327,8 +327,8 @@ if (!net_instance) return; - net_instance->SetUpFlag(arc::mojom::Flag::ENABLE_ARC_HOST_VPN, - base::FeatureList::IsEnabled(arc::kEnableArcHostVpn)); + // arc::mojom::Flag::DEPRECATE_ENABLE_ARC_HOST_VPN no longer passed to ARC, + // see b/257889534 } void ArcNetHostImpl::OnConnectionClosed() {
diff --git a/ash/components/arc/net/arc_net_host_impl.h b/ash/components/arc/net/arc_net_host_impl.h index 15ac0d94..660aae4 100644 --- a/ash/components/arc/net/arc_net_host_impl.h +++ b/ash/components/arc/net/arc_net_host_impl.h
@@ -232,7 +232,10 @@ // doing BFS over the device's root windows and its children. aura::Window* GetAppWindow(const std::string& package_name); - // Pass any Chrome flags into ARC. + // Pass any Chrome flags into ARC. This function may be empty depending on the + // current state of flags, i.e. if all Chrome->ARC flags have been launched + // and cleaned up, this method may not do anything. But we keep this around to + // keep the mojo file stable and decrease churn. void SetUpFlags(); void CreateNetworkSuccessCallback(
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index 0fe5d55..8beeb1780 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -972,6 +972,10 @@ // for testing the policy behaviour on the DUT. const char kUpdateRequiredAueForTest[] = "aue-reached-for-update-required-test"; +// Use the fake FakeCrasAudioClient to handle system audio controls. +const char kUseFakeCrasAudioClientForDBus[] = + "use-fake-cras-audio-client-for-dbus"; + // Flag that stored MyFiles folder inside the user data directory. // $HOME/Downloads is used as MyFiles folder for ease access to local files for // debugging when running on Linux. By setting this flag, <cryptohome>/MyFiles @@ -1144,5 +1148,10 @@ kCameraEffectsSupportedByHardware); } +bool UseFakeCrasAudioClientForDBus() { + return base::CommandLine::ForCurrentProcess()->HasSwitch( + kUseFakeCrasAudioClientForDBus); +} + } // namespace switches } // namespace ash
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 3460e59..d7862d9 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -326,6 +326,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUnfilteredBluetoothDevices[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUpdateRequiredAueForTest[]; COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kUseFakeCrasAudioClientForDBus[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kUseMyFilesInUserDataDirForTesting[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kWebUiDataSourcePathForTesting[]; @@ -433,6 +435,9 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsCameraEffectsSupportedByHardware(); +COMPONENT_EXPORT(ASH_CONSTANTS) +bool UseFakeCrasAudioClientForDBus(); + } // namespace ash::switches #endif // ASH_CONSTANTS_ASH_SWITCHES_H_
diff --git a/ash/public/cpp/external_arc/overlay/OWNERS b/ash/public/cpp/external_arc/overlay/OWNERS index 14ba395..203e15a4 100644 --- a/ash/public/cpp/external_arc/overlay/OWNERS +++ b/ash/public/cpp/external_arc/overlay/OWNERS
@@ -1,3 +1 @@ file://ash/components/arc/OWNERS - -lpique@chromium.org
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h index e7e3175..c6fb35cb 100644 --- a/ash/system/tray/tray_constants.h +++ b/ash/system/tray/tray_constants.h
@@ -34,7 +34,7 @@ // Horizontal margins between the glanceable bubble and individual glanceables. constexpr int kGlanceablesLeftRightMargin = 25; constexpr int kGlanceablesVerticalMargin = 10; -constexpr int kTasksGlanceableMinHeight = 200; +constexpr int kGlanceableMinHeight = 200; constexpr int kTrayPopupAutoCloseDelayInSeconds = 2; constexpr int kTrayPopupAutoCloseDelayInSecondsWithSpokenFeedback = 5;
diff --git a/ash/system/unified/classroom_bubble_view.cc b/ash/system/unified/classroom_bubble_view.cc new file mode 100644 index 0000000..e3ff9cd --- /dev/null +++ b/ash/system/unified/classroom_bubble_view.cc
@@ -0,0 +1,32 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/unified/classroom_bubble_view.h" + +#include "ash/public/cpp/style/color_provider.h" +#include "ash/style/ash_color_id.h" +#include "chromeos/constants/chromeos_features.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/chromeos/styles/cros_tokens_color_mappings.h" +#include "ui/compositor/layer.h" +#include "ui/views/background.h" +#include "ui/views/controls/label.h" +#include "ui/views/highlight_border.h" + +namespace ash { + +// views::View: +void ClassroomBubbleView::GetAccessibleNodeData(ui::AXNodeData* node_data) { + // TODO(b:283370907): Implement accessibility behavior. + if (!GetVisible()) { + return; + } + node_data->role = ax::mojom::Role::kListBox; + node_data->SetName(u"Glanceables Bubble Classroom View Accessible Name"); +} + +BEGIN_METADATA(ClassroomBubbleView, views::View) +END_METADATA + +} // namespace ash
diff --git a/ash/system/unified/classroom_bubble_view.h b/ash/system/unified/classroom_bubble_view.h new file mode 100644 index 0000000..819fc6f --- /dev/null +++ b/ash/system/unified/classroom_bubble_view.h
@@ -0,0 +1,30 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SYSTEM_UNIFIED_CLASSROOM_BUBBLE_VIEW_H_ +#define ASH_SYSTEM_UNIFIED_CLASSROOM_BUBBLE_VIEW_H_ + +#include "ash/ash_export.h" +#include "ash/system/unified/glanceable_tray_child_bubble.h" +#include "ui/base/metadata/metadata_header_macros.h" + +namespace ash { + +class ASH_EXPORT ClassroomBubbleView : public GlanceableTrayChildBubble { + public: + METADATA_HEADER(ClassroomBubbleView); + + // TODO(b:283370907): Add classroom glanceable contents. + ClassroomBubbleView() = default; + ClassroomBubbleView(const ClassroomBubbleView&) = delete; + ClassroomBubbleView& operator-(const ClassroomBubbleView&) = delete; + ~ClassroomBubbleView() override = default; + + // views::View: + void GetAccessibleNodeData(ui::AXNodeData* node_data) override; +}; + +} // namespace ash + +#endif // ASH_SYSTEM_UNIFIED_CLASSROOM_BUBBLE_VIEW_H_
diff --git a/ash/system/unified/glanceable_tray_bubble.cc b/ash/system/unified/glanceable_tray_bubble.cc index af1750c..b2fac94 100644 --- a/ash/system/unified/glanceable_tray_bubble.cc +++ b/ash/system/unified/glanceable_tray_bubble.cc
@@ -18,6 +18,9 @@ CreateInitParamsForTrayBubble(tray, /*anchor_to_shelf_corner=*/true); // TODO(b:277268122): Update with glanceable spec. init_params.preferred_width = kRevampedTrayMenuWidth; + init_params.transparent = true; + init_params.has_shadow = false; + init_params.translucent = false; bubble_view_ = new GlanceableTrayBubbleView(init_params, tray_->shelf());
diff --git a/ash/system/unified/glanceable_tray_bubble_view.cc b/ash/system/unified/glanceable_tray_bubble_view.cc index e0c6e46..060e5b05 100644 --- a/ash/system/unified/glanceable_tray_bubble_view.cc +++ b/ash/system/unified/glanceable_tray_bubble_view.cc
@@ -8,6 +8,7 @@ #include "ash/system/tray/tray_bubble_view.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_utils.h" +#include "ash/system/unified/classroom_bubble_view.h" #include "ash/system/unified/tasks_bubble_view.h" #include "ui/views/controls/label.h" @@ -24,6 +25,13 @@ tasks_bubble_view_ = AddChildView(std::make_unique<TasksBubbleView>()); } + // TODO(b:283370562): only add teacher/student classroom glanceables when + // the user is enrolled in courses. + if (!classroom_bubble_view_) { + classroom_bubble_view_ = + AddChildView(std::make_unique<ClassroomBubbleView>()); + } + int max_height = CalculateMaxTrayBubbleHeight(shelf_->GetWindow()); SetMaxHeight(max_height); ChangeAnchorAlignment(shelf_->alignment()); @@ -36,7 +44,7 @@ gfx::Size GlanceableTrayBubbleView::CalculatePreferredSize() const { // TODO(b:277268122): Scale height based on task_items_list_view_ contents. - return gfx::Size(kRevampedTrayMenuWidth, kTasksGlanceableMinHeight); + return gfx::Size(kRevampedTrayMenuWidth, kGlanceableMinHeight); } } // namespace ash
diff --git a/ash/system/unified/glanceable_tray_bubble_view.h b/ash/system/unified/glanceable_tray_bubble_view.h index feedda2..1b823be4 100644 --- a/ash/system/unified/glanceable_tray_bubble_view.h +++ b/ash/system/unified/glanceable_tray_bubble_view.h
@@ -12,9 +12,12 @@ } namespace ash { +class ClassroomBubbleView; class TasksBubbleView; class Shelf; +// The bubble associated with the `GlanceableTrayBubble`. This bubble is the +// container for the child `tasks` and `classroom` glanceables. class GlanceableTrayBubbleView : public TrayBubbleView { public: GlanceableTrayBubbleView(const InitParams& init_params, Shelf* shelf); @@ -39,8 +42,12 @@ // TODO(b:277268122): Remove and replace with actual glanceable content. raw_ptr<views::Label, ExperimentalAsh> title_label_ = nullptr; - // Bubble view for the tasks glanceable. Owned by bubble_view_. + // Child bubble view for the tasks glanceable. Owned by bubble_view_. raw_ptr<TasksBubbleView, ExperimentalAsh> tasks_bubble_view_ = nullptr; + + // Child bubble view for the classrooms glanceable. Owned by bubble_view_. + raw_ptr<ClassroomBubbleView, ExperimentalAsh> classroom_bubble_view_ = + nullptr; }; } // namespace ash
diff --git a/ash/system/unified/glanceable_tray_child_bubble.cc b/ash/system/unified/glanceable_tray_child_bubble.cc new file mode 100644 index 0000000..ad49d618b --- /dev/null +++ b/ash/system/unified/glanceable_tray_child_bubble.cc
@@ -0,0 +1,46 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/system/unified/glanceable_tray_child_bubble.h" + +#include "ash/public/cpp/style/color_provider.h" +#include "ash/style/ash_color_id.h" +#include "chromeos/constants/chromeos_features.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/chromeos/styles/cros_tokens_color_mappings.h" +#include "ui/compositor/layer.h" +#include "ui/views/background.h" +#include "ui/views/controls/label.h" +#include "ui/views/highlight_border.h" + +namespace ash { + +namespace { +constexpr int bubble_corner_radius = 24; +} + +GlanceableTrayChildBubble::GlanceableTrayChildBubble() { + SetPaintToLayer(); + layer()->SetFillsBoundsOpaquely(false); + layer()->SetRoundedCornerRadius( + gfx::RoundedCornersF{static_cast<float>(bubble_corner_radius)}); + layer()->SetIsFastRoundedCorner(true); + layer()->SetBackgroundBlur(ColorProvider::kBackgroundBlurSigma); + + SetBackground(views::CreateThemedRoundedRectBackground( + chromeos::features::IsJellyEnabled() + ? static_cast<ui::ColorId>(cros_tokens::kCrosSysSystemBaseElevated) + : kColorAshShieldAndBase80, + bubble_corner_radius)); + SetBorder(std::make_unique<views::HighlightBorder>( + bubble_corner_radius, + chromeos::features::IsJellyrollEnabled() + ? views::HighlightBorder::Type::kHighlightBorderOnShadow + : views::HighlightBorder::Type::kHighlightBorder1)); +} + +BEGIN_METADATA(GlanceableTrayChildBubble, views::View) +END_METADATA + +} // namespace ash
diff --git a/ash/system/unified/glanceable_tray_child_bubble.h b/ash/system/unified/glanceable_tray_child_bubble.h new file mode 100644 index 0000000..8eacb12b --- /dev/null +++ b/ash/system/unified/glanceable_tray_child_bubble.h
@@ -0,0 +1,28 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SYSTEM_UNIFIED_GLANCEABLE_TRAY_CHILD_BUBBLE_H_ +#define ASH_SYSTEM_UNIFIED_GLANCEABLE_TRAY_CHILD_BUBBLE_H_ + +#include "ash/ash_export.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/views/layout/flex_layout_view.h" + +namespace ash { + +// Child bubble of the `GlanceableTrayBubbleView`. +class ASH_EXPORT GlanceableTrayChildBubble : public views::FlexLayoutView { + public: + METADATA_HEADER(GlanceableTrayChildBubble); + + GlanceableTrayChildBubble(); + GlanceableTrayChildBubble(const GlanceableTrayChildBubble&) = delete; + GlanceableTrayChildBubble& operator-(const GlanceableTrayChildBubble&) = + delete; + ~GlanceableTrayChildBubble() override = default; +}; + +} // namespace ash + +#endif // ASH_SYSTEM_UNIFIED_GLANCEABLE_TRAY_CHILD_BUBBLE_H_
diff --git a/ash/system/unified/tasks_bubble_view.cc b/ash/system/unified/tasks_bubble_view.cc index 18c0d48..d5cf567 100644 --- a/ash/system/unified/tasks_bubble_view.cc +++ b/ash/system/unified/tasks_bubble_view.cc
@@ -51,7 +51,7 @@ gfx::Size TasksBubbleView::CalculatePreferredSize() const { // TODO(b:277268122): Scale height based on task_items_list_view_ contents. return gfx::Size(kRevampedTrayMenuWidth - 2 * kGlanceablesLeftRightMargin, - kTasksGlanceableMinHeight - 2 * kGlanceablesVerticalMargin); + kGlanceableMinHeight - 2 * kGlanceablesVerticalMargin); } void TasksBubbleView::InitViews(ui::ListModel<GlanceablesTaskList>* task_list) {
diff --git a/ash/system/unified/tasks_bubble_view.h b/ash/system/unified/tasks_bubble_view.h index 1a31a73..9a238a80 100644 --- a/ash/system/unified/tasks_bubble_view.h +++ b/ash/system/unified/tasks_bubble_view.h
@@ -7,6 +7,7 @@ #include "ash/ash_export.h" #include "ash/glanceables/tasks/glanceables_tasks_types.h" +#include "ash/system/unified/glanceable_tray_child_bubble.h" #include "base/memory/raw_ptr.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/base/models/list_model.h" @@ -52,7 +53,7 @@ // | +----------------------------------------------------------- + | // +----------------------------------------------------------------+ -class ASH_EXPORT TasksBubbleView : public views::FlexLayoutView { +class ASH_EXPORT TasksBubbleView : public GlanceableTrayChildBubble { public: METADATA_HEADER(TasksBubbleView);
diff --git a/ash/user_education/user_education_help_bubble_controller.cc b/ash/user_education/user_education_help_bubble_controller.cc index 9e98f7f0..434effa9 100644 --- a/ash/user_education/user_education_help_bubble_controller.cc +++ b/ash/user_education/user_education_help_bubble_controller.cc
@@ -113,4 +113,38 @@ return absl::nullopt; } +base::CallbackListSubscription +UserEducationHelpBubbleController::AddHelpBubbleAnchorBoundsChangedCallback( + base::RepeatingClosure callback) { + return help_bubble_anchor_bounds_changed_subscribers_.Add( + std::move(callback)); +} + +base::CallbackListSubscription +UserEducationHelpBubbleController::AddHelpBubbleClosedCallback( + base::RepeatingClosure callback) { + return help_bubble_closed_subscribers_.Add(std::move(callback)); +} + +base::CallbackListSubscription +UserEducationHelpBubbleController::AddHelpBubbleShownCallback( + base::RepeatingClosure callback) { + return help_bubble_shown_subscribers_.Add(std::move(callback)); +} + +void UserEducationHelpBubbleController::NotifyHelpBubbleAnchorBoundsChanged( + base::PassKey<HelpBubbleViewAsh>) { + help_bubble_anchor_bounds_changed_subscribers_.Notify(); +} + +void UserEducationHelpBubbleController::NotifyHelpBubbleClosed( + base::PassKey<HelpBubbleViewAsh>) { + help_bubble_closed_subscribers_.Notify(); +} + +void UserEducationHelpBubbleController::NotifyHelpBubbleShown( + base::PassKey<HelpBubbleViewAsh>) { + help_bubble_shown_subscribers_.Notify(); +} + } // namespace ash
diff --git a/ash/user_education/user_education_help_bubble_controller.h b/ash/user_education/user_education_help_bubble_controller.h index 1691a5f..ba3d206c 100644 --- a/ash/user_education/user_education_help_bubble_controller.h +++ b/ash/user_education/user_education_help_bubble_controller.h
@@ -11,6 +11,7 @@ #include "base/callback_list.h" #include "base/functional/callback_helpers.h" #include "base/memory/raw_ptr.h" +#include "base/types/pass_key.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ui { @@ -25,6 +26,7 @@ namespace ash { +class HelpBubbleViewAsh; class UserEducationDelegate; enum class HelpBubbleId; @@ -65,6 +67,30 @@ ui::ElementIdentifier element_id, ui::ElementContext element_context) const; + // Adds a `callback` to be invoked whenever a help bubble's anchor bounds + // change until the returned subscription is destroyed. + [[nodiscard]] base::CallbackListSubscription + AddHelpBubbleAnchorBoundsChangedCallback(base::RepeatingClosure callback); + + // Adds a `callback` to be invoked whenever a help bubble is closed until the + // returned subscription is destroyed. + [[nodiscard]] base::CallbackListSubscription AddHelpBubbleClosedCallback( + base::RepeatingClosure callback); + + // Adds a `callback` to be invoked whenever a help bubble is shown until the + // returned subscription is destroyed. + [[nodiscard]] base::CallbackListSubscription AddHelpBubbleShownCallback( + base::RepeatingClosure callback); + + // Invoked by `HelpBubbleViewAsh` when a help bubble's anchor bounds change. + void NotifyHelpBubbleAnchorBoundsChanged(base::PassKey<HelpBubbleViewAsh>); + + // Invoked by `HelpBubbleViewAsh` when a help bubble is closed. + void NotifyHelpBubbleClosed(base::PassKey<HelpBubbleViewAsh>); + + // Invoked by `HelpBubbleViewAsh` when a help bubble is shown. + void NotifyHelpBubbleShown(base::PassKey<HelpBubbleViewAsh>); + private: // The delegate owned by the `UserEducationController` which facilitates // communication between Ash and user education services in the browser. @@ -74,6 +100,14 @@ // notified when it closes. Once closed, help bubble related memory is freed. std::unique_ptr<user_education::HelpBubble> help_bubble_; base::CallbackListSubscription help_bubble_close_subscription_; + + // Lists of subscribers to notify for the following events: + // (a) Help bubble anchor bounds changed + // (b) Help bubble closed + // (c) Help bubble shown + base::RepeatingClosureList help_bubble_anchor_bounds_changed_subscribers_; + base::RepeatingClosureList help_bubble_closed_subscribers_; + base::RepeatingClosureList help_bubble_shown_subscribers_; }; } // namespace ash
diff --git a/ash/user_education/user_education_help_bubble_controller_unittest.cc b/ash/user_education/user_education_help_bubble_controller_unittest.cc index 62360c4..7d19ecf 100644 --- a/ash/user_education/user_education_help_bubble_controller_unittest.cc +++ b/ash/user_education/user_education_help_bubble_controller_unittest.cc
@@ -5,6 +5,7 @@ #include "ash/user_education/user_education_help_bubble_controller.h" #include <memory> +#include <utility> #include "ash/constants/ash_features.h" #include "ash/user_education/mock_user_education_delegate.h" @@ -12,7 +13,9 @@ #include "ash/user_education/user_education_types.h" #include "ash/user_education/user_education_util.h" #include "ash/user_education/views/help_bubble_factory_views_ash.h" +#include "base/callback_list.h" #include "base/test/mock_callback.h" +#include "base/test/repeating_test_future.h" #include "base/test/scoped_feature_list.h" #include "components/user_education/common/help_bubble.h" #include "components/user_education/common/help_bubble_params.h" @@ -45,6 +48,21 @@ // Element identifiers. DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kElementId); +// Actions --------------------------------------------------------------------- + +// NOTE: This action intentionally does *not* use `ACTION_P` macros, as actions +// generated in that way struggle to support move-only types. +template <typename ClassPtr, typename MethodPtr, typename ResultPtr> +auto InvokeAndCopyResultAddressTo(ClassPtr class_ptr, + MethodPtr method_ptr, + ResultPtr output_ptr) { + return [class_ptr, method_ptr, output_ptr](auto&&... args) { + auto result = (class_ptr->*method_ptr)(std::move(args)...); + *output_ptr = result.get(); + return result; + }; +} + } // namespace // UserEducationHelpBubbleControllerTest --------------------------------------- @@ -63,25 +81,86 @@ scoped_feature_list_.InitWithFeatures(enabled_features, {}); } + // Creates and returns a help bubble for the specified `help_bubble_params`, + // anchored to the `help_bubble_anchor_widget()`. + std::unique_ptr<HelpBubble> CreateHelpBubble( + HelpBubbleParams help_bubble_params) { + // Set `help_bubble_id` in extended properties. + help_bubble_params.extended_properties.values().Merge(std::move( + user_education_util::CreateExtendedProperties(HelpBubbleId::kTest) + .values())); + + // Create the help bubble. + return help_bubble_factory()->CreateBubble( + ui::ElementTracker::GetElementTracker()->GetFirstMatchingElement( + kElementId, help_bubble_anchor_context()), + std::move(help_bubble_params)); + } + // Returns the singleton instance owned by the `UserEducationController`. UserEducationHelpBubbleController* controller() { return UserEducationHelpBubbleController::Get(); } + // Returns the element context to use for help bubble anchors. + ui::ElementContext help_bubble_anchor_context() const { + return views::ElementTrackerViews::GetContextForWidget( + help_bubble_anchor_widget_.get()); + } + + // Returns the widget to use for help bubble anchors. + views::Widget* help_bubble_anchor_widget() { + return help_bubble_anchor_widget_.get(); + } + // Returns the factory to use to create help bubbles. HelpBubbleFactoryViewsAsh* help_bubble_factory() { return &help_bubble_factory_; } + // Returns the account ID for the primary user profile which is logged in + // during test `SetUp()`. Note that user education in Ash is currently only + // supported for the primary user profile. + const AccountId& primary_user_account_id() const { + return primary_user_account_id_; + } + private: + // UserEducationAshTestBase: + void SetUp() override { + UserEducationAshTestBase::SetUp(); + + // User education in Ash is currently only supported for the primary user + // profile. This is a self-imposed restriction. Log in the primary user. + primary_user_account_id_ = AccountId::FromUserEmail("primary@test"); + SimulateUserLogin(primary_user_account_id_); + + // Create and show a `help_bubble_anchor_widget_`. + help_bubble_anchor_widget_ = CreateFramelessTestWidget(); + help_bubble_anchor_widget_->SetContentsView( + views::Builder<views::View>() + .SetProperty(views::kElementIdentifierKey, kElementId) + .Build()); + help_bubble_anchor_widget_->CenterWindow(gfx::Size(50, 50)); + help_bubble_anchor_widget_->ShowInactive(); + } + // Used to enable user education features which are required for existence of // the `controller()` under test. base::test::ScopedFeatureList scoped_feature_list_; + // The widget to use for help bubble anchors. + views::UniqueWidgetPtr help_bubble_anchor_widget_; + // Used to mock help bubble creation given that user education services in // the browser are non-existent for unit tests in Ash. user_education::test::TestHelpBubbleDelegate help_bubble_delegate_; HelpBubbleFactoryViewsAsh help_bubble_factory_{&help_bubble_delegate_}; + + // The account ID for the primary user profile which is logged in during test + // `SetUp()`. Note that user education in Ash is currently only supported for + // the primary user profile. + AccountId primary_user_account_id_; }; // Tests ----------------------------------------------------------------------- @@ -90,28 +169,13 @@ // tracked element, and that `GetHelpBubbleId()` can be used to retrieve the ID // of the currently showing help bubble for a tracked element. TEST_F(UserEducationHelpBubbleControllerTest, CreateHelpBubble) { - // User education in Ash is currently only supported for the primary user - // profile. This is a self-imposed restriction. Log in the primary user. - AccountId primary_user_account_id = AccountId::FromUserEmail("primary@test"); - SimulateUserLogin(primary_user_account_id); - - // Create and show a `widget` to serve as help bubble anchor. - views::UniqueWidgetPtr widget = CreateFramelessTestWidget(); - widget->SetContentsView( - views::Builder<views::View>() - .SetProperty(views::kElementIdentifierKey, kElementId) - .Build()); - widget->CenterWindow(gfx::Size(50, 50)); - widget->ShowInactive(); - - // Cache `element_context`. - const ui::ElementContext element_context = - views::ElementTrackerViews::GetContextForWidget(widget.get()); + // Cache the `element_context` to use for help bubble anchors. + const ui::ElementContext element_context = help_bubble_anchor_context(); // Help bubble creation is delegated. The delegate may opt *not* to return a // help bubble in certain circumstances, e.g. if there is an ongoing tutorial. EXPECT_CALL(*user_education_delegate(), - CreateHelpBubble(Eq(primary_user_account_id), + CreateHelpBubble(Eq(primary_user_account_id()), Eq(HelpBubbleId::kTest), A<HelpBubbleParams>(), Eq(kElementId), Eq(element_context))) .WillOnce(Return(ByMove(nullptr))); @@ -132,23 +196,12 @@ // so, the delegate will return a `help_bubble` for the `controller()` to own. HelpBubble* help_bubble = nullptr; EXPECT_CALL(*user_education_delegate(), - CreateHelpBubble(Eq(primary_user_account_id), + CreateHelpBubble(Eq(primary_user_account_id()), Eq(HelpBubbleId::kTest), A<HelpBubbleParams>(), Eq(kElementId), Eq(element_context))) - .WillOnce(WithArgs<2>(Invoke([&](HelpBubbleParams help_bubble_params) { - // Set `help_bubble_id` in extended properties. - help_bubble_params.extended_properties.values().Merge(std::move( - user_education_util::CreateExtendedProperties(HelpBubbleId::kTest) - .values())); - - // Create and cache the `help_bubble`. - auto result = help_bubble_factory()->CreateBubble( - ui::ElementTracker::GetElementTracker()->GetFirstMatchingElement( - kElementId, element_context), - std::move(help_bubble_params)); - help_bubble = result.get(); - return result; - }))); + .WillOnce(WithArgs<2>(InvokeAndCopyResultAddressTo( + this, &UserEducationHelpBubbleControllerTest::CreateHelpBubble, + &help_bubble))); // When the delegate returns a `help_bubble`, the `controller()` should // indicate to the caller that a `help_bubble` was created. @@ -195,23 +248,12 @@ // Once the `help_bubble` has been closed, the delegate should again be tasked // with subsequent `help_bubble` creation. EXPECT_CALL(*user_education_delegate(), - CreateHelpBubble(Eq(primary_user_account_id), + CreateHelpBubble(Eq(primary_user_account_id()), Eq(HelpBubbleId::kTest), A<HelpBubbleParams>(), Eq(kElementId), Eq(element_context))) - .WillOnce(WithArgs<2>(Invoke([&](HelpBubbleParams help_bubble_params) { - // Set `help_bubble_id` in extended properties. - help_bubble_params.extended_properties.values().Merge(std::move( - user_education_util::CreateExtendedProperties(HelpBubbleId::kTest) - .values())); - - // Create and cache the `help_bubble`. - auto result = help_bubble_factory()->CreateBubble( - ui::ElementTracker::GetElementTracker()->GetFirstMatchingElement( - kElementId, element_context), - std::move(help_bubble_params)); - help_bubble = result.get(); - return result; - }))); + .WillOnce(WithArgs<2>(InvokeAndCopyResultAddressTo( + this, &UserEducationHelpBubbleControllerTest::CreateHelpBubble, + &help_bubble))); // The `controller()` should indicate to the caller success when attempting to // create a new `help_bubble` since the previous `help_bubble` was closed. @@ -244,4 +286,60 @@ EXPECT_FALSE(controller()->GetHelpBubbleId(kElementId, ui::ElementContext())); } +// Verifies that `UserEducationHelpBubbleController` subscriptions are WAI. +TEST_F(UserEducationHelpBubbleControllerTest, Subscriptions) { + // When the `user_education_delegate()` is asked to create a help bubble, do + // so and cache a pointer to the result. + HelpBubble* help_bubble = nullptr; + ON_CALL(*user_education_delegate(), CreateHelpBubble) + .WillByDefault(WithArgs<2>(InvokeAndCopyResultAddressTo( + this, &UserEducationHelpBubbleControllerTest::CreateHelpBubble, + &help_bubble))); + + { + // Expect that subscribers will be notified of shown events. + // Note that help bubbles are shown automatically when created. + base::test::RepeatingTestFuture<void> event_future; + base::CallbackListSubscription subscription = + controller()->AddHelpBubbleShownCallback(event_future.GetCallback()); + + // Create the `help_bubble`. + EXPECT_TRUE(controller()->CreateHelpBubble(HelpBubbleId::kTest, + HelpBubbleParams(), kElementId, + help_bubble_anchor_context())); + + // Verify expectations. + EXPECT_TRUE(event_future.Wait()); + } + + { + // Expect that subscribers will be notified of anchor bounds changed events. + base::test::RepeatingTestFuture<void> event_future; + base::CallbackListSubscription subscription = + controller()->AddHelpBubbleAnchorBoundsChangedCallback( + event_future.GetCallback()); + + // Change `help_bubble` anchor bounds. + help_bubble_anchor_widget()->CenterWindow(gfx::Size(100, 100)); + + // Verify expectations. + EXPECT_TRUE(event_future.Wait()); + } + + { + // Expect that subscribers will be notified of closed events. + base::test::RepeatingTestFuture<void> event_future; + base::CallbackListSubscription subscription = + controller()->AddHelpBubbleClosedCallback(event_future.GetCallback()); + + // Close the `help_bubble`. + ASSERT_TRUE(help_bubble); + help_bubble->Close(); + help_bubble = nullptr; + + // Verify expectations. + EXPECT_TRUE(event_future.Wait()); + } +} + } // namespace ash
diff --git a/ash/user_education/views/help_bubble_view_ash.cc b/ash/user_education/views/help_bubble_view_ash.cc index bbd4265..c587cf3e 100644 --- a/ash/user_education/views/help_bubble_view_ash.cc +++ b/ash/user_education/views/help_bubble_view_ash.cc
@@ -14,6 +14,7 @@ #include "ash/public/cpp/shell_window_ids.h" #include "ash/style/style_util.h" #include "ash/style/typography.h" +#include "ash/user_education/user_education_help_bubble_controller.h" #include "ash/user_education/user_education_types.h" #include "ash/user_education/user_education_util.h" #include "base/functional/bind.h" @@ -21,6 +22,7 @@ #include "base/metrics/user_metrics.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" +#include "base/types/pass_key.h" #include "components/strings/grit/components_strings.h" #include "components/user_education/common/help_bubble_params.h" #include "components/vector_icons/vector_icons.h" @@ -646,15 +648,26 @@ UpdateRoundedCorners(); widget->ShowInactive(); + auto* const anchor_bubble = anchor.view->GetWidget()->widget_delegate()->AsBubbleDialogDelegate(); if (anchor_bubble) { anchor_pin_ = anchor_bubble->PreventCloseOnDeactivate(); } MaybeStartAutoCloseTimer(); + + // NOTE: `controller` may be `nullptr` in testing. + if (auto* controller = UserEducationHelpBubbleController::Get()) { + controller->NotifyHelpBubbleShown(base::PassKey<HelpBubbleViewAsh>()); + } } -HelpBubbleViewAsh::~HelpBubbleViewAsh() = default; +HelpBubbleViewAsh::~HelpBubbleViewAsh() { + // NOTE: `controller` may be `nullptr` in testing. + if (auto* controller = UserEducationHelpBubbleController::Get()) { + controller->NotifyHelpBubbleClosed(base::PassKey<HelpBubbleViewAsh>()); + } +} void HelpBubbleViewAsh::MaybeStartAutoCloseTimer() { if (timeout_.is_zero()) { @@ -682,6 +695,12 @@ void HelpBubbleViewAsh::OnAnchorBoundsChanged() { views::BubbleDialogDelegateView::OnAnchorBoundsChanged(); UpdateRoundedCorners(); + + // NOTE: `controller` may be `nullptr` in testing. + if (auto* controller = UserEducationHelpBubbleController::Get()) { + controller->NotifyHelpBubbleAnchorBoundsChanged( + base::PassKey<HelpBubbleViewAsh>()); + } } std::u16string HelpBubbleViewAsh::GetAccessibleWindowTitle() const {
diff --git a/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_selected_element.ts b/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_selected_element.ts index 777f63e..a35c308 100644 --- a/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_selected_element.ts +++ b/ash/webui/personalization_app/resources/js/wallpaper/wallpaper_selected_element.ts
@@ -19,7 +19,7 @@ import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js'; import {assert} from 'chrome://resources/js/assert_ts.js'; -import {CurrentWallpaper, GooglePhotosPhoto, WallpaperLayout, WallpaperType} from '../../personalization_app.mojom-webui.js'; +import {CurrentWallpaper, GooglePhotosPhoto, WallpaperCollection, WallpaperImage, WallpaperLayout, WallpaperType} from '../../personalization_app.mojom-webui.js'; import {isGooglePhotosSharedAlbumsEnabled, isPersonalizationJellyEnabled} from '../load_time_booleans.js'; import {Paths} from '../personalization_router_element.js'; import {WithPersonalizationStore} from '../personalization_store.js'; @@ -66,6 +66,8 @@ */ path: String, + imagesByCollectionId_: Object, + photosByAlbumId_: Object, image_: { @@ -107,7 +109,8 @@ showDescriptionButton_: { type: Boolean, - computed: 'computeShowDescriptionButton_(image_)', + computed: + 'computeShowDescriptionButton_(image_,path,collectionId,imagesByCollectionId_)', }, showDescriptionDialog_: Boolean, @@ -186,6 +189,8 @@ private centerIcon_: string; private error_: string; private googlePhotosSharedAlbumsEnabled_: boolean; + private imagesByCollectionId_: + Record<WallpaperCollection['id'], WallpaperImage[]|null>|undefined; private photosByAlbumId_: Record<string, GooglePhotosPhoto[]|null|undefined>| undefined; @@ -201,6 +206,8 @@ state.wallpaper.loading.refreshWallpaper); this.watch('dailyRefreshState_', state => state.wallpaper.dailyRefresh); this.watch( + 'imagesByCollectionId_', state => state.wallpaper.backdrop.images); + this.watch( 'photosByAlbumId_', state => state.wallpaper.googlePhotos.photosByAlbumId); this.updateFromStore(); @@ -266,10 +273,30 @@ path === Paths.GOOGLE_PHOTOS_COLLECTION && !googlePhotosAlbumId))); } - private computeShowDescriptionButton_(image: CurrentWallpaper|null) { + private computeShowDescriptionButton_( + image: CurrentWallpaper|null, path: string, collectionId: string, + imagesByCollectionId: + Record<WallpaperCollection['id'], WallpaperImage[]|null>) { // Only show the description dialog if title and content exist. - return isPersonalizationJellyEnabled() && image?.descriptionContent && - image?.descriptionTitle; + if (!isPersonalizationJellyEnabled() || !image?.descriptionContent || + !image?.descriptionTitle) { + return false; + } + switch (path) { + // Hide button when viewing a different collection. + case Paths.COLLECTION_IMAGES: + if (!imagesByCollectionId![collectionId!]) { + return false; + } + const imageIsInCollection = imagesByCollectionId[collectionId]?.find( + (wallpaper) => wallpaper.unitId.toString() === image.key); + return !!imageIsInCollection; + // Hide button when viewing Google Photos. + case Paths.GOOGLE_PHOTOS_COLLECTION: + return false; + default: + return true; + } } private computeShowDailyRefreshButton_(
diff --git a/base/BUILD.gn b/base/BUILD.gn index 8cd7358..94331ce 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1142,6 +1142,8 @@ sources += [ "allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc", "allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h", + "allocator/partition_allocator/shim/nonscannable_allocator.cc", + "allocator/partition_allocator/shim/nonscannable_allocator.h", ] } if (is_android) {
diff --git a/base/allocator/partition_alloc_support.cc b/base/allocator/partition_alloc_support.cc index 8d32fb5..70db614b 100644 --- a/base/allocator/partition_alloc_support.cc +++ b/base/allocator/partition_alloc_support.cc
@@ -54,12 +54,12 @@ #include "third_party/abseil-cpp/absl/types/optional.h" #if BUILDFLAG(USE_STARSCAN) +#include "base/allocator/partition_allocator/shim/nonscannable_allocator.h" #include "base/allocator/partition_allocator/starscan/pcscan.h" #include "base/allocator/partition_allocator/starscan/pcscan_scheduling.h" #include "base/allocator/partition_allocator/starscan/stack/stack.h" #include "base/allocator/partition_allocator/starscan/stats_collector.h" #include "base/allocator/partition_allocator/starscan/stats_reporter.h" -#include "base/memory/nonscannable_memory.h" #endif // BUILDFLAG(USE_STARSCAN) #if BUILDFLAG(IS_ANDROID) @@ -1302,7 +1302,7 @@ // partition. At the same time, thread cache on the main(malloc) partition // must be disabled, because only one partition can have it on. if (scan_enabled && process_type == switches::kRendererProcess) { - base::internal::NonQuarantinableAllocator::Instance() + allocator_shim::NonQuarantinableAllocator::Instance() .root() ->EnableThreadCacheIfSupported(); } else
diff --git a/base/allocator/partition_allocator/partition_alloc_base/check.h b/base/allocator/partition_allocator/partition_alloc_base/check.h index 7df0131c..28fdba6 100644 --- a/base/allocator/partition_allocator/partition_alloc_base/check.h +++ b/base/allocator/partition_allocator/partition_alloc_base/check.h
@@ -113,10 +113,7 @@ PA_UNLIKELY(!(condition)) ? PA_IMMEDIATE_CRASH() \ : PA_EAT_CHECK_STREAM_PARAMS() -// TODO(1151236): base/test/gtest_util.h uses CHECK_WILL_STREAM(). After -// copying (or removing) gtest_util.h and removing gtest_uti.h from partition -// allocator's DEPS, rename or remove CHECK_WILL_STREAM(). -#define CHECK_WILL_STREAM() false +#define PA_BASE_CHECK_WILL_STREAM() false #define PA_BASE_PCHECK(condition) \ PA_LAZY_CHECK_STREAM( \ @@ -134,7 +131,7 @@ .stream(), \ !PA_ANALYZER_ASSUME_TRUE(condition)) -#define CHECK_WILL_STREAM() true +#define PA_BASE_CHECK_WILL_STREAM() true #define PA_BASE_PCHECK(condition) \ PA_LAZY_CHECK_STREAM( \
diff --git a/base/allocator/partition_allocator/partition_alloc_check.h b/base/allocator/partition_allocator/partition_alloc_check.h index 6c36893..0cc803e 100644 --- a/base/allocator/partition_allocator/partition_alloc_check.h +++ b/base/allocator/partition_allocator/partition_alloc_check.h
@@ -30,7 +30,7 @@ // - Otherwise, crash immediately. This provides worse error messages though. #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) // For official build discard log strings to reduce binary bloat. -#if !CHECK_WILL_STREAM() +#if !PA_BASE_CHECK_WILL_STREAM() // See base/check.h for implementation details. #define PA_CHECK(condition) \ PA_UNLIKELY(!(condition)) ? PA_IMMEDIATE_CRASH() \
diff --git a/base/allocator/partition_allocator/partition_alloc_notreached.h b/base/allocator/partition_allocator/partition_alloc_notreached.h index f1c5d214..e9a06946 100644 --- a/base/allocator/partition_allocator/partition_alloc_notreached.h +++ b/base/allocator/partition_allocator/partition_alloc_notreached.h
@@ -9,7 +9,7 @@ // PA_NOTREACHED() annotates paths that are supposed to be unreachable. They // crash if they are ever hit. -#if CHECK_WILL_STREAM() +#if PA_BASE_CHECK_WILL_STREAM() // PartitionAlloc uses async-signal-safe RawCheckFailure() for error reporting. // Async-signal-safe functions are guaranteed to not allocate as otherwise they // could operate with inconsistent allocator state.
diff --git a/base/allocator/partition_allocator/shim/DEPS b/base/allocator/partition_allocator/shim/DEPS index 3c7147f..9091bc1 100644 --- a/base/allocator/partition_allocator/shim/DEPS +++ b/base/allocator/partition_allocator/shim/DEPS
@@ -14,7 +14,7 @@ "+base/base_export.h", "+base/logging.h", "+base/mac/mach_logging.h", - "+base/memory/nonscannable_memory.h", + "+base/synchronization/lock.h", ] specific_include_rules = {
diff --git a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc index 42fb1e0..a3b3e17 100644 --- a/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -26,7 +26,7 @@ #include "base/allocator/partition_allocator/partition_root.h" #include "base/allocator/partition_allocator/partition_stats.h" #include "base/allocator/partition_allocator/shim/allocator_shim_internals.h" -#include "base/memory/nonscannable_memory.h" +#include "base/allocator/partition_allocator/shim/nonscannable_allocator.h" #include "build/build_config.h" #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) @@ -703,8 +703,8 @@ AlignedAllocator()); } - base::internal::NonScannableAllocator::Instance().NotifyPCScanEnabled(); - base::internal::NonQuarantinableAllocator::Instance().NotifyPCScanEnabled(); + allocator_shim::NonScannableAllocator::Instance().NotifyPCScanEnabled(); + allocator_shim::NonQuarantinableAllocator::Instance().NotifyPCScanEnabled(); } #endif // BUILDFLAG(USE_STARSCAN) } // namespace allocator_shim @@ -778,14 +778,14 @@ // Dump stats for nonscannable and nonquarantinable allocators. auto& nonscannable_allocator = - base::internal::NonScannableAllocator::Instance(); + allocator_shim::NonScannableAllocator::Instance(); partition_alloc::SimplePartitionStatsDumper nonscannable_allocator_dumper; if (auto* nonscannable_root = nonscannable_allocator.root()) { nonscannable_root->DumpStats("malloc", true, &nonscannable_allocator_dumper); } auto& nonquarantinable_allocator = - base::internal::NonQuarantinableAllocator::Instance(); + allocator_shim::NonQuarantinableAllocator::Instance(); partition_alloc::SimplePartitionStatsDumper nonquarantinable_allocator_dumper; if (auto* nonquarantinable_root = nonquarantinable_allocator.root()) { nonquarantinable_root->DumpStats("malloc", true,
diff --git a/base/allocator/partition_allocator/shim/malloc_zone_functions_mac.cc b/base/allocator/partition_allocator/shim/malloc_zone_functions_mac.cc index 22410b4..5315ea28 100644 --- a/base/allocator/partition_allocator/shim/malloc_zone_functions_mac.cc +++ b/base/allocator/partition_allocator/shim/malloc_zone_functions_mac.cc
@@ -7,8 +7,7 @@ #include <atomic> #include <type_traits> -#include "base/allocator/partition_allocator/partition_lock.h" -#include "base/check.h" +#include "base/synchronization/lock.h" namespace allocator_shim { @@ -58,9 +57,9 @@ // All modifications to g_malloc_zones are gated behind this lock. // Dispatch to a malloc zone does not need to acquire this lock. -partition_alloc::internal::Lock& GetLock() { - static partition_alloc::internal::Lock s_lock; - return s_lock; +base::Lock& GetLock() { + static base::Lock* g_lock = new base::Lock; + return *g_lock; } void EnsureMallocZonesInitializedLocked() { @@ -71,6 +70,7 @@ bool IsMallocZoneAlreadyStoredLocked(ChromeMallocZone* zone) { EnsureMallocZonesInitializedLocked(); + GetLock().AssertAcquired(); for (int i = 0; i < g_zone_count; ++i) { if (g_malloc_zones[i].context == reinterpret_cast<void*>(zone)) { return true; @@ -82,7 +82,8 @@ } // namespace bool StoreMallocZone(ChromeMallocZone* zone) { - partition_alloc::internal::ScopedGuard guard(GetLock()); + base::AutoLock l(GetLock()); + EnsureMallocZonesInitializedLocked(); if (IsMallocZoneAlreadyStoredLocked(zone)) { return false; } @@ -102,7 +103,7 @@ } bool IsMallocZoneAlreadyStored(ChromeMallocZone* zone) { - partition_alloc::internal::ScopedGuard guard(GetLock()); + base::AutoLock l(GetLock()); return IsMallocZoneAlreadyStoredLocked(zone); } @@ -112,12 +113,13 @@ } int GetMallocZoneCountForTesting() { - partition_alloc::internal::ScopedGuard guard(GetLock()); + base::AutoLock l(GetLock()); return g_zone_count; } void ClearAllMallocZonesForTesting() { - partition_alloc::internal::ScopedGuard guard(GetLock()); + base::AutoLock l(GetLock()); + EnsureMallocZonesInitializedLocked(); memset(g_malloc_zones, 0, kMaxZoneCount * sizeof(MallocZoneFunctions)); g_zone_count = 0; }
diff --git a/base/allocator/partition_allocator/shim/nonscannable_allocator.cc b/base/allocator/partition_allocator/shim/nonscannable_allocator.cc new file mode 100644 index 0000000..5d3d3f7 --- /dev/null +++ b/base/allocator/partition_allocator/shim/nonscannable_allocator.cc
@@ -0,0 +1,84 @@ +// Copyright 2021 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/allocator/partition_allocator/shim/nonscannable_allocator.h" + +#include "base/allocator/partition_allocator/partition_root.h" + +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +#include "base/allocator/partition_alloc_features.h" +#include "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h" + +#if BUILDFLAG(USE_STARSCAN) +#include "base/allocator/partition_allocator/starscan/metadata_allocator.h" +#include "base/allocator/partition_allocator/starscan/pcscan.h" +#endif +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + +namespace allocator_shim::internal { + +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +template <bool quarantinable> +NonScannableAllocatorImpl<quarantinable>::NonScannableAllocatorImpl() = default; +template <bool quarantinable> +NonScannableAllocatorImpl<quarantinable>::~NonScannableAllocatorImpl() = + default; + +template <bool quarantinable> +NonScannableAllocatorImpl<quarantinable>& +NonScannableAllocatorImpl<quarantinable>::Instance() { + static partition_alloc::internal::base::NoDestructor< + NonScannableAllocatorImpl> + instance; + return *instance; +} + +template <bool quarantinable> +void* NonScannableAllocatorImpl<quarantinable>::Alloc(size_t size) { +#if BUILDFLAG(USE_STARSCAN) + // TODO(bikineev): Change to LIKELY once PCScan is enabled by default. + if (PA_UNLIKELY(pcscan_enabled_.load(std::memory_order_acquire))) { + PA_DCHECK(allocator_.get()); + return allocator_->root()->AllocWithFlagsNoHooks( + 0, size, partition_alloc::PartitionPageSize()); + } +#endif // BUILDFLAG(USE_STARSCAN) + // Otherwise, dispatch to default partition. + return allocator_shim::internal::PartitionAllocMalloc::Allocator() + ->AllocWithFlagsNoHooks(0, size, partition_alloc::PartitionPageSize()); +} + +template <bool quarantinable> +void NonScannableAllocatorImpl<quarantinable>::Free(void* ptr) { + partition_alloc::ThreadSafePartitionRoot::FreeNoHooks(ptr); +} + +template <bool quarantinable> +void NonScannableAllocatorImpl<quarantinable>::NotifyPCScanEnabled() { +#if BUILDFLAG(USE_STARSCAN) + allocator_.reset(partition_alloc::internal::MakePCScanMetadata< + partition_alloc::PartitionAllocator>()); + allocator_->init(partition_alloc::PartitionOptions{ + .quarantine = + quarantinable + ? partition_alloc::PartitionOptions::Quarantine::kAllowed + : partition_alloc::PartitionOptions::Quarantine::kDisallowed, + .cookie = partition_alloc::PartitionOptions::Cookie::kAllowed, + .backup_ref_ptr = + partition_alloc::PartitionOptions::BackupRefPtr::kDisabled, + }); + if constexpr (quarantinable) { + partition_alloc::internal::PCScan::RegisterNonScannableRoot( + allocator_->root()); + } + pcscan_enabled_.store(true, std::memory_order_release); +#endif // BUILDFLAG(USE_STARSCAN) +} + +template class NonScannableAllocatorImpl<true>; +template class NonScannableAllocatorImpl<false>; + +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + +} // namespace allocator_shim::internal
diff --git a/base/allocator/partition_allocator/shim/nonscannable_allocator.h b/base/allocator/partition_allocator/shim/nonscannable_allocator.h new file mode 100644 index 0000000..869bcb57 --- /dev/null +++ b/base/allocator/partition_allocator/shim/nonscannable_allocator.h
@@ -0,0 +1,87 @@ +// Copyright 2021 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_NONSCANNABLE_ALLOCATOR_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_NONSCANNABLE_ALLOCATOR_H_ + +#include <atomic> +#include <cstddef> +#include <memory> + +#include "base/allocator/partition_allocator/partition_alloc_base/component_export.h" +#include "base/allocator/partition_allocator/partition_alloc_base/no_destructor.h" +#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" + +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +#include "base/allocator/partition_allocator/partition_alloc.h" + +#if BUILDFLAG(USE_STARSCAN) +#include "base/allocator/partition_allocator/starscan/metadata_allocator.h" +#endif +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + +namespace allocator_shim { + +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +namespace internal { + +// Represents allocator that contains memory for data-like objects (that don't +// contain pointers/references) and therefore doesn't require scanning by +// PCScan. An example would be strings or socket/IPC/file buffers. Use with +// caution. +template <bool quarantinable> +class PA_COMPONENT_EXPORT(PARTITION_ALLOC) NonScannableAllocatorImpl final { + public: + static NonScannableAllocatorImpl& Instance(); + + NonScannableAllocatorImpl(const NonScannableAllocatorImpl&) = delete; + NonScannableAllocatorImpl& operator=(const NonScannableAllocatorImpl&) = + delete; + + void* Alloc(size_t size); + static void Free(void*); + + // Returns PartitionRoot corresponding to the allocator, or nullptr if the + // allocator is not enabled. + partition_alloc::ThreadSafePartitionRoot* root() { +#if BUILDFLAG(USE_STARSCAN) + if (!allocator_.get()) { + return nullptr; + } + return allocator_->root(); +#else + return nullptr; +#endif // BUILDFLAG(USE_STARSCAN) + } + + void NotifyPCScanEnabled(); + + private: + template <typename> + friend class partition_alloc::internal::base::NoDestructor; + + NonScannableAllocatorImpl(); + ~NonScannableAllocatorImpl(); + +#if BUILDFLAG(USE_STARSCAN) + std::unique_ptr<partition_alloc::PartitionAllocator, + partition_alloc::internal::PCScanMetadataDeleter> + allocator_; + std::atomic_bool pcscan_enabled_{false}; +#endif // BUILDFLAG(USE_STARSCAN) +}; + +extern template class NonScannableAllocatorImpl<true>; +extern template class NonScannableAllocatorImpl<false>; + +} // namespace internal + +using NonScannableAllocator = internal::NonScannableAllocatorImpl<true>; +using NonQuarantinableAllocator = internal::NonScannableAllocatorImpl<false>; + +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + +} // namespace allocator_shim + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SHIM_NONSCANNABLE_ALLOCATOR_H_
diff --git a/base/memory/nonscannable_memory.cc b/base/memory/nonscannable_memory.cc index 6d6b6c6..dd98556b 100644 --- a/base/memory/nonscannable_memory.cc +++ b/base/memory/nonscannable_memory.cc
@@ -4,93 +4,19 @@ #include "base/memory/nonscannable_memory.h" -#include <stdlib.h> - #include "base/allocator/partition_allocator/partition_alloc_buildflags.h" -#include "base/allocator/partition_allocator/partition_root.h" -#include "base/feature_list.h" -#include "base/no_destructor.h" #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) -#include "base/allocator/partition_alloc_features.h" -#include "base/allocator/partition_allocator/shim/allocator_shim_default_dispatch_to_partition_alloc.h" - -#if BUILDFLAG(USE_STARSCAN) -#include "base/allocator/partition_allocator/starscan/metadata_allocator.h" -#include "base/allocator/partition_allocator/starscan/pcscan.h" +#include "base/allocator/partition_allocator/shim/nonscannable_allocator.h" +#else +#include <stdlib.h> #endif -#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) namespace base { -namespace internal { - -#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) -template <bool Quarantinable> -NonScannableAllocatorImpl<Quarantinable>::NonScannableAllocatorImpl() = default; -template <bool Quarantinable> -NonScannableAllocatorImpl<Quarantinable>::~NonScannableAllocatorImpl() = - default; - -template <bool Quarantinable> -NonScannableAllocatorImpl<Quarantinable>& -NonScannableAllocatorImpl<Quarantinable>::Instance() { - static base::NoDestructor<NonScannableAllocatorImpl> instance; - return *instance; -} - -template <bool Quarantinable> -void* NonScannableAllocatorImpl<Quarantinable>::Alloc(size_t size) { -#if BUILDFLAG(USE_STARSCAN) - // TODO(bikineev): Change to LIKELY once PCScan is enabled by default. - if (UNLIKELY(pcscan_enabled_.load(std::memory_order_acquire))) { - PA_DCHECK(allocator_.get()); - return allocator_->root()->AllocWithFlagsNoHooks( - 0, size, partition_alloc::PartitionPageSize()); - } -#endif // BUILDFLAG(USE_STARSCAN) - // Otherwise, dispatch to default partition. - return allocator_shim::internal::PartitionAllocMalloc::Allocator() - ->AllocWithFlagsNoHooks(0, size, partition_alloc::PartitionPageSize()); -} - -template <bool Quarantinable> -void NonScannableAllocatorImpl<Quarantinable>::Free(void* ptr) { - partition_alloc::ThreadSafePartitionRoot::FreeNoHooks(ptr); -} - -template <bool Quarantinable> -void NonScannableAllocatorImpl<Quarantinable>::NotifyPCScanEnabled() { -#if BUILDFLAG(USE_STARSCAN) - allocator_.reset(partition_alloc::internal::MakePCScanMetadata< - partition_alloc::PartitionAllocator>()); - allocator_->init(partition_alloc::PartitionOptions{ - .quarantine = - Quarantinable - ? partition_alloc::PartitionOptions::Quarantine::kAllowed - : partition_alloc::PartitionOptions::Quarantine::kDisallowed, - .cookie = partition_alloc::PartitionOptions::Cookie::kAllowed, - .backup_ref_ptr = - partition_alloc::PartitionOptions::BackupRefPtr::kDisabled, - }); - if (Quarantinable) { - partition_alloc::internal::PCScan::RegisterNonScannableRoot( - allocator_->root()); - } - pcscan_enabled_.store(true, std::memory_order_release); -#endif // BUILDFLAG(USE_STARSCAN) -} - -template class NonScannableAllocatorImpl<true>; -template class NonScannableAllocatorImpl<false>; - -#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - -} // namespace internal void* AllocNonScannable(size_t size) { #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - return internal::NonScannableAllocatorImpl</*Quarantinable=*/true>::Instance() - .Alloc(size); + return allocator_shim::NonScannableAllocator::Instance().Alloc(size); #else return ::malloc(size); #endif @@ -98,7 +24,7 @@ void FreeNonScannable(void* ptr) { #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - internal::NonScannableAllocatorImpl</*Quarantinable=*/true>::Free(ptr); + allocator_shim::NonScannableAllocator::Free(ptr); #else return ::free(ptr); #endif @@ -106,9 +32,7 @@ void* AllocNonQuarantinable(size_t size) { #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - return internal::NonScannableAllocatorImpl< - /*Quarantinable=*/false>::Instance() - .Alloc(size); + return allocator_shim::NonQuarantinableAllocator::Instance().Alloc(size); #else return ::malloc(size); #endif @@ -116,7 +40,7 @@ void FreeNonQuarantinable(void* ptr) { #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - internal::NonScannableAllocatorImpl</*Quarantinable=*/false>::Free(ptr); + allocator_shim::NonQuarantinableAllocator::Free(ptr); #else return ::free(ptr); #endif
diff --git a/base/memory/nonscannable_memory.h b/base/memory/nonscannable_memory.h index 4f3c02a..b01bbfd 100644 --- a/base/memory/nonscannable_memory.h +++ b/base/memory/nonscannable_memory.h
@@ -5,22 +5,9 @@ #ifndef BASE_MEMORY_NONSCANNABLE_MEMORY_H_ #define BASE_MEMORY_NONSCANNABLE_MEMORY_H_ -#include <cstdint> +#include <cstddef> -#include <atomic> -#include <memory> - -#include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/base_export.h" -#include "base/no_destructor.h" - -#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) -#include "base/allocator/partition_allocator/partition_alloc.h" - -#if BUILDFLAG(USE_STARSCAN) -#include "base/allocator/partition_allocator/starscan/metadata_allocator.h" -#endif -#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) // This file contains allocation/deallocation functions for memory that doesn't // need to be scanned by PCScan. Such memory should only contain "data" objects, @@ -28,62 +15,6 @@ // would be strings or socket/IPC/file buffers. Use with caution. namespace base { -#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) -namespace internal { - -// Represents allocator that contains memory for data-like objects (that don't -// contain pointers) and therefore doesn't require scanning. -template <bool Quarantinable> -class BASE_EXPORT NonScannableAllocatorImpl final { - public: - static NonScannableAllocatorImpl& Instance(); - - NonScannableAllocatorImpl(const NonScannableAllocatorImpl&) = delete; - NonScannableAllocatorImpl& operator=(const NonScannableAllocatorImpl&) = - delete; - - void* Alloc(size_t size); - static void Free(void*); - - // Returns PartitionRoot corresponding to the allocator, or nullptr if the - // allocator is not enabled. - partition_alloc::ThreadSafePartitionRoot* root() { -#if BUILDFLAG(USE_STARSCAN) - if (!allocator_.get()) { - return nullptr; - } - return allocator_->root(); -#else - return nullptr; -#endif // BUILDFLAG(USE_STARSCAN) - } - - void NotifyPCScanEnabled(); - - private: - template <typename> - friend class base::NoDestructor; - - NonScannableAllocatorImpl(); - ~NonScannableAllocatorImpl(); - -#if BUILDFLAG(USE_STARSCAN) - std::unique_ptr<partition_alloc::PartitionAllocator, - partition_alloc::internal::PCScanMetadataDeleter> - allocator_; - std::atomic_bool pcscan_enabled_{false}; -#endif // BUILDFLAG(USE_STARSCAN) -}; - -extern template class NonScannableAllocatorImpl<true>; -extern template class NonScannableAllocatorImpl<false>; - -using NonScannableAllocator = NonScannableAllocatorImpl<true>; -using NonQuarantinableAllocator = NonScannableAllocatorImpl<false>; - -} // namespace internal -#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) - // Allocate/free non-scannable, but still quarantinable memory. BASE_EXPORT void* AllocNonScannable(size_t size); BASE_EXPORT void FreeNonScannable(void* ptr);
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index 6e64aed..6a8088b9 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc
@@ -13,9 +13,9 @@ #include "base/allocator/partition_allocator/partition_alloc_buildflags.h" #include "base/allocator/partition_allocator/partition_alloc_config.h" #include "base/allocator/partition_allocator/partition_bucket_lookup.h" +#include "base/allocator/partition_allocator/shim/nonscannable_allocator.h" #include "base/debug/profiler.h" #include "base/format_macros.h" -#include "base/memory/nonscannable_memory.h" #include "base/metrics/histogram_functions.h" #include "base/numerics/safe_conversions.h" #include "base/strings/stringprintf.h" @@ -139,11 +139,12 @@ aligned_allocator->DumpStats("aligned", is_light_dump, &partition_stats_dumper); } - auto& nonscannable_allocator = internal::NonScannableAllocator::Instance(); + auto& nonscannable_allocator = + allocator_shim::NonScannableAllocator::Instance(); if (auto* root = nonscannable_allocator.root()) root->DumpStats("nonscannable", is_light_dump, &partition_stats_dumper); auto& nonquarantinable_allocator = - internal::NonQuarantinableAllocator::Instance(); + allocator_shim::NonQuarantinableAllocator::Instance(); if (auto* root = nonquarantinable_allocator.root()) root->DumpStats("nonquarantinable", is_light_dump, &partition_stats_dumper);
diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn index ed39cc6..1bd1e89d 100644 --- a/build/config/clang/BUILD.gn +++ b/build/config/clang/BUILD.gn
@@ -54,6 +54,42 @@ "-plugin-arg-find-bad-constructs", "-Xclang", "raw-ptr-exclude-path=base/containers/span.h", + + # TODO(mikt): Remove this once crrev.com/c/4565714 is rolled out. + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=testing/platform_test.h", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=sandbox/mac/", + + # TODO(mikt): Remove this once crrev.com/c/4575913 is rolled out. + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=chrome/browser/ui/cocoa/touchbar/browser_window_default_touch_bar.mm", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_central_manager_mac.mm", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=device/bluetooth/test/mock_bluetooth_cbperipheral_mac.mm", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=ui/views/widget/native_widget_mac_unittest.mm", + "-Xclang", + "-plugin-arg-find-bad-constructs", + "-Xclang", + "raw-ptr-exclude-path=ui/views/controls/native/native_view_host_mac_unittest.mm", ] } }
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni index 0de9792..474fde4 100644 --- a/build/config/clang/clang.gni +++ b/build/config/clang/clang.gni
@@ -16,7 +16,7 @@ enable_check_raw_ptr_fields = build_with_chromium && !is_official_build && - ((is_linux && !is_castos) || (is_android && !is_cast_android)) + ((is_linux && !is_castos) || (is_android && !is_cast_android) || is_mac) clang_base_path = default_clang_base_path
diff --git a/build/toolchain/apple/toolchain.gni b/build/toolchain/apple/toolchain.gni index f35dda8..97a56c9a 100644 --- a/build/toolchain/apple/toolchain.gni +++ b/build/toolchain/apple/toolchain.gni
@@ -23,6 +23,7 @@ # once the support is available. if (is_ios) { import("//build/config/ios/config.gni") + import("//build/config/ios/ios_sdk.gni") } assert((target_os == "ios" && host_os == "mac") || host_os != "win") @@ -45,7 +46,9 @@ build_with_chromium && is_ios && target_environment != "catalyst" if (swift_toolchain_path == -1) { - if (_can_use_hermetic_swift) { + # TODO(crbug.com/1451611) The custom swift toolchain not does currently work + # with Xcode 15 beta 1. + if (_can_use_hermetic_swift && !(is_ios && xcode_version_int >= 1500)) { # Version of the hermetic compiler. Needs to be updated when a new version of # the compiler is rolled to ensure that all outputs are regenerated. It must # be kept in sync with the `version` of `third_party/swift-toolchain` in
diff --git a/chrome/VERSION b/chrome/VERSION index 1ba80b1..a25251e 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=116 MINOR=0 -BUILD=5815 +BUILD=5816 PATCH=0
diff --git a/chrome/android/features/cablev2_authenticator/BUILD.gn b/chrome/android/features/cablev2_authenticator/BUILD.gn index fcabdd72..7c3ab25 100644 --- a/chrome/android/features/cablev2_authenticator/BUILD.gn +++ b/chrome/android/features/cablev2_authenticator/BUILD.gn
@@ -6,6 +6,7 @@ import("//chrome/android/modules/buildflags.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/webauth/authenticator/BLEAdvert.java", "java/src/org/chromium/chrome/browser/webauth/authenticator/CableAuthenticator.java", @@ -33,7 +34,6 @@ "//ui/android:ui_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.webauth.authenticator" }
diff --git a/chrome/android/features/start_surface/BUILD.gn b/chrome/android/features/start_surface/BUILD.gn index 1071cea6..1cd4cbe 100644 --- a/chrome/android/features/start_surface/BUILD.gn +++ b/chrome/android/features/start_surface/BUILD.gn
@@ -26,6 +26,7 @@ } android_library("public_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/features/start_surface/ReturnToStartSurfaceUtil.java", "java/src/org/chromium/chrome/features/start_surface/StartSurfaceConfiguration.java", @@ -62,7 +63,7 @@ "//ui/android:ui_no_recycler_view_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.start_surface" }
diff --git a/chrome/android/features/vr/BUILD.gn b/chrome/android/features/vr/BUILD.gn index c62b746..1fd712c 100644 --- a/chrome/android/features/vr/BUILD.gn +++ b/chrome/android/features/vr/BUILD.gn
@@ -32,6 +32,7 @@ } android_library("java") { + srcjar_deps = [ ":split_jni_headers" ] sources = [] if (enable_gvr_services) { sources += [ @@ -47,7 +48,8 @@ "java/src/org/chromium/chrome/browser/vr/VrWindowAndroid.java", ] } else { - sources += [ "dummy/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java" ] + sources += + [ "dummy/java/src/org/chromium/chrome/browser/vr/VrShellDelegate.java" ] } deps = [ @@ -90,7 +92,6 @@ deps += [ "//device/vr:java" ] } - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.vr" }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java index 583b083..6b1fb32 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/auxiliary_search/AuxiliarySearchBridge.java
@@ -52,7 +52,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { long getForProfile(Profile profile); byte[] getBookmarksSearchableData(long nativeAuxiliarySearchProvider);
diff --git a/chrome/android/modules/dev_ui/provider/BUILD.gn b/chrome/android/modules/dev_ui/provider/BUILD.gn index e6c97542f..eb0184b 100644 --- a/chrome/android/modules/dev_ui/provider/BUILD.gn +++ b/chrome/android/modules/dev_ui/provider/BUILD.gn
@@ -10,7 +10,8 @@ "//chrome/android/features/dev_ui/public:java", "//components/module_installer/android:module_installer_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/modules/dev_ui/DevUiInstallListener.java", "java/src/org/chromium/chrome/modules/dev_ui/DevUiModuleProvider.java",
diff --git a/chrome/android/modules/stack_unwinder/internal/BUILD.gn b/chrome/android/modules/stack_unwinder/internal/BUILD.gn index d9a6713b..a462297 100644 --- a/chrome/android/modules/stack_unwinder/internal/BUILD.gn +++ b/chrome/android/modules/stack_unwinder/internal/BUILD.gn
@@ -7,8 +7,9 @@ import("//chrome/android/modules/buildflags.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/modules/stack_unwinder/StackUnwinderModuleContentsImpl.java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ "//base:jni_java", "//build/android:build_java",
diff --git a/chrome/android/modules/stack_unwinder/provider/BUILD.gn b/chrome/android/modules/stack_unwinder/provider/BUILD.gn index bb5ce0d..d596b9f 100644 --- a/chrome/android/modules/stack_unwinder/provider/BUILD.gn +++ b/chrome/android/modules/stack_unwinder/provider/BUILD.gn
@@ -9,7 +9,8 @@ "//base:jni_java", "//chrome/android/modules/stack_unwinder/public:java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/modules/stack_unwinder/StackUnwinderModuleProvider.java" ] }
diff --git a/chrome/app/app_management_strings.grdp b/chrome/app/app_management_strings.grdp index f914538a..2abb798 100644 --- a/chrome/app/app_management_strings.grdp +++ b/chrome/app/app_management_strings.grdp
@@ -109,6 +109,9 @@ <message name="IDS_APP_MANAGEMENT_APP_DETAILS_TITLE" desc="Title for App Details Section"> App details </message> + <message name="IDS_APP_MANAGEMENT_APP_DETAILS_TOOLTIP_SYSTEM" desc="Text for System app tooltip"> + This system app is preinstalled on your device + </message> <message name="IDS_APP_MANAGEMENT_APP_DETAILS_TYPE_ANDROID" desc="Text for Android app type"> Android App </message>
diff --git a/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_APP_DETAILS_TOOLTIP_SYSTEM.png.sha1 b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_APP_DETAILS_TOOLTIP_SYSTEM.png.sha1 new file mode 100644 index 0000000..3eb57d93 --- /dev/null +++ b/chrome/app/app_management_strings_grdp/IDS_APP_MANAGEMENT_APP_DETAILS_TOOLTIP_SYSTEM.png.sha1
@@ -0,0 +1 @@ +779d9a5a04ff26cf8977f71be6c29a21b5fb62db \ No newline at end of file
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 92d56cd..9152b83 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -6070,65 +6070,65 @@ <message name="IDS_BOREALIS_CREDITS_PLACEHOLDER" desc="Shown to users who navigate to about://borealis-credits when the real credits file can't be shown (e.g. because borealis is not running)" translateable="false"> Steam is either not installed or not running. Please run Steam to view credits. </message> - <message name="IDS_BOREALIS_DISALLOWED_TITLE" desc="Title of the dialog shown to users who are unable to install Steam on Chromebook (Steam is a video game distribution service)"> - Steam cannot be installed + <message name="IDS_BOREALIS_DISALLOWED_TITLE" desc="Title of the dialog shown to users who are unable to install 'Steam for Chromebook' (Steam is a video game distribution service)"> + Can't install Steam </message> - <message name="IDS_BOREALIS_DISALLOWED_DISABLED" desc="Message shown to the user when Steam on Chromebook is disabled on their device"> - This device does not currently support Steam on Chromebook + <message name="IDS_BOREALIS_DISALLOWED_HARDWARE" desc="Message shown to the user when 'Steam for Chromebook' is disabled on their device"> + Steam for Chromebook (beta) is not available on your Chromebook. </message> - <message name="IDS_BOREALIS_DISALLOWED_FAILED" desc="Message shown to the user when Steam on Chromebook failed to determine whether it should be allowed"> - Please restart your device and try again + <message name="IDS_BOREALIS_DISALLOWED_FAILED" desc="Message shown to the user when 'Steam for Chromebook' failed to determine whether it should be allowed"> + Restart your Chromebook and try again </message> - <message name="IDS_BOREALIS_DISALLOWED_IRREGULAR" desc="Message shown to users when they try to install Steam on Chromebook on an irregular (incognito, kiosk, etc) profile"> - Please sign in to a user account and try again + <message name="IDS_BOREALIS_DISALLOWED_IRREGULAR" desc="Message shown to users when they try to install 'Steam for Chromebook' on an irregular (incognito, kiosk, etc) profile"> + You need to be signed-in to a Google Account to use Steam for Chromebook (Beta). Sign in and try again. </message> - <message name="IDS_BOREALIS_DISALLOWED_PRIMARY" desc="Message shown to users when they try to install Steam on Chromebook on a secondary profile"> - Please install using your primary profile + <message name="IDS_BOREALIS_DISALLOWED_PRIMARY" desc="Message shown to users when they try to install 'Steam for Chromebook' on a secondary profile"> + Steam for Chromebook (Beta) is only available for the account that signed in first on this Chromebook. </message> - <message name="IDS_BOREALIS_DISALLOWED_CHILD" desc="Message shown to the users when they try to install Steam on Chromebook on a child account"> - Accounts managed by Family Link are not yet supported + <message name="IDS_BOREALIS_DISALLOWED_CHILD" desc="Message shown to the users when they try to install 'Steam for Chromebook' on a child account"> + Steam for Chromebook (Beta) is not available for child Google Accounts </message> - <message name="IDS_BOREALIS_DISALLOWED_ADMIN" desc="Message shown to the user when Steam on Chromebook is blocked by their admin"> - Please contact your administrator + <message name="IDS_BOREALIS_DISALLOWED_ADMIN" desc="Message shown to the user when 'Steam for Chromebook' is blocked by their admin. The placeholders are the names of policy settings."> + Steam for Chromebook (Beta) is blocked by your administrator. Your administrator needs to turn on these policies: </message> - <message name="IDS_BOREALIS_DISALLOWED_FLAG" desc="Message shown to the user when Steam on Chromebook doesn't have the correct chrome://flags setting enabled"> - #borealis-enabled must be enabled in chrome://flags + <message name="IDS_BOREALIS_DISALLOWED_FLAG" desc="Message shown to the user when 'Steam for Chromebook' doesn't have the correct chrome://flags setting enabled"> + You need to turn on the “Borealis Enabled” flag </message> - <message name="IDS_BOREALIS_DISALLOWED_BUTTON" desc="Button label used to dismiss the Steam on Chromebook disallowed dialog"> - Got it + <message name="IDS_BOREALIS_DISALLOWED_FLAG_BUTTON" desc="Button label used to bring up the user's chrome://flags settings. Shown when users try to install borealis but are unable to due to their flags."> + ChromeOS flags </message> <message name="IDS_BOREALIS_INSTALLER_APP_NAME" desc="Name of a utility which is used to install the Steam application (Steam is a video game distribution service)"> Steam installer </message> - <message name="IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE" desc="Title for installer for Steam (noun, name of app)."> - Welcome to Steam on Chromebook + <message name="IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE" desc="Title of the installer for 'Steam for Chromebook'. 'Steam for Chromebook' is the name of the piece of software used to run 'Steam' (a software distribution platform) on Chromebooks."> + Welcome to Steam for Chromebook </message> - <message name="IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE" desc="Body for installer for Steam (noun, name of app)."> - Let’s get started + <message name="IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE" desc="Body text shown in the installer for 'Steam for Chromebook'."> + This is a beta program. You can now use Steam to play some games on your Chromebook. </message> - <message name="IDS_BOREALIS_INSTALLER_INSTALL_BUTTON" desc="Button on installer to install Steam (noun, name of app)."> + <message name="IDS_BOREALIS_INSTALLER_INSTALL_BUTTON" desc="Button on installer to install 'Steam for Chromebook'."> Install </message> - <message name="IDS_BOREALIS_INSTALLER_ONGOING_TITLE" desc="Title for installer while Steam (noun, name of app) is installing."> - Setting up Steam on Chromebook + <message name="IDS_BOREALIS_INSTALLER_ONGOING_TITLE" desc="Title for installer while 'Steam for Chromebook' is installing."> + Setting up Steam for Chromebook </message> - <message name="IDS_BOREALIS_INSTALLER_ONGOING_MESSAGE" desc="Body for Steam (noun, name of app) installer while Steam is installing."> + <message name="IDS_BOREALIS_INSTALLER_ONGOING_MESSAGE" desc="Body text shown in the installer while 'Steam for Chromebook' is installing."> This may take a few minutes </message> - <message name="IDS_BOREALIS_INSTALLER_ONGOING_PERCENTAGE" desc="Message containing the progress percentage of the ongoing Steam (noun, name of app) installation."> + <message name="IDS_BOREALIS_INSTALLER_ONGOING_PERCENTAGE" desc="Message containing the progress percentage of the ongoing 'Steam for Chromebook' installation."> <ph name="PERCENTAGE_COMPLETE">$1<ex>42</ex></ph>% completed </message> - <message name="IDS_BOREALIS_INSTALLER_ONGOING_INACTIVE" desc="Message shown while the steam installer is initializing."> - Starting installation + <message name="IDS_BOREALIS_INSTALLER_ONGOING_INITIAL" desc="Message shown while the 'Steam for Chromebook' installer is calculating how much longer it will need to complete."> + estimating time </message> - <message name="IDS_BOREALIS_INSTALLER_FINISHED_TITLE" desc="Title for installer when installation for Steam (noun, name of app) completes succesfully."> - You’re all set! + <message name="IDS_BOREALIS_INSTALLER_FINISHED_TITLE" desc="Title for installer when installation for 'Steam for Chromebook' completes succesfully."> + Let’s get gaming </message> - <message name="IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE" desc="Title for Steam (noun, name of app) installer when installation suceeded."> - Enjoy gaming on your Chromebook + <message name="IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE" desc="Body text shown in the installer when 'Steam for Chromebook' installation suceeded."> + You can now use Steam for Chromebook (Beta) </message> - <message name="IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON" desc="Button in Steam (noun, name of app) installer to launch Steam."> - Launch Steam + <message name="IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON" desc="Button in the installer for 'Steam for Chromebook' to launch Steam."> + Open Steam </message> <message name="IDS_BOREALIS_INSTALLER_ERROR_TITLE" desc="Title for installer when Steam (noun, name of app) fails to install."> There was a problem setting up Steam on Chromebook @@ -6167,7 +6167,7 @@ Beta </message> <message name="IDS_BOREALIS_CLIENT_UNINSTALL_CONFIRM_BODY" desc="Confirmation dialog for uninstalling Steam (name of app)."> - Any games and apps installed via Steam will also be removed from this device + Any apps and games installed using Steam for Chromebook (Beta) will be removed from this device. Data associated with these apps and games will also be removed. Make sure to back up saved apps and games before uninstalling. </message> <message name="IDS_BOREALIS_APPLICATION_UNINSTALL_CONFIRM_BODY" desc="Confirmation dialog for uninstalling a game."> Data associated with this app may be removed from this device
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_CLIENT_UNINSTALL_CONFIRM_BODY.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_CLIENT_UNINSTALL_CONFIRM_BODY.png.sha1 index e5aa6b1..0129a11 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_CLIENT_UNINSTALL_CONFIRM_BODY.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_CLIENT_UNINSTALL_CONFIRM_BODY.png.sha1
@@ -1 +1 @@ -280a2fdec81194d30dc9b05a9aeda949e7dcdaa8 \ No newline at end of file +8596bdff474576525b5f75a2b4d5cec6e5781277 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_ADMIN.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_ADMIN.png.sha1 index 2224716..c14b85ca 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_ADMIN.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_ADMIN.png.sha1
@@ -1 +1 @@ -f50ddf35d843697889c35df7ed5f4c603cf9b013 \ No newline at end of file +f532f17b13dbf584c83792d81528afda96e7f850 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_BUTTON.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_BUTTON.png.sha1 deleted file mode 100644 index 2224716..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_BUTTON.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -f50ddf35d843697889c35df7ed5f4c603cf9b013 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_CHILD.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_CHILD.png.sha1 index f358034f..71a37e8 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_CHILD.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_CHILD.png.sha1
@@ -1 +1 @@ -16bdaac900275f410e26fe33d1e99c8e298c6789 \ No newline at end of file +7ad1e256ddc57e8989d09a89101b5c2134d74aeb \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_DISABLED.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_DISABLED.png.sha1 deleted file mode 100644 index a004aa5..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_DISABLED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -79a5ad687164052bcb1fb25858257b98493df47b \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FAILED.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FAILED.png.sha1 index bb9fbab9..aa39040d 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FAILED.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FAILED.png.sha1
@@ -1 +1 @@ -1d96f0f68d36adb700df51a65bcbd998851728ff \ No newline at end of file +8a62bf5accbc8694f987060320177d2701e846d4 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG.png.sha1 index a903878..2ad9748b 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG.png.sha1
@@ -1 +1 @@ -e9c29e490490f9efa57d98e6a29a79e93024689c \ No newline at end of file +d0c2b85ab7c4f5caae07799ea8a4cbee4c975e44 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG_BUTTON.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG_BUTTON.png.sha1 new file mode 100644 index 0000000..0b26c33e --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_FLAG_BUTTON.png.sha1
@@ -0,0 +1 @@ +f193597ab5c801386d34c4bc1b9832bef83c69e6 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_HARDWARE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_HARDWARE.png.sha1 new file mode 100644 index 0000000..4bfafd5 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_HARDWARE.png.sha1
@@ -0,0 +1 @@ +06b6bd740618ccca5e767485db346ef25acd6905 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_IRREGULAR.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_IRREGULAR.png.sha1 index d1e8bc47..14119cac 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_IRREGULAR.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_IRREGULAR.png.sha1
@@ -1 +1 @@ -6900074ea80e97aa59d30e20ed474300ca82b3a6 \ No newline at end of file +46a5043c6df626b1957978fca7f8550fe2c45a45 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_PRIMARY.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_PRIMARY.png.sha1 index 1988fc1..83db731 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_PRIMARY.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_PRIMARY.png.sha1
@@ -1 +1 @@ -d0484cd8911054479046a61047603073f61e6576 \ No newline at end of file +70e3cde63b331bbcef3da34bb62e3504b76a6180 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_TITLE.png.sha1 index 2224716..0b26c33e 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_TITLE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_DISALLOWED_TITLE.png.sha1
@@ -1 +1 @@ -f50ddf35d843697889c35df7ed5f4c603cf9b013 \ No newline at end of file +f193597ab5c801386d34c4bc1b9832bef83c69e6 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE.png.sha1 index 3468eaa1..bd78a369 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_MESSAGE.png.sha1
@@ -1 +1 @@ -44b47f24bfbe0d63ea48adaf2131b62ca1fa8b51 \ No newline at end of file +b4d8df6555e665535d22837faab6d2f3a49b4e96 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE.png.sha1 index 2962b20..bd78a369 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_CONFIRMATION_TITLE.png.sha1
@@ -1 +1 @@ -190e7c6b2f3e4a7d381ac7b07aac087b607a3a08 \ No newline at end of file +b4d8df6555e665535d22837faab6d2f3a49b4e96 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE.png.sha1 index 4be26f5..e923c59 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_MESSAGE.png.sha1
@@ -1 +1 @@ -c946e61369cae119807199391c37b3063c6a161b \ No newline at end of file +8647bbb729d6faffe7ea48e2ff0561435cce07bb \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_TITLE.png.sha1 index 88a5b56..e923c59 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_TITLE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_FINISHED_TITLE.png.sha1
@@ -1 +1 @@ -df737feb7a29e69206a500c01cc92a9ef3d4d523 \ No newline at end of file +8647bbb729d6faffe7ea48e2ff0561435cce07bb \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON.png.sha1 index 4be26f5..e923c59 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON.png.sha1
@@ -1 +1 @@ -c946e61369cae119807199391c37b3063c6a161b \ No newline at end of file +8647bbb729d6faffe7ea48e2ff0561435cce07bb \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INACTIVE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INACTIVE.png.sha1 deleted file mode 100644 index 2962b20..0000000 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INACTIVE.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -190e7c6b2f3e4a7d381ac7b07aac087b607a3a08 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INITIAL.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INITIAL.png.sha1 new file mode 100644 index 0000000..b4cbe97f --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_INITIAL.png.sha1
@@ -0,0 +1 @@ +9018388056b52980d0eb1b4b8e3309761aa1a583 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_TITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_TITLE.png.sha1 index 2962b20..b4cbe97f 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_TITLE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_BOREALIS_INSTALLER_ONGOING_TITLE.png.sha1
@@ -1 +1 @@ -190e7c6b2f3e4a7d381ac7b07aac087b607a3a08 \ No newline at end of file +9018388056b52980d0eb1b4b8e3309761aa1a583 \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 3324290..d424f711 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -8196,6 +8196,43 @@ </if> </if> + <!--iOS password promo strings--> + <if expr="_google_chrome"> + <if expr="not is_android"> + <if expr="use_titlecase"> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE" desc="In Title Case: The title for the iOS promo bubble letting users know their password is saved."> + Your Password Is Saved + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE" desc="In Title Case: The title for the footer of the iOS promo bubble suggesting to users that they can use their passwords on their iOS devices."> + Use Your Passwords on Your iOS Devices + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON" desc="In Title Case: The text inside the button inviting the user to get started."> + Get Started + </message> + </if> + <if expr="not use_titlecase"> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE" desc="The title for the iOS promo bubble letting users know their password is saved."> + Your password is saved + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE" desc="The title for the footer of the iOS promo bubble suggesting to users that they can use their passwords on their iOS devices."> + Use your passwords on your iOS devices + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON" desc="The text inside the button inviting the user to get started."> + Get started + </message> + </if> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_SUBTITLE" desc="The subtitle for the iOS promo bubble which lets the user know they can access their saved password on the Google Password Manager."> + You can access it on Google Password Manager. + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_GENERIC" desc="The description for the iOS promo bubble footer which lets the user know how to use their saved passwords on their phone: download Chrome for iOS and sync their account."> + To use your saved passwords on your phone, download Chrome for iOS and sync your account. + </message> + <message name="IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_QR" desc="The description for the iOS promo bubble footer which lets the user know how to use their saved passwords on their phone: follow the QR code, download Chrome for iOS and sync their account."> + To use your saved passwords on your phone, follow the QR code, download Chrome for iOS and sync your account. + </message> + </if> + </if> + <!--Accessible name/action strings--> <message name="IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT" desc="The format for the accessible title of an Incognito window"> <ph name="WINDOW_TITLE">$1</ph> (Incognito)
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON.png.sha1 new file mode 100644 index 0000000..6ca57ea --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON.png.sha1
@@ -0,0 +1 @@ +53267bca8ec78a177694c438a5738b24c73443c4 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_GENERIC.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_GENERIC.png.sha1 new file mode 100644 index 0000000..09d5760a --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_GENERIC.png.sha1
@@ -0,0 +1 @@ +649d97c62a056c3f9dd2b5508e9ea83378cc4df2 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_QR.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_QR.png.sha1 new file mode 100644 index 0000000..328d741e --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_QR.png.sha1
@@ -0,0 +1 @@ +d7b12fa0f544d615d843dc92de334214e946033d \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE.png.sha1 new file mode 100644 index 0000000..b4a5709 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE.png.sha1
@@ -0,0 +1 @@ +b6afce069f65f1c64ff44a432011346f99732e16 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_SUBTITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_SUBTITLE.png.sha1 new file mode 100644 index 0000000..fd58f2ca --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +bf730fa73a0a4b3dc81c563351ce507957a26682 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE.png.sha1 new file mode 100644 index 0000000..e2173f22 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE.png.sha1
@@ -0,0 +1 @@ +89a9b77f4771f3d31a798ee7597bab7b36799be4 \ No newline at end of file
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 6ca496e4..b9da292 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -236,6 +236,9 @@ <message name="IDS_SETTINGS_SHOW_BOOKMARKS_BAR" desc="Label for the checkbox which enables or disables showing the bookmarks bar in the toolbar."> Show bookmarks bar </message> + <message name="IDS_SETTINGS_SHOW_HOVER_CARD_IMAGES" desc="Label for the checkbox which enables or disables showing image previews for tab hovercards."> + Show images on tab hover preview cards + </message> <message name="IDS_SETTINGS_SIDE_PANEL" desc="Title for the side panel section. Allows the user to toggle which side the side panel is displayed on."> Side panel </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SHOW_HOVER_CARD_IMAGES.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SHOW_HOVER_CARD_IMAGES.png.sha1 new file mode 100644 index 0000000..d14e81739 --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SHOW_HOVER_CARD_IMAGES.png.sha1
@@ -0,0 +1 @@ +14ffe753405ddf8cc406298335543ccd24a892ca \ No newline at end of file
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 0aec5267..2070b4c 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd
@@ -367,6 +367,11 @@ <structure type="chrome_scaled_image" name="IDR_TAILORED_SECURITY_UNCONSENTED" file="common/tailored_security_unconsented.png" /> <structure type="chrome_scaled_image" name="IDR_TAILORED_SECURITY_UNCONSENTED_UPDATED" file="common/safer_with_google_shield.png" /> </if> + <if expr="_google_chrome"> + <if expr="not is_android"> + <structure type="chrome_scaled_image" name="IDR_SUCCESS_GREEN_CHECKMARK" file="google_chrome/success_green_checkmark.png" /> + </if> + </if> </structures> </release> </grit>
diff --git a/chrome/app/vector_icons/picture_in_picture_alt.icon b/chrome/app/vector_icons/picture_in_picture_alt.icon index 6ffe12f..10e94f42 100644 --- a/chrome/app/vector_icons/picture_in_picture_alt.icon +++ b/chrome/app/vector_icons/picture_in_picture_alt.icon
@@ -4,7 +4,6 @@ // Set to Google Blue 600 CANVAS_DIMENSIONS, 16, -PATH_COLOR_ARGB, 0xFF, 0x1A, 0x73, 0xE8, MOVE_TO, 16, 14, H_LINE_TO, 0, V_LINE_TO, 2,
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 8b1b71c0..391f2b59 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -48,7 +48,6 @@ #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/notifications/scheduler/public/features.h" #include "chrome/browser/page_info/page_info_features.h" -#include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h" #include "chrome/browser/permissions/notifications_permission_revocation_config.h" #include "chrome/browser/permissions/quiet_notification_permission_ui_config.h" #include "chrome/browser/predictors/loading_predictor_config.h" @@ -3329,42 +3328,6 @@ std::size(kHeuristicMemorySaverConservative), nullptr}, }; -const FeatureEntry::Choice kHighEfficiencyModeTimeBeforeDiscardChoices[] = { - {flags_ui::kGenericExperimentChoiceDefault, "", ""}, - {"1 Minute Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "1"}, - {"5 Minute Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "5"}, - {"15 Minute Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "15"}, - {"30 Minute Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "30"}, - {"1 Hour Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "60"}, - {"4 Hour Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "240"}, - {"6 Hour Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "360"}, - {"12 Hour Discard", - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "720"}, -}; - const FeatureEntry::FeatureParam kDiscardedTabTreatmentWithRing30Opacity[] = { {"discard_tab_treatment_option", "2"}, {"discard_tab_treatment_opacity", "0.3"}}; @@ -5518,9 +5481,6 @@ flag_descriptions::kArcVmmSwapKBShortcutName, flag_descriptions::kArcVmmSwapKBShortcutDesc, kOsCrOS, FEATURE_VALUE_TYPE(arc::kVmmSwapKeyboardShortcut)}, - {"enable-arc-host-vpn", flag_descriptions::kEnableArcHostVpnName, - flag_descriptions::kEnableArcHostVpnDescription, kOsCrOS, - FEATURE_VALUE_TYPE(arc::kEnableArcHostVpn)}, #endif // BUILDFLAG(IS_CHROMEOS_ASH) {"enable-generic-sensor-extra-classes", flag_descriptions::kEnableGenericSensorExtraClassesName, @@ -5875,10 +5835,6 @@ omnibox::kRichAutocompletion, kOmniboxRichAutocompletionPromisingVariations, "OmniboxBundledExperimentV1")}, - {"omnibox-close-popup-with-escape", - flag_descriptions::kOmniboxClosePopupWithEscapeName, - flag_descriptions::kOmniboxClosePopupWithEscapeDescription, kOsDesktop, - FEATURE_VALUE_TYPE(omnibox::kClosePopupWithEscape)}, {"omnibox-ml-log-url-scoring-signals", flag_descriptions::kOmniboxMlLogUrlScoringSignalsName, flag_descriptions::kOmniboxMlLogUrlScoringSignalsDescription, kOsDesktop, @@ -9797,11 +9753,6 @@ flag_descriptions::kHideIncognitoMediaMetadataDescription, kOsDesktop, FEATURE_VALUE_TYPE(media::kHideIncognitoMediaMetadata)}, - {"high-efficiency-mode-time-before-discard", - flag_descriptions::kHighEfficiencyModeTimeBeforeDiscardName, - flag_descriptions::kHighEfficiencyModeTimeBeforeDiscardDescription, - kOsDesktop, MULTI_VALUE_TYPE(kHighEfficiencyModeTimeBeforeDiscardChoices)}, - {"memory-saver-multi-state-mode", flag_descriptions::kHighEfficiencyMultistateModeAvailableName, flag_descriptions::kHighEfficiencyMultistateModeAvailableDescription,
diff --git a/chrome/browser/android/browserservices/metrics/BUILD.gn b/chrome/browser/android/browserservices/metrics/BUILD.gn index 456e1fc..a124d8a 100644 --- a/chrome/browser/android/browserservices/metrics/BUILD.gn +++ b/chrome/browser/android/browserservices/metrics/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/browserservices/metrics/OriginVerifierMetricsRecorder.java", "java/src/org/chromium/chrome/browser/browserservices/metrics/TrustedWebActivityUmaRecorder.java", @@ -24,7 +25,6 @@ "//third_party/android_deps:javax_inject_javax_inject_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/android/browserservices/verification/BUILD.gn b/chrome/browser/android/browserservices/verification/BUILD.gn index fa98712..52ef095 100644 --- a/chrome/browser/android/browserservices/verification/BUILD.gn +++ b/chrome/browser/android/browserservices/verification/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifier.java", "java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifierFactory.java", @@ -29,7 +30,6 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_browser_browser_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifier.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifier.java index 8b156df..84f2574 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifier.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/ChromeOriginVerifier.java
@@ -261,7 +261,7 @@ ChromeVerificationResultStore.getInstance().clearStoredRelationships(); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { long init(ChromeOriginVerifier caller, BrowserContextHandle browserContextHandle);
diff --git a/chrome/browser/android/httpclient/BUILD.gn b/chrome/browser/android/httpclient/BUILD.gn index 34fcc4c..d7efdb5 100644 --- a/chrome/browser/android/httpclient/BUILD.gn +++ b/chrome/browser/android/httpclient/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/android/httpclient/AnnotatedSimpleHttpClient.java", "java/src/org/chromium/chrome/browser/android/httpclient/SimpleHttpClient.java", @@ -20,7 +21,6 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/android/messages/BUILD.gn b/chrome/browser/android/messages/BUILD.gn index bdf93a9a..709ef05 100644 --- a/chrome/browser/android/messages/BUILD.gn +++ b/chrome/browser/android/messages/BUILD.gn
@@ -5,10 +5,9 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/messages/MessagesResourceMapperInitializer.java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ "//base:jni_java", "//build/android:build_java",
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index f9b665a..50ba381 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -754,6 +754,8 @@ "bruschetta/bruschetta_launcher.h", "bruschetta/bruschetta_mount_provider.cc", "bruschetta/bruschetta_mount_provider.h", + "bruschetta/bruschetta_network_context.cc", + "bruschetta/bruschetta_network_context.h", "bruschetta/bruschetta_policy_handler.cc", "bruschetta/bruschetta_policy_handler.h", "bruschetta/bruschetta_pref_names.cc", @@ -2514,6 +2516,8 @@ "policy/reporting/install_event_logger_base.h", "policy/reporting/metrics_reporting/apps/app_events_observer.cc", "policy/reporting/metrics_reporting/apps/app_events_observer.h", + "policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.cc", + "policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h", "policy/reporting/metrics_reporting/apps/app_platform_metrics_retriever.cc", "policy/reporting/metrics_reporting/apps/app_platform_metrics_retriever.h", "policy/reporting/metrics_reporting/apps/app_usage_observer.cc", @@ -3123,6 +3127,8 @@ "usb/cros_usb_detector.h", "video_conference/video_conference_app_service_client.cc", "video_conference/video_conference_app_service_client.h", + "video_conference/video_conference_ash_feature_client.cc", + "video_conference/video_conference_ash_feature_client.h", "vm_shutdown_observer.h", "vm_starting_observer.h", "wallpaper/wallpaper_drivefs_delegate_impl.cc", @@ -5514,6 +5520,7 @@ "policy/reporting/arc_app_install_policy_data_helper_unittest.cc", "policy/reporting/arc_app_install_policy_data_unittest.cc", "policy/reporting/metrics_reporting/apps/app_events_observer_unittest.cc", + "policy/reporting/metrics_reporting/apps/app_metric_reporting_utils_unittest.cc", "policy/reporting/metrics_reporting/apps/app_platform_metrics_retriever_unittest.cc", "policy/reporting/metrics_reporting/apps/app_usage_observer_unittest.cc", "policy/reporting/metrics_reporting/apps/app_usage_telemetry_periodic_collector_unittest.cc",
diff --git a/chrome/browser/ash/arc/screen_capture/OWNERS b/chrome/browser/ash/arc/screen_capture/OWNERS index a5be881..0d7ce08d 100644 --- a/chrome/browser/ash/arc/screen_capture/OWNERS +++ b/chrome/browser/ash/arc/screen_capture/OWNERS
@@ -1,3 +1,4 @@ -lpique@chromium.org +file://ash/components/arc/OWNERS + domlaskowski@chromium.org -jkardatzke@google.com \ No newline at end of file +jkardatzke@google.com
diff --git a/chrome/browser/ash/bruschetta/bruschetta_download.cc b/chrome/browser/ash/bruschetta/bruschetta_download.cc index 0ff5050..1796807 100644 --- a/chrome/browser/ash/bruschetta/bruschetta_download.cc +++ b/chrome/browser/ash/bruschetta/bruschetta_download.cc
@@ -8,6 +8,7 @@ #include "base/memory/ptr_util.h" #include "base/task/task_traits.h" #include "base/task/thread_pool.h" +#include "chrome/browser/ash/bruschetta/bruschetta_network_context.h" #include "chrome/browser/extensions/cws_info_service.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/storage_partition.h" @@ -107,11 +108,14 @@ Profile* profile, GURL url, base::OnceCallback<void(base::FilePath path, std::string sha256)> callback) - : profile_(profile), url_(std::move(url)), callback_(std::move(callback)) { + : url_(std::move(url)), callback_(std::move(callback)) { + // We're owned (through a few levels of owning class) by the installer view + // which won't outlive the profile, so it's safe to pass around the raw + // pointer. base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock()}, base::BindOnce(&MakeTempDir), base::BindOnce(&SimpleURLLoaderDownload::Download, - weak_ptr_factory_.GetWeakPtr())); + weak_ptr_factory_.GetWeakPtr(), profile)); } SimpleURLLoaderDownload::~SimpleURLLoaderDownload() { @@ -123,6 +127,7 @@ } void SimpleURLLoaderDownload::Download( + Profile* profile, std::unique_ptr<base::ScopedTempDir> dir) { scoped_temp_dir_ = std::move(dir); auto path = scoped_temp_dir_->GetPath().Append("download"); @@ -130,9 +135,8 @@ req->url = url_; loader_ = network::SimpleURLLoader::Create(std::move(req), kBruschettaTrafficAnnotation); - auto factory = profile_->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess(); - loader_->DownloadToFile(factory.get(), + network_context_ = std::make_unique<BruschettaNetworkContext>(profile); + loader_->DownloadToFile(network_context_->GetURLLoaderFactory(), base::BindOnce(&SimpleURLLoaderDownload::Finished, weak_ptr_factory_.GetWeakPtr()), std::move(path));
diff --git a/chrome/browser/ash/bruschetta/bruschetta_download.h b/chrome/browser/ash/bruschetta/bruschetta_download.h index 1cd562e..c26a788d 100644 --- a/chrome/browser/ash/bruschetta/bruschetta_download.h +++ b/chrome/browser/ash/bruschetta/bruschetta_download.h
@@ -7,7 +7,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/functional/callback_forward.h" -#include "base/functional/callback_helpers.h" #include "base/memory/raw_ptr.h" #include "services/network/public/cpp/simple_url_loader.h" #include "url/gurl.h" @@ -18,6 +17,7 @@ } // namespace network namespace bruschetta { +class BruschettaNetworkContext; extern const net::NetworkTrafficAnnotationTag kBruschettaTrafficAnnotation; @@ -51,15 +51,15 @@ GURL url, base::OnceCallback<void(base::FilePath path, std::string sha256)> callback); - void Download(std::unique_ptr<base::ScopedTempDir> dir); + void Download(Profile* profile, std::unique_ptr<base::ScopedTempDir> dir); void Finished(base::FilePath path); - base::raw_ptr<Profile> profile_; GURL url_; std::unique_ptr<base::ScopedTempDir> scoped_temp_dir_; base::OnceCallback<void(base::FilePath path, std::string sha256)> callback_; std::unique_ptr<network::SimpleURLLoader> loader_; base::OnceClosure post_deletion_closure_for_testing_; + std::unique_ptr<BruschettaNetworkContext> network_context_; base::WeakPtrFactory<SimpleURLLoaderDownload> weak_ptr_factory_{this}; };
diff --git a/chrome/browser/ash/bruschetta/bruschetta_download_browsertest.cc b/chrome/browser/ash/bruschetta/bruschetta_download_browsertest.cc index a06982b8..c6951ad 100644 --- a/chrome/browser/ash/bruschetta/bruschetta_download_browsertest.cc +++ b/chrome/browser/ash/bruschetta/bruschetta_download_browsertest.cc
@@ -9,27 +9,73 @@ #include "base/strings/string_util.h" #include "base/test/test_future.h" #include "base/threading/thread_restrictions.h" +#include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/net/profile_network_context_service.h" +#include "chrome/browser/net/profile_network_context_service_factory.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/test/browser_test.h" +#include "net/dns/mock_host_resolver.h" +#include "net/ssl/client_cert_identity_test_util.h" +#include "net/ssl/client_cert_store.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/test_data_directory.h" #include "testing/gtest/include/gtest/gtest.h" namespace bruschetta { namespace { -class BruschettaDownloadBrowserTest : public InProcessBrowserTest { - public: - BruschettaDownloadBrowserTest() = default; - ~BruschettaDownloadBrowserTest() override = default; +class BruschettaDownloadBrowserTest : public InProcessBrowserTest {}; - BruschettaDownloadBrowserTest(const BruschettaDownloadBrowserTest&) = delete; - BruschettaDownloadBrowserTest& operator=( - const BruschettaDownloadBrowserTest&) = delete; +class BruschettaHttpsDownloadBrowserTest + : public BruschettaDownloadBrowserTest { + public: + BruschettaHttpsDownloadBrowserTest() = default; + ~BruschettaHttpsDownloadBrowserTest() override = default; + + BruschettaHttpsDownloadBrowserTest( + const BruschettaHttpsDownloadBrowserTest&) = delete; + BruschettaHttpsDownloadBrowserTest& operator=( + const BruschettaHttpsDownloadBrowserTest&) = delete; protected: void SetUpInProcessBrowserTestFixture() override { - InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + BruschettaDownloadBrowserTest::SetUpInProcessBrowserTestFixture(); + + // Set up the test server, with the download URL and to require SSL cert. + net::SSLServerConfig ssl_config; + ssl_config.client_cert_type = + net::SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT; + server_.SetSSLConfig(net::EmbeddedTestServer::CERT_OK, ssl_config); + server_.ServeFilesFromSourceDirectory("chrome/test/data/bruschetta"); + server_handle_ = server_.StartAndReturnHandle(); + ASSERT_TRUE(server_handle_); + url_ = server_.GetURL("/download_file.img"); } + + void SetUpOnMainThread() override { + host_resolver()->AddRule("*", "127.0.0.1"); + + // Add an entry into AutoSelectCertificateForUrls policy for automatic + // client cert selection. + content::WebContents* tab = + browser()->tab_strip_model()->GetActiveWebContents(); + Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); + DCHECK(profile); + base::Value::List filters; + filters.Append(base::Value::Dict()); + base::Value::Dict setting; + setting.Set("filters", std::move(filters)); + HostContentSettingsMapFactory::GetForProfile(profile) + ->SetWebsiteSettingDefaultScope( + url_, GURL(), ContentSettingsType::AUTO_SELECT_CERTIFICATE, + base::Value(std::move(setting))); + } + + net::EmbeddedTestServer server_{net::EmbeddedTestServer::TYPE_HTTPS}; + net::test_server::EmbeddedTestServerHandle server_handle_; + GURL url_; }; bool PathExistsBlockingAllowed(const base::FilePath& path) { @@ -37,26 +83,84 @@ return base::PathExists(path); } -IN_PROC_BROWSER_TEST_F(BruschettaDownloadBrowserTest, TestHappyPath) { - auto expected_hash = base::ToUpperASCII( +// A stub ClientCertStore which returns the list of client certs it was +// initialised with. +class StubClientCertStore : public net::ClientCertStore { + public: + explicit StubClientCertStore(net::ClientCertIdentityList list) + : list_(std::move(list)) {} + + ~StubClientCertStore() override = default; + + // net::ClientCertStore override. + void GetClientCerts(const net::SSLCertRequestInfo& cert_request_info, + ClientCertListCallback callback) override { + std::move(callback).Run(std::move(list_)); + } + + private: + net::ClientCertIdentityList list_; +}; + +// Creates a stub client cert store which returns a single test certificate. +std::unique_ptr<net::ClientCertStore> CreateStubClientCertStore() { + base::FilePath certs_dir = net::GetTestCertsDirectory(); + + net::ClientCertIdentityList cert_identity_list; + base::ScopedAllowBlockingForTesting allow_blocking; + std::unique_ptr<net::FakeClientCertIdentity> cert_identity = + net::FakeClientCertIdentity::CreateFromCertAndKeyFiles( + certs_dir, "client_1.pem", "client_1.pk8"); + EXPECT_TRUE(cert_identity.get()); + if (cert_identity) { + cert_identity_list.push_back(std::move(cert_identity)); + } + + return std::unique_ptr<net::ClientCertStore>( + new StubClientCertStore(std::move(cert_identity_list))); +} + +std::unique_ptr<net::ClientCertStore> CreateEmptyClientCertStore() { + return std::unique_ptr<net::ClientCertStore>(new StubClientCertStore({})); +} + +// Tests that we get an empty path and hash for a network error (in this case +// a bad URL). +IN_PROC_BROWSER_TEST_F(BruschettaHttpsDownloadBrowserTest, + TestDownloadUrlNotFound) { + base::test::TestFuture<base::FilePath, std::string> future; + auto download = SimpleURLLoaderDownload::StartDownload( + browser()->profile(), GURL("bad url"), future.GetCallback()); + + auto path = future.Get<base::FilePath>(); + auto hash = future.Get<std::string>(); + + ASSERT_TRUE(path.empty()); + EXPECT_EQ(hash, ""); +} + +// Tests that the `url_` is downloaded successfully. +// Because the `server_` is configured to require a client certificate +// this involves selecting a client certificate using the auto-selection +// setting configured in `SetUpOnMainThread` +IN_PROC_BROWSER_TEST_F(BruschettaHttpsDownloadBrowserTest, TestHappyPath) { + const auto kExpectedHash = base::ToUpperASCII( "f54d00e6d24844ee3b1d0d8c2b9d2ed80b967e94eb1055bb1fd43eb9522908cc"); - net::EmbeddedTestServer server(net::EmbeddedTestServer::TYPE_HTTPS); - server.ServeFilesFromSourceDirectory("chrome/test/data/bruschetta"); - auto server_handle = server.StartAndReturnHandle(); - ASSERT_TRUE(server_handle); - GURL url = server.GetURL("/download_file.img"); + // Make the browser use the ClientCertStoreStub instead of the regular one. + ProfileNetworkContextServiceFactory::GetForContext(browser()->profile()) + ->set_client_cert_store_factory_for_testing( + base::BindRepeating(&CreateStubClientCertStore)); base::test::TestFuture<base::FilePath, std::string> future; - base::FilePath path; auto download = SimpleURLLoaderDownload::StartDownload( - browser()->profile(), url, future.GetCallback()); + browser()->profile(), url_, future.GetCallback()); - path = future.Get<base::FilePath>(); + auto path = future.Get<base::FilePath>(); auto hash = future.Get<std::string>(); ASSERT_FALSE(path.empty()); - EXPECT_EQ(hash, expected_hash); + EXPECT_EQ(hash, kExpectedHash); // Deleting the download should clean up downloaded files. I found // RunUntilIdle to be flaky hence we have an explicit callback for after @@ -68,16 +172,24 @@ EXPECT_FALSE(PathExistsBlockingAllowed(path)); } -IN_PROC_BROWSER_TEST_F(BruschettaDownloadBrowserTest, TestDownloadFailed) { +// Tests downloading from url_, which requires an SSL cert for auth, when the +// cert isn't available. This should fail and signal that by returning an empty +// path. +IN_PROC_BROWSER_TEST_F(BruschettaHttpsDownloadBrowserTest, + TestDownloadNoMatchingCert) { + // Make the browser use an empty client cert store + ProfileNetworkContextServiceFactory::GetForContext(browser()->profile()) + ->set_client_cert_store_factory_for_testing( + base::BindRepeating(&CreateEmptyClientCertStore)); + base::test::TestFuture<base::FilePath, std::string> future; auto download = SimpleURLLoaderDownload::StartDownload( - browser()->profile(), GURL("bad url"), future.GetCallback()); + browser()->profile(), url_, future.GetCallback()); auto path = future.Get<base::FilePath>(); auto hash = future.Get<std::string>(); ASSERT_TRUE(path.empty()); - EXPECT_EQ(hash, ""); } } // namespace
diff --git a/chrome/browser/ash/bruschetta/bruschetta_network_context.cc b/chrome/browser/ash/bruschetta/bruschetta_network_context.cc new file mode 100644 index 0000000..537e6097 --- /dev/null +++ b/chrome/browser/ash/bruschetta/bruschetta_network_context.cc
@@ -0,0 +1,264 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/bruschetta/bruschetta_network_context.h" + +#include <stdint.h> +#include <memory> +#include <vector> + +#include "base/functional/bind.h" +#include "base/memory/scoped_refptr.h" +#include "base/memory/weak_ptr.h" +#include "base/unguessable_token.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/enterprise/util/managed_browser_utils.h" +#include "chrome/browser/extensions/cws_info_service.h" +#include "chrome/browser/net/profile_network_context_service.h" +#include "chrome/browser/net/profile_network_context_service_factory.h" +#include "chrome/browser/net/proxy_config_monitor.h" +#include "chrome/browser/net/system_network_context_manager.h" +#include "chrome/browser/profiles/profile.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/content_browser_client.h" +#include "content/public/browser/network_service_instance.h" +#include "content/public/browser/storage_partition.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver_set.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "mojo/public/cpp/bindings/self_owned_receiver.h" +#include "net/base/auth.h" +#include "net/base/net_errors.h" +#include "net/cert/x509_certificate.h" +#include "net/http/http_response_headers.h" +#include "net/ssl/client_cert_store.h" +#include "net/ssl/ssl_cert_request_info.h" +#include "net/ssl/ssl_private_key.h" +#include "services/network/public/cpp/simple_url_loader.h" +#include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" +#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "url/gurl.h" + +namespace bruschetta { + +// Wraps a net::SSLPrivateKey and turns it into a network::mojom::SSLPrivateKey. +class SSLPrivateKeyBridge : public network::mojom::SSLPrivateKey { + public: + explicit SSLPrivateKeyBridge( + scoped_refptr<net::SSLPrivateKey> ssl_private_key) + : ssl_private_key_(std::move(ssl_private_key)) {} + + SSLPrivateKeyBridge(const SSLPrivateKeyBridge&) = delete; + SSLPrivateKeyBridge& operator=(const SSLPrivateKeyBridge&) = delete; + + ~SSLPrivateKeyBridge() override = default; + + // network::mojom::SSLPrivateKey: + void Sign(uint16_t algorithm, + const std::vector<uint8_t>& input, + network::mojom::SSLPrivateKey::SignCallback callback) override { + base::span<const uint8_t> input_span(input); + ssl_private_key_->Sign( + algorithm, input_span, + base::BindOnce(&SSLPrivateKeyBridge::Callback, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + } + + private: + void Callback(network::mojom::SSLPrivateKey::SignCallback callback, + net::Error net_error, + const std::vector<uint8_t>& signature) { + std::move(callback).Run(static_cast<int32_t>(net_error), signature); + } + + scoped_refptr<net::SSLPrivateKey> ssl_private_key_; + base::WeakPtrFactory<SSLPrivateKeyBridge> weak_ptr_factory_{this}; +}; + +BruschettaNetworkContext::BruschettaNetworkContext(Profile* profile) + : profile_(profile), + proxy_config_monitor_(g_browser_process->local_state()) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +} + +BruschettaNetworkContext::~BruschettaNetworkContext() = default; + +network::mojom::URLLoaderFactory* +BruschettaNetworkContext::GetURLLoaderFactory() { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (!url_loader_factory_ || !url_loader_factory_.is_connected()) { + EnsureNetworkContextExists(); + + url_loader_observers_.Clear(); + network::mojom::URLLoaderFactoryParamsPtr url_loader_factory_params = + network::mojom::URLLoaderFactoryParams::New(); + url_loader_factory_params->process_id = network::mojom::kBrowserProcessId; + url_loader_factory_params->is_corb_enabled = false; + url_loader_factory_params->is_trusted = true; + url_loader_observers_.Add( + this, url_loader_factory_params->url_loader_network_observer + .InitWithNewPipeAndPassReceiver()); + url_loader_factory_.reset(); + network_context_->CreateURLLoaderFactory( + url_loader_factory_.BindNewPipeAndPassReceiver(), + std::move(url_loader_factory_params)); + } + return url_loader_factory_.get(); +} + +void BruschettaNetworkContext::EnsureNetworkContextExists() { + if (network_context_ && network_context_.is_connected()) { + return; + } + CreateNetworkContext(); +} + +void BruschettaNetworkContext::CreateNetworkContext() { + network::mojom::NetworkContextParamsPtr network_context_params = + g_browser_process->system_network_context_manager() + ->CreateDefaultNetworkContextParams(); + network_context_params->http_cache_enabled = false; + + proxy_config_monitor_.AddToNetworkContextParams(network_context_params.get()); + + network_context_.reset(); + content::CreateNetworkContextInNetworkService( + network_context_.BindNewPipeAndPassReceiver(), + std::move(network_context_params)); +} + +void BruschettaNetworkContext::OnSSLCertificateError( + const GURL& url, + int net_error, + const net::SSLInfo& ssl_info, + bool fatal, + OnSSLCertificateErrorCallback response) { + std::move(response).Run(net::ERR_INSECURE_RESPONSE); +} + +void BruschettaNetworkContext::OnCertificateRequested( + const absl::optional<base::UnguessableToken>& window_id, + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder_remote) { + if (!cert_store_) { + cert_store_ = ProfileNetworkContextServiceFactory::GetForContext(profile_) + ->CreateClientCertStore(); + } + cert_store_->GetClientCerts( + *cert_info.get(), + base::BindOnce(&BruschettaNetworkContext::OnGotClientCerts, + weak_ptr_factory_.GetWeakPtr(), cert_info, + std::move(cert_responder_remote))); +} + +void BruschettaNetworkContext::OnGotClientCerts( + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder_remote, + net::ClientCertIdentityList certs) { + GURL requesting_url = + chrome::enterprise_util::GetRequestingUrl(cert_info->host_and_port); + net::ClientCertIdentityList matching_certificates, nonmatching_certificates; + // Bruschetta is an enterprise feature with the URL set in policy. So if they + // pick a URL which requires an SSL cert they should also provide the cert via + // policy. We don't have a WebContents so can't show UI. + chrome::enterprise_util::AutoSelectCertificates( + profile_, requesting_url, std::move(certs), &matching_certificates, + &nonmatching_certificates); + + if (matching_certificates.size() == 0) { + LOG(ERROR) << "No matching certificate, continuing without any (this will " + "probably fail)"; + mojo::Remote<network::mojom::ClientCertificateResponder> cert_responder( + std::move(cert_responder_remote)); + cert_responder->ContinueWithoutCertificate(); + return; + } + + // We're called from views code which doesn't have a WebContents with which + // to prompt the user to pick a cert, so always take the first matching cert + // even if there are multiple. + std::unique_ptr<net::ClientCertIdentity> auto_selected_identity = + std::move(matching_certificates[0]); + + scoped_refptr<net::X509Certificate> cert = + auto_selected_identity->certificate(); + net::ClientCertIdentity::SelfOwningAcquirePrivateKey( + std::move(auto_selected_identity), + base::BindOnce(&BruschettaNetworkContext::ContinueWithCertificate, + weak_ptr_factory_.GetWeakPtr(), + std::move(cert_responder_remote), std::move(cert))); +} + +void BruschettaNetworkContext::ContinueWithCertificate( + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder_remote, + scoped_refptr<net::X509Certificate> cert, + scoped_refptr<net::SSLPrivateKey> private_key) { + mojo::PendingRemote<network::mojom::SSLPrivateKey> ssl_private_key; + mojo::Remote<network::mojom::ClientCertificateResponder> cert_responder( + std::move(cert_responder_remote)); + + mojo::MakeSelfOwnedReceiver( + std::make_unique<SSLPrivateKeyBridge>(private_key), + ssl_private_key.InitWithNewPipeAndPassReceiver()); + cert_responder->ContinueWithCertificate( + cert, private_key->GetProviderName(), + private_key->GetAlgorithmPreferences(), std::move(ssl_private_key)); +} + +void BruschettaNetworkContext::OnAuthRequired( + const absl::optional<base::UnguessableToken>& window_id, + uint32_t request_id, + const GURL& url, + bool first_auth_attempt, + const net::AuthChallengeInfo& auth_info, + const scoped_refptr<net::HttpResponseHeaders>& head_headers, + mojo::PendingRemote<network::mojom::AuthChallengeResponder> + auth_challenge_responder) { + mojo::Remote<network::mojom::AuthChallengeResponder> + auth_challenge_responder_remote(std::move(auth_challenge_responder)); + auth_challenge_responder_remote->OnAuthCredentials(absl::nullopt); +} + +void BruschettaNetworkContext::OnClearSiteData( + const GURL& url, + const std::string& header_value, + int32_t load_flags, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, + bool partitioned_state_allowed_only, + OnClearSiteDataCallback callback) { + std::move(callback).Run(); +} + +void BruschettaNetworkContext::OnLoadingStateUpdate( + network::mojom::LoadInfoPtr info, + OnLoadingStateUpdateCallback callback) { + std::move(callback).Run(); +} + +void BruschettaNetworkContext::OnDataUseUpdate( + int32_t network_traffic_annotation_id_hash, + int64_t recv_bytes, + int64_t sent_bytes) {} + +void BruschettaNetworkContext::OnSharedStorageHeaderReceived( + const url::Origin& request_origin, + std::vector<network::mojom::SharedStorageOperationPtr> operations, + OnSharedStorageHeaderReceivedCallback callback) { + std::move(callback).Run(); +} + +void BruschettaNetworkContext::Clone( + mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver> + observer) { + url_loader_observers_.Add(this, std::move(observer)); +} + +} // namespace bruschetta
diff --git a/chrome/browser/ash/bruschetta/bruschetta_network_context.h b/chrome/browser/ash/bruschetta/bruschetta_network_context.h new file mode 100644 index 0000000..04384970 --- /dev/null +++ b/chrome/browser/ash/bruschetta/bruschetta_network_context.h
@@ -0,0 +1,120 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/memory/scoped_refptr.h" +#include "base/unguessable_token.h" +#include "chrome/browser/net/proxy_config_monitor.h" +#include "chrome/browser/profiles/profile.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver_set.h" +#include "mojo/public/cpp/bindings/remote.h" +#include "net/base/auth.h" +#include "net/cert/x509_certificate.h" +#include "net/http/http_response_headers.h" +#include "net/ssl/client_cert_identity.h" +#include "net/ssl/client_cert_store.h" +#include "net/ssl/ssl_cert_request_info.h" +#include "net/ssl/ssl_private_key.h" +#include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/url_loader_factory.mojom.h" +#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "url/gurl.h" + +#ifndef CHROME_BROWSER_ASH_BRUSCHETTA_BRUSCHETTA_NETWORK_CONTEXT_H_ +#define CHROME_BROWSER_ASH_BRUSCHETTA_BRUSCHETTA_NETWORK_CONTEXT_H_ + +namespace bruschetta { + +// Provides an isolated NetworkContext which uses the client certificate store +// from the Profile passed to the constructor, but only if client certificates +// are auto-selected by Profile's enterprise policy. +class BruschettaNetworkContext + : public network::mojom::URLLoaderNetworkServiceObserver { + public: + // Class should not outlive the passed-in profile. + explicit BruschettaNetworkContext(Profile* profile); + + BruschettaNetworkContext(const BruschettaNetworkContext&) = delete; + BruschettaNetworkContext& operator=(const BruschettaNetworkContext&) = delete; + + ~BruschettaNetworkContext() override; + + network::mojom::URLLoaderFactory* GetURLLoaderFactory(); + + protected: + // network::mojom::URLLoaderNetworkServiceObserver overrides. + void OnSSLCertificateError(const GURL& url, + int net_error, + const net::SSLInfo& ssl_info, + bool fatal, + OnSSLCertificateErrorCallback response) override; + void OnCertificateRequested( + const absl::optional<base::UnguessableToken>& window_id, + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder) override; + void OnAuthRequired( + const absl::optional<base::UnguessableToken>& window_id, + uint32_t request_id, + const GURL& url, + bool first_auth_attempt, + const net::AuthChallengeInfo& auth_info, + const scoped_refptr<net::HttpResponseHeaders>& head_headers, + mojo::PendingRemote<network::mojom::AuthChallengeResponder> + auth_challenge_responder) override; + void OnClearSiteData( + const GURL& url, + const std::string& header_value, + int32_t load_flags, + const absl::optional<net::CookiePartitionKey>& cookie_partition_key, + bool partitioned_state_allowed_only, + OnClearSiteDataCallback callback) override; + void OnLoadingStateUpdate(network::mojom::LoadInfoPtr info, + OnLoadingStateUpdateCallback callback) override; + void OnDataUseUpdate(int32_t network_traffic_annotation_id_hash, + int64_t recv_bytes, + int64_t sent_bytes) override; + void OnSharedStorageHeaderReceived( + const url::Origin& request_origin, + std::vector<network::mojom::SharedStorageOperationPtr> operations, + OnSharedStorageHeaderReceivedCallback callback) override; + void Clone( + mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver> + listener) override; + + private: + void ContinueWithCertificate( + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder_remote, + scoped_refptr<net::X509Certificate> cert, + scoped_refptr<net::SSLPrivateKey> private_key); + + void EnsureNetworkContextExists(); + + void OnGotClientCerts( + const scoped_refptr<net::SSLCertRequestInfo>& cert_info, + mojo::PendingRemote<network::mojom::ClientCertificateResponder> + cert_responder_remote, + net::ClientCertIdentityList certs); + + void CreateNetworkContext(); + + raw_ptr<Profile> profile_; + ProxyConfigMonitor proxy_config_monitor_; + + mojo::Remote<network::mojom::NetworkContext> network_context_; + + mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory_; + + mojo::ReceiverSet<network::mojom::URLLoaderNetworkServiceObserver> + url_loader_observers_; + std::unique_ptr<net::ClientCertStore> cert_store_; + + base::WeakPtrFactory<BruschettaNetworkContext> weak_ptr_factory_{this}; +}; + +} // namespace bruschetta +#endif // CHROME_BROWSER_ASH_BRUSCHETTA_BRUSCHETTA_NETWORK_CONTEXT_H_
diff --git a/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc b/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc index e8f1b6e..2cf9357 100644 --- a/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc +++ b/chrome/browser/ash/camera_mic/vm_camera_mic_manager.cc
@@ -26,6 +26,7 @@ #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/ash/borealis/borealis_util.h" #include "chrome/browser/ash/plugin_vm/plugin_vm_util.h" +#include "chrome/browser/ash/video_conference/video_conference_ash_feature_client.h" #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/settings_window_manager_chromeos.h" @@ -158,11 +159,22 @@ int name_id() const { return name_id_; } NotificationType notification_type() const { return notifications_.active; } - void SetMicActive(bool active) { OnDeviceUpdated(DeviceType::kMic, active); } + void SetMicActive(bool active) { + OnDeviceUpdated(DeviceType::kMic, active); + + if (features::IsVideoConferenceEnabled()) { + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + vm_type_, DeviceType::kMic, active); + } + } void SetCameraAccessing(bool accessing) { camera_accessing_ = accessing; OnCameraUpdated(); + if (features::IsVideoConferenceEnabled()) { + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + vm_type_, DeviceType::kCamera, accessing); + } } void SetCameraPrivacyIsOn(bool on) { camera_privacy_is_on_ = on;
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.cc b/chrome/browser/ash/chrome_browser_main_parts_ash.cc index 244ec95..8f09422 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.cc +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.cc
@@ -160,6 +160,7 @@ #include "chrome/browser/ash/system_token_cert_db_initializer.h" #include "chrome/browser/ash/usb/cros_usb_detector.h" #include "chrome/browser/ash/video_conference/video_conference_app_service_client.h" +#include "chrome/browser/ash/video_conference/video_conference_ash_feature_client.h" #include "chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_manager.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part_ash.h" @@ -1423,6 +1424,8 @@ std::make_unique<video_conference::VideoConferenceManagerClientImpl>(); vc_app_service_client_ = std::make_unique<VideoConferenceAppServiceClient>(); + vc_ash_feature_client_ = + std::make_unique<VideoConferenceAshFeatureClient>(); } apn_migrator_ = std::make_unique<ApnMigrator>( @@ -1637,6 +1640,7 @@ // vc_app_service_client_ has to be destructed before PostMainMessageLoopRun. vc_app_service_client_.reset(); + vc_ash_feature_client_.reset(); // Has a dependency on Profile, so it needs to be destroyed before Profile // gets destroyed during ProfileManager destruction, which happens inside
diff --git a/chrome/browser/ash/chrome_browser_main_parts_ash.h b/chrome/browser/ash/chrome_browser_main_parts_ash.h index ab01b138..c2df5ea 100644 --- a/chrome/browser/ash/chrome_browser_main_parts_ash.h +++ b/chrome/browser/ash/chrome_browser_main_parts_ash.h
@@ -93,6 +93,7 @@ class SigninProfileHandler; class SystemTokenCertDBInitializer; class VideoConferenceAppServiceClient; +class VideoConferenceAshFeatureClient; class WebKioskAppManager; class KioskAppManager; @@ -237,6 +238,7 @@ lacros_data_backward_migration_mode_policy_observer_; std::unique_ptr<VideoConferenceAppServiceClient> vc_app_service_client_; + std::unique_ptr<VideoConferenceAshFeatureClient> vc_ash_feature_client_; std::unique_ptr<power::SmartChargingManager> smart_charging_manager_;
diff --git a/chrome/browser/ash/crosapi/browser_util.cc b/chrome/browser/ash/crosapi/browser_util.cc index b11335f..1bb0e4e 100644 --- a/chrome/browser/ash/crosapi/browser_util.cc +++ b/chrome/browser/ash/crosapi/browser_util.cc
@@ -197,6 +197,133 @@ } } +// Returns the current lacros mode. +LacrosMode GetLacrosModeInternal(const User* user, + LacrosAvailability lacros_availability, + bool check_migration_status) { + if (!IsLacrosAllowedInternal(user, lacros_availability)) { + return LacrosMode::kDisabled; + } + + DCHECK(user); + + // If profile migration is enabled, the completion of it is necessary for + // Lacros to be enabled. + if (check_migration_status && IsProfileMigrationEnabled()) { + PrefService* local_state = g_browser_process->local_state(); + // Note that local_state can be nullptr in tests. + if (local_state && + !IsCopyOrMoveProfileMigrationCompletedForUser( + local_state, + UserManager::Get()->GetPrimaryUser()->username_hash())) { + // If migration has not been completed, do not enable lacros. + return LacrosMode::kDisabled; + } + } + + // Lacros-chrome will always be the primary browser if Lacros is enabled + // in Kiosk session. + bool in_kiosk = user->GetType() == user_manager::USER_TYPE_KIOSK_APP || + user->GetType() == user_manager::USER_TYPE_WEB_KIOSK_APP; + + // Check the + switch (lacros_availability) { + case LacrosAvailability::kUserChoice: + break; + case LacrosAvailability::kLacrosDisallowed: + NOTREACHED(); // Guarded by IsLacrosAllowedInternal. + return LacrosMode::kDisabled; + case LacrosAvailability::kSideBySide: + // In Kiosk-mode, even if policy says side-by-side, it is stepped + // into at least LacrosPrimary. This is for backward compatibility + // for transition period. + if (!in_kiosk) { + return LacrosMode::kSideBySide; + } + + // Note that for this *ForMigration variant, since there might not be a + // logged in user yet, the user's email address has to be passed + // explicitly. Normally, policy should override Finch. Due to + // complications in the Google rollout, in the short term Finch will + // override policy if Finch is enabling this feature. + if (IsGoogleInternal(user) && + base::FeatureList::IsEnabled(ash::features::kLacrosOnly)) { + return LacrosMode::kOnly; + } + return LacrosMode::kPrimary; + case LacrosAvailability::kLacrosPrimary: + // Same as Side-By-Side policy. Please find the comment above. + if (IsGoogleInternal(user) && + base::FeatureList::IsEnabled(ash::features::kLacrosOnly)) { + return LacrosMode::kOnly; + } + return LacrosMode::kPrimary; + case LacrosAvailability::kLacrosOnly: + return LacrosMode::kOnly; + } + + if (!base::FeatureList::IsEnabled(ash::features::kLacrosSupport)) { + return LacrosMode::kDisabled; + } + + if (!base::FeatureList::IsEnabled(ash::features::kLacrosPrimary) && + !in_kiosk) { + return LacrosMode::kSideBySide; + } + + if (!base::FeatureList::IsEnabled(ash::features::kLacrosOnly)) { + return LacrosMode::kPrimary; + } + + return LacrosMode::kOnly; +} + +bool IsLacrosEnabledInternal(const User* user, + LacrosAvailability lacros_availability, + bool check_migration_status) { + LacrosMode mode = + GetLacrosModeInternal(user, lacros_availability, check_migration_status); + switch (mode) { + case LacrosMode::kDisabled: + return false; + case LacrosMode::kSideBySide: + case LacrosMode::kPrimary: + case LacrosMode::kOnly: + return true; + } +} + +bool IsLacrosPrimaryBrowserInternal(const User* user, + LacrosAvailability lacros_availability, + bool check_migration_status) { + LacrosMode mode = + GetLacrosModeInternal(user, lacros_availability, check_migration_status); + switch (mode) { + case LacrosMode::kDisabled: + case LacrosMode::kSideBySide: + return false; + case LacrosMode::kPrimary: + case LacrosMode::kOnly: + return true; + } +} + +// This is equivalent to "not LacrosOnly". +bool IsAshWebBrowserEnabledInternal(const User* user, + LacrosAvailability lacros_availability, + bool check_migration_status) { + LacrosMode mode = + GetLacrosModeInternal(user, lacros_availability, check_migration_status); + switch (mode) { + case LacrosMode::kDisabled: + case LacrosMode::kSideBySide: + case LacrosMode::kPrimary: + return true; + case LacrosMode::kOnly: + return false; + } +} + // Called from `IsDataWipeRequired()` or `IsDataWipeRequiredForTesting()`. // data_version` is the version of last data wipe. `current_version` is the // version of ash-chrome. `required_version` is the version that introduces some @@ -360,60 +487,16 @@ } bool IsLacrosEnabled() { - if (!IsLacrosAllowedInternal(GetPrimaryUser(), - GetCachedLacrosAvailability())) { - return false; - } - - // If profile migration is enabled, the completion of it is necessary for - // Lacros to be enabled. - if (IsProfileMigrationEnabled()) { - PrefService* local_state = g_browser_process->local_state(); - // Note that local_state can be nullptr in tests. - if (local_state && - !IsCopyOrMoveProfileMigrationCompletedForUser( - local_state, - UserManager::Get()->GetPrimaryUser()->username_hash())) { - // If migration has not been completed, do not enable lacros. - return false; - } - } - - switch (GetCachedLacrosAvailability()) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - return false; - case LacrosAvailability::kSideBySide: - case LacrosAvailability::kLacrosPrimary: - case LacrosAvailability::kLacrosOnly: - return true; - } - - return base::FeatureList::IsEnabled(ash::features::kLacrosSupport); + return IsLacrosEnabledInternal(GetPrimaryUser(), + GetCachedLacrosAvailability(), + /*check_migration_status=*/true); } bool IsLacrosEnabledForMigration(const User* user, PolicyInitState policy_init_state) { - LacrosAvailability lacros_availability = - GetLacrosAvailability(user, policy_init_state); - - if (!IsLacrosAllowedInternal(user, lacros_availability)) { - return false; - } - - switch (lacros_availability) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - return false; - case LacrosAvailability::kSideBySide: - case LacrosAvailability::kLacrosPrimary: - case LacrosAvailability::kLacrosOnly: - return true; - } - - return base::FeatureList::IsEnabled(ash::features::kLacrosSupport); + return IsLacrosEnabledInternal(user, + GetLacrosAvailability(user, policy_init_state), + /*check_migration_status=*/false); } bool IsProfileMigrationEnabled() { @@ -450,141 +533,34 @@ } bool IsAshWebBrowserEnabled() { - // Note that if you are updating this function, please also update the - // *ForMigration variant to keep the logics consistent. - // If Lacros is not a primary browser, Ash browser is always enabled. - if (!IsLacrosPrimaryBrowser()) - return true; - - switch (GetCachedLacrosAvailability()) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - return true; - case LacrosAvailability::kSideBySide: - case LacrosAvailability::kLacrosPrimary: - // Normally, policy should override Finch. Due to complications in the - // Google rollout, in the short term Finch will override policy if Finch - // is enabling this feature. - if (IsGoogleInternal(UserManager::Get()->GetPrimaryUser()) && - base::FeatureList::IsEnabled(ash::features::kLacrosOnly)) { - return false; - } - return true; - case LacrosAvailability::kLacrosOnly: - return false; - } - - return !base::FeatureList::IsEnabled(ash::features::kLacrosOnly); + return IsAshWebBrowserEnabledInternal(GetPrimaryUser(), + GetCachedLacrosAvailability(), + /*check_migration_status=*/true); } bool IsAshWebBrowserEnabledForMigration(const user_manager::User* user, PolicyInitState policy_init_state) { - // If Lacros is not a primary browser, Ash browser is always enabled. - if (!IsLacrosPrimaryBrowserForMigration(user, policy_init_state)) - return true; - - LacrosAvailability lacros_availability = - GetLacrosAvailability(user, policy_init_state); - - switch (lacros_availability) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - return true; - case LacrosAvailability::kSideBySide: - case LacrosAvailability::kLacrosPrimary: - // Note that for this *ForMigration variant, since there might not be a - // logged in user yet, the user's email address has to be passed - // explicitly. Normally, policy should override Finch. Due to - // complications in the Google rollout, in the short term Finch will - // override policy if Finch is enabling this feature. - if (gaia::IsGoogleInternalAccountEmail( - user->GetAccountId().GetUserEmail()) && - base::FeatureList::IsEnabled(ash::features::kLacrosOnly)) { - return false; - } - return true; - case LacrosAvailability::kLacrosOnly: - return false; - } - - return !base::FeatureList::IsEnabled(ash::features::kLacrosOnly); + return IsAshWebBrowserEnabledInternal( + user, GetLacrosAvailability(user, policy_init_state), + /*check_migration_status=*/false); } bool IsLacrosPrimaryBrowser() { - if (!IsLacrosEnabled()) - return false; - - // Lacros-chrome will always be the primary browser if Lacros is enabled in - // Kiosk session. - if (UserManager::Get()->IsLoggedInAsWebKioskApp() || - UserManager::Get()->IsLoggedInAsKioskApp()) { - return true; - } - - if (!IsLacrosPrimaryBrowserAllowed()) - return false; - - switch (GetCachedLacrosAvailability()) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - NOTREACHED(); - return false; - case LacrosAvailability::kSideBySide: - return false; - case LacrosAvailability::kLacrosPrimary: - case LacrosAvailability::kLacrosOnly: - return true; - } - - return base::FeatureList::IsEnabled(ash::features::kLacrosPrimary); + return IsLacrosPrimaryBrowserInternal(GetPrimaryUser(), + GetCachedLacrosAvailability(), + /*check_migration_status=*/true); } bool IsLacrosPrimaryBrowserForMigration(const user_manager::User* user, PolicyInitState policy_init_state) { - if (!IsLacrosEnabledForMigration(user, policy_init_state)) - return false; - - // Lacros-chrome will always be the primary browser if Lacros is enabled in - // web Kiosk session. - if (user->GetType() == user_manager::USER_TYPE_KIOSK_APP || - user->GetType() == user_manager::USER_TYPE_WEB_KIOSK_APP) { - return true; - } - - LacrosAvailability lacros_availability = - GetLacrosAvailability(user, policy_init_state); - - if (!IsLacrosAllowedInternal(user, lacros_availability)) { - return false; - } - - switch (lacros_availability) { - case LacrosAvailability::kUserChoice: - break; - case LacrosAvailability::kLacrosDisallowed: - NOTREACHED(); - return false; - case LacrosAvailability::kSideBySide: - return false; - case LacrosAvailability::kLacrosPrimary: - case LacrosAvailability::kLacrosOnly: - return true; - } - - return base::FeatureList::IsEnabled(ash::features::kLacrosPrimary); + return IsLacrosPrimaryBrowserInternal( + user, GetLacrosAvailability(user, policy_init_state), + /*check_migration_status=*/false); } LacrosMode GetLacrosMode() { - if (!IsAshWebBrowserEnabled()) - return LacrosMode::kOnly; - if (IsLacrosPrimaryBrowser()) - return LacrosMode::kPrimary; - if (IsLacrosEnabled()) - return LacrosMode::kSideBySide; - return LacrosMode::kDisabled; + return GetLacrosModeInternal(GetPrimaryUser(), GetCachedLacrosAvailability(), + /*check_migration_status=*/true); } bool IsLacrosPrimaryBrowserAllowed() {
diff --git a/chrome/browser/ash/crosapi/crosapi_util.cc b/chrome/browser/ash/crosapi/crosapi_util.cc index 0f298f32..0460d36 100644 --- a/chrome/browser/ash/crosapi/crosapi_util.cc +++ b/chrome/browser/ash/crosapi/crosapi_util.cc
@@ -176,6 +176,8 @@ // Capability to register observers for extension controlled prefs via the // prefs api. constexpr char kExtensionControlledPrefObserversCapability[] = "crbug/1334985"; +// Capability to always use ConfirmComposition for input methods. +constexpr char kAlwaysConfirmCompositionCapability[] = "b/265853952"; // Returns the vector containing policy data of the device account. In case of // an error, returns nullopt. @@ -570,9 +572,17 @@ ash::features:: IsHoldingSpaceInProgressDownloadsNotificationSuppressionEnabled(); - params->ash_capabilities = {{kBrowserManagerReloadBrowserCapability, - kSharedStoragePrefsCapability, - kExtensionControlledPrefObserversCapability}}; + std::vector<std::string> ash_capabilities = { + kBrowserManagerReloadBrowserCapability, + kSharedStoragePrefsCapability, + kExtensionControlledPrefObserversCapability, + }; + // TODO(b/265853952): Remove this once kAlwaysConfirmComposition is enabled by + // default. + if (base::FeatureList::IsEnabled(features::kAlwaysConfirmComposition)) { + ash_capabilities.push_back(kAlwaysConfirmCompositionCapability); + } + params->ash_capabilities = {std::move(ash_capabilities)}; params->lacros_selection = GetLacrosSelection(lacros_selection);
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.cc new file mode 100644 index 0000000..264e43c --- /dev/null +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.cc
@@ -0,0 +1,34 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h" + +#include <string> + +#include "base/check.h" +#include "chrome/browser/apps/app_service/app_service_proxy_ash.h" +#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "components/services/app_service/public/cpp/app_update.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace reporting { + +absl::optional<std::string> GetPublisherIdForApp(const std::string& app_id, + Profile* profile) { + DCHECK(profile); + DCHECK( + ::apps::AppServiceProxyFactory::IsAppServiceAvailableForProfile(profile)); + absl::optional<std::string> publisher_id = absl::nullopt; + ::apps::AppServiceProxyFactory::GetForProfile(profile) + ->AppRegistryCache() + .ForOneApp(app_id, [&publisher_id](const ::apps::AppUpdate& app_update) { + if (!app_update.PublisherId().empty()) { + publisher_id = app_update.PublisherId(); + } + }); + return publisher_id; +} + +} // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h new file mode 100644 index 0000000..d976391d --- /dev/null +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h
@@ -0,0 +1,20 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_POLICY_REPORTING_METRICS_REPORTING_APPS_APP_METRIC_REPORTING_UTILS_H_ +#define CHROME_BROWSER_ASH_POLICY_REPORTING_METRICS_REPORTING_APPS_APP_METRIC_REPORTING_UTILS_H_ + +#include "chrome/browser/profiles/profile.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace reporting { + +// Retrieves the app publisher id from the app registry cache using the +// specified profile if one exists. +absl::optional<std::string> GetPublisherIdForApp(const std::string& app_id, + Profile* profile); + +} // namespace reporting + +#endif // CHROME_BROWSER_ASH_POLICY_REPORTING_METRICS_REPORTING_APPS_APP_METRIC_REPORTING_UTILS_H_
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils_unittest.cc new file mode 100644 index 0000000..82f39867 --- /dev/null +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils_unittest.cc
@@ -0,0 +1,52 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h" + +#include <string> + +#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" +#include "chrome/browser/apps/app_service/metrics/app_platform_metrics_service_test_base.h" +#include "components/services/app_service/public/cpp/app_types.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +using ::testing::StrEq; + +namespace reporting { +namespace { + +constexpr char kTestAppId[] = "TestApp"; +constexpr char kTestAppPublisherId[] = "com.google.test"; + +class AppMetricReportingUtilsTest + : public ::apps::AppPlatformMetricsServiceTestBase {}; + +TEST_F(AppMetricReportingUtilsTest, AppWithNoPublisherId) { + InstallOneApp(kTestAppId, ::apps::AppType::kChromeApp, /*publisher_id=*/"", + ::apps::Readiness::kReady, + ::apps::InstallSource::kChromeWebStore); + const absl::optional<std::string> publisher_id = + GetPublisherIdForApp(kTestAppId, profile()); + EXPECT_FALSE(publisher_id.has_value()); +} + +TEST_F(AppMetricReportingUtilsTest, AppWithPublisherId) { + InstallOneApp(kTestAppId, ::apps::AppType::kArc, kTestAppPublisherId, + ::apps::Readiness::kReady, ::apps::InstallSource::kPlayStore); + const absl::optional<std::string> publisher_id = + GetPublisherIdForApp(kTestAppId, profile()); + ASSERT_TRUE(publisher_id.has_value()); + EXPECT_THAT(publisher_id.value(), StrEq(kTestAppPublisherId)); +} + +TEST_F(AppMetricReportingUtilsTest, UnregisteredApp) { + const absl::optional<std::string> publisher_id = + GetPublisherIdForApp(kTestAppId, profile()); + EXPECT_FALSE(publisher_id.has_value()); +} + +} // namespace +} // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.cc index f951c5fb..46bd241 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.cc
@@ -8,7 +8,10 @@ #include "base/memory/ptr_util.h" #include "base/time/time.h" +#include "chrome/browser/apps/app_service/app_service_proxy_ash.h" +#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" #include "chrome/browser/apps/app_service/metrics/app_platform_metrics.h" +#include "chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_metric_reporting_utils.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_platform_metrics_retriever.h" #include "chrome/browser/ash/policy/reporting/metrics_reporting/metric_reporting_prefs.h" #include "chrome/browser/chromeos/reporting/metric_default_utils.h" @@ -18,6 +21,7 @@ #include "components/services/app_service/public/cpp/app_types.h" #include "components/services/app_service/public/protos/app_types.pb.h" #include "content/public/browser/browser_thread.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace reporting { @@ -119,6 +123,7 @@ ::apps::GetAppTypeName(profile_.get(), app_type, app_id, ::apps::LaunchContainer::kLaunchContainerNone); usage_time.reporting_usage_time = running_time; + MaybeSetAppPublisherId(usage_time); usage_dict_pref->SetByDottedPath(instance_id_string, usage_time.ConvertToDict()); return; @@ -128,8 +133,24 @@ ::apps::AppPlatformMetrics::UsageTime usage_time( *usage_dict_pref->FindByDottedPath(instance_id_string)); usage_time.reporting_usage_time += running_time; + MaybeSetAppPublisherId(usage_time); usage_dict_pref->SetByDottedPath(instance_id_string, usage_time.ConvertToDict()); } +void AppUsageObserver::MaybeSetAppPublisherId( + ::apps::AppPlatformMetrics::UsageTime& usage_time) { + DCHECK_CURRENTLY_ON(::content::BrowserThread::UI); + DCHECK(profile_); + if (!usage_time.app_publisher_id.empty()) { + // We are already tracking the app publisher id. + return; + } + if (const absl::optional<std::string> app_publisher_id = + GetPublisherIdForApp(usage_time.app_id, profile_.get()); + app_publisher_id.has_value()) { + usage_time.app_publisher_id = app_publisher_id.value(); + } +} + } // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.h b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.h index d622e1b..ccaae2de 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.h +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer.h
@@ -71,6 +71,11 @@ const base::UnguessableToken& instance_id, const base::TimeDelta& running_time); + // Attempts to retrieve and set the app publisher id if one is not being + // tracked already. + void MaybeSetAppPublisherId( + ::apps::AppPlatformMetrics::UsageTime& usage_time); + // Weak pointer to the user profile. Used to save usage data to the user pref // store. const base::WeakPtr<Profile> profile_;
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer_unittest.cc index 854bde0..53fd8c5 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer_unittest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_observer_unittest.cc
@@ -34,6 +34,7 @@ namespace { constexpr char kTestAppId[] = "TestApp"; +constexpr char kTestAppPublisherId[] = "com.google.test"; constexpr base::TimeDelta kAppUsageCollectionInterval = base::Minutes(5); // Mock retriever for the `AppPlatformMetrics` component. @@ -63,7 +64,7 @@ {syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY}); // Pre-install app so it can be used by tests to simulate usage. - InstallOneApp(kTestAppId, ::apps::AppType::kArc, /*publisher_id=*/"", + InstallOneApp(kTestAppId, ::apps::AppType::kArc, kTestAppPublisherId, ::apps::Readiness::kReady, ::apps::InstallSource::kPlayStore); // Set up `AppUsageObserver` with relevant test params. @@ -105,6 +106,9 @@ EXPECT_THAT(*usage_dict_pref.FindDict(instance_id.ToString()) ->FindString(::apps::kUsageTimeAppIdKey), StrEq(kTestAppId)); + EXPECT_THAT(*usage_dict_pref.FindDict(instance_id.ToString()) + ->FindString(::apps::kUsageTimeAppPublisherIdKey), + StrEq(kTestAppPublisherId)); EXPECT_THAT(base::ValueToTimeDelta( usage_dict_pref.FindDict(instance_id.ToString()) ->Find(::apps::kReportingUsageTimeDurationKey)),
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler.cc index 0604dd6..b90ecc9 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler.h" #include <memory> +#include <string> #include "base/memory/weak_ptr.h" #include "base/time/time.h" @@ -67,10 +68,17 @@ ::apps::AppType app_type = ::apps::GetAppType(profile_.get(), usage_time.app_id); + std::string public_app_id = usage_time.app_id; + if (!usage_time.app_publisher_id.empty()) { + // Use publisher id if there is one set. Mostly needed for android apps, + // web apps, etc. because they include public app identifiers. + public_app_id = usage_time.app_publisher_id; + } + AppUsageData::AppUsage* const app_usage = app_usage_data->mutable_app_usage()->Add(); app_usage->set_app_instance_id(usage_it.first); - app_usage->set_app_id(usage_time.app_id); + app_usage->set_app_id(public_app_id); app_usage->set_app_type( ::apps::ConvertAppTypeToProtoApplicationType(app_type)); app_usage->set_running_time_ms(
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc index 3dadd53..2fb95e8 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_browsertest.cc
@@ -69,7 +69,7 @@ constexpr char kDMToken[] = "token"; // Standalone webapp start URL. -constexpr char kWebAppUrl[] = "https://test.example.com"; +constexpr char kWebAppUrl[] = "https://test.example.com/"; // App usage UKM entry name. constexpr char kAppUsageUKMEntryName[] = "ChromeOSApp.UsageTime"; @@ -190,9 +190,9 @@ } void VerifyAppUsage(const AppUsageData::AppUsage& app_usage, - const ::web_app::AppId& app_id, const base::TimeDelta& running_time) { EXPECT_TRUE(app_usage.has_app_instance_id()); + EXPECT_THAT(app_usage.app_id(), StrEq(kWebAppUrl)); EXPECT_THAT(app_usage.app_type(), Eq(::apps::ApplicationType::APPLICATION_TYPE_WEB)); @@ -305,8 +305,8 @@ const auto& app_usage_data = metric_data.telemetry_data().app_telemetry().app_usage_data(); ASSERT_THAT(app_usage_data.app_usage().size(), Eq(1)); - const auto& app_usage = app_usage_data.app_usage().at(0); - VerifyAppUsage(app_usage, app_id, kAppUsageDuration); + const auto& app_usage = app_usage_data.app_usage(0); + VerifyAppUsage(app_usage, kAppUsageDuration); // Trigger upload to UKM by advancing the timer. test::MockClock::Get().Advance(kAppUsageUKMReportingInterval); @@ -353,7 +353,7 @@ const auto& app_usage_data = metric_data.telemetry_data().app_telemetry().app_usage_data(); ASSERT_THAT(app_usage_data.app_usage().size(), Eq(1)); - VerifyAppUsage(app_usage_data.app_usage().at(0), app_id, kAppUsageDuration); + VerifyAppUsage(app_usage_data.app_usage(0), kAppUsageDuration); // Advance timer and verify no data is reported to UKM. test::MockClock::Get().Advance(kAppUsageUKMReportingInterval); @@ -416,8 +416,7 @@ const auto& app_usage_data = metric_data.telemetry_data().app_telemetry().app_usage_data(); ASSERT_THAT(app_usage_data.app_usage().size(), Eq(1)); - const auto& app_usage = app_usage_data.app_usage().at(0); - VerifyAppUsage(app_usage, app_id, kAppUsageDuration); + VerifyAppUsage(app_usage_data.app_usage(0), kAppUsageDuration); } } // namespace
diff --git a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_unittest.cc b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_unittest.cc index 6a44b805..61d300f 100644 --- a/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_unittest.cc +++ b/chrome/browser/ash/policy/reporting/metrics_reporting/apps/app_usage_telemetry_sampler_unittest.cc
@@ -44,6 +44,7 @@ constexpr char kTestUserEmail[] = "test@test.com"; constexpr char kTestAppId[] = "TestApp"; +constexpr char kTestAppPublisherId[] = "com.google.test"; // Checks equality of the two protos in an std::tuple. Useful for matching two // two protos using ::testing::Pointwise or ::testing::UnorderedPointwise. @@ -95,6 +96,7 @@ // Create a new entry in the pref store with the specified running time. ::apps::AppPlatformMetrics::UsageTime usage_time; usage_time.app_id = kTestAppId; + usage_time.app_publisher_id = kTestAppPublisherId; usage_time.reporting_usage_time = usage_duration; usage_dict_pref->SetByDottedPath(instance_id_string, usage_time.ConvertToDict()); @@ -131,7 +133,7 @@ const base::UnguessableToken& instance_id, const base::TimeDelta& running_time) const { AppUsageData::AppUsage app_usage; - app_usage.set_app_id(kTestAppId); + app_usage.set_app_id(kTestAppPublisherId); app_usage.set_app_type(::apps::ApplicationType::APPLICATION_TYPE_UNKNOWN); app_usage.set_app_instance_id(instance_id.ToString()); app_usage.set_running_time_ms(running_time.InMilliseconds());
diff --git a/chrome/browser/ash/power/ml/OWNERS b/chrome/browser/ash/power/ml/OWNERS index fa3c42b..f4a55bd 100644 --- a/chrome/browser/ash/power/ml/OWNERS +++ b/chrome/browser/ash/power/ml/OWNERS
@@ -1 +1,2 @@ amoylan@chromium.org +alanlxl@chromium.org
diff --git a/chrome/browser/ash/scalable_iph/BUILD.gn b/chrome/browser/ash/scalable_iph/BUILD.gn index 11715a5..bd3a26b7 100644 --- a/chrome/browser/ash/scalable_iph/BUILD.gn +++ b/chrome/browser/ash/scalable_iph/BUILD.gn
@@ -13,16 +13,33 @@ ] deps = [ + ":scalable_iph_delegate_impl", "//base", "//chrome/browser", "//chrome/browser/profiles:profile", "//chromeos/ash/components/scalable_iph", + "//chromeos/ash/components/scalable_iph:scalable_iph_delegate", "//components/feature_engagement/public", + "//components/keyed_service/content", "//components/keyed_service/core", "//content/public/browser", ] } +source_set("scalable_iph_delegate_impl") { + sources = [ + "scalable_iph_delegate_impl.cc", + "scalable_iph_delegate_impl.h", + ] + + deps = [ + "//chrome/browser/profiles:profile", + "//chromeos/ash/components/scalable_iph:iph_session", + "//chromeos/ash/components/scalable_iph:scalable_iph_delegate", + "//components/keyed_service/core", + ] +} + source_set("browser_test_base") { testonly = true @@ -32,12 +49,15 @@ ] deps = [ + ":mock_scalable_iph_delegate", ":scalable_iph_factory", "//base", "//chrome/browser", "//chrome/browser/profiles:profile", "//chrome/browser/ui", "//chrome/test:test_support_ui", + "//chromeos/ash/components/scalable_iph", + "//chromeos/ash/components/scalable_iph:scalable_iph_delegate", "//components/feature_engagement/public", "//components/feature_engagement/test:test_support", "//components/keyed_service/content", @@ -46,3 +66,19 @@ "//testing/gmock", ] } + +source_set("mock_scalable_iph_delegate") { + testonly = true + + sources = [ + "mock_scalable_iph_delegate.cc", + "mock_scalable_iph_delegate.h", + ] + + deps = [ + "//chromeos/ash/components/scalable_iph:iph_session", + "//chromeos/ash/components/scalable_iph:scalable_iph_delegate", + "//components/keyed_service/core", + "//testing/gmock", + ] +}
diff --git a/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.cc b/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.cc new file mode 100644 index 0000000..e3356b8 --- /dev/null +++ b/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.cc
@@ -0,0 +1,14 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h" + +namespace ash { +namespace test { + +MockScalableIphDelegate::MockScalableIphDelegate() = default; +MockScalableIphDelegate::~MockScalableIphDelegate() = default; + +} // namespace test +} // namespace ash
diff --git a/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h b/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h new file mode 100644 index 0000000..dff81e7 --- /dev/null +++ b/chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h
@@ -0,0 +1,39 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_SCALABLE_IPH_MOCK_SCALABLE_IPH_DELEGATE_H_ +#define CHROME_BROWSER_ASH_SCALABLE_IPH_MOCK_SCALABLE_IPH_DELEGATE_H_ + +#include <memory> + +#include "chromeos/ash/components/scalable_iph/iph_session.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" +#include "components/keyed_service/core/keyed_service.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ash { +namespace test { + +class MockScalableIphDelegate : public scalable_iph::ScalableIphDelegate { + public: + MockScalableIphDelegate(); + ~MockScalableIphDelegate() override; + + MOCK_METHOD(void, + ShowBubble, + (const scalable_iph::ScalableIphDelegate::BubbleParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session), + (override)); + MOCK_METHOD( + void, + ShowNotification, + (const scalable_iph::ScalableIphDelegate::NotificationParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session), + (override)); +}; + +} // namespace test +} // namespace ash + +#endif // CHROME_BROWSER_ASH_SCALABLE_IPH_MOCK_SCALABLE_IPH_DELEGATE_H_
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.cc b/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.cc index 8b0557b..1fa7ca7 100644 --- a/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.cc +++ b/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.cc
@@ -7,10 +7,14 @@ #include <memory> #include "base/functional/bind.h" +#include "chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h" +#include "chrome/browser/ash/scalable_iph/scalable_iph_factory.h" #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/browser/browser_context.h" @@ -36,8 +40,8 @@ // before command lines are set, etc. subscription_ = BrowserContextDependencyManager::GetInstance() - ->RegisterCreateServicesCallbackForTesting( - base::BindRepeating(&ScalableIphBrowserTestBase::CreateServices)); + ->RegisterCreateServicesCallbackForTesting(base::BindRepeating( + &ScalableIphBrowserTestBase::SetTestingFactories)); InProcessBrowserTest::SetUp(); } @@ -60,24 +64,51 @@ ON_CALL(*mock_tracker_, IsInitialized).WillByDefault(testing::Return(true)); + CHECK(ScalableIphFactory::GetInstance()->has_delegate_factory_for_testing()) + << "This test uses MockScalableIphDelegate. A factory for testing must " + "be set."; + scalable_iph::ScalableIph* scalable_iph = + ScalableIphFactory::GetForProfile(browser()->profile()); + CHECK(scalable_iph); + + mock_delegate_ = static_cast<test::MockScalableIphDelegate*>( + scalable_iph->delegate_for_testing()); + CHECK(mock_delegate_); + InProcessBrowserTest::SetUpOnMainThread(); } void ScalableIphBrowserTestBase::TearDownOnMainThread() { - // We are going to release a reference to a MockTracker below. Verify the - // expectation in advance to have a predictable behavior. + // We are going to release references to mock objects below. Verify the + // expectations in advance to have a predictable behavior. testing::Mock::VerifyAndClearExpectations(mock_tracker_); mock_tracker_ = nullptr; + testing::Mock::VerifyAndClearExpectations(mock_delegate_); + mock_delegate_ = nullptr; InProcessBrowserTest::TearDownOnMainThread(); } // static -void ScalableIphBrowserTestBase::CreateServices( +void ScalableIphBrowserTestBase::SetTestingFactories( content::BrowserContext* browser_context) { feature_engagement::TrackerFactory::GetInstance()->SetTestingFactory( browser_context, base::BindRepeating(&ScalableIphBrowserTestBase::CreateMockTracker)); + + ScalableIphFactory* scalable_iph_factory = ScalableIphFactory::GetInstance(); + CHECK(scalable_iph_factory); + + // This method can be called more than once for a single browser context. + if (scalable_iph_factory->has_delegate_factory_for_testing()) { + return; + } + + // This is NOT a testing factory of a keyed service factory .But the delegate + // factory is called from the factory of `ScalableIphFactory`. Set this at the + // same time. + scalable_iph_factory->SetDelegateFactoryForTesting( + base::BindRepeating(&ScalableIphBrowserTestBase::CreateMockDelegate)); } // static @@ -86,4 +117,10 @@ return std::make_unique<feature_engagement::test::MockTracker>(); } +// static +std::unique_ptr<scalable_iph::ScalableIphDelegate> +ScalableIphBrowserTestBase::CreateMockDelegate() { + return std::make_unique<test::MockScalableIphDelegate>(); +} + } // namespace ash
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.h b/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.h index 19bbb87..aac2396 100644 --- a/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.h +++ b/chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.h
@@ -9,6 +9,7 @@ #include "base/callback_list.h" #include "base/memory/raw_ptr.h" +#include "chrome/browser/ash/scalable_iph/mock_scalable_iph_delegate.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/feature_engagement/test/mock_tracker.h" #include "components/keyed_service/core/keyed_service.h" @@ -27,14 +28,18 @@ feature_engagement::test::MockTracker* mock_tracker() { return mock_tracker_; } + test::MockScalableIphDelegate* mock_delegate() { return mock_delegate_; } private: - static void CreateServices(content::BrowserContext* browser_context); + static void SetTestingFactories(content::BrowserContext* browser_context); static std::unique_ptr<KeyedService> CreateMockTracker( content::BrowserContext* browser_context); + static std::unique_ptr<scalable_iph::ScalableIphDelegate> + CreateMockDelegate(); base::CallbackListSubscription subscription_; raw_ptr<feature_engagement::test::MockTracker> mock_tracker_; + raw_ptr<test::MockScalableIphDelegate> mock_delegate_; }; } // namespace ash
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_browsertest.cc b/chrome/browser/ash/scalable_iph/scalable_iph_browsertest.cc index 95b5bdc..fa1f55e1 100644 --- a/chrome/browser/ash/scalable_iph/scalable_iph_browsertest.cc +++ b/chrome/browser/ash/scalable_iph/scalable_iph_browsertest.cc
@@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/feature_list.h" #include "chrome/browser/ash/scalable_iph/scalable_iph_browser_test_base.h" #include "chrome/browser/ash/scalable_iph/scalable_iph_factory.h" #include "chrome/browser/ui/browser.h" +#include "chromeos/ash/components/scalable_iph/iph_session.h" #include "chromeos/ash/components/scalable_iph/scalable_iph.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" #include "components/feature_engagement/test/mock_tracker.h" #include "content/public/test/browser_test.h" #include "testing/gmock/include/gmock/gmock.h" @@ -14,6 +17,10 @@ using ScalableIphBrowserTest = ash::ScalableIphBrowserTestBase; +BASE_FEATURE(kScalableIphTest, + "ScalableIphTest", + base::FEATURE_DISABLED_BY_DEFAULT); + } // namespace IN_PROC_BROWSER_TEST_F(ScalableIphBrowserTest, RecordEvent) { @@ -24,5 +31,32 @@ scalable_iph->RecordEvent(scalable_iph::ScalableIph::Event::kFiveMinTick); } +IN_PROC_BROWSER_TEST_F(ScalableIphBrowserTest, InvokeIph) { + ON_CALL(*mock_tracker(), ShouldTriggerHelpUI) + .WillByDefault([](const base::Feature& feature) { + return &feature == &kScalableIphTest; + }); + + // Tracker::Dismissed must be called when an IPH gets dismissed. + EXPECT_CALL(*mock_tracker(), Dismissed(::testing::Ref(kScalableIphTest))); + + scalable_iph::ScalableIphDelegate::BubbleParams expected_params; + EXPECT_CALL(*mock_delegate(), + ShowBubble(::testing::Eq(expected_params), ::testing::NotNull())) + .WillOnce( + [](const scalable_iph::ScalableIphDelegate::BubbleParams& params, + std::unique_ptr<scalable_iph::IphSession> session) { + // Simulate that an IPH gets dismissed. + session.reset(); + }); + + scalable_iph::ScalableIph* scalable_iph = + ash::ScalableIphFactory::GetForProfile(browser()->profile()); + std::vector<const base::Feature*> features = {&kScalableIphTest}; + scalable_iph->OverrideFeatureListForTesting(features); + + scalable_iph->RecordEvent(scalable_iph::ScalableIph::Event::kFiveMinTick); +} + +// TODO(b/284053005): Add a test case for available profiles. // TODO(b/284053005): Add a test case for invalid event name. -// TODO(b/284053005): Add a test case for checking trigger condition.
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.cc b/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.cc new file mode 100644 index 0000000..b015c48 --- /dev/null +++ b/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.cc
@@ -0,0 +1,34 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.h" + +#include <memory> + +#include "chrome/browser/profiles/profile.h" +#include "chromeos/ash/components/scalable_iph/iph_session.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" + +namespace ash { + +ScalableIphDelegateImpl::ScalableIphDelegateImpl(Profile* profile) + : profile_(profile) {} + +// Remember NOT to interact with `iph_session` from the destructor. See the +// comment of `ScalableIphDelegate::ShowBubble` for details. +ScalableIphDelegateImpl::~ScalableIphDelegateImpl() = default; + +void ScalableIphDelegateImpl::ShowBubble( + const scalable_iph::ScalableIphDelegate::BubbleParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session) { + // TODO(b/284158855): Add implementation. +} + +void ScalableIphDelegateImpl::ShowNotification( + const scalable_iph::ScalableIphDelegate::NotificationParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session) { + // TODO(b/284158831): Add implementation. +} + +} // namespace ash
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.h b/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.h new file mode 100644 index 0000000..28eb01f --- /dev/null +++ b/chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.h
@@ -0,0 +1,35 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_IMPL_H_ +#define CHROME_BROWSER_ASH_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_IMPL_H_ + +#include <memory> + +#include "chrome/browser/profiles/profile.h" +#include "chromeos/ash/components/scalable_iph/iph_session.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" +#include "components/keyed_service/core/keyed_service.h" + +namespace ash { + +class ScalableIphDelegateImpl : public scalable_iph::ScalableIphDelegate { + public: + explicit ScalableIphDelegateImpl(Profile* profile); + ~ScalableIphDelegateImpl() override; + + // scalable_iph::ScalableIphDelegate: + void ShowBubble( + const BubbleParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session) override; + void ShowNotification( + const NotificationParams& params, + std::unique_ptr<scalable_iph::IphSession> iph_session) override; + + private: + raw_ptr<Profile> profile_; +}; +} // namespace ash + +#endif // CHROME_BROWSER_ASH_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_IMPL_H_
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_factory.cc b/chrome/browser/ash/scalable_iph/scalable_iph_factory.cc index 7631d69..2d51847 100644 --- a/chrome/browser/ash/scalable_iph/scalable_iph_factory.cc +++ b/chrome/browser/ash/scalable_iph/scalable_iph_factory.cc
@@ -5,10 +5,14 @@ #include "chrome/browser/ash/scalable_iph/scalable_iph_factory.h" #include "base/no_destructor.h" +#include "chrome/browser/ash/scalable_iph/scalable_iph_delegate_impl.h" #include "chrome/browser/feature_engagement/tracker_factory.h" -#include "chrome/browser/profiles/profile_keyed_service_factory.h" +#include "chrome/browser/profiles/profile.h" #include "chromeos/ash/components/scalable_iph/scalable_iph.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" #include "components/feature_engagement/public/tracker.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/browser/browser_context.h" @@ -19,7 +23,12 @@ } ScalableIphFactory::ScalableIphFactory() - : ProfileKeyedServiceFactory(kScalableIphServiceName) { + : BrowserContextKeyedServiceFactory( + kScalableIphServiceName, + BrowserContextDependencyManager::GetInstance()) { + CHECK(delegate_testing_factory_.is_null()) + << "Testing factory must be null at initialization."; + DependsOn(feature_engagement::TrackerFactory::GetInstance()); } @@ -35,14 +44,55 @@ GetInstance()->GetServiceForBrowserContext(profile, /*create=*/true)); } +void ScalableIphFactory::SetDelegateFactoryForTesting( + DelegateTestingFactory delegate_testing_factory) { + CHECK(delegate_testing_factory_.is_null()) + << "It's NOT allowed to set DelegateTestingFactory twice"; + + delegate_testing_factory_ = std::move(delegate_testing_factory); +} + +content::BrowserContext* ScalableIphFactory::GetBrowserContextToUse( + content::BrowserContext* browser_context) const { + Profile* profile = Profile::FromBrowserContext(browser_context); + if (!profile) { + return nullptr; + } + + if (!profile->IsRegularProfile() || profile->IsChild()) { + return nullptr; + } + + return browser_context; +} + std::unique_ptr<KeyedService> ScalableIphFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* browser_context) const { feature_engagement::Tracker* tracker = feature_engagement::TrackerFactory::GetForBrowserContext(browser_context); - CHECK(tracker); + CHECK(tracker) << "No tracker. This method cannot handle this error. " + "BuildServiceInstanceForBrowserContext method is not " + "allowed to return nullptr"; - return std::make_unique<scalable_iph::ScalableIph>(tracker); + Profile* profile = Profile::FromBrowserContext(browser_context); + CHECK(profile) << "No profile. This method cannot handle this error. " + "BuildServiceInstanceForBrowserContext method is not " + "allowed to return nullptr"; + + return std::make_unique<scalable_iph::ScalableIph>( + tracker, CreateScalableIphDelegate(profile)); +} + +std::unique_ptr<scalable_iph::ScalableIphDelegate> +ScalableIphFactory::CreateScalableIphDelegate(Profile* profile) const { + CHECK(profile) << "Profile must not be nullptr for this method"; + + if (!delegate_testing_factory_.is_null()) { + return delegate_testing_factory_.Run(); + } + + return std::make_unique<ScalableIphDelegateImpl>(profile); } } // namespace ash
diff --git a/chrome/browser/ash/scalable_iph/scalable_iph_factory.h b/chrome/browser/ash/scalable_iph/scalable_iph_factory.h index 2ebda18..f368ad4 100644 --- a/chrome/browser/ash/scalable_iph/scalable_iph_factory.h +++ b/chrome/browser/ash/scalable_iph/scalable_iph_factory.h
@@ -5,29 +5,49 @@ #ifndef CHROME_BROWSER_ASH_SCALABLE_IPH_SCALABLE_IPH_FACTORY_H_ #define CHROME_BROWSER_ASH_SCALABLE_IPH_SCALABLE_IPH_FACTORY_H_ +#include "base/functional/callback_forward.h" #include "base/no_destructor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" #include "chromeos/ash/components/scalable_iph/scalable_iph.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "content/public/browser/browser_context.h" namespace ash { -class ScalableIphFactory : public ProfileKeyedServiceFactory { +class ScalableIphFactory : public BrowserContextKeyedServiceFactory { public: + using DelegateTestingFactory = base::RepeatingCallback< + std::unique_ptr<scalable_iph::ScalableIphDelegate>()>; + static ScalableIphFactory* GetInstance(); static scalable_iph::ScalableIph* GetForProfile(Profile* profile); + void SetDelegateFactoryForTesting( + DelegateTestingFactory delegate_testing_factory); + + bool has_delegate_factory_for_testing() const { + return !delegate_testing_factory_.is_null(); + } + protected: - // ProfileKeyedServiceFactory: + // BrowserContextKeyedServiceFactory: + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext( content::BrowserContext* browser_context) const override; private: friend base::NoDestructor<ScalableIphFactory>; + std::unique_ptr<scalable_iph::ScalableIphDelegate> CreateScalableIphDelegate( + Profile* profile) const; + ScalableIphFactory(); ~ScalableIphFactory() override; + + DelegateTestingFactory delegate_testing_factory_; }; } // namespace ash
diff --git a/chrome/browser/ash/system_web_apps/test_support/test_system_web_app_url_data_source.cc b/chrome/browser/ash/system_web_apps/test_support/test_system_web_app_url_data_source.cc index a37b103..17c7e26f 100644 --- a/chrome/browser/ash/system_web_apps/test_support/test_system_web_app_url_data_source.cc +++ b/chrome/browser/ash/system_web_apps/test_support/test_system_web_app_url_data_source.cc
@@ -8,6 +8,7 @@ #include "base/memory/ref_counted_memory.h" #include "base/test/bind.h" +#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/grit/browser_resources.h" #include "chrome/grit/chrome_unscaled_resources.h" #include "content/public/browser/web_ui_data_source.h" @@ -66,7 +67,7 @@ content::BrowserContext* browser_context) { content::WebUIDataSource* data_source = content::WebUIDataSource::CreateAndAdd(browser_context, source_name); - data_source->DisableTrustedTypesCSP(); + webui::EnableTrustedTypesCSP(data_source); data_source->AddResourcePath("icon-256.png", IDR_PRODUCT_LOGO_256); data_source->SetRequestFilter( base::BindLambdaForTesting([](const std::string& path) {
diff --git a/chrome/browser/ash/video_conference/video_conference_ash_feature_client.cc b/chrome/browser/ash/video_conference/video_conference_ash_feature_client.cc new file mode 100644 index 0000000..033d86e --- /dev/null +++ b/chrome/browser/ash/video_conference/video_conference_ash_feature_client.cc
@@ -0,0 +1,274 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/video_conference/video_conference_ash_feature_client.h" + +#include "base/containers/contains.h" +#include "base/strings/utf_string_conversions.h" +#include "base/unguessable_token.h" +#include "chrome/browser/ash/borealis/borealis_prefs.h" +#include "chrome/browser/ash/crosapi/crosapi_ash.h" +#include "chrome/browser/ash/crosapi/crosapi_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" +#include "chrome/browser/ash/video_conference/video_conference_manager_ash.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "components/prefs/pref_service.h" + +namespace ash { +namespace { + +VideoConferenceAshFeatureClient* g_client_instance = nullptr; + +constexpr char kCrostiniVmId[] = "Linux"; +constexpr char kPluginVmId[] = "PluginVm"; +constexpr char kBorealisId[] = "Borealis"; + +// Returns an "Id" as an identifier for the VmType. +std::string ToVideoConferenceAppId(VmCameraMicManager::VmType vm_type) { + switch (vm_type) { + case VmCameraMicManager::VmType::kCrostiniVm: + return kCrostiniVmId; + case VmCameraMicManager::VmType::kPluginVm: + return kPluginVmId; + case VmCameraMicManager::VmType::kBorealis: + return kBorealisId; + } +} + +} // namespace + +VideoConferenceAshFeatureClient::VideoConferenceAshFeatureClient() + : client_id_(base::UnguessableToken::Create()), + status_(crosapi::mojom::VideoConferenceMediaUsageStatus::New( + /*client_id=*/client_id_, + /*has_media_app=*/false, + /*has_camera_permission=*/false, + /*has_microphone_permission=*/false, + /*is_capturing_camera=*/false, + /*is_capturing_microphone=*/false, + /*is_capturing_screen=*/false)) { + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->RegisterCppClient(this, client_id_); + + CHECK(!g_client_instance); + g_client_instance = this; +} + +VideoConferenceAshFeatureClient::~VideoConferenceAshFeatureClient() { + // C++ clients are responsible for manually calling |UnregisterClient| on the + // manager when disconnecting. + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->UnregisterClient(client_id_); + + g_client_instance = nullptr; +} + +void VideoConferenceAshFeatureClient::GetMediaApps( + GetMediaAppsCallback callback) { + std::vector<crosapi::mojom::VideoConferenceMediaAppInfoPtr> apps; + + for (const auto& [app_id, app_state] : id_to_app_state_) { + const std::string app_name = GetAppName(app_id); + + apps.push_back(crosapi::mojom::VideoConferenceMediaAppInfo::New( + /*id=*/app_state.token, + /*last_activity_time=*/app_state.last_activity_time, + /*is_capturing_camera=*/app_state.is_capturing_camera, + /*is_capturing_microphone=*/app_state.is_capturing_microphone, + /*is_capturing_screen=*/false, + /*title=*/base::UTF8ToUTF16(app_name), + /*url=*/absl::nullopt, + /*app_type=*/GetAppType(app_id))); + } + + std::move(callback).Run(std::move(apps)); +} + +void VideoConferenceAshFeatureClient::ReturnToApp( + const base::UnguessableToken& token, + ReturnToAppCallback callback) { + // Currently, for Vms, we treat the whole VM as one app, so it is not clear + // which one to return to. + std::move(callback).Run(true); +} + +void VideoConferenceAshFeatureClient::SetSystemMediaDeviceStatus( + crosapi::mojom::VideoConferenceMediaDevice device, + bool disabled, + SetSystemMediaDeviceStatusCallback callback) { + switch (device) { + case crosapi::mojom::VideoConferenceMediaDevice::kCamera: + camera_system_disabled_ = disabled; + std::move(callback).Run(true); + return; + case crosapi::mojom::VideoConferenceMediaDevice::kMicrophone: + microphone_system_disabled_ = disabled; + std::move(callback).Run(true); + return; + case crosapi::mojom::VideoConferenceMediaDevice::kUnusedDefault: + std::move(callback).Run(false); + return; + } +} + +void VideoConferenceAshFeatureClient::OnVmDeviceUpdated( + VmCameraMicManager::VmType vm_type, + VmCameraMicManager::DeviceType device_type, + bool is_capturing) { + const AppIdString& app_id = ToVideoConferenceAppId(vm_type); + + const bool is_already_tracked = base::Contains(id_to_app_state_, app_id); + + // We only want to start tracking a app if it starts to accessing + // microphone/camera. + if (!is_already_tracked && !is_capturing) { + return; + } + + AppState& state = GetOrAddAppState(app_id); + const std::string app_name = GetAppName(app_id); + + if (device_type == VmCameraMicManager::DeviceType::kCamera) { + state.is_capturing_camera = is_capturing; + } + + if (device_type == VmCameraMicManager::DeviceType::kMic) { + state.is_capturing_microphone = is_capturing; + } + + MaybeRemoveApp(app_id); + HandleMediaUsageUpdate(); + + // This will be an AnchoredNudge, which is only visible if the tray is + // visible; so we have to call this after HandleMediaUsageUpdate. + if (device_type == VmCameraMicManager::DeviceType::kCamera && is_capturing && + camera_system_disabled_) { + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->NotifyDeviceUsedWhileDisabled( + crosapi::mojom::VideoConferenceMediaDevice::kCamera, + base::UTF8ToUTF16(app_name), base::DoNothingAs<void(bool)>()); + } + + if (device_type == VmCameraMicManager::DeviceType::kMic && is_capturing && + microphone_system_disabled_) { + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->NotifyDeviceUsedWhileDisabled( + crosapi::mojom::VideoConferenceMediaDevice::kMicrophone, + base::UTF8ToUTF16(app_name), base::DoNothingAs<void(bool)>()); + } +} + +// static +VideoConferenceAshFeatureClient* VideoConferenceAshFeatureClient::Get() { + return g_client_instance; +} + +// For Ash Features, we simply keep the app_id and app_name as the same. +std::string VideoConferenceAshFeatureClient::GetAppName( + const AppIdString& app_id) { + return app_id; +} + +// Get current camera/microphone permission of the `app_id`. +VideoConferenceAshFeatureClient::VideoConferencePermissions +VideoConferenceAshFeatureClient::GetAppPermission(const AppIdString& app_id) { + VideoConferencePermissions permissions{false, false}; + + // Get permission from prefs based in the app_id. + auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); + if (app_id == kCrostiniVmId) { + permissions.has_microphone_permission = + prefs->GetBoolean(crostini::prefs::kCrostiniMicAllowed); + } + if (app_id == kBorealisId) { + permissions.has_microphone_permission = + prefs->GetBoolean(borealis::prefs::kBorealisMicAllowed); + } + if (app_id == kPluginVmId) { + permissions.has_camera_permission = + prefs->GetBoolean(plugin_vm ::prefs::kPluginVmCameraAllowed); + permissions.has_microphone_permission = + prefs->GetBoolean(plugin_vm ::prefs::kPluginVmMicAllowed); + } + return permissions; +} + +crosapi::mojom::VideoConferenceAppType +VideoConferenceAshFeatureClient::GetAppType(const AppIdString& app_id) { + if (app_id == kCrostiniVmId) { + return crosapi::mojom::VideoConferenceAppType::kCrostiniVm; + } + + if (app_id == kPluginVmId) { + return crosapi::mojom::VideoConferenceAppType::kPluginVm; + } + + if (app_id == kBorealisId) { + return crosapi::mojom::VideoConferenceAppType::kBorealis; + } + + return crosapi::mojom::VideoConferenceAppType::kAshClientUnknown; +} + +VideoConferenceAshFeatureClient::AppState& +VideoConferenceAshFeatureClient::GetOrAddAppState(const std::string& app_id) { + if (!base::Contains(id_to_app_state_, app_id)) { + id_to_app_state_[app_id] = AppState{base::UnguessableToken::Create(), + base::Time::Now(), false, false}; + } + return id_to_app_state_[app_id]; +} + +void VideoConferenceAshFeatureClient::MaybeRemoveApp( + const AppIdString& app_id) { + if (!id_to_app_state_[app_id].is_capturing_microphone && + !id_to_app_state_[app_id].is_capturing_camera) { + id_to_app_state_.erase(app_id); + } +} + +void VideoConferenceAshFeatureClient::HandleMediaUsageUpdate() { + crosapi::mojom::VideoConferenceMediaUsageStatusPtr new_status = + crosapi::mojom::VideoConferenceMediaUsageStatus::New(); + new_status->client_id = client_id_; + new_status->has_media_app = !id_to_app_state_.empty(); + + for (const auto& [app_id, app_state] : id_to_app_state_) { + new_status->is_capturing_camera |= app_state.is_capturing_camera; + new_status->is_capturing_microphone |= app_state.is_capturing_microphone; + + VideoConferencePermissions permissions = GetAppPermission(app_id); + new_status->has_camera_permission |= permissions.has_camera_permission; + new_status->has_microphone_permission |= + permissions.has_microphone_permission; + } + + // If `status` equals the previously sent status, don't notify manager. + if (new_status.Equals(status_)) { + return; + } + status_ = new_status->Clone(); + + auto callback = base::BindOnce([](bool success) { + if (!success) { + LOG(ERROR) + << "VideoConferenceManager::NotifyMediaUsageUpdate did not succeed."; + } + }); + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->NotifyMediaUsageUpdate(std::move(new_status), std::move(callback)); +} + +} // namespace ash
diff --git a/chrome/browser/ash/video_conference/video_conference_ash_feature_client.h b/chrome/browser/ash/video_conference/video_conference_ash_feature_client.h new file mode 100644 index 0000000..e075280 --- /dev/null +++ b/chrome/browser/ash/video_conference/video_conference_ash_feature_client.h
@@ -0,0 +1,104 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_VIDEO_CONFERENCE_VIDEO_CONFERENCE_ASH_FEATURE_CLIENT_H_ +#define CHROME_BROWSER_ASH_VIDEO_CONFERENCE_VIDEO_CONFERENCE_ASH_FEATURE_CLIENT_H_ + +#include "base/unguessable_token.h" +#include "chrome/browser/ash/camera_mic/vm_camera_mic_manager.h" +#include "chrome/browser/chromeos/video_conference/video_conference_manager_client_common.h" +#include "chromeos/crosapi/mojom/video_conference.mojom.h" + +namespace ash { + +// VideoConferenceAshFeatureClient is a client class for CrOS +// videoconferencing. +// It covers the individual features that are not covered by the browser or the +// AppService. This includes: Vms (Crostini, PluginVm, Borealis), screen +// capturer, diction etc. +class VideoConferenceAshFeatureClient + : public crosapi::mojom::VideoConferenceManagerClient { + public: + using AppIdString = std::string; + using VideoConferencePermissions = + video_conference::VideoConferencePermissions; + + // AppState records information that is required for VideoConferenceManagerAsh + // to show correct icons. + struct AppState { + // Used for uniquely identifying an App in VideoConferenceManagerAsh. + base::UnguessableToken token; + base::Time last_activity_time; + bool is_capturing_microphone = false; + bool is_capturing_camera = false; + }; + + VideoConferenceAshFeatureClient(); + + VideoConferenceAshFeatureClient(const VideoConferenceAshFeatureClient&) = + delete; + VideoConferenceAshFeatureClient& operator=( + const VideoConferenceAshFeatureClient&) = delete; + + ~VideoConferenceAshFeatureClient() override; + + // crosapi::mojom::VideoConferenceManagerClient overrides. + void GetMediaApps(GetMediaAppsCallback callback) override; + void ReturnToApp(const base::UnguessableToken& token, + ReturnToAppCallback callback) override; + void SetSystemMediaDeviceStatus( + crosapi::mojom::VideoConferenceMediaDevice device, + bool disabled, + SetSystemMediaDeviceStatusCallback callback) override; + + // Called when VmCameraMicManager change Camera/Mic accessing state. + void OnVmDeviceUpdated(VmCameraMicManager::VmType vm_type, + VmCameraMicManager::DeviceType device_type, + bool is_capturing); + + // Returns current VideoConferenceAshFeatureClient. + static VideoConferenceAshFeatureClient* Get(); + + private: + friend class VideoConferenceAshfeatureClientTest; + + // Returns the name of the app with `app_id`. + std::string GetAppName(const AppIdString& app_id); + + // Returns the current camera/microphone permission status for `app_id`. + VideoConferencePermissions GetAppPermission(const AppIdString& app_id); + + // Returns the crosapi::mojom::VideoConferenceAppType of `app_id`. + crosapi::mojom::VideoConferenceAppType GetAppType(const AppIdString& app_id); + + // Returns AppState of `app_id`; adds if doesn't exist yet. + AppState& GetOrAddAppState(const AppIdString& app_id); + + // Removes `app_id` from `id_to_app_state_` if there is no running instance + // for it. + void MaybeRemoveApp(const AppIdString& app_id); + + // Calculates a new `crosapi::mojom::VideoConferenceMediaUsageStatus` from all + // current VC apps and notifies the manager if a field has changed. + void HandleMediaUsageUpdate(); + + // Unique id associated with this client. It is used by the VcManager to + // identify clients. + const base::UnguessableToken client_id_; + + // Current status_ aggregated from all apps in `id_to_app_state_`. + crosapi::mojom::VideoConferenceMediaUsageStatusPtr status_; + + // The following two fields are true if the camera/microphone is system-wide + // software disabled OR disabled via a hardware switch. + bool camera_system_disabled_{false}; + bool microphone_system_disabled_{false}; + + // This records a list of AppState; each represents a video conference app. + std::map<AppIdString, AppState> id_to_app_state_; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_VIDEO_CONFERENCE_VIDEO_CONFERENCE_ASH_FEATURE_CLIENT_H_
diff --git a/chrome/browser/ash/video_conference/video_conference_ash_feature_client_browsertest.cc b/chrome/browser/ash/video_conference/video_conference_ash_feature_client_browsertest.cc new file mode 100644 index 0000000..839f8ec8 --- /dev/null +++ b/chrome/browser/ash/video_conference/video_conference_ash_feature_client_browsertest.cc
@@ -0,0 +1,284 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/video_conference/video_conference_ash_feature_client.h" + +#include <cstdlib> +#include <utility> +#include <vector> + +#include "ash/constants/ash_features.h" +#include "ash/constants/ash_switches.h" +#include "ash/system/video_conference/fake_video_conference_tray_controller.h" +#include "ash/system/video_conference/video_conference_common.h" +#include "base/command_line.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/bind.h" +#include "base/test/scoped_feature_list.h" +#include "base/unguessable_token.h" +#include "chrome/browser/ash/borealis/borealis_prefs.h" +#include "chrome/browser/ash/crosapi/crosapi_ash.h" +#include "chrome/browser/ash/crosapi/crosapi_manager.h" +#include "chrome/browser/ash/crostini/crostini_pref_names.h" +#include "chrome/browser/ash/plugin_vm/plugin_vm_pref_names.h" +#include "chrome/browser/ash/video_conference/video_conference_manager_ash.h" +#include "chrome/browser/chromeos/video_conference/video_conference_manager_client_common.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chromeos/crosapi/mojom/video_conference.mojom.h" +#include "components/prefs/pref_service.h" +#include "content/public/test/browser_test.h" + +namespace ash { + +constexpr char kCrostiniVmId[] = "Linux"; +constexpr char kPluginVmId[] = "PluginVm"; +constexpr char kBorealisId[] = "Borealis"; + +class VideoConferenceAshfeatureClientTest : public InProcessBrowserTest { + public: + void SetUpCommandLine(base::CommandLine* command_line) override { + command_line->AppendSwitch( + ::ash::switches::kCameraEffectsSupportedByHardware); + } + + // Update the permission of current `app_id`. + void UpdateAppPermision(const std::string& app_id, + bool has_camera_permission, + bool has_microphone_permission) { + auto* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); + if (app_id == kCrostiniVmId) { + prefs->SetBoolean(crostini::prefs::kCrostiniMicAllowed, + has_microphone_permission); + CHECK(!has_camera_permission) + << "Camera is not supported for CrostiniVm yet."; + } + if (app_id == kBorealisId) { + prefs->SetBoolean(borealis::prefs::kBorealisMicAllowed, + has_microphone_permission); + CHECK(!has_camera_permission) + << "Camera is not supported for CrostiniVm yet."; + } + if (app_id == kPluginVmId) { + prefs->SetBoolean(plugin_vm::prefs::kPluginVmCameraAllowed, + has_camera_permission); + prefs->SetBoolean(plugin_vm::prefs::kPluginVmMicAllowed, + has_microphone_permission); + } + } + + std::vector<crosapi::mojom::VideoConferenceMediaAppInfoPtr> GetMediaApps() { + std::vector<crosapi::mojom::VideoConferenceMediaAppInfoPtr> media_app_info; + + VideoConferenceAshFeatureClient::Get()->GetMediaApps( + base::BindLambdaForTesting( + [&media_app_info]( + std::vector<crosapi::mojom::VideoConferenceMediaAppInfoPtr> + result) { media_app_info = std::move(result); })); + + return media_app_info; + } + + // Returns current VideoConferenceMediaState in the VideoConferenceManagerAsh + VideoConferenceMediaState GetMediaStateInVideoConferenceManagerAsh() { + return crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->GetAggregatedState(); + } + + protected: + base::test::ScopedFeatureList scoped_feature_list_{ + ash::features::kVideoConference}; +}; + +IN_PROC_BROWSER_TEST_F(VideoConferenceAshfeatureClientTest, GetMediaApps) { + { + // Notifying Crostini is using Mic. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kCrostiniVm, + VmCameraMicManager::DeviceType::kMic, true); + + // GetMediaApps should return kCrostinId. + auto media_app_info = GetMediaApps(); + ASSERT_EQ(media_app_info.size(), 1u); + const auto& info0 = media_app_info[0]; + + crosapi::mojom::VideoConferenceMediaAppInfoPtr expected_media_app_info = + crosapi::mojom::VideoConferenceMediaAppInfo::New( + /*id=*/info0->id, + /*last_activity_time=*/info0->last_activity_time, + /*is_capturing_camera=*/false, + /*is_capturing_microphone=*/true, + /*is_capturing_screen=*/false, + /*title=*/base::UTF8ToUTF16(std::string(kCrostiniVmId)), + /*url=*/absl::nullopt, + /*app_type=*/crosapi::mojom::VideoConferenceAppType::kCrostiniVm); + + EXPECT_TRUE(media_app_info[0].Equals(expected_media_app_info)); + + // Stop accessing should remove the app. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kCrostiniVm, + VmCameraMicManager::DeviceType::kMic, false); + + EXPECT_TRUE(GetMediaApps().empty()); + } + + { + // Notifying PluginVm is using Mic and Camera. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kMic, true); + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kCamera, true); + + // GetMediaApps should return PluginVm. + auto media_app_info = GetMediaApps(); + ASSERT_EQ(media_app_info.size(), 1u); + const auto& info0 = media_app_info[0]; + + crosapi::mojom::VideoConferenceMediaAppInfoPtr expected_media_app_info = + crosapi::mojom::VideoConferenceMediaAppInfo::New( + /*id=*/info0->id, + /*last_activity_time=*/info0->last_activity_time, + /*is_capturing_camera=*/true, + /*is_capturing_microphone=*/true, + /*is_capturing_screen=*/false, + /*title=*/base::UTF8ToUTF16(std::string(kPluginVmId)), + /*url=*/absl::nullopt, + /*app_type=*/crosapi::mojom::VideoConferenceAppType::kPluginVm); + + EXPECT_TRUE(media_app_info[0].Equals(expected_media_app_info)); + } +} + +IN_PROC_BROWSER_TEST_F(VideoConferenceAshfeatureClientTest, + HandleMediaUsageUpdate) { + // Set initial permissions. + UpdateAppPermision(kCrostiniVmId, /*has_camera_permission=*/false, + /*has_microphone_permission=*/true); + UpdateAppPermision(kPluginVmId, /*has_camera_permission=*/true, + /*has_microphone_permission=*/false); + + // All state should be false initially. + VideoConferenceMediaState state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_FALSE(state.has_media_app); + EXPECT_FALSE(state.has_camera_permission); + EXPECT_FALSE(state.has_microphone_permission); + EXPECT_FALSE(state.is_capturing_camera); + EXPECT_FALSE(state.is_capturing_microphone); + EXPECT_FALSE(state.is_capturing_screen); + + // Notifying Crostini is using Mic. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kCrostiniVm, + VmCameraMicManager::DeviceType::kMic, true); + + // State should have update for microphone from CrostiniVm. + state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_TRUE(state.has_media_app); + EXPECT_TRUE(state.has_microphone_permission); + EXPECT_TRUE(state.is_capturing_microphone); + EXPECT_FALSE(state.has_camera_permission); + EXPECT_FALSE(state.is_capturing_camera); + + // Notifying PluginVm is using Mic. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kMic, true); + + // Extra permission obtained from PluginVm. + state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_TRUE(state.has_camera_permission); + EXPECT_FALSE(state.is_capturing_camera); + + // Notifying PluginVm is using Camera. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kCamera, true); + + // Expecting camera capturing from PluginVm. + state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_TRUE(state.has_camera_permission); + EXPECT_TRUE(state.is_capturing_camera); + + // Notifying Stopping accessing from PluginVm. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kMic, false); + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kCamera, false); + + // Camera permission and capturing should be gone. + state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_FALSE(state.has_camera_permission); + EXPECT_FALSE(state.is_capturing_camera); + + // Notifying Stopping accessing from Crostini. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kCrostiniVm, + VmCameraMicManager::DeviceType::kMic, false); + + state = GetMediaStateInVideoConferenceManagerAsh(); + EXPECT_FALSE(state.has_media_app); + EXPECT_FALSE(state.has_camera_permission); + EXPECT_FALSE(state.has_microphone_permission); + EXPECT_FALSE(state.is_capturing_camera); + EXPECT_FALSE(state.is_capturing_microphone); + EXPECT_FALSE(state.is_capturing_screen); +} + +IN_PROC_BROWSER_TEST_F(VideoConferenceAshfeatureClientTest, + HandleDeviceUsedWhileDisabled) { + // Notify disabling state of camera and microphone from + // video_conference_manager_ash. + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->SetSystemMediaDeviceStatus( + crosapi::mojom::VideoConferenceMediaDevice::kCamera, + /*disabled=*/true); + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->video_conference_manager_ash() + ->SetSystemMediaDeviceStatus( + crosapi::mojom::VideoConferenceMediaDevice::kMicrophone, + /*disabled=*/true); + + FakeVideoConferenceTrayController* fake_try_controller = + static_cast<FakeVideoConferenceTrayController*>( + VideoConferenceTrayController::Get()); + + // Notifying Crostini is using Mic. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kCrostiniVm, + VmCameraMicManager::DeviceType::kMic, true); + + // One UsedWhileDisabled call should be sent to + // FakeVideoConferenceTrayController. + ASSERT_EQ(fake_try_controller->device_used_while_disabled_records().size(), + 1u); + EXPECT_THAT( + fake_try_controller->device_used_while_disabled_records().back(), + testing::Pair(crosapi::mojom::VideoConferenceMediaDevice::kMicrophone, + base::UTF8ToUTF16(std::string(kCrostiniVmId)))); + + // Notifying PluginVm is using Camera. + VideoConferenceAshFeatureClient::Get()->OnVmDeviceUpdated( + VmCameraMicManager::VmType::kPluginVm, + VmCameraMicManager::DeviceType::kCamera, true); + + // Another UsedWhileDisabled call should be sent to + // FakeVideoConferenceTrayController. + ASSERT_EQ(fake_try_controller->device_used_while_disabled_records().size(), + 2u); + EXPECT_THAT(fake_try_controller->device_used_while_disabled_records().back(), + testing::Pair(crosapi::mojom::VideoConferenceMediaDevice::kCamera, + base::UTF8ToUTF16(std::string(kPluginVmId)))); +} + +} // namespace ash
diff --git a/chrome/browser/ash/video_conference/video_conference_manager_ash.h b/chrome/browser/ash/video_conference/video_conference_manager_ash.h index 1f2993b..fae8a5c3d 100644 --- a/chrome/browser/ash/video_conference/video_conference_manager_ash.h +++ b/chrome/browser/ash/video_conference/video_conference_manager_ash.h
@@ -92,6 +92,7 @@ VideoConferenceTrayController* GetTrayController(); private: + friend class VideoConferenceAshfeatureClientTest; friend class VideoConferenceAppServiceClientTest; // A (client_id, client_wrapper) entry is inserted into this map
diff --git a/chrome/browser/autofill/android/BUILD.gn b/chrome/browser/autofill/android/BUILD.gn index 3959d75..d265258 100644 --- a/chrome/browser/autofill/android/BUILD.gn +++ b/chrome/browser/autofill/android/BUILD.gn
@@ -75,9 +75,10 @@ "//url:gurl_java", ] - srcjar_deps = [ ":autofill_generated_enums" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":autofill_generated_enums", + ":jni_headers", + ] } android_library("bottom_sheet_utils_java") {
diff --git a/chrome/browser/banners/android/BUILD.gn b/chrome/browser/banners/android/BUILD.gn index 3ff143c..fdabaca 100644 --- a/chrome/browser/banners/android/BUILD.gn +++ b/chrome/browser/banners/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/banners/AppBannerInProductHelpController.java", "java/src/org/chromium/chrome/browser/banners/AppBannerInProductHelpControllerFactory.java", @@ -28,7 +29,6 @@ "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.banners" }
diff --git a/chrome/browser/bluetooth/android/BUILD.gn b/chrome/browser/bluetooth/android/BUILD.gn index ca38c48..18d6136 100644 --- a/chrome/browser/bluetooth/android/BUILD.gn +++ b/chrome/browser/bluetooth/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/bluetooth/BluetoothBridge.java", "java/src/org/chromium/chrome/browser/bluetooth/BluetoothNotificationManager.java", @@ -26,7 +27,7 @@ "//third_party/androidx:androidx_fragment_fragment_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.bluetooth" }
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 6427bea..76d5fc88 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3694,11 +3694,6 @@ return base::OnceClosure(); } - GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); - DCHECK(requesting_url.is_valid()) - << "Invalid URL string: https://" - << cert_request_info->host_and_port.ToString(); - Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); #if BUILDFLAG(IS_CHROMEOS_ASH) @@ -3729,6 +3724,10 @@ } #endif // BUILDFLAG(IS_CHROMEOS_ASH) + GURL requesting_url = chrome::enterprise_util::GetRequestingUrl( + cert_request_info->host_and_port); + DCHECK(requesting_url.is_valid()) << "Invalid URL string: " << requesting_url; + net::ClientCertIdentityList matching_certificates, nonmatching_certificates; chrome::enterprise_util::AutoSelectCertificates( profile, requesting_url, std::move(client_certs), &matching_certificates, @@ -7506,22 +7505,26 @@ } } - // TODO(b/247618374): Lacros implementation #if BUILDFLAG(IS_CHROMEOS_ASH) if (ash::features::IsCaptivePortalErrorPageEnabled()) { - auto alternative_error_page_override_info = - content::mojom::AlternativeErrorPageOverrideInfo::New(); - // Use the alternative error page dictionary to provide additional - // suggestions in the default error page. - alternative_error_page_override_info->alternative_error_page_params.Set( - error_page::kOverrideErrorPage, base::Value(false)); - bool is_portal_state = - ash::network_health::NetworkHealthManager::GetInstance() - ->helper() - ->IsWiFiPortalState(); - alternative_error_page_override_info->alternative_error_page_params.Set( - error_page::kIsPortalStateKey, base::Value(is_portal_state)); - return alternative_error_page_override_info; + using PortalState = chromeos::network_config::mojom::PortalState; + auto portal_state = ash::network_health::NetworkHealthManager::GetInstance() + ->helper() + ->WiFiPortalState(); + if (portal_state != PortalState::kUnknown) { + auto alternative_error_page_override_info = + content::mojom::AlternativeErrorPageOverrideInfo::New(); + bool is_portal_state = portal_state == PortalState::kPortal || + portal_state == PortalState::kPortalSuspected || + portal_state == PortalState::kProxyAuthRequired; + // Use the alternative error page dictionary to provide additional + // suggestions in the default error page. + alternative_error_page_override_info->alternative_error_page_params.Set( + error_page::kOverrideErrorPage, base::Value(false)); + alternative_error_page_override_info->alternative_error_page_params.Set( + error_page::kIsPortalStateKey, base::Value(is_portal_state)); + return alternative_error_page_override_info; + } } #endif
diff --git a/chrome/browser/commerce/android/BUILD.gn b/chrome/browser/commerce/android/BUILD.gn index 67de142..d3b5bf1 100644 --- a/chrome/browser/commerce/android/BUILD.gn +++ b/chrome/browser/commerce/android/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":shopping_service_jni" ] sources = [ "java/src/org/chromium/chrome/browser/commerce/PriceNotificationPreferenceFragment.java", "java/src/org/chromium/chrome/browser/commerce/PriceTrackingUtils.java", @@ -38,8 +39,6 @@ "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - resources_package = "org.chromium.chrome.browser.commerce" }
diff --git a/chrome/browser/commerce/android/java/src/org/chromium/chrome/browser/commerce/PriceTrackingUtils.java b/chrome/browser/commerce/android/java/src/org/chromium/chrome/browser/commerce/PriceTrackingUtils.java index 58876e4..3f14b5f 100644 --- a/chrome/browser/commerce/android/java/src/org/chromium/chrome/browser/commerce/PriceTrackingUtils.java +++ b/chrome/browser/commerce/android/java/src/org/chromium/chrome/browser/commerce/PriceTrackingUtils.java
@@ -39,7 +39,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { void setPriceTrackingStateForBookmark(Profile profile, long bookmarkId, boolean enabled, Callback<Boolean> callback, boolean bookmarkCreatedForPriceTracking);
diff --git a/chrome/browser/commerce/merchant_viewer/android/BUILD.gn b/chrome/browser/commerce/merchant_viewer/android/BUILD.gn index ed288565..10ee0c69 100644 --- a/chrome/browser/commerce/merchant_viewer/android/BUILD.gn +++ b/chrome/browser/commerce/merchant_viewer/android/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/merchant_viewer/BottomSheetToolbarProperties.java", "java/src/org/chromium/chrome/browser/merchant_viewer/BottomSheetToolbarView.java", @@ -77,8 +78,6 @@ "//url:gurl_java", ] resources_package = "org.chromium.chrome.tab_ui" - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } robolectric_library("junit") {
diff --git a/chrome/browser/consent_auditor/android/BUILD.gn b/chrome/browser/consent_auditor/android/BUILD.gn index ec1837b..b089b16f 100644 --- a/chrome/browser/consent_auditor/android/BUILD.gn +++ b/chrome/browser/consent_auditor/android/BUILD.gn
@@ -18,6 +18,8 @@ "//components/signin/public/android:java", "//third_party/androidx:androidx_annotation_annotation_java", ] - srcjar_deps = [ "//components/consent_auditor:consent_auditor_java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":jni_headers", + "//components/consent_auditor:consent_auditor_java", + ] }
diff --git a/chrome/browser/content_creation/notes/internal/android/BUILD.gn b/chrome/browser/content_creation/notes/internal/android/BUILD.gn index b656225..9dca0b8 100644 --- a/chrome/browser/content_creation/notes/internal/android/BUILD.gn +++ b/chrome/browser/content_creation/notes/internal/android/BUILD.gn
@@ -12,6 +12,7 @@ "//chrome/android:chrome_test_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/content_creation/notes/LineLimitedTextView.java", "java/src/org/chromium/chrome/browser/content_creation/notes/NoteCreationCoordinatorFactory.java", @@ -58,11 +59,11 @@ "//url:gurl_java", ] resources_package = "org.chromium.chrome.browser.content_creation.internal" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") { visibility = [ + ":*", "//chrome/browser", "//chrome/browser/content_creation/notes/internal:*", ]
diff --git a/chrome/browser/contextmenu/BUILD.gn b/chrome/browser/contextmenu/BUILD.gn index d79a4d2..a206c09 100644 --- a/chrome/browser/contextmenu/BUILD.gn +++ b/chrome/browser/contextmenu/BUILD.gn
@@ -17,8 +17,10 @@ "java/src/org/chromium/chrome/browser/contextmenu/ContextMenuPopulatorFactory.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ "//chrome:context_menu_image_format_enum_javagen" ] + srcjar_deps = [ + ":jni_headers", + "//chrome:context_menu_image_format_enum_javagen", + ] deps = [ "//base:base_java",
diff --git a/chrome/browser/device_reauth/android/BUILD.gn b/chrome/browser/device_reauth/android/BUILD.gn index 3aed35e..39aeff5 100644 --- a/chrome/browser/device_reauth/android/BUILD.gn +++ b/chrome/browser/device_reauth/android/BUILD.gn
@@ -17,15 +17,16 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//ui/android:ui_no_recycler_view_java", ] - srcjar_deps = [ ":device_reauth_java_enums_srcjar" ] + srcjar_deps = [ + ":device_reauth_java_enums_srcjar", + ":jni_headers", + ] sources = [ "java/src/org/chromium/chrome/browser/device_reauth/DeviceAuthenticatorBridge.java", "java/src/org/chromium/chrome/browser/device_reauth/ReauthenticatorBridge.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - resources_package = "org.chromium.chrome.browser.device_reauth" }
diff --git a/chrome/browser/download/android/BUILD.gn b/chrome/browser/download/android/BUILD.gn index 8f3f481..52609b0 100644 --- a/chrome/browser/download/android/BUILD.gn +++ b/chrome/browser/download/android/BUILD.gn
@@ -100,10 +100,12 @@ "//url:gurl_java", ] - srcjar_deps = [ "//chrome:download_enum_javagen" ] + srcjar_deps = [ + ":jni_headers", + "//chrome:download_enum_javagen", + ] resources_package = "org.chromium.chrome.browser.download" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library_factory("factory_java") {
diff --git a/chrome/browser/download/internal/android/BUILD.gn b/chrome/browser/download/internal/android/BUILD.gn index 3a24727..8576360 100644 --- a/chrome/browser/download/internal/android/BUILD.gn +++ b/chrome/browser/download/internal/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/download/DownloadMessageUiControllerFactory.java", "java/src/org/chromium/chrome/browser/download/DownloadMessageUiControllerImpl.java", @@ -142,7 +143,6 @@ "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.download.internal" }
diff --git a/chrome/browser/endpoint_fetcher/BUILD.gn b/chrome/browser/endpoint_fetcher/BUILD.gn index 5196e2f..f263a5c3 100644 --- a/chrome/browser/endpoint_fetcher/BUILD.gn +++ b/chrome/browser/endpoint_fetcher/BUILD.gn
@@ -14,11 +14,11 @@ "//net/android:net_java", "//third_party/androidx:androidx_annotation_annotation_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java", "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointResponse.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/enterprise/util/managed_browser_utils.cc b/chrome/browser/enterprise/util/managed_browser_utils.cc index dcda61b..f3f8a6b 100644 --- a/chrome/browser/enterprise/util/managed_browser_utils.cc +++ b/chrome/browser/enterprise/util/managed_browser_utils.cc
@@ -29,6 +29,7 @@ #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "google_apis/gaia/gaia_auth_util.h" +#include "net/base/host_port_pair.h" #include "net/cert/x509_certificate.h" #include "net/ssl/client_cert_identity.h" #include "url/gurl.h" @@ -122,6 +123,10 @@ return gaia::ExtractDomainName(email); } +GURL GetRequestingUrl(const net::HostPortPair host_port_pair) { + return GURL("https://" + host_port_pair.ToString()); +} + void AutoSelectCertificates( Profile* profile, const GURL& requesting_url,
diff --git a/chrome/browser/enterprise/util/managed_browser_utils.h b/chrome/browser/enterprise/util/managed_browser_utils.h index e765fe0..89d0f90 100644 --- a/chrome/browser/enterprise/util/managed_browser_utils.h +++ b/chrome/browser/enterprise/util/managed_browser_utils.h
@@ -10,6 +10,7 @@ #include <string> #include "build/build_config.h" +#include "net/base/host_port_pair.h" #include "net/ssl/client_cert_identity.h" class GURL; @@ -28,6 +29,11 @@ // returns an empty string, otherwise. std::string GetDomainFromEmail(const std::string& email); +// Returns an HTTPS URL for the host and port identified by `host_port_pair`. +// This is intended to be used to build a `requesting_url` for +// `AutoSelectCertificates`. +GURL GetRequestingUrl(const net::HostPortPair host_port_pair); + // Partitions |client_certs| according to the value of the // |ContentSettingsType::AUTO_SELECT_CERTIFICATE| content setting for the // |requesting_url|. If a filter is set, all certs that match the
diff --git a/chrome/browser/enterprise/util/managed_browser_utils_unittest.cc b/chrome/browser/enterprise/util/managed_browser_utils_unittest.cc index c3f54e0..5f7bb2a 100644 --- a/chrome/browser/enterprise/util/managed_browser_utils_unittest.cc +++ b/chrome/browser/enterprise/util/managed_browser_utils_unittest.cc
@@ -17,6 +17,7 @@ #include "chrome/test/base/testing_profile_manager.h" #include "components/content_settings/core/browser/host_content_settings_map.h" #include "content/public/test/browser_task_environment.h" +#include "net/base/host_port_pair.h" #include "net/cert/x509_certificate.h" #include "net/ssl/client_cert_identity_test_util.h" #include "net/test/cert_test_util.h" @@ -61,6 +62,13 @@ EXPECT_TRUE(chrome::enterprise_util::IsBrowserManaged(profile.get())); } +TEST(ManagedBrowserUtils, GetRequestingUrl) { + GURL expected("https://hostname:1234"); + net::HostPortPair host_port_pair("hostname", 1234); + EXPECT_EQ(expected, + chrome::enterprise_util::GetRequestingUrl(host_port_pair)); +} + #if !BUILDFLAG(IS_CHROMEOS_ASH) class ManagedBrowserUtilsTest : public testing::Test { protected:
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index f86c190..0f17572 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -242,6 +242,8 @@ #endif (*s_allowlist)[dom_distiller::prefs::kOfferReaderMode] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_allowlist)[prefs::kHoverCardImagesEnabled] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; // On startup. (*s_allowlist)[::prefs::kRestoreOnStartup] =
diff --git a/chrome/browser/feature_engagement/BUILD.gn b/chrome/browser/feature_engagement/BUILD.gn index 3fa8a01..72334e9 100644 --- a/chrome/browser/feature_engagement/BUILD.gn +++ b/chrome/browser/feature_engagement/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitor.java", "java/src/org/chromium/chrome/browser/feature_engagement/ScreenshotMonitorDelegate.java", @@ -27,7 +28,6 @@ "//third_party/androidx:androidx_core_core_java", "//ui/android:ui_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/feed/android/BUILD.gn b/chrome/browser/feed/android/BUILD.gn index 0ccd7df..626a5c2 100644 --- a/chrome/browser/feed/android/BUILD.gn +++ b/chrome/browser/feed/android/BUILD.gn
@@ -8,6 +8,7 @@ import("//chrome/browser/buildflags.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/feed/BackToTopBubble.java", "java/src/org/chromium/chrome/browser/feed/BackToTopBubbleScrollListener.java", @@ -153,7 +154,6 @@ "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.feed" # Add the actual implementation where necessary so that downstream targets
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedProcessScopeDependencyProvider.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedProcessScopeDependencyProvider.java index 77f6dfd6..cc3d4c5 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedProcessScopeDependencyProvider.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedProcessScopeDependencyProvider.java
@@ -230,7 +230,7 @@ sEnableAppFlowDebugging = enable; } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { int[] getExperimentIds();
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java index dc25dc53..6bb9f13 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/FeedStream.java
@@ -1424,7 +1424,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { long init(FeedStream caller, @StreamKind int streamKind, long nativeFeedReliabilityLoggingBridge);
diff --git a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedBridge.java b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedBridge.java index d1b35749..db538d9 100644 --- a/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedBridge.java +++ b/chrome/browser/feed/android/java/src/org/chromium/chrome/browser/feed/webfeed/WebFeedBridge.java
@@ -284,7 +284,7 @@ } } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { void followWebFeed(WebFeedPageInformation pageInfo, int webFeedChangeReason,
diff --git a/chrome/browser/feedback/android/BUILD.gn b/chrome/browser/feedback/android/BUILD.gn index 898c99b..0375832 100644 --- a/chrome/browser/feedback/android/BUILD.gn +++ b/chrome/browser/feedback/android/BUILD.gn
@@ -27,6 +27,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/feedback/AsyncFeedbackSourceAdapter.java", "java/src/org/chromium/chrome/browser/feedback/DeviceInfoFeedbackSource.java", @@ -65,7 +66,7 @@ ":delegate_java", ":feedback_collector_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.feedback" }
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 40e66d1..380d3df 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -1841,11 +1841,6 @@ "expiry_milestone": 130 }, { - "name": "enable-arc-host-vpn", - "owners": [ "cassiewang", "cros-networking@google.com" ], - "expiry_milestone": 111 - }, - { "name": "enable-aria-element-reflection", "owners": [ "aleventhal", "//third_party/blink/renderer/modules/accessibility/OWNERS" ], "expiry_milestone": 105 @@ -4387,11 +4382,6 @@ "expiry_milestone": 118 }, { - "name": "high-efficiency-mode-time-before-discard", - "owners": [ "chrome-performance-ui-team@google.com" ], - "expiry_milestone": 120 - }, - { "name": "history-journeys", "owners": [ "tommycli", "chrome-journeys@google.com" ], "expiry_milestone": 120 @@ -5487,11 +5477,6 @@ "expiry_milestone": 120 }, { - "name": "omnibox-close-popup-with-escape", - "owners": ["manukh", "chrome-omnibox-team@google.com"], - "expiry_milestone": 110 - }, - { "name": "omnibox-consumes-ime-insets", "owners": ["pnoland", "chrome-omnibox-team@google.com"], "expiry_milestone": 120
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index feaee03..e57fe19 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2119,13 +2119,6 @@ "When enabled, the omnibox will cache frequently used drawables and " "strings rather than loading them from Android every time they're needed."; -const char kOmniboxClosePopupWithEscapeName[] = - "Omnibox Close Popup with Escape"; -const char kOmniboxClosePopupWithEscapeDescription[] = - "When enabled, pressing escape when the omnibox popup is open and the " - "default suggestion is selected will close the omnibox without removing " - "its focus or clearing user input."; - const char kOmniboxConsumesImeInsetsName[] = "Omnibox Consumes IME (keyboard) insets directly"; const char kOmniboxConsumesImeInsetsDescription[] = @@ -4491,11 +4484,6 @@ "When enabled, media metadata will be hidden from your OS' media player " "if you are in an Incognito session."; -extern const char kHighEfficiencyModeTimeBeforeDiscardName[] = - "Configure discard timer for Memory Saver"; -extern const char kHighEfficiencyModeTimeBeforeDiscardDescription[] = - "When set, this controls the time before memory saver discards a tab."; - extern const char kHighEfficiencyMultistateModeAvailableName[] = "Enable the multi-state option for Memory Saver Mode."; extern const char kHighEfficiencyMultistateModeAvailableDescription[] = @@ -5553,12 +5541,6 @@ "Enable the bridge bewteen DriveFS and the Chrome Network Service for " "communication with the Drive backend."; -const char kEnableArcHostVpnName[] = - "Enable ArcHostVpn for builtin VPN clients"; -const char kEnableArcHostVpnDescription[] = - "When a builtin VPN client is started, also start the ArcHostVpn service " - "to reflect the builtin VPN config and VPN network inside ARC."; - const char kEnableBackgroundBlurName[] = "Enable background blur."; const char kEnableBackgroundBlurDescription[] = "Enables background blur for the Launcher, Shelf, Unified System Tray etc.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 170404d6..a168f5d 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1194,9 +1194,6 @@ extern const char kOmniboxCacheSuggestionResourcesName[]; extern const char kOmniboxCacheSuggestionResourcesDescription[]; -extern const char kOmniboxClosePopupWithEscapeName[]; -extern const char kOmniboxClosePopupWithEscapeDescription[]; - extern const char kOmniboxConsumesImeInsetsName[]; extern const char kOmniboxConsumesImeInsetsDescription[]; @@ -2569,9 +2566,6 @@ extern const char kHideIncognitoMediaMetadataName[]; extern const char kHideIncognitoMediaMetadataDescription[]; -extern const char kHighEfficiencyModeTimeBeforeDiscardName[]; -extern const char kHighEfficiencyModeTimeBeforeDiscardDescription[]; - extern const char kHighEfficiencyMultistateModeAvailableName[]; extern const char kHighEfficiencyMultistateModeAvailableDescription[]; @@ -3180,9 +3174,6 @@ extern const char kDriveFsChromeNetworkingName[]; extern const char kDriveFsChromeNetworkingDescription[]; -extern const char kEnableArcHostVpnName[]; -extern const char kEnableArcHostVpnDescription[]; - extern const char kEnableAssistantRoutinesName[]; extern const char kEnableAssistantRoutinesDescription[];
diff --git a/chrome/browser/flags/BUILD.gn b/chrome/browser/flags/BUILD.gn index 21041e6..be222f2 100644 --- a/chrome/browser/flags/BUILD.gn +++ b/chrome/browser/flags/BUILD.gn
@@ -37,8 +37,8 @@ srcjar_deps = [ ":chrome_android_java_switches_srcjar", ":chrome_browser_flags_enums_srcjar", + ":jni_headers", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/gesturenav/android/BUILD.gn b/chrome/browser/gesturenav/android/BUILD.gn index 9798c0a..5cba75e 100644 --- a/chrome/browser/gesturenav/android/BUILD.gn +++ b/chrome/browser/gesturenav/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/gesturenav/TabOnBackGestureHandler.java" ] deps = [ "//base:base_java", @@ -12,7 +13,7 @@ "//chrome/browser/tab:java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.gesturenav" }
diff --git a/chrome/browser/history_clusters/BUILD.gn b/chrome/browser/history_clusters/BUILD.gn index 41f210e..f503088 100644 --- a/chrome/browser/history_clusters/BUILD.gn +++ b/chrome/browser/history_clusters/BUILD.gn
@@ -25,6 +25,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/history_clusters/ClusterVisit.java", "java/src/org/chromium/chrome/browser/history_clusters/DividerView.java", @@ -78,7 +79,6 @@ ] resources_package = "org.chromium.chrome.browser.history_clusters" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/image_descriptions/BUILD.gn b/chrome/browser/image_descriptions/BUILD.gn index c6289b59..96fed31 100644 --- a/chrome/browser/image_descriptions/BUILD.gn +++ b/chrome/browser/image_descriptions/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/image_descriptions/ImageDescriptionsController.java", "android/java/src/org/chromium/chrome/browser/image_descriptions/ImageDescriptionsControllerDelegate.java", @@ -33,8 +34,6 @@ "//ui/android:ui_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - resources_package = "org.chromium.chrome.browser.image_descriptions" }
diff --git a/chrome/browser/incognito/BUILD.gn b/chrome/browser/incognito/BUILD.gn index 7349404..eccefc9 100644 --- a/chrome/browser/incognito/BUILD.gn +++ b/chrome/browser/incognito/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/incognito/IncognitoCctProfileManager.java", "android/java/src/org/chromium/chrome/browser/incognito/IncognitoStartup.java", @@ -60,7 +61,7 @@ "//ui/android:ui_full_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.incognito" }
diff --git a/chrome/browser/lacros/input_method_lacros_browsertest.cc b/chrome/browser/lacros/input_method_lacros_browsertest.cc index 71a9fc00..cab33e25 100644 --- a/chrome/browser/lacros/input_method_lacros_browsertest.cc +++ b/chrome/browser/lacros/input_method_lacros_browsertest.cc
@@ -60,8 +60,7 @@ // Enables the following Ash feature flags: // - AlwaysConfirmComposition // - // Will not be true if `extended_confirm_composition` or `fix_268467697` are - // false. + // Will not be true if `extended_confirm_composition` is false. bool fix_265853952 = false; }; @@ -573,20 +572,20 @@ base::test::ScopedFeatureList feature_list_override_; }; -INSTANTIATE_TEST_SUITE_P(InputMethodLacrosBrowserTestAllParams, - InputMethodLacrosBrowserTest, - ::testing::Values( - // All features off. - TestParam{}, - // Enable `extended_confirm_composition` first. - TestParam{.extended_confirm_composition = true}, - // Enable `fix_268467697` next. - TestParam{.extended_confirm_composition = true, - .fix_268467697 = true}, - // Enable `fix_265853952` last. - TestParam{.extended_confirm_composition = true, - .fix_268467697 = true, - .fix_265853952 = true})); +INSTANTIATE_TEST_SUITE_P( + InputMethodLacrosBrowserTestAllParams, + InputMethodLacrosBrowserTest, + ::testing::Values( + // All features off. + TestParam{}, + // Enable `extended_confirm_composition` first. + TestParam{.extended_confirm_composition = true}, + // Combos of `fix_268467697` and `fix_265853952`. + TestParam{.extended_confirm_composition = true, .fix_268467697 = true}, + TestParam{.extended_confirm_composition = true, .fix_265853952 = true}, + TestParam{.extended_confirm_composition = true, + .fix_268467697 = true, + .fix_265853952 = true})); IN_PROC_BROWSER_TEST_P(InputMethodLacrosBrowserTest, FocusingInputFieldSendsFocus) {
diff --git a/chrome/browser/language/android/BUILD.gn b/chrome/browser/language/android/BUILD.gn index a1be7f4..efb1480 100644 --- a/chrome/browser/language/android/BUILD.gn +++ b/chrome/browser/language/android/BUILD.gn
@@ -24,6 +24,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/language/AppLanguagePromoDialog.java", "java/src/org/chromium/chrome/browser/language/LanguageAskPrompt.java", @@ -77,7 +78,6 @@ "//ui/android:ui_no_recycler_view_java", ] resources_package = "org.chromium.chrome.browser.language" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/notifications/BUILD.gn b/chrome/browser/notifications/BUILD.gn index 1beb421..9f8f270d 100644 --- a/chrome/browser/notifications/BUILD.gn +++ b/chrome/browser/notifications/BUILD.gn
@@ -83,9 +83,11 @@ "//ui/android:ui_no_recycler_view_java", ] - srcjar_deps = [ ":notifications_java_enum_srcjar" ] + srcjar_deps = [ + ":jni_headers", + ":notifications_java_enum_srcjar", + ] resources_package = "org.chromium.chrome.browser.notifications" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } java_cpp_enum("notifications_java_enum_srcjar") {
diff --git a/chrome/browser/optimization_guide/android/BUILD.gn b/chrome/browser/optimization_guide/android/BUILD.gn index 5349be0..de9de7a9 100644 --- a/chrome/browser/optimization_guide/android/BUILD.gn +++ b/chrome/browser/optimization_guide/android/BUILD.gn
@@ -30,10 +30,9 @@ ] srcjar_deps = [ + ":jni_headers", "//components/optimization_guide/core:optimization_guide_generated_enums", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("native_j_unittests_jni_headers") {
diff --git a/chrome/browser/paint_preview/android/BUILD.gn b/chrome/browser/paint_preview/android/BUILD.gn index 760b630c..80604dce 100644 --- a/chrome/browser/paint_preview/android/BUILD.gn +++ b/chrome/browser/paint_preview/android/BUILD.gn
@@ -13,8 +13,7 @@ } android_library("java") { - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/paint_preview/DemoPaintPreview.java", "java/src/org/chromium/chrome/browser/paint_preview/PaintPreviewCompositorUtils.java",
diff --git a/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/PaintPreviewCompositorUtils.java b/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/PaintPreviewCompositorUtils.java index 6144132..842f148a 100644 --- a/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/PaintPreviewCompositorUtils.java +++ b/chrome/browser/paint_preview/android/java/src/org/chromium/chrome/browser/paint_preview/PaintPreviewCompositorUtils.java
@@ -30,7 +30,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { void warmupCompositor(); boolean stopWarmCompositor();
diff --git a/chrome/browser/password_edit_dialog/android/BUILD.gn b/chrome/browser/password_edit_dialog/android/BUILD.gn index c3cc454b..4dcbd8f 100644 --- a/chrome/browser/password_edit_dialog/android/BUILD.gn +++ b/chrome/browser/password_edit_dialog/android/BUILD.gn
@@ -20,6 +20,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/password_edit_dialog/NoFilterArrayAdapter.java", "java/src/org/chromium/chrome/browser/password_edit_dialog/PasswordEditDialogBridge.java", @@ -46,7 +47,6 @@ "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.password_edit_dialog" }
diff --git a/chrome/browser/password_manager/android/BUILD.gn b/chrome/browser/password_manager/android/BUILD.gn index 4becb50..62cdc95 100644 --- a/chrome/browser/password_manager/android/BUILD.gn +++ b/chrome/browser/password_manager/android/BUILD.gn
@@ -137,6 +137,7 @@ ":password_manager_resource_provider_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/password_manager/ConfirmationDialogHelper.java", "java/src/org/chromium/chrome/browser/password_manager/OutdatedGmsCoreDialog.java", @@ -159,15 +160,12 @@ "java/src/org/chromium/chrome/browser/password_manager/settings/ReauthenticationManager.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - resources_package = "org.chromium.chrome.browser.password_manager" } generate_jni("jni_headers") { visibility = [ - ":backend", - ":test_support", + ":*", "//chrome/browser", ] sources = [ @@ -341,6 +339,7 @@ android_library("test_support_java") { testonly = true + srcjar_deps = [ ":test_support_jni_headers" ] sources = [ "test_support/java/src/org/chromium/chrome/browser/password_manager/FakeCredentialManagerLauncher.java", "test_support/java/src/org/chromium/chrome/browser/password_manager/FakeCredentialManagerLauncherFactoryImpl.java", @@ -368,8 +367,6 @@ "//content/public/android:content_main_dex_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("password_manager_resource_provider_java") {
diff --git a/chrome/browser/password_manager/android/pwd_migration/BUILD.gn b/chrome/browser/password_manager/android/pwd_migration/BUILD.gn index c1ac8381..8e03985 100644 --- a/chrome/browser/password_manager/android/pwd_migration/BUILD.gn +++ b/chrome/browser/password_manager/android/pwd_migration/BUILD.gn
@@ -19,15 +19,13 @@ generate_jni("jni_headers") { visibility = [ - ":utils", + ":*", "//chrome/browser", ] sources = [ "java/src/org/chromium/chrome/browser/pwd_migration/PasswordMigrationWarningBridge.java" ] } android_library("java") { - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ ":java_resources", "//base:base_java", @@ -44,6 +42,7 @@ "//ui/android:ui_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/pwd_migration/PasswordMigrationWarningBridge.java", "java/src/org/chromium/chrome/browser/pwd_migration/PasswordMigrationWarningCoordinator.java",
diff --git a/chrome/browser/payments/webapps/OWNERS b/chrome/browser/payments/webapps/OWNERS index 2f20c377..d173c9c 100644 --- a/chrome/browser/payments/webapps/OWNERS +++ b/chrome/browser/payments/webapps/OWNERS
@@ -1,2 +1,2 @@ -ericwilligers@chromium.org glenrob@chromium.org +tsergeant@chromium.org
diff --git a/chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h b/chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h index 96bd93f2..02c496d 100644 --- a/chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h +++ b/chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h
@@ -7,6 +7,7 @@ #include <memory> +#include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "base/observer_list_types.h" #include "base/scoped_observation.h" @@ -41,9 +42,6 @@ // would be `20` for 20%. static const uint64_t kLowBatteryThresholdPercent; - // Command line switch for setting the discard time. - static const char kTimeBeforeDiscardInMinutesSwitch[]; - class FrameThrottlingDelegate { public: virtual void StartThrottlingAllFrameSinks() = 0; @@ -108,6 +106,23 @@ virtual void OnMemoryMetricsRefreshed() {} }; + class TabResourceUsage : public base::RefCounted<TabResourceUsage> { + public: + TabResourceUsage() = default; + + uint64_t memory_usage_in_bytes() const { return memory_usage_bytes_; } + + void set_memory_usage_in_bytes(uint64_t memory_usage_bytes) { + memory_usage_bytes_ = memory_usage_bytes; + } + + private: + friend class base::RefCounted<TabResourceUsage>; + ~TabResourceUsage() = default; + + uint64_t memory_usage_bytes_ = 0; + }; + // Per-tab class to keep track of current memory usage for each tab. class ResourceUsageTabHelper : public content::WebContentsObserver, @@ -121,10 +136,16 @@ // content::WebContentsObserver void PrimaryPageChanged(content::Page& page) override; - uint64_t GetMemoryUsageInBytes() { return memory_usage_bytes_; } + uint64_t GetMemoryUsageInBytes() { + return resource_usage_->memory_usage_in_bytes(); + } void SetMemoryUsageInBytes(uint64_t memory_usage_bytes) { - memory_usage_bytes_ = memory_usage_bytes; + resource_usage_->set_memory_usage_in_bytes(memory_usage_bytes); + } + + scoped_refptr<const TabResourceUsage> resource_usage() const { + return resource_usage_; } private: @@ -132,7 +153,7 @@ explicit ResourceUsageTabHelper(content::WebContents* contents); WEB_CONTENTS_USER_DATA_KEY_DECL(); - uint64_t memory_usage_bytes_ = 0; + scoped_refptr<TabResourceUsage> resource_usage_; }; class PreDiscardResourceUsage @@ -192,10 +213,6 @@ // Enables high efficiency mode and sets the relevant prefs accordingly. void SetHighEfficiencyModeEnabled(bool enabled); - // Sets the default value of the discard time pref using the command line - // switch, if the pref is in the default state. - static void SetDefaultTimeBeforeDiscardFromSwitch(PrefService* local_state); - // Discards the given WebContents with the same mechanism as one that is // discarded through a natural timeout void DiscardPageForTesting(content::WebContents* web_contents);
diff --git a/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager.cc b/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager.cc index bcd6355..4e40e56 100644 --- a/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager.cc +++ b/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager.cc
@@ -423,9 +423,6 @@ const uint64_t UserPerformanceTuningManager::kLowBatteryThresholdPercent = 20; -const char UserPerformanceTuningManager::kTimeBeforeDiscardInMinutesSwitch[] = - "time-before-discard-in-minutes"; - const char UserPerformanceTuningManager::kForceDeviceHasBatterySwitch[] = "force-device-has-battery"; @@ -439,13 +436,14 @@ content::Page&) { // Reset memory usage count when we navigate to another site since the // memory usage reported will be outdated. - memory_usage_bytes_ = 0; + resource_usage_->set_memory_usage_in_bytes(0); } UserPerformanceTuningManager::ResourceUsageTabHelper::ResourceUsageTabHelper( content::WebContents* contents) : content::WebContentsObserver(contents), - content::WebContentsUserData<ResourceUsageTabHelper>(*contents) {} + content::WebContentsUserData<ResourceUsageTabHelper>(*contents), + resource_usage_(base::MakeRefCounted<TabResourceUsage>()) {} WEB_CONTENTS_USER_DATA_KEY_IMPL( UserPerformanceTuningManager::PreDiscardResourceUsage); @@ -550,33 +548,6 @@ : -1; } -// static -void UserPerformanceTuningManager::SetDefaultTimeBeforeDiscardFromSwitch( - PrefService* local_state) { - // TODO(https://crbug.com/1424220): remove this function after multistate - // memory saver UI is available as the discard time pref will be configurable - // by the user - const PrefService::Preference* time_before_discard_pref = - local_state->FindPreference( - performance_manager::user_tuning::prefs:: - kHighEfficiencyModeTimeBeforeDiscardInMinutes); - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (time_before_discard_pref->IsDefaultValue() && - command_line->HasSwitch(kTimeBeforeDiscardInMinutesSwitch)) { - int time_before_discard_in_minutes; - std::string time_before_discard_in_minutes_string = - command_line->GetSwitchValueASCII(kTimeBeforeDiscardInMinutesSwitch); - if (base::StringToInt(time_before_discard_in_minutes_string, - &time_before_discard_in_minutes) && - time_before_discard_in_minutes > 0) { - local_state->SetDefaultPrefValue( - performance_manager::user_tuning::prefs:: - kHighEfficiencyModeTimeBeforeDiscardInMinutes, - base::Value(time_before_discard_in_minutes)); - } - } -} - UserPerformanceTuningManager::UserPerformanceTuningReceiverImpl:: ~UserPerformanceTuningReceiverImpl() = default; @@ -685,8 +656,6 @@ performance_manager::user_tuning::prefs::MigrateHighEfficiencyModePref( local_state); - SetDefaultTimeBeforeDiscardFromSwitch(local_state); - pref_change_registrar_.Init(local_state); }
diff --git a/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager_unittest.cc b/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager_unittest.cc index 1eeb879..a3fabf3 100644 --- a/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager_unittest.cc +++ b/chrome/browser/performance_manager/user_tuning/user_performance_tuning_manager_unittest.cc
@@ -290,20 +290,6 @@ EXPECT_FALSE(throttling_enabled()); } -TEST_F(UserPerformanceTuningManagerTest, SetDefaultTimeBeforeDiscardPref) { - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - performance_manager::user_tuning::UserPerformanceTuningManager:: - kTimeBeforeDiscardInMinutesSwitch, - "5"); - StartManager(); - - EXPECT_EQ(5, local_state_.GetInteger( - performance_manager::user_tuning::prefs:: - kHighEfficiencyModeTimeBeforeDiscardInMinutes)); - EXPECT_THAT(high_efficiency_mode_delegate_->GetLastTimeBeforeDiscard(), - Optional(base::Minutes(5))); -} - TEST_F(UserPerformanceTuningManagerTest, EnabledOnBatteryPower) { StartManager(); EXPECT_FALSE(manager()->IsBatterySaverActive());
diff --git a/chrome/browser/preferences/BUILD.gn b/chrome/browser/preferences/BUILD.gn index c303894..e0257b2d 100644 --- a/chrome/browser/preferences/BUILD.gn +++ b/chrome/browser/preferences/BUILD.gn
@@ -24,8 +24,11 @@ "//components/browser_ui/site_settings/android:constants_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":java_pref_names_srcjar" ] + + srcjar_deps = [ + ":java_pref_names_srcjar", + ":jni_headers", + ] } # TODO(chouinard,estade): Consider breaking this target up into a different target for each pref file.
diff --git a/chrome/browser/prefetch/android/BUILD.gn b/chrome/browser/prefetch/android/BUILD.gn index 8d652ba..333b0b6 100644 --- a/chrome/browser/prefetch/android/BUILD.gn +++ b/chrome/browser/prefetch/android/BUILD.gn
@@ -38,8 +38,11 @@ "//third_party/androidx:androidx_preference_preference_java", "//third_party/androidx:androidx_vectordrawable_vectordrawable_java", ] - srcjar_deps = [ ":preload_pages_state_generated_enum" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":jni_headers", + ":preload_pages_state_generated_enum", + ] + resources_package = "org.chromium.chrome.browser.prefetch.settings" }
diff --git a/chrome/browser/privacy/BUILD.gn b/chrome/browser/privacy/BUILD.gn index aec7e7b5..2a431be 100644 --- a/chrome/browser/privacy/BUILD.gn +++ b/chrome/browser/privacy/BUILD.gn
@@ -39,10 +39,11 @@ "//third_party/androidx:androidx_preference_preference_java", ] srcjar_deps = [ + ":jni_headers", "//chrome/browser/net:secure_dns_management_mode_generated_enum", "//net/dns/public:secure_dns_mode_generated_enum", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.privacy.secure_dns" }
diff --git a/chrome/browser/privacy_sandbox/android/BUILD.gn b/chrome/browser/privacy_sandbox/android/BUILD.gn index 4ef0cad..fffb46fe 100644 --- a/chrome/browser/privacy_sandbox/android/BUILD.gn +++ b/chrome/browser/privacy_sandbox/android/BUILD.gn
@@ -74,8 +74,11 @@ "//ui/android:ui_full_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":privacy_sandbox_enums" ] + + srcjar_deps = [ + ":jni_headers", + ":privacy_sandbox_enums", + ] resources_package = "org.chromium.chrome.browser.privacy_sandbox" }
diff --git a/chrome/browser/profiles/android/BUILD.gn b/chrome/browser/profiles/android/BUILD.gn index 2e3c3671..63fa257 100644 --- a/chrome/browser/profiles/android/BUILD.gn +++ b/chrome/browser/profiles/android/BUILD.gn
@@ -19,7 +19,8 @@ "//content/public/android:content_full_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/cookies/CanonicalCookie.java", "java/src/org/chromium/chrome/browser/cookies/CookiesFetcher.java",
diff --git a/chrome/browser/recent_tabs/BUILD.gn b/chrome/browser/recent_tabs/BUILD.gn index bcec0a47..12c583c 100644 --- a/chrome/browser/recent_tabs/BUILD.gn +++ b/chrome/browser/recent_tabs/BUILD.gn
@@ -6,6 +6,7 @@ import("//chrome/android/features/android_library_factory_tmpl.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/recent_tabs/ForeignSessionHelper.java", "android/java/src/org/chromium/chrome/browser/recent_tabs/RestoreTabsFeatureHelper.java", @@ -22,8 +23,6 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//url:gurl_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library_factory("factory_java") {
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.html b/chrome/browser/resources/settings/appearance_page/appearance_page.html index 14e6cd1..e74dc52 100644 --- a/chrome/browser/resources/settings/appearance_page/appearance_page.html +++ b/chrome/browser/resources/settings/appearance_page/appearance_page.html
@@ -117,6 +117,17 @@ label="$i18n{showBookmarksBar}"> </settings-toggle-button> + <template is="dom-if" if="[[showHoverCardImagesOption_]]"> + <div id="hoverCardImagesHr" class="hr" + hidden="[[!pageVisibility.hoverCardImages]]"> + </div> + <settings-toggle-button + hidden="[[!pageVisibility.hoverCardImages]]" + pref="{{prefs.browser.hovercard_images_enabled}}" + label="$i18n{showHoverCardImages}"> + </settings-toggle-button> + </template> + <template is="dom-if" if="[[showSidePanelOptions_]]"> <div class="cr-row">$i18n{sidePanel}</div> <div class="list-frame">
diff --git a/chrome/browser/resources/settings/appearance_page/appearance_page.ts b/chrome/browser/resources/settings/appearance_page/appearance_page.ts index 77d57cd..d1d1d33 100644 --- a/chrome/browser/resources/settings/appearance_page/appearance_page.ts +++ b/chrome/browser/resources/settings/appearance_page/appearance_page.ts
@@ -174,6 +174,13 @@ }, }, + showHoverCardImagesOption_: { + type: Boolean, + value() { + return loadTimeData.getBoolean('showHoverCardImagesOption'); + }, + }, + showManagedThemeDialog_: Boolean, }; } @@ -202,6 +209,7 @@ private focusConfig_: Map<string, string>; private showReaderModeOption_: boolean; private isForcedTheme_: boolean; + private showHoverCardImagesOption_: boolean; // <if expr="is_linux"> private showCustomChromeFrame_: boolean;
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.html b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.html index 7b6abbb..334636b 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.html +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.html
@@ -47,7 +47,7 @@ <paper-tooltip id="infoIconTooltip" for="infoIcon"> <div id="tooltipText"> - [[getSanitizedUrl_(app)]] + [[getTooltipText_(app)]] </div> </paper-tooltip> </div>
diff --git a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.ts b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.ts index 4941949..a65765e 100644 --- a/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.ts +++ b/chrome/browser/resources/settings/chromeos/os_apps_page/app_management_page/app_details_item.ts
@@ -88,10 +88,12 @@ return Boolean(app.dataSize); } /** - * The info icon is only shown for apps installed from the Chrome browser. + * The info icon is only shown for System apps and apps installed from the + * Chrome browser. */ private shouldShowInfoIcon_(app: App): boolean { - return app.installSource === InstallSource.kBrowser; + return app.installSource === InstallSource.kBrowser || + app.installSource === InstallSource.kSystem; } /** @@ -191,11 +193,18 @@ } /** - * Returns the sanitized URL for apps downloaded from - * the Chrome browser, to be shown in the tooltip. + * Returns the sanitized URL for apps downloaded from the Chrome browser, or a + * message for system apps, to be shown in the tooltip. */ - private getSanitizedUrl_(app: App): string { - return app.publisherId.replace(/\?.*$/g, ''); + private getTooltipText_(app: App): string { + switch (app.installSource) { + case InstallSource.kSystem: + return this.i18n('appManagementAppDetailsTooltipSystem'); + case InstallSource.kBrowser: + return app.publisherId.replace(/\?.*$/g, ''); + default: + return ''; + } } }
diff --git a/chrome/browser/resources/settings/page_visibility.ts b/chrome/browser/resources/settings/page_visibility.ts index 0234474..ecd5a7a 100644 --- a/chrome/browser/resources/settings/page_visibility.ts +++ b/chrome/browser/resources/settings/page_visibility.ts
@@ -29,6 +29,7 @@ export interface AppearancePageVisibility { bookmarksBar: boolean; homeButton: boolean; + hoverCardImages: boolean; pageZoom: boolean; setTheme: boolean; sidePanel: boolean; @@ -77,6 +78,7 @@ appearance: { setTheme: false, homeButton: false, + hoverCardImages: false, bookmarksBar: false, pageZoom: false, sidePanel: false,
diff --git a/chrome/browser/safe_browsing/android/BUILD.gn b/chrome/browser/safe_browsing/android/BUILD.gn index ce63b14ce..7869e67c 100644 --- a/chrome/browser/safe_browsing/android/BUILD.gn +++ b/chrome/browser/safe_browsing/android/BUILD.gn
@@ -72,8 +72,11 @@ "//ui/android:ui_full_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":safe_browsing_enums" ] + + srcjar_deps = [ + ":jni_headers", + ":safe_browsing_enums", + ] resources_package = "org.chromium.chrome.browser.safe_browsing.settings" }
diff --git a/chrome/browser/safety_check/android/BUILD.gn b/chrome/browser/safety_check/android/BUILD.gn index 14c2089..2bc6aa2 100644 --- a/chrome/browser/safety_check/android/BUILD.gn +++ b/chrome/browser/safety_check/android/BUILD.gn
@@ -62,9 +62,10 @@ "//third_party/androidx:androidx_preference_preference_java", "//ui/android:ui_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":bulk_leak_check_service_enums", + ":jni_headers", ":safety_check_enums", ] resources_package = "org.chromium.chrome.browser.safety_check"
diff --git a/chrome/browser/search_engines/android/BUILD.gn b/chrome/browser/search_engines/android/BUILD.gn index 59f2c7f..939d1d5 100644 --- a/chrome/browser/search_engines/android/BUILD.gn +++ b/chrome/browser/search_engines/android/BUILD.gn
@@ -20,7 +20,10 @@ "java/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettings.java", ] - srcjar_deps = [ "//components/search_engines:search_engine_type_java" ] + srcjar_deps = [ + ":jni_headers", + "//components/search_engines:search_engine_type_java", + ] deps = [ ":java_resources", @@ -46,7 +49,7 @@ "//third_party/androidx:androidx_fragment_fragment_java", "//ui/android:ui_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.search_engines" }
diff --git a/chrome/browser/search_resumption/BUILD.gn b/chrome/browser/search_resumption/BUILD.gn index 1cc836e4..16afa9f 100644 --- a/chrome/browser/search_resumption/BUILD.gn +++ b/chrome/browser/search_resumption/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/search_resumption/SearchResumptionModuleBridge.java", "java/src/org/chromium/chrome/browser/search_resumption/SearchResumptionModuleCoordinator.java", @@ -45,7 +46,6 @@ "//url:gurl_java", ] resources_package = "org.chromium.chrome.browser.search_resumption" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/segmentation_platform/BUILD.gn b/chrome/browser/segmentation_platform/BUILD.gn index 9fd4154..e9163bb 100644 --- a/chrome/browser/segmentation_platform/BUILD.gn +++ b/chrome/browser/segmentation_platform/BUILD.gn
@@ -9,6 +9,7 @@ if (is_android) { android_library("factory_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/segmentation_platform/SegmentationPlatformServiceFactory.java" ] deps = [ @@ -18,8 +19,6 @@ "//components/segmentation_platform/public:public_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/share/BUILD.gn b/chrome/browser/share/BUILD.gn index 19c617c..1df5d26 100644 --- a/chrome/browser/share/BUILD.gn +++ b/chrome/browser/share/BUILD.gn
@@ -59,6 +59,7 @@ if (is_android) { android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/share/ChromeShareExtras.java", "android/java/src/org/chromium/chrome/browser/share/ShareDelegate.java", @@ -67,8 +68,6 @@ "android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeOptionShareCallback.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ ":jni_headers", "//base:base_java",
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/android_share_sheet/AndroidCustomActionProvider.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/android_share_sheet/AndroidCustomActionProvider.java index f727409..265d3f5 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/android_share_sheet/AndroidCustomActionProvider.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/android_share_sheet/AndroidCustomActionProvider.java
@@ -152,8 +152,10 @@ .setDisableForMultiWindow(true) .setOnClickCallback((view) -> { mFeatureEngagementTracker.notifyEvent(EventConstants.SHARE_SCREENSHOT_SELECTED); + // Do not add link to the screenshot for Android share sheet since there's no + // custom action to remove the link from image. LongScreenshotsCoordinator coordinator = - LongScreenshotsCoordinator.create(mActivity, mTabProvider.get(), mUrl, + LongScreenshotsCoordinator.create(mActivity, mTabProvider.get(), "", mChromeOptionShareCallback, mBottomSheetController, null); coordinator.captureScreenshot(); })
diff --git a/chrome/browser/signin/services/android/BUILD.gn b/chrome/browser/signin/services/android/BUILD.gn index d872879..05466a9a 100644 --- a/chrome/browser/signin/services/android/BUILD.gn +++ b/chrome/browser/signin/services/android/BUILD.gn
@@ -46,9 +46,11 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_appcompat_appcompat_resources_java", ] - srcjar_deps = [ "//chrome/browser/profiles:profile_metrics_enum_java" ] + srcjar_deps = [ + ":jni_headers", + "//chrome/browser/profiles:profile_metrics_enum_java", + ] resources_package = "org.chromium.chrome.browser.signin.services" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_resources("java_resources") {
diff --git a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/SigninMetricsUtils.java b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/SigninMetricsUtils.java index cae9fd2..9fa01936 100644 --- a/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/SigninMetricsUtils.java +++ b/chrome/browser/signin/services/android/java/src/org/chromium/chrome/browser/signin/services/SigninMetricsUtils.java
@@ -79,7 +79,7 @@ "Signin.AddAccountState", state, State.NUM_STATES); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { void logProfileAccountManagementMenu(int metric, int gaiaServiceType);
diff --git a/chrome/browser/ssl/https_upgrades_interceptor.cc b/chrome/browser/ssl/https_upgrades_interceptor.cc index b6a0468..b3def92 100644 --- a/chrome/browser/ssl/https_upgrades_interceptor.cc +++ b/chrome/browser/ssl/https_upgrades_interceptor.cc
@@ -98,7 +98,8 @@ response_head->response_start = response_head->request_start; std::string header_string = base::StringPrintf( "HTTP/1.1 %i Temporary Redirect\n" - "Location: %s\n", + "Location: %s\n" + "Non-Authoritative-Reason: HttpsUpgrades\n", net::HTTP_TEMPORARY_REDIRECT, new_url.spec().c_str()); response_head->headers = base::MakeRefCounted<net::HttpResponseHeaders>( net::HttpUtil::AssembleRawHeaders(header_string));
diff --git a/chrome/browser/subresource_filter/BUILD.gn b/chrome/browser/subresource_filter/BUILD.gn index 41293a25..eee2a844bb 100644 --- a/chrome/browser/subresource_filter/BUILD.gn +++ b/chrome/browser/subresource_filter/BUILD.gn
@@ -13,7 +13,8 @@ android_library("subresource_filter_java_test_support") { testonly = true - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "../../android/javatests/src/org/chromium/chrome/browser/subresource_filter/TestRulesetPublisher.java" ] deps = [ "//base:jni_java" ] }
diff --git a/chrome/browser/supervised_user/BUILD.gn b/chrome/browser/supervised_user/BUILD.gn index 53bd311..1cef136 100644 --- a/chrome/browser/supervised_user/BUILD.gn +++ b/chrome/browser/supervised_user/BUILD.gn
@@ -94,9 +94,11 @@ "//url:gurl_java", ] - srcjar_deps = [ ":local_web_approval_outcome_java_enum_srcjar" ] + srcjar_deps = [ + ":jni_headers", + ":local_web_approval_outcome_java_enum_srcjar", + ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/ParentAuthDelegateProvider.java", "android/java/src/org/chromium/chrome/browser/supervised_user/WebsiteParentApproval.java", @@ -120,6 +122,7 @@ android_library("test_support_java") { testonly = true + srcjar_deps = [ ":test_support_jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/supervised_user/SupervisedUserSettingsBridge.java" ] deps = [ ":test_support_jni_headers", @@ -130,7 +133,6 @@ "//components/browser_ui/bottomsheet/android/test:java", "//content/public/test/android:content_java_test_support", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("javatests") {
diff --git a/chrome/browser/sync/android/BUILD.gn b/chrome/browser/sync/android/BUILD.gn index 7c6be0b7..33e5a19 100644 --- a/chrome/browser/sync/android/BUILD.gn +++ b/chrome/browser/sync/android/BUILD.gn
@@ -15,15 +15,17 @@ "//third_party/androidx:androidx_annotation_annotation_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/sync/SyncService.java", "java/src/org/chromium/chrome/browser/sync/SyncServiceImpl.java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") { - visibility = [ "//chrome/browser" ] + visibility = [ + ":*", + "//chrome/browser", + ] sources = [ "java/src/org/chromium/chrome/browser/sync/SyncServiceImpl.java" ] }
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/WebContentsStateBridge.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/WebContentsStateBridge.java index 1636f64b..1b47f9d 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/WebContentsStateBridge.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/WebContentsStateBridge.java
@@ -95,7 +95,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { WebContents restoreContentsFromByteBuffer(ByteBuffer buffer, int savedStateVersion, boolean initiallyHidden, boolean noRenderer);
diff --git a/chrome/browser/test_dummy/internal/BUILD.gn b/chrome/browser/test_dummy/internal/BUILD.gn index c1f73435..a760762 100644 --- a/chrome/browser/test_dummy/internal/BUILD.gn +++ b/chrome/browser/test_dummy/internal/BUILD.gn
@@ -21,9 +21,9 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_appcompat_appcompat_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/test_dummy/TestDummyImpl.java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] deps += [ "//base:jni_java" ] resources_package = "org.chromium.chrome.browser.test_dummy" }
diff --git a/chrome/browser/thumbnail/generator/BUILD.gn b/chrome/browser/thumbnail/generator/BUILD.gn index 1247c20..0a21e78 100644 --- a/chrome/browser/thumbnail/generator/BUILD.gn +++ b/chrome/browser/thumbnail/generator/BUILD.gn
@@ -81,6 +81,7 @@ "//third_party/androidx:androidx_core_core_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailDiskStorage.java", "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailGenerator.java", @@ -89,8 +90,6 @@ "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailProviderImpl.java", "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailStorageDelegate.java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") { @@ -169,6 +168,7 @@ android_library("generator_java_test_support") { testonly = true + srcjar_deps = [ ":test_support_jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailMediaData.java", "android/java/src/org/chromium/chrome/browser/thumbnail/generator/ThumbnailMediaParserBridge.java", @@ -180,8 +180,6 @@ "//base:jni_java", "//build/android:build_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } source_set("test_support") {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 0dda8dd4d..b82563e 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -5688,6 +5688,13 @@ allow_circular_includes_from += [ "//chrome/browser/ui/views" ] + if (is_chrome_branded && !is_android) { + sources += [ + "views/promos/ios_promo_password_bubble.cc", + "views/promos/ios_promo_password_bubble.h", + ] + } + if (is_linux || is_chromeos_lacros) { sources += [ "views/chrome_views_delegate_linux.cc",
diff --git a/chrome/browser/ui/android/autofill/internal/BUILD.gn b/chrome/browser/ui/android/autofill/internal/BUILD.gn index 76d30ab..9514f4c 100644 --- a/chrome/browser/ui/android/autofill/internal/BUILD.gn +++ b/chrome/browser/ui/android/autofill/internal/BUILD.gn
@@ -10,6 +10,7 @@ ":*", "//chrome/android:chrome_all_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/ui/autofill/AuthenticatorOptionsAdapter.java", "java/src/org/chromium/chrome/browser/ui/autofill/AuthenticatorSelectionDialog.java", @@ -36,7 +37,7 @@ "//third_party/androidx:androidx_recyclerview_recyclerview_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.ui.autofill.internal" }
diff --git a/chrome/browser/ui/android/favicon/BUILD.gn b/chrome/browser/ui/android/favicon/BUILD.gn index cee8503..f91ecc42 100644 --- a/chrome/browser/ui/android/favicon/BUILD.gn +++ b/chrome/browser/ui/android/favicon/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/ui/favicon/FaviconHelper.java", "java/src/org/chromium/chrome/browser/ui/favicon/FaviconUtils.java", @@ -30,8 +31,6 @@ ] resources_package = "org.chromium.chrome.browser.ui.favicon" - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/ui/android/layouts/BUILD.gn b/chrome/browser/ui/android/layouts/BUILD.gn index 6edd317..8b35cfc 100644 --- a/chrome/browser/ui/android/layouts/BUILD.gn +++ b/chrome/browser/ui/android/layouts/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":layouts_jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/layouts/CompositorModelChangeProcessor.java", "java/src/org/chromium/chrome/browser/layouts/EventFilter.java", @@ -21,8 +22,6 @@ "java/src/org/chromium/chrome/browser/layouts/scene_layer/SceneOverlayLayer.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ "//base:base_java", "//base:jni_java",
diff --git a/chrome/browser/ui/android/logo/BUILD.gn b/chrome/browser/ui/android/logo/BUILD.gn index ab4d43e..a5195fc0 100644 --- a/chrome/browser/ui/android/logo/BUILD.gn +++ b/chrome/browser/ui/android/logo/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/logo/CachedTintedBitmap.java", "java/src/org/chromium/chrome/browser/logo/LogoBridge.java", @@ -30,7 +31,7 @@ "//third_party/gif_player:gif_player_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.logo" }
diff --git a/chrome/browser/ui/android/toolbar/BUILD.gn b/chrome/browser/ui/android/toolbar/BUILD.gn index ee748f06..605b0ecb 100644 --- a/chrome/browser/ui/android/toolbar/BUILD.gn +++ b/chrome/browser/ui/android/toolbar/BUILD.gn
@@ -186,9 +186,11 @@ "//url:gurl_java", ] - srcjar_deps = [ "//chrome/browser/ui:adaptive_toolbar_enums_java" ] + srcjar_deps = [ + ":jni_headers", + "//chrome/browser/ui:adaptive_toolbar_enums_java", + ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.chrome.browser.toolbar" }
diff --git a/chrome/browser/ui/messages/android/BUILD.gn b/chrome/browser/ui/messages/android/BUILD.gn index 1856e2a0..665d1e0 100644 --- a/chrome/browser/ui/messages/android/BUILD.gn +++ b/chrome/browser/ui/messages/android/BUILD.gn
@@ -21,6 +21,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/ui/messages/infobar/SimpleConfirmInfoBarBuilder.java", "java/src/org/chromium/chrome/browser/ui/messages/snackbar/Snackbar.java", @@ -52,7 +53,6 @@ ] resources_package = "org.chromium.chrome.ui.messages" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/ui/tabs/tab_renderer_data.cc b/chrome/browser/ui/tabs/tab_renderer_data.cc index d465083..2067fd5 100644 --- a/chrome/browser/ui/tabs/tab_renderer_data.cc +++ b/chrome/browser/ui/tabs/tab_renderer_data.cc
@@ -8,7 +8,6 @@ #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/favicon/favicon_utils.h" -#include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-shared.h" #include "chrome/browser/ui/browser.h" @@ -117,6 +116,13 @@ high_efficiency::GetDiscardedMemorySavingsInBytes(contents); } + const auto* const resource_tab_helper = + performance_manager::user_tuning::UserPerformanceTuningManager:: + ResourceUsageTabHelper::FromWebContents(contents); + if (resource_tab_helper) { + data.tab_resource_usage = resource_tab_helper->resource_usage(); + } + return data; } @@ -144,7 +150,8 @@ is_tab_discarded == other.is_tab_discarded && should_show_discard_status == other.should_show_discard_status && discarded_memory_savings_in_bytes == - other.discarded_memory_savings_in_bytes; + other.discarded_memory_savings_in_bytes && + tab_resource_usage == other.tab_resource_usage; } bool TabRendererData::IsCrashed() const {
diff --git a/chrome/browser/ui/tabs/tab_renderer_data.h b/chrome/browser/ui/tabs/tab_renderer_data.h index 71e9d98..30e4e4d 100644 --- a/chrome/browser/ui/tabs/tab_renderer_data.h +++ b/chrome/browser/ui/tabs/tab_renderer_data.h
@@ -8,6 +8,7 @@ #include <string> #include "base/process/kill.h" +#include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h" #include "chrome/browser/ui/tabs/tab_enums.h" #include "chrome/browser/ui/tabs/tab_network_state.h" #include "chrome/browser/ui/thumbnails/thumbnail_image.h" @@ -61,6 +62,10 @@ bool should_show_discard_status = false; // Amount of memory saved through discarding the tab uint64_t discarded_memory_savings_in_bytes = 0; + // Contains information about how much resource a tab is using + scoped_refptr<const performance_manager::user_tuning:: + UserPerformanceTuningManager::TabResourceUsage> + tab_resource_usage; bool is_monochrome_favicon = false; };
diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc index 83352f72..c792bbc 100644 --- a/chrome/browser/ui/ui_features.cc +++ b/chrome/browser/ui/ui_features.cc
@@ -202,6 +202,11 @@ "TabGroupsSave", base::FEATURE_DISABLED_BY_DEFAULT); +// Enables configuring tab hover card image previews in the settings. +BASE_FEATURE(kTabHoverCardImageSettings, + "TabHoverCardImageSettings", + base::FEATURE_ENABLED_BY_DEFAULT); + // Enables preview images in tab-hover cards. // https://crbug.com/928954 BASE_FEATURE(kTabHoverCardImages,
diff --git a/chrome/browser/ui/ui_features.h b/chrome/browser/ui/ui_features.h index ab2764560..50f180e 100644 --- a/chrome/browser/ui/ui_features.h +++ b/chrome/browser/ui/ui_features.h
@@ -107,6 +107,8 @@ BASE_DECLARE_FEATURE(kTabGroupsSave); +BASE_DECLARE_FEATURE(kTabHoverCardImageSettings); + BASE_DECLARE_FEATURE(kTabHoverCardImages); // These parameters control how long the hover card system waits before
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_disallowed_dialog.cc b/chrome/browser/ui/views/borealis/borealis_installer_disallowed_dialog.cc index 6eb0384..e86f8166d 100644 --- a/chrome/browser/ui/views/borealis/borealis_installer_disallowed_dialog.cc +++ b/chrome/browser/ui/views/borealis/borealis_installer_disallowed_dialog.cc
@@ -4,16 +4,25 @@ #include "chrome/browser/ui/views/borealis/borealis_installer_disallowed_dialog.h" #include <memory> +#include <string> +#include "ash/constants/ash_features.h" #include "ash/public/cpp/new_window_delegate.h" #include "ash/public/cpp/shelf_types.h" #include "ash/public/cpp/window_properties.h" +#include "base/functional/callback_forward.h" +#include "base/strings/utf_string_conversions.h" #include "chrome/browser/ash/borealis/borealis_features.h" #include "chrome/browser/ash/borealis/borealis_util.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/ash/system_web_apps/system_web_app_ui_utils.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" +#include "chrome/common/webui_url_constants.h" #include "chrome/grit/generated_resources.h" +#include "components/policy/policy_constants.h" #include "components/strings/grit/components_strings.h" +#include "content/public/browser/browser_thread.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_types.h" @@ -32,60 +41,125 @@ using AllowStatus = ::borealis::BorealisFeatures::AllowStatus; +using MaybeAction = + absl::optional<std::pair<std::u16string, base::OnceClosure>>; + // Views uses tricks like this to ensure singleton-ness of dialogs. static Widget* g_instance_ = nullptr; -static std::pair<std::u16string, absl::optional<GURL>> GetMessageForStatus( - AllowStatus status) { - // TODO(b/256699588): Replace the below direct URLs with p-links. - switch (status) { - case AllowStatus::kAllowed: - DCHECK(false); - // Unreachable in practice. Show "failed" message just in case. - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FAILED), - absl::nullopt}; - case AllowStatus::kFeatureDisabled: - case AllowStatus::kUnsupportedModel: - case AllowStatus::kHardwareChecksFailed: - case AllowStatus::kIncorrectToken: - // TODO(b/256699588): Replace this with an actual help-center link when - // one is created. - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_DISABLED), - GURL("https://www.chromium.org/chromium-os/steam-on-chromeos/" - "#supported-devices")}; - case AllowStatus::kFailedToDetermine: - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FAILED), - absl::nullopt}; - case AllowStatus::kBlockedOnIrregularProfile: - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_IRREGULAR), - absl::nullopt}; - case AllowStatus::kBlockedOnNonPrimaryProfile: - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_PRIMARY), - absl::nullopt}; - case AllowStatus::kBlockedOnChildAccount: - // TODO(b/256699588): Add a help-center link for child-accounts. - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_CHILD), - absl::nullopt}; - case AllowStatus::kVmPolicyBlocked: - case AllowStatus::kUserPrefBlocked: - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_ADMIN), - absl::nullopt}; - case AllowStatus::kBlockedByFlag: - return {l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FLAG), - absl::nullopt}; - } -} - -class BorealisInstallerDisallowedDialog : public DialogDelegate { +class BehaviourProvider { public: - explicit BorealisInstallerDisallowedDialog(AllowStatus status) { + virtual ~BehaviourProvider() = default; + + virtual std::u16string GetMessage() const = 0; + + // Get a label and callback for the "call to action" button, if present. + virtual MaybeAction GetAction() const { return absl::nullopt; } + + virtual std::vector<std::pair<std::u16string, GURL>> GetLinks() const { + return {}; + } +}; + +class DisallowedHardware : public BehaviourProvider { + public: + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_HARDWARE); + } + std::vector<std::pair<std::u16string, GURL>> GetLinks() const override { + // TODO(b/256699588): Replace this with an actual help-center link when + // one is created. + return {{l10n_util::GetStringUTF16(IDS_LEARN_MORE), + GURL("https://www.chromium.org/chromium-os/steam-on-chromeos/" + "#supported-devices")}}; + } +}; + +class DisallowedFailure : public BehaviourProvider { + public: + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FAILED); + } +}; + +class DisallowedIrregular : public BehaviourProvider { + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_IRREGULAR); + } +}; + +class DisallowedPrimary : public BehaviourProvider { + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_PRIMARY); + } + std::vector<std::pair<std::u16string, GURL>> GetLinks() const override { + // TODO(b/256699588): Replace this with a p-link. + return {{l10n_util::GetStringUTF16(IDS_LEARN_MORE), + GURL("https://support.google.com/chromebook/answer/6088201")}}; + } +}; + +class DisallowedChild : public BehaviourProvider { + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_CHILD); + } +}; + +class DisallowedPolicy : public BehaviourProvider { + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_ADMIN); + } + std::vector<std::pair<std::u16string, GURL>> GetLinks() const override { + // As of 2023q2 directly-linking to chromeenterprise is common, so we shall + // do it too. + return { + {base::UTF8ToUTF16(policy::key::kUserBorealisAllowed), + GURL("https://chromeenterprise.google/policies/#UserBorealisAllowed")}, + {base::UTF8ToUTF16(policy::key::kVirtualMachinesAllowed), + GURL("https://chromeenterprise.google/policies/" + "#VirtualMachinesAllowed")}, + }; + } +}; + +class DisallowedFlag : public BehaviourProvider { + std::u16string GetMessage() const override { + return l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FLAG); + } + MaybeAction GetAction() const override { + return {{l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_FLAG_BUTTON), + base::BindOnce([]() { + ash::SystemAppLaunchParams params; + params.url = GURL{std::string(chrome::kChromeUIOsFlagsAppURL) + + "#borealis-enabled"}; + ash::LaunchSystemWebAppAsync( + ProfileManager::GetPrimaryUserProfile(), + ash::SystemWebAppType::OS_FLAGS, params); + })}}; + } +}; + +class BorealisDisallowedDialog : public DialogDelegate { + public: + explicit BorealisDisallowedDialog( + std::unique_ptr<BehaviourProvider> behaviour) { DCHECK(!g_instance_); set_internal_name("BorealisDisallowedDialog"); - SetButtons(ui::DIALOG_BUTTON_OK); - SetButtonLabel(ui::DIALOG_BUTTON_OK, - l10n_util::GetStringUTF16(IDS_BOREALIS_DISALLOWED_BUTTON)); - InitializeView(status); + MaybeAction second_action = behaviour->GetAction(); + if (second_action.has_value()) { + SetButtons(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL); + SetButtonLabel(ui::DIALOG_BUTTON_CANCEL, + l10n_util::GetStringUTF16(IDS_CLOSE)); + SetButtonLabel(ui::DIALOG_BUTTON_OK, + std::move(second_action.value().first)); + SetAcceptCallback(std::move(second_action.value().second)); + } else { + SetButtons(ui::DIALOG_BUTTON_OK); + SetButtonLabel(ui::DIALOG_BUTTON_OK, + l10n_util::GetStringUTF16(IDS_CLOSE)); + } + InitializeView(*behaviour); SetModalType(ui::MODAL_TYPE_NONE); SetOwnedByWidget(true); SetShowCloseButton(false); @@ -93,13 +167,13 @@ views::DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH)); } - ~BorealisInstallerDisallowedDialog() override { + ~BorealisDisallowedDialog() override { DCHECK(g_instance_); g_instance_ = nullptr; } private: - void InitializeView(AllowStatus status) { + void InitializeView(const BehaviourProvider& behaviour) { auto view = std::make_unique<views::View>(); views::LayoutProvider* provider = views::LayoutProvider::Get(); @@ -115,31 +189,55 @@ title_label->SetMultiLine(true); view->AddChildView(title_label); - std::pair<std::u16string, absl::optional<GURL>> message_link = - GetMessageForStatus(status); - views::Label* message_label = new views::Label(message_link.first); + views::Label* message_label = new views::Label(behaviour.GetMessage()); message_label->SetMultiLine(true); message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); view->AddChildView(message_label); - if (message_link.second.has_value()) { - views::Link* learn_more_link = - new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); - learn_more_link->SetHorizontalAlignment(gfx::ALIGN_LEFT); - learn_more_link->SetCallback(base::BindRepeating( + for (const std::pair<std::u16string, GURL>& link : behaviour.GetLinks()) { + views::Link* link_label = + view->AddChildView(std::make_unique<views::Link>(link.first)); + link_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); + link_label->SetCallback(base::BindRepeating( [](GURL url) { ash::NewWindowDelegate::GetPrimary()->OpenUrl( url, ash::NewWindowDelegate::OpenUrlFrom::kUserInteraction, ash::NewWindowDelegate::Disposition::kNewForegroundTab); }, - message_link.second.value())); - view->AddChildView(learn_more_link); + link.second)); } SetContentsView(std::move(view)); } }; +std::unique_ptr<BehaviourProvider> StatusBehaviour(AllowStatus status) { + switch (status) { + case AllowStatus::kAllowed: + DCHECK(false); + // Unreachable in practice. Show "failed" message just in case. + return std::make_unique<DisallowedFailure>(); + case AllowStatus::kFeatureDisabled: + case AllowStatus::kUnsupportedModel: + case AllowStatus::kHardwareChecksFailed: + case AllowStatus::kIncorrectToken: + return std::make_unique<DisallowedHardware>(); + case AllowStatus::kFailedToDetermine: + return std::make_unique<DisallowedFailure>(); + case AllowStatus::kBlockedOnIrregularProfile: + return std::make_unique<DisallowedIrregular>(); + case AllowStatus::kBlockedOnNonPrimaryProfile: + return std::make_unique<DisallowedPrimary>(); + case AllowStatus::kBlockedOnChildAccount: + return std::make_unique<DisallowedChild>(); + case AllowStatus::kVmPolicyBlocked: + case AllowStatus::kUserPrefBlocked: + return std::make_unique<DisallowedPolicy>(); + case AllowStatus::kBlockedByFlag: + return std::make_unique<DisallowedFlag>(); + } +} + } // namespace void ShowInstallerDisallowedDialog(AllowStatus status) { @@ -151,7 +249,8 @@ g_instance_->CloseNow(); } - auto delegate = std::make_unique<BorealisInstallerDisallowedDialog>(status); + auto delegate = + std::make_unique<BorealisDisallowedDialog>(StatusBehaviour(status)); g_instance_ = views::DialogDelegate::CreateDialogWidget(std::move(delegate), nullptr, nullptr); g_instance_->GetNativeWindow()->SetProperty(
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_view.cc b/chrome/browser/ui/views/borealis/borealis_installer_view.cc index 44a14175a..2aca570 100644 --- a/chrome/browser/ui/views/borealis/borealis_installer_view.cc +++ b/chrome/browser/ui/views/borealis/borealis_installer_view.cc
@@ -61,6 +61,11 @@ constexpr auto kButtonRowInsets = gfx::Insets::TLBR(0, 64, 32, 64); +// The left column should be ~1/phi-th the width of the right column. +// +// 456 * ( 2 / (1 + sqrt(5)) ) +constexpr int kLeftPannelWidth = 282; + void ShowBorealisInstallerViewIfAllowed( Profile* profile, borealis::BorealisFeatures::AllowStatus status) { @@ -91,7 +96,7 @@ // We have no confidence in the prediction for the first second or for // too-small proportions. if (completion_proportion < 0.001 || duration < base::Seconds(1)) { - return l10n_util::GetStringUTF16(IDS_BOREALIS_INSTALLER_ONGOING_INACTIVE); + return l10n_util::GetStringUTF16(IDS_BOREALIS_INSTALLER_ONGOING_INITIAL); } // Linear-interpolation to predict remaining time. base::TimeDelta remaining = (duration / completion_proportion) - duration; @@ -142,7 +147,6 @@ left_container_view->SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical, gfx::Insets())); left_layout->set_inside_border_insets(gfx::Insets::TLBR(0, 0, 0, 80)); - AddChildView(left_container_view); views::ImageView* flair = left_container_view->AddChildView(std::make_unique<views::ImageView>()); @@ -153,27 +157,28 @@ flair->SetImage(s); primary_message_label_ = - new TitleLabel(GetPrimaryMessage(), ash::CONTEXT_HEADLINE_OVERSIZED, - views::style::STYLE_PRIMARY); + left_container_view->AddChildView(std::make_unique<TitleLabel>( + GetPrimaryMessage(), ash::CONTEXT_HEADLINE_OVERSIZED, + views::style::STYLE_PRIMARY)); primary_message_label_->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(40, 0, 0, 0)); primary_message_label_->SetMultiLine(true); primary_message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - primary_message_label_->SetMaximumWidth(264); - left_container_view->AddChildView(primary_message_label_.get()); + primary_message_label_->SetMaximumWidth(kLeftPannelWidth); beta_badge_ = left_container_view->AddChildView( std::make_unique<views::BorealisBetaBadge>()); beta_badge_->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(16, 0, 0, 0)); - secondary_message_label_ = new views::Label( - GetSecondaryMessage(), views::style::CONTEXT_DIALOG_BODY_TEXT, - views::style::STYLE_SECONDARY); + secondary_message_label_ = + left_container_view->AddChildView(std::make_unique<views::Label>( + GetSecondaryMessage(), views::style::CONTEXT_DIALOG_BODY_TEXT, + views::style::STYLE_SECONDARY)); secondary_message_label_->SetProperty(views::kMarginsKey, gfx::Insets::TLBR(16, 0, 0, 0)); secondary_message_label_->SetMultiLine(true); secondary_message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); - left_container_view->AddChildView(secondary_message_label_.get()); + secondary_message_label_->SetMaximumWidth(kLeftPannelWidth); views::View* progress_container = left_container_view->AddChildView(std::make_unique<views::View>()); @@ -208,7 +213,6 @@ views::BoxLayout::Orientation::kVertical)); right_container_layout_->set_inside_border_insets( gfx::Insets::TLBR(64, 0, 64, 0)); - AddChildView(right_container_view); big_image_ = new views::ImageView(); big_image_->SetVerticalAlignment(views::ImageView::Alignment::kCenter); @@ -380,7 +384,7 @@ case State::kCompleted: { return l10n_util::GetStringUTF16( button == ui::DIALOG_BUTTON_OK ? IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON - : IDS_APP_CLOSE); + : IDS_APP_CANCEL); } } }
diff --git a/chrome/browser/ui/views/borealis/borealis_installer_view_browsertest.cc b/chrome/browser/ui/views/borealis/borealis_installer_view_browsertest.cc index af8b8aec..b2b4d86 100644 --- a/chrome/browser/ui/views/borealis/borealis_installer_view_browsertest.cc +++ b/chrome/browser/ui/views/borealis/borealis_installer_view_browsertest.cc
@@ -126,7 +126,7 @@ l10n_util::GetStringUTF16(IDS_BOREALIS_INSTALLER_LAUNCH_BUTTON)); EXPECT_TRUE(HasCancelButton()); EXPECT_EQ(view_->GetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL), - l10n_util::GetStringUTF16(IDS_APP_CLOSE)); + l10n_util::GetStringUTF16(IDS_APP_CANCEL)); EXPECT_EQ(view_->GetPrimaryMessage(), l10n_util::GetStringUTF16(IDS_BOREALIS_INSTALLER_FINISHED_TITLE)); }
diff --git a/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc b/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc index 4d8c465..85db77a 100644 --- a/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc +++ b/chrome/browser/ui/views/borealis/borealis_splash_screen_view.cc
@@ -22,6 +22,7 @@ #include "chrome/grit/generated_resources.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/l10n/l10n_util.h" +#include "ui/color/color_provider_manager.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/controls/image_view.h" #include "ui/views/controls/message_box_view.h" @@ -59,7 +60,12 @@ nullptr); g_delegate->UpdateColors(); g_delegate->GetWidget()->GetNativeWindow()->SetProperty( - ash::kShelfIDKey, ash::ShelfID(borealis::kInstallerAppId).Serialize()); + ash::kShelfIDKey, ash::ShelfID(borealis::kClientAppId).Serialize()); + // Override the widget to be dark-mode permanently. + // This UI has custom colors to match Steam's and those are close to ash's + // dark mode. + g_delegate->GetWidget()->SetColorModeOverride( + {ui::ColorProviderManager::ColorMode::kDark}); } g_delegate->GetWidget()->Show(); }
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_button.cc b/chrome/browser/ui/views/extensions/extensions_menu_button.cc index ecbb4b6f..f9d5867 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_button.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_button.cc
@@ -16,7 +16,9 @@ #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/hover_button_controller.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "extensions/common/extension_features.h" #include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/gfx/geometry/insets.h" #include "ui/views/animation/ink_drop.h" #include "ui/views/border.h" #include "ui/views/controls/button/button.h" @@ -71,17 +73,25 @@ SetTooltipText(controller_->GetTooltip(GetCurrentWebContents())); SetEnabled(controller_->IsEnabled(GetCurrentWebContents())); - // The vertical insets need to take into account the icon spacing, since this - // button's icon is larger, to align with others buttons heights. - const int vertical_inset = - provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN) - - provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_ICON_SPACING); - // The horizontal insets reasonably align the extension icons with text inside - // the dialog with the default button margin. - const int horizontal_inset = - provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN); - SetBorder(views::CreateEmptyBorder( - gfx::Insets::VH(vertical_inset, horizontal_inset))); + if (base::FeatureList::IsEnabled( + extensions_features::kExtensionsMenuAccessControl)) { + // Remove the button's border since we are adding margins in between menu + // items. + SetBorder(views::CreateEmptyBorder(gfx::Insets(0))); + } else { + // The vertical insets need to take into account the icon spacing, since + // this + // button's icon is larger, to align with others buttons heights. + const int vertical_inset = + provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN) - + provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_ICON_SPACING); + // The horizontal insets reasonably align the extension icons with text + // inside the dialog with the default button margin. + const int horizontal_inset = + provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN); + SetBorder(views::CreateEmptyBorder( + gfx::Insets::VH(vertical_inset, horizontal_inset))); + } } void ExtensionsMenuButton::ShowContextMenuAsFallback() {
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_item_view.cc b/chrome/browser/ui/views/extensions/extensions_menu_item_view.cc index ba611138..933230b 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_item_view.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_item_view.cc
@@ -188,10 +188,12 @@ ChromeLayoutProvider* const provider = ChromeLayoutProvider::Get(); const int icon_size = provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_EXTENSION_ICON_SIZE); - const int horizontal_inset = - provider->GetDistanceMetric(DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN); const int icon_label_spacing = provider->GetDistanceMetric(views::DISTANCE_RELATED_LABEL_HORIZONTAL); + const int menu_item_vertical_spacing = + provider->GetDistanceMetric(DISTANCE_RELATED_CONTROL_VERTICAL_SMALL); + const int horizontal_spacing = + provider->GetDistanceMetric(DISTANCE_RELATED_LABEL_HORIZONTAL_LIST); auto site_permissions_button_icon = std::make_unique<views::ImageView>(ui::ImageModel::FromVectorIcon( @@ -210,6 +212,10 @@ views::Builder<views::FlexLayoutView>() .SetOrientation(views::LayoutOrientation::kHorizontal) .SetIgnoreDefaultMainAxisMargins(true) + // Spacing between menu items is done by setting the top margin. + // Horizontal margins are added by the parent view. + .SetInteriorMargin( + gfx::Insets::TLBR(menu_item_vertical_spacing, 0, 0, 0)) .AddChildren( // Primary action button. views::Builder<ExtensionsMenuButton>( @@ -221,6 +227,9 @@ // Site access toggle. views::Builder<views::ToggleButton>() .CopyAddressTo(&site_access_toggle_) + .SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, horizontal_spacing, 0, 0)) .SetCallback(base::BindRepeating( [](views::ToggleButton* toggle_button, base::RepeatingCallback<void(bool)> @@ -235,6 +244,9 @@ views::Button::PressedCallback(), std::u16string())) .CopyAddressTo(&context_menu_button_) .SetID(EXTENSION_CONTEXT_MENU) + .SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, horizontal_spacing, 0, 0)) .SetBorder(views::CreateEmptyBorder( ChromeLayoutProvider::Get()->GetDistanceMetric( DISTANCE_EXTENSIONS_MENU_BUTTON_MARGIN))) @@ -255,13 +267,12 @@ std::u16string(), std::u16string(), std::move(site_permissions_button_icon))) .CopyAddressTo(&site_permissions_button_) - // Margin to align the main and secondary row text. Icon - // size and horizontal insets should be the values used by - // the extensions menu button. + // Align the main and secondary row text by adding the primary + // action button's icon size as margin. .SetProperty(views::kMarginsKey, - gfx::Insets::VH(0, icon_size + horizontal_inset)) - // Border should be the same as the icon label - // spacing used by the extensions menu button. + gfx::Insets::VH(0, icon_size)) + // Border should be the same as the space between icon and + // label in the primary action button. .SetBorder(views::CreateEmptyBorder( gfx::Insets::VH(0, icon_label_spacing))))) .BuildChildren();
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc b/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc index 1e81e62..d2becabf 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_main_page_view.cc
@@ -409,6 +409,22 @@ /*adjust_height_for_width =*/true) .WithWeight(1); + ChromeLayoutProvider* const chrome_layout_provider = + ChromeLayoutProvider::Get(); + const int vertical_spacing = chrome_layout_provider->GetDistanceMetric( + DISTANCE_UNRELATED_CONTROL_VERTICAL_LARGE); + const int horizontal_spacing = chrome_layout_provider->GetDistanceMetric( + DISTANCE_RELATED_CONTROL_HORIZONTAL_SMALL); + // This value must be the same as the `HoverButton` vertical margin. + const int hover_button_vertical_spacing = + chrome_layout_provider->GetDistanceMetric( + DISTANCE_CONTROL_LIST_VERTICAL) / + 2; + + views::LayoutProvider* layout_provider = views::LayoutProvider::Get(); + const gfx::Insets dialog_insets = + layout_provider->GetInsetsMetric(views::InsetsMetric::INSETS_DIALOG); + views::Builder<ExtensionsMenuMainPageView>(this) .SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical)) @@ -418,6 +434,13 @@ // Subheader section. views::Builder<views::FlexLayoutView>() .SetCrossAxisAlignment(views::LayoutAlignment::kStart) + // Add top dialog margins, since its the first element, and + // horizontal dialog margins. Bottom margin will be added by the + // next view (in general, vertical margins should be added by the + // bottom view). + .SetInteriorMargin(gfx::Insets::TLBR(dialog_insets.top(), + dialog_insets.left(), 0, + dialog_insets.right())) .SetProperty(views::kFlexBehaviorKey, stretch_specification) .SetVisible(true) .AddChildren( @@ -467,6 +490,9 @@ }, browser_), vector_icons::kSettingsIcon)) + .SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, horizontal_spacing, 0, 0)) .SetAccessibleName( l10n_util::GetStringUTF16(IDS_MANAGE_EXTENSIONS)) .CustomConfigure( @@ -477,6 +503,9 @@ // Toggle site settings button. views::Builder<views::ToggleButton>() .CopyAddressTo(&site_settings_toggle_) + .SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR(0, horizontal_spacing, 0, 0)) .SetCallback(base::BindRepeating( [](views::ToggleButton* toggle_button, base::RepeatingCallback<void(bool)> callback) { @@ -488,7 +517,8 @@ OnSiteSettingsToggleButtonPressed, base::Unretained(menu_handler))))), // Contents. - views::Builder<views::Separator>(), + views::Builder<views::Separator>().SetProperty( + views::kMarginsKey, gfx::Insets::VH(vertical_spacing, 0)), views::Builder<views::ScrollView>() .ClipHeightTo(0, kMaxExtensionButtonsHeightDp) .SetDrawOverflowIndicator(false) @@ -497,6 +527,11 @@ .SetContents( views::Builder<views::BoxLayoutView>() .SetOrientation(views::BoxLayout::Orientation::kVertical) + // Horizontal dialog margins are added inside the scroll + // view contents to have the scroll bar by the dialog + // border. + .SetInsideBorderInsets( + gfx::Insets::VH(0, dialog_insets.left())) .AddChildren( // Message section. views::Builder<MessageSection>( @@ -517,6 +552,15 @@ // Menu items section. views::Builder<views::BoxLayoutView>() .CopyAddressTo(&menu_items_) + // Add bottom dialog margins since it's the last + // element. + .SetProperty( + views::kMarginsKey, + gfx::Insets::TLBR( + 0, 0, + dialog_insets.bottom() - + hover_button_vertical_spacing, + 0)) .SetOrientation( views::BoxLayout::Orientation::kVertical))))
diff --git a/chrome/browser/ui/views/promos/ios_promo_password_bubble.cc b/chrome/browser/ui/views/promos/ios_promo_password_bubble.cc new file mode 100644 index 0000000..3472e87 --- /dev/null +++ b/chrome/browser/ui/views/promos/ios_promo_password_bubble.cc
@@ -0,0 +1,291 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/promos/ios_promo_password_bubble.h" +#include <memory> +#include "base/functional/bind.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/views/chrome_typography.h" +#include "chrome/grit/generated_resources.h" +#include "chrome/grit/theme_resources.h" +#include "chrome/services/qrcode_generator/public/cpp/qrcode_generator_service.h" +#include "content/public/browser/page_navigator.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/base/models/dialog_model.h" +#include "ui/base/page_transition_types.h" +#include "ui/base/window_open_disposition.h" +#include "ui/views/bubble/bubble_dialog_delegate_view.h" +#include "ui/views/bubble/bubble_dialog_model_host.h" +#include "ui/views/interaction/element_tracker_views.h" +#include "ui/views/view_class_properties.h" +#include "ui/views/view_utils.h" + +namespace constants { +// Margin for QR code image view. +constexpr int kQrCodeMargin = 20; + +// Size of QR code image view. +constexpr int kQrCodeImageSize = 100; + +// URL used for the QR code within the promo +const char kQRCodeURL[] = + "https://itunes.apple.com/app/apple-store/" + "id535886823?pt=9008&ct=saved-passwords-ios-promo-direct-qr&mt=8"; + +// URL used for the new tab opened by clicking the "Get Started" button. +const char kGetStartedButtonURL[] = "https://google.com/chrome/chrome-for-ios"; +} // namespace constants + +DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(IOSPromoPasswordBubble, kQRCodeView); + +// Pointer to BubbleDialogDelegate instance. +views::BubbleDialogDelegate* ios_promo_password_delegate_ = nullptr; + +class IOSPromoPasswordBubbleDelegate : public ui::DialogModelDelegate { + public: + explicit IOSPromoPasswordBubbleDelegate(Browser* browser) + : browser_(browser) { + qr_code_service_ = nullptr; + } + + // Returns a new QR code generator service if one does not yet exist. + qrcode_generator::QRImageGenerator& GetQRCodeGenerator() { + if (!qr_code_service_) { + qr_code_service_ = std::make_unique<qrcode_generator::QRImageGenerator>(); + } + return *qr_code_service_; + } + + // Handler for when the window closes. + void OnWindowClosing() { + ios_promo_password_delegate_ = nullptr; + qr_code_service_ = nullptr; + } + + // Callback passed to QR code generation for populating the QR code image in + // the UI. + void OnQrCodeGenerated( + const qrcode_generator::mojom::GenerateQRCodeResponsePtr response) { + DCHECK(response->error_code == + qrcode_generator::mojom::QRCodeGeneratorError::NONE); + + auto qr_code_views = views::ElementTrackerViews::GetInstance() + ->GetAllMatchingViewsInAnyContext( + IOSPromoPasswordBubble::kQRCodeView); + + // There should only be one promo at a time. + DCHECK(qr_code_views.size() == 1); + + views::ImageView* image_view = + views::AsViewClass<views::ImageView>(qr_code_views.front()); + + image_view->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(response->bitmap)); + } + + // Callback for when the "Get started" button is clicked. + void OnGetStartedButtonClicked() { + browser_->OpenURL(content::OpenURLParams( + GURL(constants::kGetStartedButtonURL), content::Referrer(), + WindowOpenDisposition::NEW_FOREGROUND_TAB, + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); + + ios_promo_password_delegate_->GetWidget()->Close(); + } + + private: + // Pointer to the QR code generator service. + std::unique_ptr<qrcode_generator::QRImageGenerator> qr_code_service_; + + // Pointer to the current Browser; + std::unique_ptr<Browser> browser_; +}; + +// CreateFooter creates the view that is inserted as footer to the bubble. +std::unique_ptr<views::View> CreateFooter( + IOSPromoPasswordBubble::PromoVariant variant, + IOSPromoPasswordBubbleDelegate* bubble_delegate) { + views::LayoutProvider* provider = views::LayoutProvider::Get(); + + auto footer_title_container = + views::Builder<views::BoxLayoutView>() + .SetOrientation(views::BoxLayout::Orientation::kHorizontal) + .AddChild(views::Builder<views::ImageView>() + .SetImage(ui::ResourceBundle::GetSharedInstance() + .GetImageSkiaNamed(IDR_PRODUCT_LOGO_32)) + .SetImageSize(gfx::Size(20, 20))) + .AddChild(views::Builder<views::Label>() + .SetText(l10n_util::GetStringUTF16( + IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_TITLE)) + .SetTextStyle(views::style::STYLE_PRIMARY) + .SetMultiLine(true) + .SetHorizontalAlignment( + gfx::HorizontalAlignment::ALIGN_TO_HEAD)) + .SetBetweenChildSpacing(provider->GetDistanceMetric( + views::DistanceMetric:: + DISTANCE_TEXTFIELD_HORIZONTAL_TEXT_PADDING)) + .SetMainAxisAlignment(views::BoxLayout::MainAxisAlignment::kStart); + + auto footer_view = + views::Builder<views::BoxLayoutView>() + .SetOrientation(views::BoxLayout::Orientation::kVertical) + .SetMainAxisAlignment(views::BoxLayout::MainAxisAlignment::kStart) + .SetCrossAxisAlignment(views::BoxLayout::CrossAxisAlignment::kStretch) + .SetBetweenChildSpacing(provider->GetDistanceMetric( + views::DistanceMetric:: + DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT)); + + if (variant == + IOSPromoPasswordBubble::PromoVariant::GET_STARTED_BUTTON_VARIANT) { + auto footer_description = + views::Builder<views::Label>() + .SetText(l10n_util::GetStringUTF16( + IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_GENERIC)) + .SetTextContext(ChromeTextContext::CONTEXT_DIALOG_BODY_TEXT_SMALL) + .SetTextStyle(views::style::STYLE_SECONDARY) + .SetMultiLine(true) + .SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_TO_HEAD); + + auto button_callback = base::BindRepeating( + &IOSPromoPasswordBubbleDelegate::OnGetStartedButtonClicked, + base::Unretained(bubble_delegate)); + auto footer_button_container = + views::Builder<views::BoxLayoutView>() + .SetOrientation(views::BoxLayout::Orientation::kHorizontal) + .SetMainAxisAlignment(views::BoxLayout::MainAxisAlignment::kEnd) + .AddChild(views::Builder<views::MdTextButton>() + .SetText(l10n_util::GetStringUTF16( + IDS_IOS_PASSWORD_PROMO_BUBBLE_BUTTON)) + .SetIsDefault(true) + .SetCallback(button_callback)); + + return std::move(footer_view.AddChild(footer_title_container) + .AddChild(footer_description) + .AddChild(footer_button_container)) + .Build(); + + } else if (variant == IOSPromoPasswordBubble::PromoVariant::QR_CODE_VARIANT) { + qrcode_generator::mojom::GenerateQRCodeRequestPtr request = + qrcode_generator::mojom::GenerateQRCodeRequest::New(); + request->data = std::string(constants::kQRCodeURL); + request->center_image = qrcode_generator::mojom::CenterImage::CHROME_DINO; + + request->render_module_style = + qrcode_generator::mojom::ModuleStyle::CIRCLES; + request->render_locator_style = + qrcode_generator::mojom::LocatorStyle::ROUNDED; + + auto callback = + base::BindOnce(&IOSPromoPasswordBubbleDelegate::OnQrCodeGenerated, + base::Unretained(bubble_delegate)); + bubble_delegate->GetQRCodeGenerator().GenerateQRCode(std::move(request), + std::move(callback)); + views::Label* footer_qr_description_view_ptr = nullptr; + auto footer_content_container = + views::Builder<views::BoxLayoutView>() + .SetOrientation(views::BoxLayout::Orientation::kHorizontal) + .SetMainAxisAlignment(views::BoxLayout::MainAxisAlignment::kStart) + .SetCrossAxisAlignment( + views::BoxLayout::CrossAxisAlignment::kCenter) + .AddChild( + views::Builder<views::Label>() + .SetText(l10n_util::GetStringUTF16( + IDS_IOS_PASSWORD_PROMO_BUBBLE_FOOTER_DESCRIPTION_QR)) + .SetTextContext( + ChromeTextContext::CONTEXT_DIALOG_BODY_TEXT_SMALL) + .SetTextStyle(views::style::STYLE_SECONDARY) + .SetMultiLine(true) + .SetHorizontalAlignment( + gfx::HorizontalAlignment::ALIGN_TO_HEAD) + .CopyAddressTo(&footer_qr_description_view_ptr)) + .AddChild( + views::Builder<views::ImageView>() + .SetHorizontalAlignment( + views::ImageView::Alignment::kCenter) + .SetHorizontalAlignment( + views::ImageView::Alignment::kCenter) + .SetImageSize(gfx::Size(constants::kQrCodeImageSize, + constants::kQrCodeImageSize)) + .SetPreferredSize(gfx::Size(constants::kQrCodeImageSize, + constants::kQrCodeImageSize) + + gfx::Size(constants::kQrCodeMargin, + constants::kQrCodeMargin)) + .SetProperty(views::kElementIdentifierKey, + IOSPromoPasswordBubble::kQRCodeView) + .SetVisible(true) + .SetBackground(views::CreateSolidBackground(SK_ColorWHITE))) + .AfterBuild(base::BindOnce( + [](views::Label* footer_description_view_ptr, + views::BoxLayoutView* view) { + view->SetFlexForView(footer_description_view_ptr, 1); + }, + footer_qr_description_view_ptr)); + + return std::move(footer_view.AddChild(footer_title_container) + .AddChild(footer_content_container)) + .Build(); + } else { + NOTREACHED_NORETURN(); + } +} + +// static +void IOSPromoPasswordBubble::ShowBubble(views::View* anchor_view, + PageActionIconView* highlighted_button, + PromoVariant variant, + Browser* browser) { + if (ios_promo_password_delegate_) { + return; + } + + auto bubble_delegate_unique = + std::make_unique<IOSPromoPasswordBubbleDelegate>(browser); + IOSPromoPasswordBubbleDelegate* bubble_delegate = + bubble_delegate_unique.get(); + + auto dialog_model_builder = + ui::DialogModel::Builder(std::move(bubble_delegate_unique)); + + dialog_model_builder.SetDialogDestroyingCallback( + base::BindOnce(&IOSPromoPasswordBubbleDelegate::OnWindowClosing, + base::Unretained(bubble_delegate))); + + ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); + auto banner_image = ui::ImageModel::FromImageSkia( + *bundle.GetImageSkiaNamed(IDR_SUCCESS_GREEN_CHECKMARK)); + dialog_model_builder.SetBannerImage(banner_image); + + dialog_model_builder.SetTitle( + l10n_util::GetStringUTF16(IDS_IOS_PASSWORD_PROMO_BUBBLE_TITLE)); + + auto subtitle = std::make_unique<views::Label>( + l10n_util::GetStringUTF16(IDS_IOS_PASSWORD_PROMO_BUBBLE_SUBTITLE), + ChromeTextContext::CONTEXT_DIALOG_BODY_TEXT_SMALL, + views::style::STYLE_SECONDARY); + subtitle->SetMultiLine(true); + subtitle->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_TO_HEAD); + + dialog_model_builder.AddCustomField( + std::make_unique<views::BubbleDialogModelHost::CustomView>( + std::move(subtitle), views::BubbleDialogModelHost::FieldType::kText)); + + auto promo_bubble = std::make_unique<views::BubbleDialogModelHost>( + dialog_model_builder.Build(), anchor_view, + views::BubbleBorder::TOP_RIGHT); + + ios_promo_password_delegate_ = promo_bubble.get(); + + promo_bubble->SetHighlightedButton(highlighted_button); + promo_bubble->SetFootnoteView(CreateFooter(variant, bubble_delegate)); + + views::Widget* const widget = + views::BubbleDialogDelegate::CreateBubble(std::move(promo_bubble)); + widget->Show(); +} + +// static +void IOSPromoPasswordBubble::Hide() { + if (ios_promo_password_delegate_) { + ios_promo_password_delegate_->GetWidget()->Close(); + } +}
diff --git a/chrome/browser/ui/views/promos/ios_promo_password_bubble.h b/chrome/browser/ui/views/promos/ios_promo_password_bubble.h new file mode 100644 index 0000000..4837241 --- /dev/null +++ b/chrome/browser/ui/views/promos/ios_promo_password_bubble.h
@@ -0,0 +1,45 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_VIEWS_PROMOS_IOS_PROMO_PASSWORD_BUBBLE_H_ +#define CHROME_BROWSER_UI_VIEWS_PROMOS_IOS_PROMO_PASSWORD_BUBBLE_H_ + +#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" + +namespace views { +class PageActionIconView; +class View; +} // namespace views + +class Browser; + +// A view for the iOS bubble promo which support 2 variants. One variant +// displays a QR code and the other a button which redirects the user to a +// download page. +class IOSPromoPasswordBubble { + public: + // Enum for the different variants the promo can be. + enum PromoVariant { + GET_STARTED_BUTTON_VARIANT = 0, + QR_CODE_VARIANT, + }; + + // QR code view identifier. + DECLARE_CLASS_ELEMENT_IDENTIFIER_VALUE(kQRCodeView); + + IOSPromoPasswordBubble(const IOSPromoPasswordBubble&) = delete; + IOSPromoPasswordBubble& operator=(const IOSPromoPasswordBubble&) = delete; + + // ShowBubble creates the view and shows the bubble to the user, attached + // to the passwords key icon. + static void ShowBubble(views::View* anchor_view, + PageActionIconView* highlighted_button, + PromoVariant variant, + Browser* browser); + + // Hide closes the bubble. + static void Hide(); +}; + +#endif // CHROME_BROWSER_UI_VIEWS_PROMOS_IOS_PROMO_PASSWORD_BUBBLE_H_
diff --git a/chrome/browser/ui/views/promos/ios_promo_password_bubble_browsertest.cc b/chrome/browser/ui/views/promos/ios_promo_password_bubble_browsertest.cc new file mode 100644 index 0000000..70f9ad5 --- /dev/null +++ b/chrome/browser/ui/views/promos/ios_promo_password_bubble_browsertest.cc
@@ -0,0 +1,52 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/page_action/page_action_icon_type.h" +#include "chrome/browser/ui/test/test_browser_dialog.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/frame/toolbar_button_provider.h" +#include "chrome/browser/ui/views/promos/ios_promo_password_bubble.h" +#include "content/public/test/browser_test.h" + +class IOSPromoPasswordBubbleTest : public DialogBrowserTest { + public: + IOSPromoPasswordBubbleTest() = default; + + IOSPromoPasswordBubbleTest(const IOSPromoPasswordBubbleTest&) = delete; + + IOSPromoPasswordBubbleTest& operator=(const IOSPromoPasswordBubbleTest&) = + delete; + + // DialogBrowserTest + void ShowUi(const std::string& name) override { + ToolbarButtonProvider* button_provider = + BrowserView::GetBrowserViewForBrowser(browser()) + ->toolbar_button_provider(); + + if (name == "qr_code") { + IOSPromoPasswordBubble::ShowBubble( + button_provider->GetAnchorView(PageActionIconType::kManagePasswords), + button_provider->GetPageActionIconView( + PageActionIconType::kManagePasswords), + IOSPromoPasswordBubble::PromoVariant::QR_CODE_VARIANT, browser()); + } else { + // default + IOSPromoPasswordBubble::ShowBubble( + button_provider->GetAnchorView(PageActionIconType::kManagePasswords), + button_provider->GetPageActionIconView( + PageActionIconType::kManagePasswords), + IOSPromoPasswordBubble::PromoVariant::GET_STARTED_BUTTON_VARIANT, + browser()); + } + } +}; + +IN_PROC_BROWSER_TEST_F(IOSPromoPasswordBubbleTest, InvokeUi_default) { + ShowAndVerifyUi(); +} + +IN_PROC_BROWSER_TEST_F(IOSPromoPasswordBubbleTest, InvokeUi_qr_code) { + ShowAndVerifyUi(); +}
diff --git a/chrome/browser/ui/web_applications/app_browser_controller_browsertest_chromeos.cc b/chrome/browser/ui/web_applications/app_browser_controller_browsertest_chromeos.cc index 0810224c..9348a11 100644 --- a/chrome/browser/ui/web_applications/app_browser_controller_browsertest_chromeos.cc +++ b/chrome/browser/ui/web_applications/app_browser_controller_browsertest_chromeos.cc
@@ -269,8 +269,10 @@ app_browser_->tab_strip_model()->GetActiveWebContents(); content::ThemeChangeWaiter theme_waiter(web_contents); EXPECT_TRUE(content::ExecJs(web_contents, R"( - document.documentElement.innerHTML = - '<meta name="theme-color" content="yellow">'; + const el = document.createElement("meta"); + el.setAttribute("name", "theme-color"); + el.setAttribute("content", "yellow"); + document.documentElement.appendChild(el); )", content::EXECUTE_SCRIPT_DEFAULT_OPTIONS, /*world_id=*/1));
diff --git a/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc b/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc index e8aeeb9..515e32b 100644 --- a/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc +++ b/chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.cc
@@ -5,10 +5,12 @@ #include "chrome/browser/ui/webui/ash/cloud_upload/cloud_upload_dialog.h" #include "ash/resources/vector_icons/vector_icons.h" +#include "base/containers/enum_set.h" #include "base/files/file_path.h" #include "base/functional/bind.h" #include "base/functional/callback.h" #include "base/logging.h" +#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/notreached.h" #include "base/strings/escape.h" @@ -79,6 +81,9 @@ constexpr char kFileHandlerSelectionMetricName[] = "FileBrowser.OfficeFiles.Setup.FileHandlerSelection"; +constexpr char kFirstTimeMicrosoft365AvailabilityMetric[] = + "FileBrowser.OfficeFiles.Setup.FirstTimeMicrosoft365Availability"; + // These values are persisted to logs. Entries should not be renumbered and // numeric values should never be reused. enum class OfficeFilesTransferRequired { @@ -113,6 +118,19 @@ kMicrosoftOneDrive = 101, }; +// Represents (as a bitmask) whether or not Microsoft 365 PWA and ODFS are set +// up. Used to record this state when setup is launched. +// +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class Microsoft365Availability { + kPWA = 0, + kODFS = 1, + + kMinValue = kPWA, + kMaxValue = kODFS, +}; + std::vector<ProvidedFileSystemInfo> GetODFSFileSystems(Profile* profile) { Service* service = Service::Get(profile); ProviderId provider_id = ProviderId::CreateFromExtensionId( @@ -338,6 +356,21 @@ }); } +void RecordMicrosoft365Availability(const char* metric, Profile* profile) { + base::EnumSet<Microsoft365Availability, Microsoft365Availability::kMinValue, + Microsoft365Availability::kMaxValue> + ms365_state; + if (CloudUploadDialog::IsOfficeWebAppInstalled(profile)) { + ms365_state.Put(Microsoft365Availability::kPWA); + } + if (CloudUploadDialog::IsODFSMounted(profile)) { + ms365_state.Put(Microsoft365Availability::kODFS); + } + base::UmaHistogramExactLinear( + metric, ms365_state.ToEnumBitmask(), + decltype(ms365_state)::All().ToEnumBitmask() + 1); +} + } // namespace // static @@ -382,6 +415,8 @@ // With' menu. In that case we might need to run fixup or just open/move the // file, but without changing stored user file handler preferences. if (!HaveExplicitFileHandlers(profile_, file_urls_)) { + RecordMicrosoft365Availability(kFirstTimeMicrosoft365AvailabilityMetric, + profile_); return InitAndShowDialog(mojom::DialogPage::kFileHandlerDialog); }
diff --git a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_ui.cc b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_ui.cc index 16bfc97..700fe01 100644 --- a/chrome/browser/ui/webui/ash/in_session_password_change/password_change_ui.cc +++ b/chrome/browser/ui/webui/ash/in_session_password_change/password_change_ui.cc
@@ -94,13 +94,12 @@ prefs::kSamlInSessionPasswordChangeEnabled)); content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd( profile, chrome::kChromeUIPasswordChangeHost); + webui::EnableTrustedTypesCSP(source); const std::string password_change_url = GetPasswordChangeUrl(profile); web_ui->AddMessageHandler( std::make_unique<PasswordChangeHandler>(password_change_url)); - source->DisableTrustedTypesCSP(); - source->AddString("hostedHeader", GetHostedHeaderText(password_change_url)); source->UseStringsJs(); @@ -129,8 +128,7 @@ prefs::kSamlInSessionPasswordChangeEnabled)); content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd( profile, chrome::kChromeUIConfirmPasswordChangeHost); - - source->DisableTrustedTypesCSP(); + webui::EnableTrustedTypesCSP(source); static constexpr webui::LocalizedString kLocalizedStrings[] = { {"title", IDS_PASSWORD_CHANGE_CONFIRM_DIALOG_TITLE}, @@ -182,8 +180,7 @@ content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd( profile, chrome::kChromeUIUrgentPasswordExpiryNotificationHost); - - source->DisableTrustedTypesCSP(); + webui::EnableTrustedTypesCSP(source); SamlPasswordAttributes attrs = SamlPasswordAttributes::LoadFromPrefs(prefs); if (attrs.has_expiration_time()) {
diff --git a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.cc b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.cc index 03046fc..e7c3e1f 100644 --- a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.cc +++ b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_ui.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/webui/ash/internet_config_dialog.h" #include "chrome/browser/ui/webui/ash/internet_detail_dialog.h" #include "chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_network_handler.h" +#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/url_constants.h" #include "chrome/grit/browser_resources.h" #include "chrome/grit/generated_resources.h" @@ -72,9 +73,7 @@ content::WebUIDataSource* html = content::WebUIDataSource::CreateAndAdd( web_ui->GetWebContents()->GetBrowserContext(), chrome::kChromeUILockScreenNetworkHost); - - // TODO(crbug.com/1400799): Enable TrustedTypes - html->DisableTrustedTypesCSP(); + webui::EnableTrustedTypesCSP(html); html->AddLocalizedStrings(localized_strings);
diff --git a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_start_reauth_ui.cc b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_start_reauth_ui.cc index 9f2af02..d4e35c05 100644 --- a/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_start_reauth_ui.cc +++ b/chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_start_reauth_ui.cc
@@ -14,6 +14,7 @@ #include "chrome/browser/ui/webui/ash/lock_screen_reauth/lock_screen_reauth_handler.h" #include "chrome/browser/ui/webui/ash/login/oobe_ui.h" #include "chrome/browser/ui/webui/metrics_handler.h" +#include "chrome/browser/ui/webui/webui_util.h" #include "chrome/common/pref_names.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/browser_resources.h" @@ -47,15 +48,13 @@ content::WebUIDataSource* source = content::WebUIDataSource::CreateAndAdd( profile, chrome::kChromeUILockScreenStartReauthHost); + webui::EnableTrustedTypesCSP(source); auto main_handler = std::make_unique<LockScreenReauthHandler>(email); main_handler_ = main_handler.get(); web_ui->AddMessageHandler(std::move(main_handler)); web_ui->AddMessageHandler(std::make_unique<MetricsHandler>()); - // TODO(crbug.com/1400799): Enable TrustedTypes. - source->DisableTrustedTypesCSP(); - source->EnableReplaceI18nInJS(); source->UseStringsJs();
diff --git a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc index bbe6f3e..440202d 100644 --- a/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc +++ b/chrome/browser/ui/webui/chrome_url_data_manager_browsertest.cc
@@ -39,7 +39,10 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_features.h" +#include "ash/constants/ash_switches.h" +#include "chrome/browser/ash/login/login_pref_names.h" #include "chromeos/constants/chromeos_features.h" +#include "components/prefs/pref_service.h" #else #include "chrome/browser/signin/signin_features.h" #endif @@ -160,6 +163,10 @@ EXPECT_NE(net::OK, observer.net_error()); } +#if BUILDFLAG(IS_CHROMEOS_ASH) +class PrefService; +#endif + class ChromeURLDataManagerWebUITrustedTypesTest : public InProcessBrowserTest, public testing::WithParamInterface<const char*> { @@ -234,6 +241,19 @@ return name; } + protected: +#if BUILDFLAG(IS_CHROMEOS_ASH) + void SetUpCommandLine(base::CommandLine* command_line) override { + command_line->AppendSwitchASCII(ash::switches::kSamlPasswordChangeUrl, + "http://password-change.example"); + } + + void SetUpOnMainThread() override { + browser()->profile()->GetPrefs()->SetBoolean( + ash::prefs::kSamlInSessionPasswordChangeEnabled, true); + } +#endif + private: base::test::ScopedFeatureList feature_list_; #if !BUILDFLAG(IS_CHROMEOS_ASH) @@ -381,6 +401,9 @@ "chrome://add-supervision/", "chrome://app-disabled", "chrome://certificate-manager/", + // Crashes because message handler is not registered outside of the dialog + // for confirm password change UI. + // "chrome://confirm-password-change", "chrome://cloud-upload", "chrome://cryptohome", "chrome://drive-internals", @@ -396,6 +419,7 @@ "chrome://network", "chrome://office-fallback/", "chrome://parent-access", + "chrome://password-change", "chrome://power", "chrome://projector", "chrome://proximity-auth/proximity_auth.html", @@ -403,6 +427,7 @@ "chrome://slow", "chrome://smb-credentials-dialog/", "chrome://smb-share-dialog/", + "chrome://urgent-password-expiry-notification/", "chrome://sys-internals", #endif #if !BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/ui/webui/settings/ash/apps_section.cc b/chrome/browser/ui/webui/settings/ash/apps_section.cc index 8e0d933..439a160 100644 --- a/chrome/browser/ui/webui/settings/ash/apps_section.cc +++ b/chrome/browser/ui/webui/settings/ash/apps_section.cc
@@ -197,6 +197,8 @@ void AddAppManagementStrings(content::WebUIDataSource* html_source) { static constexpr webui::LocalizedString kLocalizedStrings[] = { {"appManagementAppDetailsTitle", IDS_APP_MANAGEMENT_APP_DETAILS_TITLE}, + {"appManagementAppDetailsTooltipSystem", + IDS_APP_MANAGEMENT_APP_DETAILS_TOOLTIP_SYSTEM}, {"appManagementAppDetailsTypeAndroid", IDS_APP_MANAGEMENT_APP_DETAILS_TYPE_ANDROID}, {"appManagementAppDetailsTypeChrome",
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index e21ebfd2..eb68186 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -371,6 +371,7 @@ {"chromeColors", IDS_SETTINGS_CHROME_COLORS}, {"showHomeButton", IDS_SETTINGS_SHOW_HOME_BUTTON}, {"showBookmarksBar", IDS_SETTINGS_SHOW_BOOKMARKS_BAR}, + {"showHoverCardImages", IDS_SETTINGS_SHOW_HOVER_CARD_IMAGES}, {"sidePanel", IDS_SETTINGS_SIDE_PANEL}, {"homePageNtp", IDS_SETTINGS_HOME_PAGE_NTP}, {"changeHomePage", IDS_SETTINGS_CHANGE_HOME_PAGE}, @@ -418,6 +419,9 @@ html_source->AddBoolean("showReaderModeOption", dom_distiller::OfferReaderModeInSettings()); html_source->AddBoolean("showSidePanelOptions", true); + html_source->AddBoolean( + "showHoverCardImagesOption", + base::FeatureList::IsEnabled(features::kTabHoverCardImageSettings)); // TODO(crbug.com/1052397): Revisit the macro expression once build flag switch // of lacros-chrome is complete.
diff --git a/chrome/browser/usb/android/BUILD.gn b/chrome/browser/usb/android/BUILD.gn index e9150b1..b9fa07d 100644 --- a/chrome/browser/usb/android/BUILD.gn +++ b/chrome/browser/usb/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/usb/UsbBridge.java", "java/src/org/chromium/chrome/browser/usb/UsbNotificationManager.java", @@ -26,7 +27,7 @@ "//third_party/androidx:androidx_fragment_fragment_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.usb" }
diff --git a/chrome/browser/util/BUILD.gn b/chrome/browser/util/BUILD.gn index 399cddd6..3774734 100644 --- a/chrome/browser/util/BUILD.gn +++ b/chrome/browser/util/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/chrome/browser/util/AfterStartupTaskUtils.java", "android/java/src/org/chromium/chrome/browser/util/AndroidTaskUtils.java", @@ -26,7 +27,6 @@ "//ui/android:ui_full_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/chrome/browser/web_applications/BUILD.gn b/chrome/browser/web_applications/BUILD.gn index e9ab3495..ad9cde66 100644 --- a/chrome/browser/web_applications/BUILD.gn +++ b/chrome/browser/web_applications/BUILD.gn
@@ -888,10 +888,7 @@ group("browser_tests") { testonly = true - deps = [ - ":web_applications_browser_tests", - "adjustments:adjustments_browser_tests", - ] + deps = [ ":web_applications_browser_tests" ] } # On Lacros, these browser tests require Ash to be running.
diff --git a/chrome/browser/web_applications/adjustments/BUILD.gn b/chrome/browser/web_applications/adjustments/BUILD.gn index b32b056a..fe219a6 100644 --- a/chrome/browser/web_applications/adjustments/BUILD.gn +++ b/chrome/browser/web_applications/adjustments/BUILD.gn
@@ -6,8 +6,6 @@ source_set("adjustments") { sources = [ - "preinstalled_web_app_duplication_fixer.cc", - "preinstalled_web_app_duplication_fixer.h", "web_app_adjustments.cc", "web_app_adjustments.h", ] @@ -37,26 +35,6 @@ } } -source_set("adjustments_browser_tests") { - testonly = true - - sources = [] - - if (!is_chromeos_lacros) { - sources += [ "preinstalled_web_app_duplication_fixer_browsertest.cc" ] - } - - defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] - - deps = [ - ":adjustments", - "//chrome/browser/apps/app_service", - "//chrome/browser/web_applications", - "//chrome/browser/web_applications:web_applications_test_support", - "//chrome/test:test_support", - ] -} - source_set("unit_tests") { testonly = true
diff --git a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.cc b/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.cc deleted file mode 100644 index 41f31ac..0000000 --- a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.cc +++ /dev/null
@@ -1,183 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h" - -#include "base/metrics/histogram_functions.h" -#include "chrome/browser/apps/app_service/app_service_proxy.h" -#include "chrome/browser/apps/app_service/app_service_proxy_factory.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" -#include "chrome/browser/web_applications/preinstalled_app_install_features.h" -#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h" -#include "chrome/browser/web_applications/user_uninstalled_preinstalled_web_app_prefs.h" -#include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/browser/web_applications/web_app_registrar.h" -#include "chrome/browser/web_applications/web_app_registry_update.h" -#include "chrome/browser/web_applications/web_app_sync_bridge.h" -#include "chrome/common/chrome_features.h" -#include "components/services/app_service/public/cpp/types_util.h" - -namespace web_app { - -namespace { -bool g_skip_startup_for_testing = false; -} - -const char PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppAbsentChromeAppAbsent[] = - "WebApp.Preinstalled.MigratingWebAppAbsentChromeAppAbsent"; -const char PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppAbsentChromeAppPresent[] = - "WebApp.Preinstalled.MigratingWebAppAbsentChromeAppPresent"; -const char PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppPresentChromeAppAbsent[] = - "WebApp.Preinstalled.MigratingWebAppPresentChromeAppAbsent"; -const char PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppPresentChromeAppPresent[] = - "WebApp.Preinstalled.MigratingWebAppPresentChromeAppPresent"; -const char - PreinstalledWebAppDuplicationFixer::kHistogramAppDuplicationFixApplied[] = - "WebApp.Preinstalled.AppDuplicationFixApplied"; - -void PreinstalledWebAppDuplicationFixer::SkipStartupForTesting() { - g_skip_startup_for_testing = true; -} - -PreinstalledWebAppDuplicationFixer::PreinstalledWebAppDuplicationFixer( - Profile& profile) - : profile_(profile) { - if (g_skip_startup_for_testing) - return; - // WebAppAdjustmentsFactory guarantees that AppServiceProxy exists. - apps::AppRegistryCache& app_registry_cache = - apps::AppServiceProxyFactory::GetForProfile(&*profile_) - ->AppRegistryCache(); - web_apps_ready_ = - app_registry_cache.IsAppTypeInitialized(apps::AppType::kWeb); - chrome_apps_ready_ = - app_registry_cache.IsAppTypeInitialized(apps::AppType::kChromeApp); - if (web_apps_ready_ && chrome_apps_ready_) { - ScanForDuplication(); - } else { - // Await OnAppTypeInitialized(). - scoped_observation_.Observe(&app_registry_cache); - } -} - -PreinstalledWebAppDuplicationFixer::~PreinstalledWebAppDuplicationFixer() = - default; - -void PreinstalledWebAppDuplicationFixer::OnAppUpdate( - const apps::AppUpdate& update) {} - -void PreinstalledWebAppDuplicationFixer::OnAppTypeInitialized( - apps::AppType app_type) { - if (app_type == apps::AppType::kWeb) - web_apps_ready_ = true; - - if (app_type == apps::AppType::kChromeApp) - chrome_apps_ready_ = true; - - if (web_apps_ready_ && chrome_apps_ready_) { - ScanForDuplication(); - scoped_observation_.Reset(); - } -} - -void PreinstalledWebAppDuplicationFixer::OnAppRegistryCacheWillBeDestroyed( - apps::AppRegistryCache* cache) { - scoped_observation_.Reset(); -} - -void PreinstalledWebAppDuplicationFixer::ScanForDuplicationForTesting() { - ScanForDuplication(); -} - -void PreinstalledWebAppDuplicationFixer::ScanForDuplication() { - std::vector<std::string> installed_web_apps; - std::vector<std::string> installed_chrome_apps; - apps::AppServiceProxyFactory::GetForProfile(&*profile_) - ->AppRegistryCache() - .ForEachApp([&installed_web_apps, - &installed_chrome_apps](const apps::AppUpdate& update) { - if (update.Readiness() != apps::Readiness::kReady) - return; - - if (update.AppType() == apps::AppType::kWeb) - installed_web_apps.push_back(update.AppId()); - else if (update.AppType() == apps::AppType::kChromeApp) - installed_chrome_apps.push_back(update.AppId()); - }); - - size_t fix_count = 0; - base::flat_set<std::string> installed_web_apps_set( - std::move(installed_web_apps)); - base::flat_set<std::string> installed_chrome_apps_set( - std::move(installed_chrome_apps)); - - int installed_tally[2][2] = {}; - - for (const PreinstalledWebAppMigration& migration : - GetPreinstalledWebAppMigrations(*profile_)) { - bool web_app_installed = - installed_web_apps_set.contains(migration.expected_web_app_id); - bool chrome_app_installed = - installed_chrome_apps_set.contains(migration.old_chrome_app_id); - - if (chrome_app_installed) { - // Remove evidence of web app installation causing - // PreinstalledWebAppManager::Synchronize() to reinstall the web - // app and re-trigger migration. - if (RemoveInstallUrlForPreinstalledApp(migration.install_url)) { - UserUninstalledPreinstalledWebAppPrefs(profile_->GetPrefs()) - .RemoveByInstallUrl(migration.expected_web_app_id, - migration.install_url); - ++fix_count; - } - } - - ++installed_tally[web_app_installed][chrome_app_installed]; - } - - base::UmaHistogramCounts100(kHistogramWebAppAbsentChromeAppAbsent, - installed_tally[false][false]); - base::UmaHistogramCounts100(kHistogramWebAppAbsentChromeAppPresent, - installed_tally[false][true]); - base::UmaHistogramCounts100(kHistogramWebAppPresentChromeAppAbsent, - installed_tally[true][false]); - base::UmaHistogramCounts100(kHistogramWebAppPresentChromeAppPresent, - installed_tally[true][true]); - - base::UmaHistogramCounts100(kHistogramAppDuplicationFixApplied, fix_count); -} - -bool PreinstalledWebAppDuplicationFixer::RemoveInstallUrlForPreinstalledApp( - GURL install_url) { - bool external_prefs_removed = - ExternallyInstalledWebAppPrefs(profile_->GetPrefs()).Remove(install_url); - - // Get web_app by install_url and then remove the install_url. - WebAppProvider* provider = - WebAppProvider::GetForLocalAppsUnchecked(&*profile_); - absl::optional<AppId> preinstalled_app_id = - provider->registrar_unsafe().LookupExternalAppId(install_url); - if (!preinstalled_app_id.has_value()) - return external_prefs_removed; - - bool url_removed_from_database = false; - { - ScopedRegistryUpdate update(&provider->sync_bridge_unsafe()); - WebApp* installed_app = update->UpdateApp(preinstalled_app_id.value()); - if (installed_app) { - url_removed_from_database = installed_app->RemoveInstallUrlForSource( - WebAppManagement::kDefault, install_url); - } - } - - return external_prefs_removed || url_removed_from_database; -} - -} // namespace web_app
diff --git a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h b/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h deleted file mode 100644 index 614db6f..0000000 --- a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h +++ /dev/null
@@ -1,66 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_WEB_APPLICATIONS_ADJUSTMENTS_PREINSTALLED_WEB_APP_DUPLICATION_FIXER_H_ -#define CHROME_BROWSER_WEB_APPLICATIONS_ADJUSTMENTS_PREINSTALLED_WEB_APP_DUPLICATION_FIXER_H_ - -#include "base/memory/raw_ref.h" -#include "base/scoped_observation.h" -#include "components/services/app_service/public/cpp/app_registry_cache.h" -#include "components/services/app_service/public/cpp/app_types.h" -#include "url/gurl.h" - -class Profile; - -namespace apps { -class AppUpdate; -namespace mojom { -enum class AppType; -} -} // namespace apps - -namespace web_app { - -class PreinstalledWebAppDuplicationFixer - : public apps::AppRegistryCache::Observer { - public: - static const char kHistogramWebAppAbsentChromeAppAbsent[]; - static const char kHistogramWebAppAbsentChromeAppPresent[]; - static const char kHistogramWebAppPresentChromeAppAbsent[]; - static const char kHistogramWebAppPresentChromeAppPresent[]; - static const char kHistogramAppDuplicationFixApplied[]; - - static void SkipStartupForTesting(); - - explicit PreinstalledWebAppDuplicationFixer(Profile& profile); - ~PreinstalledWebAppDuplicationFixer() override; - - // apps::AppRegistryCache::Observer: - void OnAppUpdate(const apps::AppUpdate& update) override; - void OnAppTypeInitialized(apps::AppType app_type) override; - void OnAppRegistryCacheWillBeDestroyed( - apps::AppRegistryCache* cache) override; - - void ScanForDuplicationForTesting(); - - private: - void ObserveAppRegistryCache(); - - void ScanForDuplication(); - - bool RemoveInstallUrlForPreinstalledApp(GURL url); - - const raw_ref<Profile> profile_; - - bool web_apps_ready_ = false; - bool chrome_apps_ready_ = false; - - base::ScopedObservation<apps::AppRegistryCache, - apps::AppRegistryCache::Observer> - scoped_observation_{this}; -}; - -} // namespace web_app - -#endif // CHROME_BROWSER_WEB_APPLICATIONS_ADJUSTMENTS_PREINSTALLED_WEB_APP_DUPLICATION_FIXER_H_
diff --git a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer_browsertest.cc b/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer_browsertest.cc deleted file mode 100644 index a5012d0..0000000 --- a/chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer_browsertest.cc +++ /dev/null
@@ -1,402 +0,0 @@ -// Copyright 2022 The Chromium Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h" - -#include "base/auto_reset.h" -#include "base/memory/raw_ptr.h" -#include "base/strings/string_piece.h" -#include "base/test/bind.h" -#include "base/test/metrics/histogram_tester.h" -#include "build/chromeos_buildflags.h" -#include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/profiles/profile.h" -#include "chrome/browser/ui/browser.h" -#include "chrome/browser/web_applications/adjustments/web_app_adjustments.h" -#include "chrome/browser/web_applications/extension_status_utils.h" -#include "chrome/browser/web_applications/externally_installed_web_app_prefs.h" -#include "chrome/browser/web_applications/os_integration/os_integration_manager.h" -#include "chrome/browser/web_applications/preinstalled_web_app_manager.h" -#include "chrome/browser/web_applications/preinstalled_web_apps/preinstalled_web_apps.h" -#include "chrome/browser/web_applications/test/web_app_install_test_utils.h" -#include "chrome/browser/web_applications/test/web_app_test_utils.h" - -#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h" -#include "chrome/browser/web_applications/user_uninstalled_preinstalled_web_app_prefs.h" -#include "chrome/browser/web_applications/web_app.h" -#include "chrome/browser/web_applications/web_app_helpers.h" -#include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/common/chrome_features.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "content/public/test/browser_test.h" -#include "extensions/browser/test_extension_registry_observer.h" -#include "url/gurl.h" - -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/ash/app_list/app_list_syncable_service.h" -#include "chrome/browser/ash/app_list/app_list_syncable_service_factory.h" -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - -namespace web_app { - -class PreinstalledWebAppDuplicationFixerBrowserTest - : public extensions::ExtensionBrowserTest, - public testing::WithParamInterface<test::ExternalPrefMigrationTestCases> { - public: - static GURL install_url() { - return GURL("https://www.example.com/install_url"); - } - static GURL start_url() { return GURL("https://www.example.com/start_url"); } - static AppId web_app_id() { - return GenerateAppId(absl::nullopt, start_url()); - } - static extensions::ExtensionId chrome_app_id() { - return "kbmnembihfiondgfjekmnmcbddelicoi"; - } - - PreinstalledWebAppDuplicationFixerBrowserTest() - : enable_chrome_apps_( - &extensions::testing::g_enable_chrome_apps_for_testing, - true) { - PreinstalledWebAppManager::SkipStartupForTesting(); - PreinstalledWebAppDuplicationFixer::SkipStartupForTesting(); - std::vector<base::test::FeatureRef> enabled_features{ - features::kPreinstalledWebAppDuplicationFixer}; - std::vector<base::test::FeatureRef> disabled_features; - switch (GetParam()) { - case test::ExternalPrefMigrationTestCases::kDisableMigrationReadPref: - disabled_features.push_back(features::kMigrateExternalPrefsToWebAppDB); - disabled_features.push_back( - features::kUseWebAppDBInsteadOfExternalPrefs); - break; - case test::ExternalPrefMigrationTestCases::kDisableMigrationReadDB: - disabled_features.push_back(features::kMigrateExternalPrefsToWebAppDB); - enabled_features.push_back( - features::kUseWebAppDBInsteadOfExternalPrefs); - break; - case test::ExternalPrefMigrationTestCases::kEnableMigrationReadPref: - enabled_features.push_back(features::kMigrateExternalPrefsToWebAppDB); - disabled_features.push_back( - features::kUseWebAppDBInsteadOfExternalPrefs); - break; - case test::ExternalPrefMigrationTestCases::kEnableMigrationReadDB: - enabled_features.push_back(features::kMigrateExternalPrefsToWebAppDB); - enabled_features.push_back( - features::kUseWebAppDBInsteadOfExternalPrefs); - break; - } - feature_list_.InitWithFeatures(enabled_features, disabled_features); - } - ~PreinstalledWebAppDuplicationFixerBrowserTest() override = default; - - // InProcessBrowserTest: - void SetUpOnMainThread() override { - extensions::ExtensionBrowserTest::SetUpOnMainThread(); - - provider_ = WebAppProvider::GetForTest(browser()->profile()); - InProcessBrowserTest::SetUpOnMainThread(); - test::WaitUntilReady(provider_); - - ExternalInstallOptions options(install_url(), - mojom::UserDisplayMode::kStandalone, - ExternalInstallSource::kExternalDefault); - options.user_type_allowlist = {"unmanaged"}; - options.uninstall_and_replace = {chrome_app_id()}; - options.only_use_app_info_factory = true; - options.app_info_factory = base::BindRepeating( - [](GURL start_url) { - auto info = std::make_unique<WebAppInstallInfo>(); - info->title = u"Test app"; - info->start_url = start_url; - return info; - }, - start_url()); - options.expected_app_id = web_app_id(); - preinstalled_app_data_.apps = {options}; - } - - void SyncPreinstalledWebApps() { - base::RunLoop run_loop; - provider_->preinstalled_web_app_manager().LoadAndSynchronizeForTesting( - base::BindLambdaForTesting( - [&](std::map<GURL, ExternallyManagedAppManager::InstallResult> - install_results, - std::map<GURL, bool> uninstall_results) { run_loop.Quit(); })); - run_loop.Run(); - } - - void SyncPreinstalledWebAppsAwaitChromeAppUninstall() { - extensions::TestExtensionRegistryObserver uninstall_observer( - extensions::ExtensionRegistry::Get(profile())); - SyncPreinstalledWebApps(); - ASSERT_EQ(uninstall_observer.WaitForExtensionUninstalled()->id(), - chrome_app_id()); - } - - bool IsWebAppInstalled() const { - return provider_->registrar_unsafe().IsInstalled(web_app_id()); - } - - bool IsWebAppExternallyInstalled() { - return provider_->registrar_unsafe().LookupExternalAppId(install_url()) == - web_app_id(); - } - - bool IsPreinstalledWebAppUninstalled() { - return UserUninstalledPreinstalledWebAppPrefs(profile()->GetPrefs()) - .DoesAppIdExist(web_app_id()); - } - - bool IsWebAppInSync() const { - return provider_->registrar_unsafe() - .GetAppById(web_app_id()) - ->GetSources() - .test(WebAppManagement::kSync); - } - - void UninstallWebApp() { test::UninstallWebApp(profile(), web_app_id()); } - - void RunAppDuplicationFix() { - WebAppAdjustmentsFactory::GetInstance() - ->Get(profile()) - ->preinstalled_web_app_duplication_fixer() - ->ScanForDuplicationForTesting(); - } - - std::vector<base::Bucket> GetFixCountMetrics() { - return histogram_tester_.GetAllSamples( - PreinstalledWebAppDuplicationFixer::kHistogramAppDuplicationFixApplied); - } - - std::array<int64_t, 4> GetDuplicationMetrics() { - return { - histogram_tester_.GetTotalSum( - PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppAbsentChromeAppAbsent), - histogram_tester_.GetTotalSum( - PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppAbsentChromeAppPresent), - histogram_tester_.GetTotalSum( - PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppPresentChromeAppAbsent), - histogram_tester_.GetTotalSum( - PreinstalledWebAppDuplicationFixer:: - kHistogramWebAppPresentChromeAppPresent), - }; - } - - void InstallChromeApp() { - const extensions::Extension* extension = - InstallExtension(test_data_dir_.AppendASCII("hosted_app.crx"), 1); - ASSERT_EQ(extension->id(), chrome_app_id()); - } - - bool IsChromeAppInstalled() { - return extensions::ExtensionRegistry::Get(profile()) - ->enabled_extensions() - .Contains(chrome_app_id()); - } - -#if BUILDFLAG(IS_CHROMEOS_ASH) - void PinApp(const std::string& app_id) { - auto* service = - app_list::AppListSyncableServiceFactory::GetForProfile(profile()); - service->SetPinPosition(app_id, service->GetLastPosition()); - } - - bool IsAppPinned(const std::string& app_id) { - return app_list::AppListSyncableServiceFactory::GetForProfile(profile()) - ->GetPinPosition(app_id) - .IsValid(); - } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - - protected: - raw_ptr<WebAppProvider, DanglingUntriaged> provider_; - base::test::ScopedFeatureList feature_list_; - ScopedTestingPreinstalledAppData preinstalled_app_data_; - base::HistogramTester histogram_tester_; - OsIntegrationManager::ScopedSuppressForTesting os_hooks_supress_; - - private: - base::AutoReset<bool> enable_chrome_apps_; -}; - -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - FixDuplicateChromeApp) { - SyncPreinstalledWebApps(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_FALSE(IsChromeAppInstalled()); - EXPECT_TRUE(IsWebAppExternallyInstalled()); - - // Running the fix while the Chrome app is not installed should do nothing. - { - RunAppDuplicationFix(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_FALSE(IsChromeAppInstalled()); - EXPECT_EQ(GetFixCountMetrics(), (std::vector<base::Bucket>{{0, 1}})); - EXPECT_EQ(GetDuplicationMetrics(), (std::array<int64_t, 4>{0, 0, 1, 0})); - EXPECT_TRUE(IsWebAppExternallyInstalled()); - } - - InstallChromeApp(); - EXPECT_TRUE(IsChromeAppInstalled()); - - // Resyncing preinstalled web app configs again will not re-migrate the web - // app despite the Chrome app being installed. - { - SyncPreinstalledWebApps(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - } - - // Running the fix causes the Chrome app to get migrated on the next - // preinstalled web app sync. - { - RunAppDuplicationFix(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - EXPECT_EQ(GetFixCountMetrics(), - (std::vector<base::Bucket>{{0, 1}, {1, 1}})); - EXPECT_FALSE(IsWebAppExternallyInstalled()); - EXPECT_EQ(GetDuplicationMetrics(), (std::array<int64_t, 4>{0, 0, 1, 1})); - SyncPreinstalledWebAppsAwaitChromeAppUninstall(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_FALSE(IsChromeAppInstalled()); - } - - // Metrics now counts the web app as present and the Chrome app absent. - { - RunAppDuplicationFix(); - EXPECT_EQ(GetFixCountMetrics(), - (std::vector<base::Bucket>{{0, 2}, {1, 1}})); - EXPECT_EQ(GetDuplicationMetrics(), (std::array<int64_t, 4>{0, 0, 2, 1})); - } -} - -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - RemigrateUninstalledWebApp) { - SyncPreinstalledWebApps(); - InstallChromeApp(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - EXPECT_TRUE(IsWebAppExternallyInstalled()); - - UninstallWebApp(); - EXPECT_FALSE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - EXPECT_TRUE(IsPreinstalledWebAppUninstalled()); - - RunAppDuplicationFix(); - EXPECT_FALSE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - EXPECT_EQ(GetFixCountMetrics(), (std::vector<base::Bucket>{{1, 1}})); - EXPECT_EQ(GetDuplicationMetrics(), (std::array<int64_t, 4>{0, 1, 0, 0})); - EXPECT_FALSE(IsWebAppExternallyInstalled()); - EXPECT_FALSE(IsPreinstalledWebAppUninstalled()); - - // Running the preinstalled web app sync should remigrate the old Chrome app - // even if the user had uninstalled the web app. - { - SyncPreinstalledWebAppsAwaitChromeAppUninstall(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_FALSE(IsChromeAppInstalled()); - } - - // Metrics now counts the web app as present and the Chrome app absent. - { - RunAppDuplicationFix(); - EXPECT_EQ(GetFixCountMetrics(), - (std::vector<base::Bucket>{{0, 1}, {1, 1}})); - EXPECT_EQ(GetDuplicationMetrics(), (std::array<int64_t, 4>{0, 1, 1, 0})); - } -} - -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - RunFixOnSyncInstalledWebApp) { - SyncPreinstalledWebApps(); - InstallChromeApp(); - EXPECT_TRUE(IsWebAppInstalled()); - EXPECT_TRUE(IsChromeAppInstalled()); - EXPECT_TRUE(IsWebAppExternallyInstalled()); - - // Simulate a user install of the same web app to put it in sync. - { - auto info = std::make_unique<WebAppInstallInfo>(); - info->start_url = start_url(); - AppId app_id = test::InstallWebApp(profile(), std::move(info)); - ASSERT_EQ(app_id, web_app_id()); - ASSERT_TRUE(IsWebAppInSync()); - } - - // The duplication fix should have no effect on the sync install status of the - // web app. - { - RunAppDuplicationFix(); - ASSERT_TRUE(IsWebAppInSync()); - } -} - -#if BUILDFLAG(IS_CHROMEOS_ASH) -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - WebAppPinnedChromeAppUnpinned) { - SyncPreinstalledWebApps(); - InstallChromeApp(); - - PinApp(web_app_id()); - EXPECT_TRUE(IsAppPinned(web_app_id())); - EXPECT_FALSE(IsAppPinned(chrome_app_id())); - - RunAppDuplicationFix(); - SyncPreinstalledWebAppsAwaitChromeAppUninstall(); - - // If the web app already exists and is pinned it should not take on the - // Chrome app's unpinned UI position. - EXPECT_TRUE(IsAppPinned(web_app_id())); -} - -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - WebAppUnpinnedChromeAppPinned) { - SyncPreinstalledWebApps(); - InstallChromeApp(); - - PinApp(chrome_app_id()); - EXPECT_FALSE(IsAppPinned(web_app_id())); - EXPECT_TRUE(IsAppPinned(chrome_app_id())); - - RunAppDuplicationFix(); - SyncPreinstalledWebAppsAwaitChromeAppUninstall(); - - // If the web app already exists and is not pinned it should take on the - // Chrome app's pinned UI position. - EXPECT_TRUE(IsAppPinned(web_app_id())); -} - -IN_PROC_BROWSER_TEST_P(PreinstalledWebAppDuplicationFixerBrowserTest, - BothUnpinned) { - SyncPreinstalledWebApps(); - InstallChromeApp(); - - EXPECT_FALSE(IsAppPinned(web_app_id())); - EXPECT_FALSE(IsAppPinned(chrome_app_id())); - - RunAppDuplicationFix(); - SyncPreinstalledWebAppsAwaitChromeAppUninstall(); - - // If neither app was pinned the web app should remain unpinned. - EXPECT_FALSE(IsAppPinned(web_app_id())); -} -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - -INSTANTIATE_TEST_SUITE_P( - All, - PreinstalledWebAppDuplicationFixerBrowserTest, - ::testing::Values( - test::ExternalPrefMigrationTestCases::kDisableMigrationReadPref, - test::ExternalPrefMigrationTestCases::kDisableMigrationReadDB, - test::ExternalPrefMigrationTestCases::kEnableMigrationReadPref, - test::ExternalPrefMigrationTestCases::kEnableMigrationReadDB), - test::GetExternalPrefMigrationTestName); - -} // namespace web_app
diff --git a/chrome/browser/web_applications/adjustments/web_app_adjustments.cc b/chrome/browser/web_applications/adjustments/web_app_adjustments.cc index 4906beba..35668bf 100644 --- a/chrome/browser/web_applications/adjustments/web_app_adjustments.cc +++ b/chrome/browser/web_applications/adjustments/web_app_adjustments.cc
@@ -20,11 +20,6 @@ // -------------------------------- WebAppAdjustments::WebAppAdjustments(Profile* profile) { - if (base::FeatureList::IsEnabled( - features::kPreinstalledWebAppDuplicationFixer)) { - preinstalled_web_app_duplication_fixer_ = - std::make_unique<PreinstalledWebAppDuplicationFixer>(*profile); - } #if BUILDFLAG(IS_CHROMEOS_ASH) if (base::FeatureList::IsEnabled(web_app::kWebAppCalculatorAppErasureFixer)) { calculator_app_erasure_fixer_ =
diff --git a/chrome/browser/web_applications/adjustments/web_app_adjustments.h b/chrome/browser/web_applications/adjustments/web_app_adjustments.h index 53574d3..df2abaa 100644 --- a/chrome/browser/web_applications/adjustments/web_app_adjustments.h +++ b/chrome/browser/web_applications/adjustments/web_app_adjustments.h
@@ -8,7 +8,6 @@ #include <memory> #include "build/chromeos_buildflags.h" -#include "chrome/browser/web_applications/adjustments/preinstalled_web_app_duplication_fixer.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "components/keyed_service/core/keyed_service.h" @@ -32,15 +31,7 @@ explicit WebAppAdjustments(Profile* profile); ~WebAppAdjustments() override; - PreinstalledWebAppDuplicationFixer* preinstalled_web_app_duplication_fixer() { - return preinstalled_web_app_duplication_fixer_.get(); - } - private: - // TODO(crbug.com/1290716): This was added in M100, remove in M120. - std::unique_ptr<PreinstalledWebAppDuplicationFixer> - preinstalled_web_app_duplication_fixer_; - #if BUILDFLAG(IS_CHROMEOS_ASH) // TODO(crbug.com/1290716): This was added in M110, remove in M120. std::unique_ptr<CalculatorAppErasureFixer> calculator_app_erasure_fixer_;
diff --git a/chrome/browser/webauthn/android/BUILD.gn b/chrome/browser/webauthn/android/BUILD.gn index 81fd40a..15d6840 100644 --- a/chrome/browser/webauthn/android/BUILD.gn +++ b/chrome/browser/webauthn/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/webauthn/CableAuthenticatorModuleProvider.java", "java/src/org/chromium/chrome/browser/webauthn/PrivacySettingsFragment.java", @@ -27,7 +28,7 @@ "//third_party/androidx:androidx_vectordrawable_vectordrawable_animated_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.chrome.browser.webauthn" }
diff --git a/chrome/build/lacros64.pgo.txt b/chrome/build/lacros64.pgo.txt index 8184b6f..b3a706b 100644 --- a/chrome/build/lacros64.pgo.txt +++ b/chrome/build/lacros64.pgo.txt
@@ -1 +1 @@ -chrome-chromeos-amd64-generic-main-1685966279-13403d721cbd0f475442daa27c7023d1213787f5.profdata +chrome-chromeos-amd64-generic-main-1686009881-8a91280adc1562c36ea338ec715bcbd8981d9eaf.profdata
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index 2e7c91c..809e848 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1685966279-868c51cf643bd0d145cadf0832bf57207c363175.profdata +chrome-linux-main-1686009507-c764ea743da265e8647a2a636978821f25b23dc0.profdata
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 781f21ec..b61ba5a 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1685994862-67c48361c713580063ad5470cc6ba7abe2dc053f.profdata +chrome-mac-arm-main-1686023914-ae1cb734ffd1764a264223b0e3dd462856b2ebb4.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 1d570c8..4016e54 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1685987829-982140572a658d0d60c9601e7598a78f2edf8125.profdata +chrome-mac-main-1686009507-935dfb7c1c13365b7eb648679ab1860152bbe059.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index a6f9049..9f25c41 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1685987829-ceb73971f32ca82b4bfaf56c9dd5cf1e87d8b714.profdata +chrome-win32-main-1686009507-8d476b458504b9403caf08dd56b6d9939af97b87.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index a291854..17d8220 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1685987829-7e6f2228e3c057fa790c5be381eaefe489e0e76c.profdata +chrome-win64-main-1686009507-e2848e0016f3d65864c89cdc36fd2fb2f6d079fe.profdata
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 9ade4bb..252b773 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -88,12 +88,12 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/blink/public/mojom:android_mojo_bindings_java", ] + srcjar_deps = [ ":test_support_jni_headers" ] sources = [ "android/test_support/src/org/chromium/chrome/test_support/FamilyInfoFeedbackSourceTestBridge.java", "android/test_support/src/org/chromium/chrome/test_support/PaymentRequestTestBridge.java", "android/test_support/src/org/chromium/chrome/test_support/ToolbarManagerTestHelper.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("test_support_jni_headers") { @@ -2548,6 +2548,12 @@ sources += [ "../browser/ui/views/device_signals_consent/consent_dialog_browsertest.cc" ] } + if (is_chrome_branded && !is_android) { + sources += [ + "../browser/ui/views/promos/ios_promo_password_bubble_browsertest.cc", + ] + } + if (build_with_tflite_lib) { sources += [ "../browser/optimization_guide/prediction/prediction_manager_browsertest.cc", @@ -4214,6 +4220,7 @@ "../browser/ash/system/tray_accessibility_browsertest.cc", "../browser/ash/url_handler_browsertest.cc", "../browser/ash/video_conference/video_conference_app_service_client_browsertest.cc", + "../browser/ash/video_conference/video_conference_ash_feature_client_browsertest.cc", "../browser/ash/video_conference/video_conference_integration_browsertest.cc", "../browser/ash/wallpaper/wallpaper_drivefs_delegate_impl_browsertest.cc", "../browser/ash/web_applications/camera_app/camera_app_integration_browsertest.cc", @@ -4582,6 +4589,8 @@ "//chromeos/ash/components/mojo_service_manager", "//chromeos/ash/components/network/portal_detector", "//chromeos/ash/components/scalable_iph", + "//chromeos/ash/components/scalable_iph:iph_session", + "//chromeos/ash/components/scalable_iph:scalable_iph_delegate", "//chromeos/ash/components/smbfs", "//chromeos/ash/components/system", "//chromeos/ash/components/timezone",
diff --git a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts index aced490a..786cf21 100644 --- a/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts +++ b/chrome/test/data/webui/chromeos/personalization_app/wallpaper_selected_element_test.ts
@@ -662,13 +662,12 @@ wallpaperSelectedElement = initElement( WallpaperSelected, { - path: Paths.GOOGLE_PHOTOS_COLLECTION, + path: Paths.COLLECTIONS, }, ); await waitAfterNextRender(wallpaperSelectedElement); - assertEquals( - null, + assertNull( wallpaperSelectedElement.shadowRoot!.getElementById( descriptionOptionsId), 'no description options present'); @@ -687,6 +686,87 @@ 'description options present'); }); + test('hides description options when viewing Google Photos', async () => { + loadTimeData.overrideValues({isPersonalizationJellyEnabled: true}); + personalizationStore.data.wallpaper.currentSelected = { + attribution: ['testing'], + descriptionContent: '', + descriptionTitle: '', + key: 'key', + layout: WallpaperLayout.kStretch, + type: WallpaperType.kDefault, + }; + personalizationStore.data.wallpaper.loading.selected = false; + + wallpaperSelectedElement = initElement( + WallpaperSelected, + { + path: Paths.GOOGLE_PHOTOS_COLLECTION, + }, + ); + await waitAfterNextRender(wallpaperSelectedElement); + + assertNull( + wallpaperSelectedElement.shadowRoot!.getElementById( + descriptionOptionsId), + 'no description options present'); + + personalizationStore.data.wallpaper.currentSelected = { + ...personalizationStore.data.wallpaper.currentSelected, + descriptionContent: 'content', + descriptionTitle: 'title', + }; + personalizationStore.notifyObservers(); + await waitAfterNextRender(wallpaperSelectedElement); + + assertNull( + wallpaperSelectedElement.shadowRoot!.getElementById( + descriptionOptionsId), + 'no description options present when viewing Google Photos'); + }); + + test( + 'hides description options when viewing a different collection', + async () => { + loadTimeData.overrideValues({isPersonalizationJellyEnabled: true}); + personalizationStore.data.wallpaper.currentSelected = { + attribution: ['testing'], + descriptionContent: '', + descriptionTitle: '', + key: 'key', + layout: WallpaperLayout.kStretch, + type: WallpaperType.kDefault, + }; + personalizationStore.data.wallpaper.backdrop.images = {}; + personalizationStore.data.wallpaper.loading.selected = false; + + wallpaperSelectedElement = initElement( + WallpaperSelected, + { + path: Paths.COLLECTION_IMAGES, + }, + ); + await waitAfterNextRender(wallpaperSelectedElement); + + assertNull( + wallpaperSelectedElement.shadowRoot!.getElementById( + descriptionOptionsId), + 'no description options present'); + + personalizationStore.data.wallpaper.currentSelected = { + ...personalizationStore.data.wallpaper.currentSelected, + descriptionContent: 'content', + descriptionTitle: 'title', + }; + personalizationStore.notifyObservers(); + await waitAfterNextRender(wallpaperSelectedElement); + + assertNull( + wallpaperSelectedElement.shadowRoot!.getElementById( + descriptionOptionsId), + 'no description options present when viewing a different collection'); + }); + test('clicking description options opens dialog', async () => { loadTimeData.overrideValues({isPersonalizationJellyEnabled: true}); personalizationStore.data.wallpaper.currentSelected = { @@ -702,13 +782,12 @@ wallpaperSelectedElement = initElement( WallpaperSelected, { - path: Paths.GOOGLE_PHOTOS_COLLECTION, + path: Paths.COLLECTIONS, }, ); await waitAfterNextRender(wallpaperSelectedElement); - assertEquals( - null, + assertNull( wallpaperSelectedElement.shadowRoot!.getElementById( descriptionDialogId), 'no description dialog until button clicked'); @@ -734,8 +813,7 @@ 'dialogCloseButton')!.click(); await waitAfterNextRender(wallpaperSelectedElement); - assertEquals( - null, + assertNull( wallpaperSelectedElement.shadowRoot!.getElementById( descriptionDialogId), 'no description dialog after close button clicked');
diff --git a/chrome/test/data/webui/settings/chromeos/os_apps_page/app_management_page/app_details_item_test.ts b/chrome/test/data/webui/settings/chromeos/os_apps_page/app_management_page/app_details_item_test.ts index d40fb6c..943be2a 100644 --- a/chrome/test/data/webui/settings/chromeos/os_apps_page/app_management_page/app_details_item_test.ts +++ b/chrome/test/data/webui/settings/chromeos/os_apps_page/app_management_page/app_details_item_test.ts
@@ -146,15 +146,24 @@ assertEquals('System App', typeAndSource.textContent!.trim()); }); - test('System install source', async () => { + test('System install source', async function() { await addApp({ installSource: InstallSource.kSystem, }); - const typeAndSource = - appDetailsItem.shadowRoot!.querySelector('#typeAndSource'); - assertTrue(!!typeAndSource); - assertEquals('ChromeOS System App', typeAndSource.textContent!.trim()); + const typeAndSourceText = + appDetailsItem.shadowRoot!.querySelector('#typeAndSourceText'); + assertTrue(!!typeAndSourceText); + assertEquals('ChromeOS System App', typeAndSourceText.textContent!.trim()); + + const infoIconTooltip = + appDetailsItem.shadowRoot!.querySelector('#infoIconTooltip'); + assertTrue(!!infoIconTooltip); + const tooltipText = infoIconTooltip.querySelector('#tooltipText'); + assertTrue(!!tooltipText); + assertEquals( + 'This system app is preinstalled on your device', + tooltipText.textContent!.trim()); }); test('Chrome app version', async () => {
diff --git a/chrome/updater/win/task_scheduler.cc b/chrome/updater/win/task_scheduler.cc index e7c67ac..3451e15cd2 100644 --- a/chrome/updater/win/task_scheduler.cc +++ b/chrome/updater/win/task_scheduler.cc
@@ -134,7 +134,10 @@ bool use_task_subfolders) : scope_(scope), use_task_subfolders_(use_task_subfolders) { task_service_ = GetTaskService(); - VLOG_IF(2, !task_service_) << "Can't get the task service."; + if (!task_service_) { + VLOG(2) << "Can't get the task service."; + return; + } task_folder_ = GetUpdaterTaskFolder(); VLOG_IF(2, !task_folder_) << "Can't get the task scheduler folder."; }
diff --git a/chrome/utility/safe_browsing/mac/udif_unittest.cc b/chrome/utility/safe_browsing/mac/udif_unittest.cc index c0b3cd3..90e8f244 100644 --- a/chrome/utility/safe_browsing/mac/udif_unittest.cc +++ b/chrome/utility/safe_browsing/mac/udif_unittest.cc
@@ -10,6 +10,7 @@ #include <stdint.h> #include "base/files/file.h" +#include "base/memory/raw_ptr_exclusion.h" #include "base/strings/stringprintf.h" #include "chrome/utility/safe_browsing/mac/dmg_test_utils.h" #include "chrome/utility/safe_browsing/mac/read_stream.h" @@ -58,7 +59,9 @@ const char* file_name; // The NULL-terminated C array of expected partition types. - const char** expected_partitions; + // This field is not a raw_ptr<> because it was filtered by the rewriter + // for: #global-scope + RAW_PTR_EXCLUSION const char** expected_partitions; // A bitmask of ExpectedResults. As the parser currently only supports // certain UDIF features, this is used to properly test expectations.
diff --git a/chromecast/media/cma/backend/android/BUILD.gn b/chromecast/media/cma/backend/android/BUILD.gn index cd1d764..7f5fa09 100644 --- a/chromecast/media/cma/backend/android/BUILD.gn +++ b/chromecast/media/cma/backend/android/BUILD.gn
@@ -51,6 +51,7 @@ } android_library("audio_track_java") { + srcjar_deps = [ ":audio_track_jni_headers" ] sources = [ "java/src/org/chromium/chromecast/cma/backend/android/AudioSinkAudioTrackImpl.java", "java/src/org/chromium/chromecast/cma/backend/android/ThrottledLog.java", @@ -66,7 +67,6 @@ "//chromecast/public:volume_control_enums_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } test("cast_android_cma_backend_unittests") {
diff --git a/chromeos/ash/components/dbus/audio/BUILD.gn b/chromeos/ash/components/dbus/audio/BUILD.gn index 68d4932..148d3b2 100644 --- a/chromeos/ash/components/dbus/audio/BUILD.gn +++ b/chromeos/ash/components/dbus/audio/BUILD.gn
@@ -12,6 +12,7 @@ defines = [ "IS_DBUS_AUDIO_IMPL" ] deps = [ + "//ash/constants", "//base", "//chromeos/dbus/common", "//dbus",
diff --git a/chromeos/ash/components/dbus/audio/cras_audio_client.cc b/chromeos/ash/components/dbus/audio/cras_audio_client.cc index e39113d9e..335ee78 100644 --- a/chromeos/ash/components/dbus/audio/cras_audio_client.cc +++ b/chromeos/ash/components/dbus/audio/cras_audio_client.cc
@@ -8,7 +8,7 @@ #include <utility> -#include "base/format_macros.h" +#include "ash/constants/ash_switches.h" #include "base/functional/bind.h" #include "base/functional/callback_helpers.h" #include "base/logging.h" @@ -18,7 +18,6 @@ #include "dbus/message.h" #include "dbus/object_path.h" #include "dbus/object_proxy.h" -#include "third_party/cros_system_api/dbus/service_constants.h" namespace ash { @@ -1313,7 +1312,13 @@ // static void CrasAudioClient::Initialize(dbus::Bus* bus) { DCHECK(bus); - new CrasAudioClientImpl(bus); + if (ash::switches::UseFakeCrasAudioClientForDBus()) { + LOG(WARNING) << "Using FakeCrasAudioClient due to switch: " + << ash::switches::kUseFakeCrasAudioClientForDBus; + InitializeFake(); + } else { + new CrasAudioClientImpl(bus); + } } // static
diff --git a/chromeos/ash/components/dbus/dlcservice/dlcservice_client.h b/chromeos/ash/components/dbus/dlcservice/dlcservice_client.h index bbee2f9..1384061 100644 --- a/chromeos/ash/components/dbus/dlcservice/dlcservice_client.h +++ b/chromeos/ash/components/dbus/dlcservice/dlcservice_client.h
@@ -25,7 +25,7 @@ // manages DLC (Downloadable Content) modules. DlcserviceClient will allow for // CrOS features to be installed and uninstalled at runtime of the system. If // more details about dlcservice are required, please consult -// https://chromium.git.corp.google.com/chromiumos/platform2/+/HEAD/dlcservice +// https://chromium.googlesource.com/chromiumos/platform2/+/HEAD/dlcservice class COMPONENT_EXPORT(DLCSERVICE_CLIENT) DlcserviceClient { public: // Observer class for objects that need to know the change in the state of
diff --git a/chromeos/ash/components/drivefs/BUILD.gn b/chromeos/ash/components/drivefs/BUILD.gn index f4c3735..3847c05 100644 --- a/chromeos/ash/components/drivefs/BUILD.gn +++ b/chromeos/ash/components/drivefs/BUILD.gn
@@ -96,6 +96,7 @@ "//base", "//base/test:test_support", "//chromeos/ash/components/dbus/spaced", + "//chromeos/ash/components/dbus/spaced:spaced_proto", "//chromeos/ash/components/dbus/userdataauth", "//chromeos/ash/components/disks:test_support", "//chromeos/ash/components/drivefs/mojom",
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager.cc b/chromeos/ash/components/drivefs/drivefs_pin_manager.cc index 4ebb2eed..90d5113 100644 --- a/chromeos/ash/components/drivefs/drivefs_pin_manager.cc +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager.cc
@@ -393,6 +393,13 @@ const int64_t size = GetSize(md); DCHECK_GE(size, 0) << " for " << id << " " << Quote(path); + if (files_to_track_.empty() && progress_.emptied_queue) { + progress_.files_to_pin = 0; + progress_.bytes_to_pin = 0; + progress_.pinned_files = 0; + progress_.pinned_bytes = 0; + } + const auto [it, ok] = files_to_track_.try_emplace(id, File{.path = path, .total = size, @@ -668,6 +675,16 @@ base::BindOnce(&PinManager::OnFreeSpaceRetrieved2, GetWeakPtr())); } +void PinManager::LowDiskSpace(const user_data_auth::LowDiskSpace& event) { + LOG(ERROR) << "LowDiskSpace: " << HumanReadableSize(event.disk_free_bytes()); + OnFreeSpaceRetrieved2(event.disk_free_bytes()); +} + +void PinManager::OnSpaceUpdate(const SpaceEvent& event) { + VLOG(1) << "OnSpaceUpdate: " << HumanReadableSize(event.free_space_bytes()); + OnFreeSpaceRetrieved2(event.free_space_bytes()); +} + void PinManager::OnFreeSpaceRetrieved2(const int64_t free_space) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -681,22 +698,13 @@ if (progress_.HasEnoughFreeSpace()) { if (progress_.stage == Stage::kNotEnoughSpace) { - return Complete(Stage::kSuccess); + // Transition from kNotEnoughSpace to kSuccess. + Complete(Stage::kSuccess); + } else { + NotifyProgress(); } - - NotifyProgress(); - } else { - if (progress_.stage != Stage::kNotEnoughSpace) { - return Complete(Stage::kNotEnoughSpace); - } - } - - // Periodically retrieve the disk space only if the `StatefulDiskSpaceUpdate` - // signal has not been connected successfully. - if (!spaced_) { - SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask( - FROM_HERE, base::BindOnce(&PinManager::CheckFreeSpace, GetWeakPtr()), - space_check_interval_); + } else if (progress_.stage != Stage::kNotEnoughSpace) { + Complete(Stage::kNotEnoughSpace); } } @@ -997,21 +1005,20 @@ FROM_HERE, base::BindOnce(&PinManager::CheckStalledFiles, GetWeakPtr()), kStalledFileInterval); - if (!StartMonitoringSpace()) { - CheckFreeSpace(); - } - + CheckFreeSpace(); + StartMonitoringSpace(); PinSomeFiles(); } bool PinManager::StartMonitoringSpace() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (spaced_) { - LOG(ERROR) << "SpacedClient observer is already registered"; + VLOG(1) << "SpacedClient::Observer is already registered"; return true; } SpacedClient* const spaced = SpacedClient::Get(); + DCHECK(spaced); if (!spaced->IsConnected()) { LOG(ERROR) << "SpacedClient is not connected"; return false; @@ -1019,7 +1026,7 @@ spaced_ = spaced; spaced_->AddObserver(this); - VLOG(1) << "Added SpacedClient observer"; + VLOG(1) << "Added SpacedClient::Observer"; return true; } @@ -1028,7 +1035,7 @@ if (spaced_) { spaced_->RemoveObserver(this); spaced_ = nullptr; - VLOG(1) << "Removed SpacedClient observer"; + VLOG(1) << "Removed SpacedClient::Observer"; } } @@ -1371,17 +1378,6 @@ } } -void PinManager::LowDiskSpace(const ::user_data_auth::LowDiskSpace& status) { - LOG(ERROR) << "Got LowDiskSpace " - << HumanReadableSize(status.disk_free_bytes()); - OnFreeSpaceRetrieved2(status.disk_free_bytes()); -} - -void PinManager::OnSpaceUpdate(const SpaceEvent& event) { - VLOG(1) << "OnSpaceUpdate: " << HumanReadableSize(event.free_space_bytes()); - OnFreeSpaceRetrieved2(event.free_space_bytes()); -} - void PinManager::CheckStalledFiles() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager.h b/chromeos/ash/components/drivefs/drivefs_pin_manager.h index 5c59468..a791030 100644 --- a/chromeos/ash/components/drivefs/drivefs_pin_manager.h +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager.h
@@ -255,8 +255,7 @@ // manager accordingly. void SetOnline(bool online); - // Periodically check for free space. - // Used in testing to override the 60s delay in space checks. + // Check for free space. void CheckFreeSpace(); private: @@ -429,10 +428,6 @@ // `spaced` daemon client. ash::SpacedClient* spaced_ GUARDED_BY_CONTEXT(sequence_checker_) = nullptr; - // Interval at which the free space is periodically checked. - base::TimeDelta space_check_interval_ GUARDED_BY_CONTEXT(sequence_checker_) = - base::Seconds(5); - SpaceGetter space_getter_ GUARDED_BY_CONTEXT(sequence_checker_); CompletionCallback completion_callback_ GUARDED_BY_CONTEXT(sequence_checker_); @@ -476,8 +471,8 @@ FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, CannotGetFreeSpace2); FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, NotEnoughSpace2); FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, NotEnoughSpace3); - FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, OnFreeSpaceRetrieved2); - FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, PeriodicSpaceCheck); + FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, OnSpaceUpdate); + FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, StartMonitoringSpace); FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, SetOnline); FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, OnTransientError); FRIEND_TEST_ALL_PREFIXES(DriveFsPinManagerTest, OnError);
diff --git a/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc b/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc index 81086bc5..32bc61dd 100644 --- a/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc +++ b/chromeos/ash/components/drivefs/drivefs_pin_manager_unittest.cc
@@ -25,7 +25,9 @@ #include "base/test/task_environment.h" #include "base/time/time.h" #include "chromeos/ash/components/dbus/spaced/fake_spaced_client.h" +#include "chromeos/ash/components/dbus/spaced/spaced_client.h" #include "chromeos/ash/components/dbus/userdataauth/fake_userdataauth_client.h" +#include "chromeos/ash/components/dbus/userdataauth/userdataauth_client.h" #include "chromeos/ash/components/drivefs/mojom/drivefs.mojom-test-utils.h" #include "chromeos/ash/components/drivefs/mojom/drivefs.mojom.h" #include "components/drive/file_errors.h" @@ -35,6 +37,10 @@ namespace drivefs::pinning { namespace { +using ash::FakeSpacedClient; +using ash::FakeUserDataAuthClient; +using ash::SpacedClient; +using ash::UserDataAuthClient; using base::BindOnce; using base::OnceCallback; using base::RunLoop; @@ -207,13 +213,13 @@ } void SetUp() override { - ash::UserDataAuthClient::InitializeFake(); - ash::SpacedClient::InitializeFake(); + UserDataAuthClient::InitializeFake(); + SpacedClient::InitializeFake(); } void TearDown() override { - ash::UserDataAuthClient::Shutdown(); - ash::SpacedClient::Shutdown(); + UserDataAuthClient::Shutdown(); + SpacedClient::Shutdown(); } PinManager::SpaceGetter GetSpaceGetter() { @@ -2189,7 +2195,7 @@ manager.SetCompletionCallback(completion_callback.Get()); DCHECK_CALLED_ON_VALID_SEQUENCE(manager.sequence_checker_); manager.progress_.stage = Stage::kSyncing; - ash::FakeUserDataAuthClient::Get()->NotifyLowDiskSpace(200 << 20); + FakeUserDataAuthClient::Get()->NotifyLowDiskSpace(200 << 20); run_loop.Run(); const Progress progress = manager.GetProgress(); @@ -2200,66 +2206,87 @@ EXPECT_EQ(progress.pinned_files, 0); } -// Tests what happens when there is enough free space during the periodic check. -TEST_F(DriveFsPinManagerTest, OnFreeSpaceRetrieved2) { +TEST_F(DriveFsPinManagerTest, OnSpaceUpdate) { PinManager manager(profile_path_, mount_path_, &drivefs_); DCHECK_CALLED_ON_VALID_SEQUENCE(manager.sequence_checker_); manager.progress_.stage = Stage::kSyncing; - manager.OnFreeSpaceRetrieved2(int64_t(2) << 30); - const Progress progress = manager.GetProgress(); - EXPECT_EQ(progress.stage, Stage::kSyncing); - EXPECT_EQ(progress.free_space, int64_t(2) << 30); - EXPECT_EQ(progress.required_space, 0); - EXPECT_EQ(progress.pinned_bytes, 0); - EXPECT_EQ(progress.pinned_files, 0); + SpacedClient::Observer::SpaceEvent event; + const SpacedClient::Observer::SpaceEvent& cevent = event; + + event.set_free_space_bytes(int64_t(2) << 30); + manager.OnSpaceUpdate(cevent); + EXPECT_EQ(manager.progress_.stage, Stage::kSyncing); + EXPECT_EQ(manager.progress_.free_space, int64_t(2) << 30); + EXPECT_EQ(manager.progress_.required_space, 0); + EXPECT_EQ(manager.progress_.pinned_bytes, 0); + EXPECT_EQ(manager.progress_.pinned_files, 0); + + EXPECT_FALSE(manager.spaced_); + FakeSpacedClient::Get()->set_connected(true); + + // Transition to kNotEnoughSpace. + event.set_free_space_bytes(int64_t(1) << 30); + manager.OnSpaceUpdate(cevent); + EXPECT_EQ(manager.progress_.stage, Stage::kNotEnoughSpace); + EXPECT_EQ(manager.progress_.free_space, int64_t(1) << 30); + EXPECT_EQ(manager.progress_.required_space, 0); + EXPECT_EQ(manager.progress_.pinned_bytes, 0); + EXPECT_EQ(manager.progress_.pinned_files, 0); + EXPECT_TRUE(manager.spaced_); + + // Still in kNotEnoughSpace. + event.clear_free_space_bytes(); + manager.OnSpaceUpdate(cevent); + EXPECT_EQ(manager.progress_.stage, Stage::kNotEnoughSpace); + EXPECT_EQ(manager.progress_.free_space, 0); + EXPECT_EQ(manager.progress_.required_space, 0); + EXPECT_EQ(manager.progress_.pinned_bytes, 0); + EXPECT_EQ(manager.progress_.pinned_files, 0); + EXPECT_TRUE(manager.spaced_); + + // Go back to enough space. + event.set_free_space_bytes(int64_t(2) << 30); + manager.OnSpaceUpdate(cevent); + EXPECT_EQ(manager.progress_.stage, Stage::kSuccess); + EXPECT_EQ(manager.progress_.free_space, int64_t(2) << 30); + EXPECT_EQ(manager.progress_.required_space, 0); + EXPECT_EQ(manager.progress_.pinned_bytes, 0); + EXPECT_EQ(manager.progress_.pinned_files, 0); + EXPECT_FALSE(manager.spaced_); manager.progress_.stage = Stage::kStopped; } -// Tests that the space check is actually periodic. -TEST_F(DriveFsPinManagerTest, PeriodicSpaceCheck) { - CompletionCallback completion_callback; - RunLoop run_loop; - - // Fall back on the periodic space check instead of using the DBus signals. - ash::FakeSpacedClient::Get()->set_connected(false); - - EXPECT_CALL(completion_callback, Run(Stage::kNotEnoughSpace)) - .WillOnce(RunClosure(run_loop.QuitClosure())); - EXPECT_CALL(space_getter_, GetFreeSpace(gcache_dir_, _)) - .WillOnce(RunOnceCallback<1>(int64_t(4) << 30)) // 4 GB is enough space - .WillOnce(RunOnceCallback<1>(int64_t(3) << 30)) // 3 GB is enough space - .WillOnce( - RunOnceCallback<1>(int64_t(2100) << 20)) // 2100 MB is enough space - .WillOnce(RunOnceCallback<1>(400 << 20)); // 400 MB is not enough - +TEST_F(DriveFsPinManagerTest, StartMonitoringSpace) { PinManager manager(profile_path_, mount_path_, &drivefs_); DCHECK_CALLED_ON_VALID_SEQUENCE(manager.sequence_checker_); - - // Check the original time interval. - EXPECT_EQ(manager.space_check_interval_, base::Seconds(5)); - - // But use a much shorter interval for this test. - manager.space_check_interval_ = base::Milliseconds(100); - - manager.SetSpaceGetter(GetSpaceGetter()); - manager.SetCompletionCallback(completion_callback.Get()); manager.progress_.stage = Stage::kSyncing; + EXPECT_FALSE(manager.spaced_); - manager.CheckFreeSpace(); + // If SpacedClient is not connected, then StartMonitoringSpace should fail. + FakeSpacedClient::Get()->set_connected(false); + EXPECT_FALSE(manager.StartMonitoringSpace()); + EXPECT_FALSE(manager.spaced_); - // There should be 3 iterations of 100 ms each. - base::ElapsedTimer timer; - run_loop.Run(); - EXPECT_GE(timer.Elapsed(), base::Milliseconds(300)); + // If SpacedClient is connected, then StartMonitoringSpace should succeed. + FakeSpacedClient::Get()->set_connected(true); + EXPECT_TRUE(manager.StartMonitoringSpace()); + EXPECT_TRUE(manager.spaced_); - const Progress progress = manager.GetProgress(); - EXPECT_EQ(progress.stage, Stage::kNotEnoughSpace); - EXPECT_EQ(progress.free_space, 400 << 20); - EXPECT_EQ(progress.required_space, 0); - EXPECT_EQ(progress.pinned_bytes, 0); - EXPECT_EQ(progress.pinned_files, 0); + // StartMonitoringSpace called when it is already monitoring. + EXPECT_TRUE(manager.StartMonitoringSpace()); + EXPECT_TRUE(manager.spaced_); + + // Stop monitoring. + manager.StopMonitoringSpace(); + EXPECT_FALSE(manager.spaced_); + + // Stop monitoring when it is already stopped. + manager.StopMonitoringSpace(); + EXPECT_FALSE(manager.spaced_); + + manager.progress_.stage = Stage::kStopped; } TEST_F(DriveFsPinManagerTest, JustCheckRequiredSpace) {
diff --git a/chromeos/ash/components/human_presence/OWNERS b/chromeos/ash/components/human_presence/OWNERS index 2f2ec35..341529e 100644 --- a/chromeos/ash/components/human_presence/OWNERS +++ b/chromeos/ash/components/human_presence/OWNERS
@@ -1,4 +1,3 @@ charleszhao@chromium.org -martis@chromium.org skyostil@chromium.org thanhdng@chromium.org
diff --git a/chromeos/ash/components/scalable_iph/BUILD.gn b/chromeos/ash/components/scalable_iph/BUILD.gn index f55aa15f..f5ed37f 100644 --- a/chromeos/ash/components/scalable_iph/BUILD.gn +++ b/chromeos/ash/components/scalable_iph/BUILD.gn
@@ -13,8 +13,31 @@ ] deps = [ + ":iph_session", + ":scalable_iph_delegate", "//base", "//components/feature_engagement/public", "//components/keyed_service/core", ] } + +source_set("iph_session") { + sources = [ + "iph_session.cc", + "iph_session.h", + ] + + deps = [ + "//base", + "//components/feature_engagement/public", + ] +} + +source_set("scalable_iph_delegate") { + sources = [ "scalable_iph_delegate.h" ] + + deps = [ + ":iph_session", + "//components/keyed_service/core", + ] +}
diff --git a/chromeos/ash/components/scalable_iph/iph_session.cc b/chromeos/ash/components/scalable_iph/iph_session.cc new file mode 100644 index 0000000..533f41f1 --- /dev/null +++ b/chromeos/ash/components/scalable_iph/iph_session.cc
@@ -0,0 +1,22 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chromeos/ash/components/scalable_iph/iph_session.h" + +#include "base/feature_list.h" +#include "components/feature_engagement/public/tracker.h" + +namespace scalable_iph { + +IphSession::IphSession(const base::Feature& feature, + feature_engagement::Tracker* tracker) + : feature_(feature), tracker_(tracker) { + CHECK(tracker_); +} + +IphSession::~IphSession() { + tracker_->Dismissed(feature_); +} + +} // namespace scalable_iph
diff --git a/chromeos/ash/components/scalable_iph/iph_session.h b/chromeos/ash/components/scalable_iph/iph_session.h new file mode 100644 index 0000000..9bd1618 --- /dev/null +++ b/chromeos/ash/components/scalable_iph/iph_session.h
@@ -0,0 +1,33 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_IPH_SESSION_H_ +#define CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_IPH_SESSION_H_ + +#include "base/feature_list.h" +#include "components/feature_engagement/public/tracker.h" + +namespace scalable_iph { + +// `IphSession` manages a single IPH session. An IPH UI is responsible to +// destroy this object once it stops showing the IPH. +class IphSession { + public: + IphSession(const base::Feature& feature, + feature_engagement::Tracker* tracker); + ~IphSession(); + + IphSession(const IphSession& iph_session) = delete; + IphSession& operator=(const IphSession& iph_session) = delete; + + private: + // This is an IPH feature which is tied to this IPH session. See + // //components/feature_engagement/README.md for details about an IPH feature. + const base::Feature& feature_; + const raw_ptr<feature_engagement::Tracker> tracker_; +}; + +} // namespace scalable_iph + +#endif // CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_IPH_SESSION_H_
diff --git a/chromeos/ash/components/scalable_iph/scalable_iph.cc b/chromeos/ash/components/scalable_iph/scalable_iph.cc index d6ce4d29..d33cf36c 100644 --- a/chromeos/ash/components/scalable_iph/scalable_iph.cc +++ b/chromeos/ash/components/scalable_iph/scalable_iph.cc
@@ -4,7 +4,13 @@ #include "chromeos/ash/components/scalable_iph/scalable_iph.h" +#include <memory> +#include <vector> + +#include "base/feature_list.h" #include "base/no_destructor.h" +#include "chromeos/ash/components/scalable_iph/iph_session.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" namespace scalable_iph { @@ -24,7 +30,7 @@ // The list of IPH features `SclableIph` supports. `ScalableIph` checks trigger // conditions of all events listed in this list when it receives an `Event`. -const std::vector<const base::Feature*>& GetFeatureList() { +const std::vector<const base::Feature*>& GetFeatureListConstant() { static const base::NoDestructor<std::vector<const base::Feature*>> feature_list({}); return *feature_list; @@ -32,15 +38,27 @@ } // namespace -ScalableIph::ScalableIph(feature_engagement::Tracker* tracker) - : tracker_(tracker) { +ScalableIph::ScalableIph(feature_engagement::Tracker* tracker, + std::unique_ptr<ScalableIphDelegate> delegate) + : tracker_(tracker), delegate_(std::move(delegate)) { CHECK(tracker_); + CHECK(delegate_); } ScalableIph::~ScalableIph() = default; void ScalableIph::Shutdown() { tracker_ = nullptr; + delegate_.reset(); +} + +void ScalableIph::OverrideFeatureListForTesting( + const std::vector<const base::Feature*> feature_list) { + CHECK(feature_list_for_testing_.size() == 0) + << "It's NOT allowed to override feature list twice for testing"; + CHECK(feature_list.size() > 0) << "An empty list is NOT allowed to set."; + + feature_list_for_testing_ = feature_list; } void ScalableIph::RecordEvent(ScalableIph::Event event) { @@ -88,9 +106,20 @@ for (const base::Feature* feature : GetFeatureList()) { if (tracker_->ShouldTriggerHelpUI(*feature)) { - // TODO(b/284053005): Call the UI framework to trigger a help UI. + // TODO(b/284053005): Add the actual implementations. + ScalableIphDelegate::BubbleParams params; + delegate_->ShowBubble(params, + std::make_unique<IphSession>(*feature, tracker_)); } } } +const std::vector<const base::Feature*>& ScalableIph::GetFeatureList() const { + if (!feature_list_for_testing_.empty()) { + return feature_list_for_testing_; + } + + return GetFeatureListConstant(); +} + } // namespace scalable_iph
diff --git a/chromeos/ash/components/scalable_iph/scalable_iph.h b/chromeos/ash/components/scalable_iph/scalable_iph.h index bab8662..11fd3e64 100644 --- a/chromeos/ash/components/scalable_iph/scalable_iph.h +++ b/chromeos/ash/components/scalable_iph/scalable_iph.h
@@ -5,31 +5,51 @@ #ifndef CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_H_ #define CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_H_ +#include <vector> + #include "base/memory/weak_ptr.h" +#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" #include "components/feature_engagement/public/tracker.h" #include "components/keyed_service/core/keyed_service.h" namespace scalable_iph { +// `ScalableIph` provides a scalable way to deliver IPHs. +// +// - Scalable: we provide a scalable way by building this framework on top of +// the feature engagement framework. A developer can set up an IPH without +// modifying a binary. See feature engagement doc for details about its +// flexibility: //components/feature_engagement/README.md. +// +// - IPH: in-product-help. class ScalableIph : public KeyedService { public: // List of events ScalableIph supports. - enum Event { kFiveMinTick }; + enum class Event { kFiveMinTick }; - explicit ScalableIph(feature_engagement::Tracker* tracker); + ScalableIph(feature_engagement::Tracker* tracker, + std::unique_ptr<ScalableIphDelegate> delegate); void RecordEvent(Event event); + ScalableIphDelegate* delegate_for_testing() { return delegate_.get(); } + // KeyedService: ~ScalableIph() override; void Shutdown() override; + void OverrideFeatureListForTesting( + const std::vector<const base::Feature*> features); + private: void RecordEventInternal(Event event, bool init_success); void CheckTriggerConditions(); - void TriggerIph(const base::Feature& feature); + const std::vector<const base::Feature*>& GetFeatureList() const; raw_ptr<feature_engagement::Tracker> tracker_; + std::unique_ptr<ScalableIphDelegate> delegate_; + + std::vector<const base::Feature*> feature_list_for_testing_; base::WeakPtrFactory<ScalableIph> weak_ptr_factory_{this}; };
diff --git a/chromeos/ash/components/scalable_iph/scalable_iph_delegate.h b/chromeos/ash/components/scalable_iph/scalable_iph_delegate.h new file mode 100644 index 0000000..7c5c367e --- /dev/null +++ b/chromeos/ash/components/scalable_iph/scalable_iph_delegate.h
@@ -0,0 +1,83 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_H_ +#define CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_H_ + +#include "chromeos/ash/components/scalable_iph/iph_session.h" + +namespace scalable_iph { + +// `ScalableIphDelegate` is responsible to delivering IPH. `ScalableIph` class +// is responsible to triggering an IPH. After the class has decided to trigger +// an IPH, this delegate is responsible to deliver it. +class ScalableIphDelegate { + public: + // Have a virtul destructor as we can put `ScalableIphDelegate` in unique_ptr. + virtual ~ScalableIphDelegate() = default; + + // TODO(b/284158779): Details of the interface TBD. + enum class ActionType { + // `kNoActionInvalid` is used as an initial value. This should not be used + // in prod. + kNoActionInvalid, + }; + + struct Action { + ActionType action_type = ActionType::kNoActionInvalid; + + // An event name notified to the feature engagement framework on the + // execution of this action. Typically this event name will be set to + // `event_used` of an event config. + std::string iph_event_name; + bool operator==(const Action& action) const = default; + }; + + struct Button { + std::string text; + Action action; + + bool operator==(const Button& button) const = default; + }; + + enum class BubbleIcon { + kNoIcon, + }; + + struct BubbleParams { + std::string text; + BubbleIcon icon = BubbleIcon::kNoIcon; + Button button; + + bool operator==(const BubbleParams& params) const = default; + }; + + struct NotificationParams { + std::string title; + std::string text; + Button button; + + bool operator==(const NotificationParams& params) const = default; + }; + + // Deliver a bubble UI IPH to a user with specified behavior via + // `BubbleParams`. A delegate must show an IPH if this method gets called. + // Note that `IphSession` has a reference to `feature_engagement::Tracker`. Do + // NOT interact it after a `Tracker` service `Shutdown`. `ScalableIphDelegate` + // is owned by `ScalableIph` keyed service. `ScalableIph` keyed service + // depends on `Tracker` keyed service and `ScalableIph` keyed service + // destrcuts this `ScalableIphDelegate` in `ScalableIph::Shutdown`. Do NOT + // interact with `IphSession` once the destructor gets called. + virtual void ShowBubble(const BubbleParams& params, + std::unique_ptr<IphSession> iph_session) = 0; + + // Same with `ShowBubble` method. But this method delivers a notification UI + // IPH to a user with specified behavior via `NotificationParams`. + virtual void ShowNotification(const NotificationParams& params, + std::unique_ptr<IphSession> iph_session) = 0; +}; + +} // namespace scalable_iph + +#endif // CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_SCALABLE_IPH_DELEGATE_H_
diff --git a/chromeos/ash/services/network_health/public/cpp/network_health_helper.cc b/chromeos/ash/services/network_health/public/cpp/network_health_helper.cc index 47ac4510..b69dca3 100644 --- a/chromeos/ash/services/network_health/public/cpp/network_health_helper.cc +++ b/chromeos/ash/services/network_health/public/cpp/network_health_helper.cc
@@ -38,8 +38,9 @@ void NetworkHealthHelper::OnConnectionStateChanged(const std::string& guid, mojom::NetworkState state) { - if (default_network_ && default_network_->guid == guid) + if (default_network_ && default_network_->guid == guid) { default_network_->state = state; + } } void NetworkHealthHelper::OnSignalStrengthChanged( @@ -79,19 +80,15 @@ &NetworkHealthHelper::NetworkListReceived, base::Unretained(this))); } -bool NetworkHealthHelper::IsWiFiPortalState() { - if (!default_network_) { - return false; - } - if (default_network_->type != - chromeos::network_config::mojom::NetworkType::kWiFi) { - return false; - } +chromeos::network_config::mojom::PortalState +NetworkHealthHelper::WiFiPortalState() { using PortalState = chromeos::network_config::mojom::PortalState; - auto portal_state = default_network_->portal_state; - return portal_state == PortalState::kPortal || - portal_state == PortalState::kPortalSuspected || - portal_state == PortalState::kProxyAuthRequired; + if (!default_network_ || + default_network_->type != + chromeos::network_config::mojom::NetworkType::kWiFi) { + return PortalState::kUnknown; + } + return default_network_->portal_state; } void NetworkHealthHelper::NetworkListReceived(
diff --git a/chromeos/ash/services/network_health/public/cpp/network_health_helper.h b/chromeos/ash/services/network_health/public/cpp/network_health_helper.h index 89d3339f..a4e63d3 100644 --- a/chromeos/ash/services/network_health/public/cpp/network_health_helper.h +++ b/chromeos/ash/services/network_health/public/cpp/network_health_helper.h
@@ -13,6 +13,7 @@ #include "chromeos/services/network_health/public/mojom/network_health_types.mojom.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace ash::network_health { @@ -28,9 +29,9 @@ NetworkHealthHelper& operator=(const NetworkHealthHelper&) = delete; ~NetworkHealthHelper() override; - // Returns the portal state of the default network if the default network is - // set and is a WiFi network, otherwise returns false. - bool IsWiFiPortalState(); + // If the default network is set and is a WiFi network, returns the portal + // state of the default network, otherwise returns kUnknown. + chromeos::network_config::mojom::PortalState WiFiPortalState(); // chromeos::network_health::mojom::NetworkEventsObserver: void OnConnectionStateChanged(
diff --git a/chromeos/ash/services/network_health/public/cpp/network_health_helper_unittest.cc b/chromeos/ash/services/network_health/public/cpp/network_health_helper_unittest.cc index 2f11a64f..24145f5 100644 --- a/chromeos/ash/services/network_health/public/cpp/network_health_helper_unittest.cc +++ b/chromeos/ash/services/network_health/public/cpp/network_health_helper_unittest.cc
@@ -86,20 +86,21 @@ EXPECT_EQ(default_network->state, mojom::NetworkState::kOnline); } -TEST_F(NetworkHealthHelperTest, RequestIsWiFiPortalState) { - EXPECT_FALSE(helper()->IsWiFiPortalState()); +TEST_F(NetworkHealthHelperTest, WiFiPortalState) { + using PortalState = chromeos::network_config::mojom::PortalState; + EXPECT_EQ(helper()->WiFiPortalState(), PortalState::kUnknown); std::string path = SetupWiFiService(shill::kStateOnline); - EXPECT_FALSE(helper()->IsWiFiPortalState()); + EXPECT_EQ(helper()->WiFiPortalState(), PortalState::kOnline); SetWiFiState(path, shill::kStateRedirectFound); - EXPECT_TRUE(helper()->IsWiFiPortalState()); + EXPECT_EQ(helper()->WiFiPortalState(), PortalState::kPortal); - // Ethernet in a portal state should return false. + // Ethernet in a portal state should return kUnknown. SetWiFiState(path, shill::kStateIdle); cros_network_config_test_helper()->network_state_helper().ConfigureService( R"({"GUID": "eth_guid", "Type": "ethernet", "State": "redirect-found"})"); - EXPECT_FALSE(helper()->IsWiFiPortalState()); + EXPECT_EQ(helper()->WiFiPortalState(), PortalState::kUnknown); } } // namespace ash::network_health
diff --git a/chromeos/crosapi/mojom/video_conference.mojom b/chromeos/crosapi/mojom/video_conference.mojom index 1ee9ed6..17d72d0 100644 --- a/chromeos/crosapi/mojom/video_conference.mojom +++ b/chromeos/crosapi/mojom/video_conference.mojom
@@ -82,6 +82,11 @@ kArcApp, // App is traced by AppService, but the type is unknown. kAppServiceUnknown, + [MinVersion=1] kCrostiniVm, + [MinVersion=1] kPluginVm, + [MinVersion=1] kBorealis, + // App is traced by AshClient, but the type is unknown. + [MinVersion=1] kAshClientUnknown, }; [Stable]
diff --git a/components/about_ui/android/BUILD.gn b/components/about_ui/android/BUILD.gn index 5a00532..f2491a6 100644 --- a/components/about_ui/android/BUILD.gn +++ b/components/about_ui/android/BUILD.gn
@@ -8,10 +8,10 @@ } android_library("aboutui_java") { + srcjar_deps = [ ":about_ui_jni_headers" ] sources = [ "java/src/org/chromium/components/aboutui/CreditUtils.java" ] deps = [ "//base:jni_java", "//build/android:build_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] }
diff --git a/components/android_autofill/browser/BUILD.gn b/components/android_autofill/browser/BUILD.gn index 248b469..a1a8b64 100644 --- a/components/android_autofill/browser/BUILD.gn +++ b/components/android_autofill/browser/BUILD.gn
@@ -15,7 +15,10 @@ } android_library("java") { - srcjar_deps = [ ":autofill_aidl" ] + srcjar_deps = [ + ":autofill_aidl", + ":jni_headers", + ] deps = [ ":features_java", "//base:base_java", @@ -28,7 +31,7 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + sources = [ "java/src/org/chromium/components/autofill/AutofillHintsService.java", "java/src/org/chromium/components/autofill/AutofillManagerWrapper.java", @@ -51,10 +54,11 @@ } android_library("features_java") { + srcjar_deps = [ ":jni_headers_features" ] sources = [ "java/src/org/chromium/components/autofill/AndroidAutofillFeatures.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ ":features", "//base:base_java",
diff --git a/components/android_autofill/browser/test_support/BUILD.gn b/components/android_autofill/browser/test_support/BUILD.gn index 7e81de8a..49a9c37 100644 --- a/components/android_autofill/browser/test_support/BUILD.gn +++ b/components/android_autofill/browser/test_support/BUILD.gn
@@ -8,7 +8,7 @@ testonly = true android_library("java") { - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/autofill/AutofillHintsServiceTestHelper.java", "java/src/org/chromium/components/autofill/AutofillProviderTestHelper.java",
diff --git a/components/background_task_scheduler/internal/BUILD.gn b/components/background_task_scheduler/internal/BUILD.gn index 4d530199..82d9d5e6 100644 --- a/components/background_task_scheduler/internal/BUILD.gn +++ b/components/background_task_scheduler/internal/BUILD.gn
@@ -45,13 +45,12 @@ } android_library("native_task_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/background_task_scheduler/internal/NativeTaskScheduler.java", "android/java/src/org/chromium/components/background_task_scheduler/internal/TaskInfoBridge.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ "//base:base_java", "//base:jni_java",
diff --git a/components/browser_ui/accessibility/android/BUILD.gn b/components/browser_ui/accessibility/android/BUILD.gn index ab47fd6..1fc4f2f 100644 --- a/components/browser_ui/accessibility/android/BUILD.gn +++ b/components/browser_ui/accessibility/android/BUILD.gn
@@ -34,6 +34,7 @@ } android_library("java") { + srcjar_deps = [ ":accessibility_jni_headers" ] sources = [ "java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettings.java", "java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java", @@ -49,7 +50,7 @@ "java/src/org/chromium/components/browser_ui/accessibility/PageZoomViewBinder.java", "java/src/org/chromium/components/browser_ui/accessibility/TextScalePreference.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ ":constants_java", ":java_resources",
diff --git a/components/browser_ui/client_certificate/android/BUILD.gn b/components/browser_ui/client_certificate/android/BUILD.gn index a9337fcb..a6e64181 100644 --- a/components/browser_ui/client_certificate/android/BUILD.gn +++ b/components/browser_ui/client_certificate/android/BUILD.gn
@@ -16,6 +16,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/browser_ui/client_certificate/SSLClientCertificateRequest.java" ] deps = [ ":java_resources", @@ -28,7 +29,7 @@ "//third_party/androidx:androidx_appcompat_appcompat_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.browser_ui.client_certificate" }
diff --git a/components/browser_ui/contacts_picker/android/BUILD.gn b/components/browser_ui/contacts_picker/android/BUILD.gn index e557c0c..23d90204 100644 --- a/components/browser_ui/contacts_picker/android/BUILD.gn +++ b/components/browser_ui/contacts_picker/android/BUILD.gn
@@ -31,7 +31,7 @@ "java/src/org/chromium/components/browser_ui/contacts_picker/PickerCategoryView.java", "java/src/org/chromium/components/browser_ui/contacts_picker/TopView.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.browser_ui.contacts_picker" deps = [ ":java_resources", @@ -50,6 +50,7 @@ "//ui/android:ui_java", ] srcjar_deps = [ + ":contacts_picker_jni_headers", "//content/public/browser:contacts_picker_properties_requested_javagen", ] }
diff --git a/components/browser_ui/modaldialog/android/BUILD.gn b/components/browser_ui/modaldialog/android/BUILD.gn index 9cab188d..bc9dd99 100644 --- a/components/browser_ui/modaldialog/android/BUILD.gn +++ b/components/browser_ui/modaldialog/android/BUILD.gn
@@ -21,6 +21,7 @@ } android_library("java") { + srcjar_deps = [ ":modaldialog_jni_headers" ] sources = [ "java/src/org/chromium/components/browser_ui/modaldialog/AppModalPresenter.java", "java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogFeatureList.java", @@ -28,7 +29,6 @@ "java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogViewBinder.java", "java/src/org/chromium/components/browser_ui/modaldialog/TabModalPresenter.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] deps = [ ":java_resources",
diff --git a/components/browser_ui/photo_picker/android/BUILD.gn b/components/browser_ui/photo_picker/android/BUILD.gn index 4480bba..a5460ae 100644 --- a/components/browser_ui/photo_picker/android/BUILD.gn +++ b/components/browser_ui/photo_picker/android/BUILD.gn
@@ -37,7 +37,7 @@ "java/src/org/chromium/components/browser_ui/photo_picker/PickerCategoryView.java", "java/src/org/chromium/components/browser_ui/photo_picker/PickerVideoPlayer.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.browser_ui.photo_picker" deps = [ ":java_resources", @@ -57,7 +57,10 @@ "//third_party/androidx:androidx_vectordrawable_vectordrawable_java", "//ui/android:ui_java", ] - srcjar_deps = [ ":photo_picker_aidl" ] + srcjar_deps = [ + ":photo_picker_aidl", + ":photo_picker_jni_headers", + ] } generate_jni("photo_picker_jni_headers") {
diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn index 489626f0..e836935 100644 --- a/components/browser_ui/site_settings/android/BUILD.gn +++ b/components/browser_ui/site_settings/android/BUILD.gn
@@ -102,7 +102,7 @@ "java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java", "java/src/org/chromium/components/browser_ui/site_settings/WebsiteRowPreference.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.browser_ui.site_settings" deps = [ ":java_resources", @@ -139,8 +139,10 @@ "//ui/android:ui_utils_java", "//url:gurl_java", ] - srcjar_deps = - [ "//components/content_settings/android:java_pref_names_srcjar" ] + srcjar_deps = [ + ":site_settings_jni_headers", + "//components/content_settings/android:java_pref_names_srcjar", + ] } android_library("javatests") {
diff --git a/components/component_updater/android/BUILD.gn b/components/component_updater/android/BUILD.gn index a7e6421..e11e195 100644 --- a/components/component_updater/android/BUILD.gn +++ b/components/component_updater/android/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") android_library("background_task_update_scheduler_java") { + srcjar_deps = [ ":background_task_update_scheduler_jni_headers" ] sources = [ "java/src/org/chromium/components/component_updater/UpdateScheduler.java", "java/src/org/chromium/components/component_updater/UpdateTask.java", @@ -19,7 +20,6 @@ "//components/background_task_scheduler:background_task_scheduler_task_ids_java", "//third_party/android_deps:chromium_play_services_availability_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("background_task_update_scheduler_jni_headers") { @@ -63,8 +63,10 @@ "//content/public/android:content_main_dex_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - srcjar_deps = [ ":component_loader_policy_enum_srcjar" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":component_loader_policy_enum_srcjar", + ":embedded_component_loader_jni_headers", + ] } java_cpp_enum("component_loader_policy_enum_srcjar") {
diff --git a/components/content_capture/android/BUILD.gn b/components/content_capture/android/BUILD.gn index 394ab79..ca60588 100644 --- a/components/content_capture/android/BUILD.gn +++ b/components/content_capture/android/BUILD.gn
@@ -25,7 +25,8 @@ "//content/public/android:content_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/content_capture/ContentCaptureConsumer.java", "java/src/org/chromium/components/content_capture/ContentCaptureData.java",
diff --git a/components/content_capture/android/test_support/BUILD.gn b/components/content_capture/android/test_support/BUILD.gn index d20da54..909f05d 100644 --- a/components/content_capture/android/test_support/BUILD.gn +++ b/components/content_capture/android/test_support/BUILD.gn
@@ -21,7 +21,8 @@ "//build/android:build_java", "//content/public/android:content_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/content_capture/ContentCaptureTestSupport.java" ] }
diff --git a/components/content_creation/notes/android/BUILD.gn b/components/content_creation/notes/android/BUILD.gn index fb391207..ebafbb1 100644 --- a/components/content_creation/notes/android/BUILD.gn +++ b/components/content_creation/notes/android/BUILD.gn
@@ -6,6 +6,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/content_creation/notes/NoteService.java", "java/src/org/chromium/components/content_creation/notes/bridges/NoteServiceBridge.java", @@ -32,7 +33,6 @@ ] resources_package = "org.chromium.components.content_creation.notes" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/content_relationship_verification/android/BUILD.gn b/components/content_relationship_verification/android/BUILD.gn index f33972b..e58f56ed 100644 --- a/components/content_relationship_verification/android/BUILD.gn +++ b/components/content_relationship_verification/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/content_relationship_verification/OriginVerificationScheduler.java", "java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java", @@ -21,7 +22,6 @@ "//content/public/android:content_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } robolectric_library("junit_test_support") {
diff --git a/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java b/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java index 665fe1c..33bb1e6 100644 --- a/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java +++ b/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java
@@ -360,7 +360,7 @@ */ public abstract void recordVerificationTimeMetrics(long duration, boolean online); - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { long init(OriginVerifier caller, BrowserContextHandle browserContextHandle);
diff --git a/components/content_settings/android/BUILD.gn b/components/content_settings/android/BUILD.gn index ff4b4274..20cf274 100644 --- a/components/content_settings/android/BUILD.gn +++ b/components/content_settings/android/BUILD.gn
@@ -12,6 +12,7 @@ } android_library("java") { + srcjar_deps = [ ":content_settings_jni_headers" ] sources = [ "java/src/org/chromium/components/content_settings/ContentSettingsObserver.java", "java/src/org/chromium/components/content_settings/CookieControlsBridge.java", @@ -24,7 +25,6 @@ "//content/public/android:content_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } source_set("android") {
diff --git a/components/dom_distiller/content/browser/android/BUILD.gn b/components/dom_distiller/content/browser/android/BUILD.gn index e3b9390..c83cdc5 100644 --- a/components/dom_distiller/content/browser/android/BUILD.gn +++ b/components/dom_distiller/content/browser/android/BUILD.gn
@@ -11,7 +11,8 @@ "//components/dom_distiller/core/android:dom_distiller_core_java", "//content/public/android:content_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java" ] }
diff --git a/components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java b/components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java index 5e91ef33..6c4e2b16 100644 --- a/components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java +++ b/components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java
@@ -79,7 +79,7 @@ } @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { String getDistillerViewUrlFromUrl(String scheme, String url, String title); GURL getOriginalUrlFromDistillerUrl(String viewerUrl);
diff --git a/components/download/internal/common/BUILD.gn b/components/download/internal/common/BUILD.gn index ca1b7db..409eb3bd 100644 --- a/components/download/internal/common/BUILD.gn +++ b/components/download/internal/common/BUILD.gn
@@ -109,6 +109,7 @@ if (is_android) { android_library("internal_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/download/DownloadCollectionBridge.java", "android/java/src/org/chromium/components/download/DownloadDelegate.java", @@ -121,7 +122,6 @@ "//third_party/android_provider:android_provider_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/download/network/BUILD.gn b/components/download/network/BUILD.gn index 42582d6..c19da40 100644 --- a/components/download/network/BUILD.gn +++ b/components/download/network/BUILD.gn
@@ -46,6 +46,7 @@ if (is_android) { android_library("network_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/download/BackgroundNetworkStatusListener.java", "android/java/src/org/chromium/components/download/NetworkStatusListenerAndroid.java", @@ -58,7 +59,6 @@ "//net/android:net_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/embedder_support/android/BUILD.gn b/components/embedder_support/android/BUILD.gn index 3542f2a7..86fe35bd 100644 --- a/components/embedder_support/android/BUILD.gn +++ b/components/embedder_support/android/BUILD.gn
@@ -53,6 +53,7 @@ } android_library("util_java") { + srcjar_deps = [ ":util_jni_headers" ] sources = [ "java/src/org/chromium/components/embedder_support/util/InputStreamUtil.java", "java/src/org/chromium/components/embedder_support/util/Origin.java", @@ -60,7 +61,7 @@ "java/src/org/chromium/components/embedder_support/util/UrlUtilities.java", "java/src/org/chromium/components/embedder_support/util/WebResourceResponseInfo.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ "//base:base_java", "//base:jni_java", @@ -153,7 +154,8 @@ "//content/public/android:content_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":view_jni_headers" ] sources = [ "java/src/org/chromium/components/embedder_support/view/ContentViewRenderView.java" ] } @@ -221,7 +223,8 @@ "//url:gurl_java", ] resources_package = "org.chromium.components.embedder_support.delegate" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":web_contents_delegate_jni_headers" ] sources = [ "java/src/org/chromium/components/embedder_support/delegate/ColorChooserAndroid.java", "java/src/org/chromium/components/embedder_support/delegate/ColorPickerAdvanced.java", @@ -270,7 +273,8 @@ "//ui/android:ui_no_recycler_view_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":context_menu_jni_headers" ] sources = [ "java/src/org/chromium/components/embedder_support/contextmenu/ContextMenuParams.java" ] } @@ -281,9 +285,8 @@ "//base:jni_java", "//third_party/junit", ] + srcjar_deps = [ ":native_j_unittests_jni_headers" ] sources = [ "native_java_unittests/src/org/chromium/components/embedder_support/util/InputStreamUnittest.java" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } # See https://bugs.chromium.org/p/chromium/issues/detail?id=908819 for why we
diff --git a/components/embedder_support/android/metrics/BUILD.gn b/components/embedder_support/android/metrics/BUILD.gn index e0b9d8a..550966a9 100644 --- a/components/embedder_support/android/metrics/BUILD.gn +++ b/components/embedder_support/android/metrics/BUILD.gn
@@ -66,8 +66,8 @@ srcjar_deps = [ ":java_enum_srcjar", ":java_features_srcjar", + ":jni", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni") {
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index 43953b3..42f3f90 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -75,6 +75,9 @@ DEFINE_UI_CLASS_PROPERTY_TYPE(exo::Surface*) namespace exo { + +DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasAugmentedSurfaceKey, false) + namespace { // A property key containing the surface that is associated with @@ -451,7 +454,12 @@ DCHECK(!sub_surface->window()->parent()); sub_surface->window()->SetBounds( gfx::Rect(sub_surface->window()->bounds().size())); - window_->AddChild(sub_surface->window()); + + // As an optimization, don't add augmented subsurfaces's aura::Window to the + // tree. + if (!GetProperty(kSurfaceHasAugmentedSurfaceKey)) { + window_->AddChild(sub_surface->window()); + } DCHECK(!ListContainsEntry(pending_sub_surfaces_, sub_surface)); pending_sub_surfaces_.push_back(std::make_pair(sub_surface, gfx::PointF())); @@ -481,7 +489,9 @@ if (sub_surface->window()->IsVisible()) sub_surface->window()->Hide(); - window_->RemoveChild(sub_surface->window()); + if (sub_surface->window()->parent() == window_.get()) { + window_->RemoveChild(sub_surface->window()); + } DCHECK(ListContainsEntry(pending_sub_surfaces_, sub_surface)); pending_sub_surfaces_.erase( @@ -1064,8 +1074,9 @@ sub_surface->SetTrustedDamage(trusted_damage_); sub_surfaces_.push_back(sub_surface_entry); // Move sub-surface to its new position in the stack. - if (stacking_target) + if (stacking_target && sub_surface->window()->parent()) { window_->StackChildAbove(sub_surface->window(), stacking_target); + } // Stack next sub-surface above this sub-surface. stacking_target = sub_surface->window(); @@ -1728,7 +1739,12 @@ 1.0f / state_.basic_state.buffer_scale); } - window_->Show(); + // Check that a window has a parent before showing it. + // For example, aura::Window associated with augmented subsurfaces don't + // have parents, because they are not part of the tree. + if (window_->parent()) { + window_->Show(); + } } else { window_->Hide(); }
diff --git a/components/exo/surface.h b/components/exo/surface.h index a584703..a16bc76 100644 --- a/components/exo/surface.h +++ b/components/exo/surface.h
@@ -85,6 +85,10 @@ // component. extern const ui::ClassProperty<int32_t>* const kWindowSessionId; +// A property key containing a boolean set to true if a surface augmenter is +// associated with with surface object. +extern const ui::ClassProperty<bool>* const kSurfaceHasAugmentedSurfaceKey; + // This class represents a rectangular area that is displayed on the screen. // It has a location, size and pixel contents. class Surface final : public ui::PropertyHandler {
diff --git a/components/exo/wayland/surface_augmenter.cc b/components/exo/wayland/surface_augmenter.cc index 9364a61..14116ba 100644 --- a/components/exo/wayland/surface_augmenter.cc +++ b/components/exo/wayland/surface_augmenter.cc
@@ -21,11 +21,11 @@ namespace exo { namespace wayland { + namespace { // A property key containing a boolean set to true if a surface augmenter is -// associated with with surface object. -DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSurfaceHasAugmentedSurfaceKey, false) +// associated with with subsurface object. DEFINE_UI_CLASS_PROPERTY_KEY(bool, kSubSurfaceHasAugmentedSubSurfaceKey, false) ////////////////////////////////////////////////////////////////////////////////
diff --git a/components/external_intents/android/BUILD.gn b/components/external_intents/android/BUILD.gn index 69b1810..6e95bf2 100644 --- a/components/external_intents/android/BUILD.gn +++ b/components/external_intents/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/external_intents/ExternalIntentsFeatures.java", "java/src/org/chromium/components/external_intents/ExternalIntentsSwitches.java", @@ -16,7 +17,6 @@ "java/src/org/chromium/components/external_intents/RedirectHandler.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] deps = [ ":java_resources", "//base:base_java", @@ -100,8 +100,8 @@ android_library("test_support_java") { testonly = true - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":test_support_java_jni_headers" ] sources = [ "javatests/src/org/chromium/components/external_intents/TestChildFrameNavigationObserver.java" ] deps = [
diff --git a/components/favicon/android/BUILD.gn b/components/favicon/android/BUILD.gn index a60832d6..74b288cd 100644 --- a/components/favicon/android/BUILD.gn +++ b/components/favicon/android/BUILD.gn
@@ -16,9 +16,10 @@ "//url:gurl_java", ] - srcjar_deps = [ "//components/favicon_base:favicon_base_enums_java" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":jni_headers", + "//components/favicon_base:favicon_base_enums_java", + ] } generate_jni("jni_headers") {
diff --git a/components/feature_engagement/internal/BUILD.gn b/components/feature_engagement/internal/BUILD.gn index edf92e0..a07c9848a 100644 --- a/components/feature_engagement/internal/BUILD.gn +++ b/components/feature_engagement/internal/BUILD.gn
@@ -130,6 +130,7 @@ android_library("internal_java") { visibility = [ "//components/feature_engagement:feature_engagement_java" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/feature_engagement/internal/TrackerImpl.java" ] deps = [ @@ -140,7 +141,6 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/feature_engagement/public/BUILD.gn b/components/feature_engagement/public/BUILD.gn index 4d737a3f..8cffb0a9 100644 --- a/components/feature_engagement/public/BUILD.gn +++ b/components/feature_engagement/public/BUILD.gn
@@ -84,9 +84,11 @@ "//base:jni_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":public_java_enums_srcjar" ] + srcjar_deps = [ + ":jni_headers", + ":public_java_enums_srcjar", + ] } java_cpp_enum("public_java_enums_srcjar") {
diff --git a/components/feed/core/proto/v2/wire/capability.proto b/components/feed/core/proto/v2/wire/capability.proto index 53d526f..d0a8da3 100644 --- a/components/feed/core/proto/v2/wire/capability.proto +++ b/components/feed/core/proto/v2/wire/capability.proto
@@ -42,4 +42,5 @@ OPEN_IN_NEW_TAB_IN_GROUP = 81; SYNTHETIC_CAPABILITIES = 89; OPEN_WEB_FEED_COMMAND = 98; + REFRESH_FEED_COMMAND = 102; }
diff --git a/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto b/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto index 9dc956e..0e0dc49 100644 --- a/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto +++ b/components/feed/core/proto/v2/wire/chrome_fulfillment_info.proto
@@ -16,6 +16,7 @@ repeated InfoCardTrackingState info_card_tracking_state = 3; optional ChromeFeatureUsage chrome_feature_usage = 4; optional ChromeSignInStatus sign_in_status = 5; + optional DefaultSearchEngine default_search_engine = 6; } message ChromeFeatureUsage { optional int32 times_followed_from_web_page_menu = 1; @@ -30,3 +31,11 @@ } optional SignInStatus sign_in_status = 1; } +message DefaultSearchEngine { + enum SearchEngine { + ENGINE_UNSPECIFIED = 0; + ENGINE_GOOGLE = 1; + ENGINE_OTHER = 2; + } + optional SearchEngine search_engine = 1; +}
diff --git a/components/find_in_page/android/BUILD.gn b/components/find_in_page/android/BUILD.gn index bd711b0f..f17ca65 100644 --- a/components/find_in_page/android/BUILD.gn +++ b/components/find_in_page/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/find_in_page/FindInPageBridge.java", "java/src/org/chromium/components/find_in_page/FindMatchRectsDetails.java", @@ -12,8 +13,6 @@ "java/src/org/chromium/components/find_in_page/FindResultBar.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ ":java_resources", ":jni_headers",
diff --git a/components/gcm_driver/android/BUILD.gn b/components/gcm_driver/android/BUILD.gn index 6c05b7d..e394011 100644 --- a/components/gcm_driver/android/BUILD.gn +++ b/components/gcm_driver/android/BUILD.gn
@@ -16,8 +16,8 @@ "//third_party/android_deps:com_google_code_findbugs_jsr305_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/gcm_driver/GCMDriver.java", "java/src/org/chromium/components/gcm_driver/GCMMessage.java",
diff --git a/components/gcm_driver/instance_id/android/BUILD.gn b/components/gcm_driver/instance_id/android/BUILD.gn index ccfaa3be..3b59c09 100644 --- a/components/gcm_driver/instance_id/android/BUILD.gn +++ b/components/gcm_driver/instance_id/android/BUILD.gn
@@ -22,10 +22,11 @@ "//components/gcm_driver/android:gcm_driver_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = - [ "//components/gcm_driver/instance_id:instance_id_java_enums_srcjar" ] + srcjar_deps = [ + ":jni_headers", + "//components/gcm_driver/instance_id:instance_id_java_enums_srcjar", + ] sources = [ "java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDBridge.java",
diff --git a/components/heap_profiling/multi_process/BUILD.gn b/components/heap_profiling/multi_process/BUILD.gn index f0daff9..ca7ac4a2 100644 --- a/components/heap_profiling/multi_process/BUILD.gn +++ b/components/heap_profiling/multi_process/BUILD.gn
@@ -33,7 +33,8 @@ # shim to function correctly. android_library("heap_profiling_java_test_support") { testonly = true - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "javatests/src/org/chromium/components/heap_profiling/multi_process/HeapProfilingTestShim.java" ] deps = [ "//base:jni_java",
diff --git a/components/image_fetcher/BUILD.gn b/components/image_fetcher/BUILD.gn index 7e74fc2..1ab1f56a 100644 --- a/components/image_fetcher/BUILD.gn +++ b/components/image_fetcher/BUILD.gn
@@ -24,8 +24,11 @@ "//third_party/gif_player:gif_player_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ "//components/image_fetcher/core:java_enums_srcjar" ] + + srcjar_deps = [ + ":jni_headers", + "//components/image_fetcher/core:java_enums_srcjar", + ] } generate_jni("jni_headers") {
diff --git a/components/infobars/android/BUILD.gn b/components/infobars/android/BUILD.gn index e7bff473..af7c56e 100644 --- a/components/infobars/android/BUILD.gn +++ b/components/infobars/android/BUILD.gn
@@ -53,6 +53,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/infobars/ConfirmInfoBar.java", "java/src/org/chromium/components/infobars/InfoBar.java", @@ -81,7 +82,7 @@ "//third_party/androidx:androidx_core_core_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.infobars" }
diff --git a/components/installedapp/android/BUILD.gn b/components/installedapp/android/BUILD.gn index 852ad7c..c407dac 100644 --- a/components/installedapp/android/BUILD.gn +++ b/components/installedapp/android/BUILD.gn
@@ -15,14 +15,13 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/installedapp/InstalledAppProviderImpl.java", "java/src/org/chromium/components/installedapp/PackageHash.java", "java/src/org/chromium/components/installedapp/PackageManagerDelegate.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - deps = [ "//base:base_java", "//base:jni_java",
diff --git a/components/javascript_dialogs/android/BUILD.gn b/components/javascript_dialogs/android/BUILD.gn index 6feef18d..7a4b414 100644 --- a/components/javascript_dialogs/android/BUILD.gn +++ b/components/javascript_dialogs/android/BUILD.gn
@@ -7,6 +7,7 @@ import("//tools/grit/grit_rule.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/javascript_dialogs/JavascriptAppModalDialog.java", "java/src/org/chromium/components/javascript_dialogs/JavascriptDialogCustomView.java", @@ -14,7 +15,6 @@ "java/src/org/chromium/components/javascript_dialogs/JavascriptTabModalDialog.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.components.javascript_dialogs" deps = [
diff --git a/components/language/android/BUILD.gn b/components/language/android/BUILD.gn index 6b84b93..8f17f358e 100644 --- a/components/language/android/BUILD.gn +++ b/components/language/android/BUILD.gn
@@ -25,6 +25,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/language/AndroidLanguageMetricsBridge.java", "java/src/org/chromium/components/language/GeoLanguageProviderBridge.java", @@ -39,8 +40,6 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("ulp_delegate_java") {
diff --git a/components/location/android/BUILD.gn b/components/location/android/BUILD.gn index 7d070ffe..0d9b2bd 100644 --- a/components/location/android/BUILD.gn +++ b/components/location/android/BUILD.gn
@@ -29,9 +29,9 @@ "//build/android:build_java", "//ui/android:ui_no_recycler_view_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/location/LocationSettings.java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/media_router/browser/android/BUILD.gn b/components/media_router/browser/android/BUILD.gn index 8ee32cc..5f712e1 100644 --- a/components/media_router/browser/android/BUILD.gn +++ b/components/media_router/browser/android/BUILD.gn
@@ -28,6 +28,7 @@ "//third_party/androidx:androidx_media_media_java", "//third_party/androidx:androidx_mediarouter_mediarouter_java", ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/media_router/BaseMediaRouteDialogManager.java", "java/src/org/chromium/components/media_router/BrowserMediaRouter.java", @@ -70,7 +71,6 @@ "java/src/org/chromium/components/media_router/caf/remoting/RemotingSessionController.java", "java/src/org/chromium/components/media_router/caf/remoting/StreamPositionExtrapolator.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("cast_options_provider_java") {
diff --git a/components/messages/android/BUILD.gn b/components/messages/android/BUILD.gn index 0a4b2ac..f32baef 100644 --- a/components/messages/android/BUILD.gn +++ b/components/messages/android/BUILD.gn
@@ -19,7 +19,7 @@ "java/src/org/chromium/components/messages/MessagesMetrics.java", ] resources_package = "org.chromium.components.messages" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ ":java_resources", "//base:base_java", @@ -34,7 +34,10 @@ "//ui/android:ui_java", ] - srcjar_deps = [ ":message_enums_java" ] + srcjar_deps = [ + ":jni_headers", + ":message_enums_java", + ] } android_library("unit_device_javatests") {
diff --git a/components/metrics/structured/structured_metrics_provider.cc b/components/metrics/structured/structured_metrics_provider.cc index b8316ce..c3a3721 100644 --- a/components/metrics/structured/structured_metrics_provider.cc +++ b/components/metrics/structured/structured_metrics_provider.cc
@@ -95,10 +95,13 @@ // When StructuredMetricsService is enabled then the StructuredMetricsProvider // will not upload metrics. if (base::FeatureList::IsEnabled(kEnabledStructuredMetricsService)) { + NOTREACHED(); + std::move(done_callback).Run(false); return; } if (!recording_enabled_) { + std::move(done_callback).Run(false); return; }
diff --git a/components/minidump_uploader/BUILD.gn b/components/minidump_uploader/BUILD.gn index 741317dc..e97c7268 100644 --- a/components/minidump_uploader/BUILD.gn +++ b/components/minidump_uploader/BUILD.gn
@@ -40,6 +40,7 @@ "//third_party/androidx:androidx_annotation_annotation_java", ] + srcjar_deps = [ ":minidump_uploader_jni_headers" ] sources = [ "android/java/src/org/chromium/components/minidump_uploader/CrashFileManager.java", "android/java/src/org/chromium/components/minidump_uploader/CrashReportMimeWriter.java", @@ -54,7 +55,6 @@ "android/java/src/org/chromium/components/minidump_uploader/util/HttpURLConnectionFactoryImpl.java", "android/java/src/org/chromium/components/minidump_uploader/util/NetworkPermissionUtil.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } android_library("minidump_uploader_java_test_support") {
diff --git a/components/module_installer/android/BUILD.gn b/components/module_installer/android/BUILD.gn index 697572b..1377680 100644 --- a/components/module_installer/android/BUILD.gn +++ b/components/module_installer/android/BUILD.gn
@@ -6,6 +6,7 @@ import("//chrome/android/modules/buildflags.gni") android_library("module_installer_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/module_installer/builder/Module.java", "java/src/org/chromium/components/module_installer/builder/ModuleDescriptor.java", @@ -41,8 +42,6 @@ ] public_deps = [ "//build/android:build_java" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } robolectric_binary("module_installer_junit_tests") {
diff --git a/components/offline_items_collection/core/BUILD.gn b/components/offline_items_collection/core/BUILD.gn index 879bf12..c254fd0 100644 --- a/components/offline_items_collection/core/BUILD.gn +++ b/components/offline_items_collection/core/BUILD.gn
@@ -106,9 +106,11 @@ "android/java/src/org/chromium/components/offline_items_collection/bridges/OfflineItemShareInfoBridge.java", "android/java/src/org/chromium/components/offline_items_collection/bridges/OfflineItemVisualsBridge.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":jni_enums" ] + srcjar_deps = [ + ":jni_enums", + ":jni_headers", + ] deps = [ "//base:base_java", @@ -152,9 +154,8 @@ "//third_party/junit", ] + srcjar_deps = [ ":native_j_unittests_jni_headers" ] sources = [ "android/native_java_unittests/src/org/chromium/components/offline_items_collection/bridges/OfflineItemBridgeUnitTest.java" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("native_j_unittests_jni_headers") {
diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc index 6b9f5b9..d55345e 100644 --- a/components/omnibox/browser/omnibox_edit_model.cc +++ b/components/omnibox/browser/omnibox_edit_model.cc
@@ -1235,8 +1235,7 @@ } // Close the popup if it's open. - if (base::FeatureList::IsEnabled(omnibox::kClosePopupWithEscape) && - PopupIsOpen()) { + if (PopupIsOpen()) { base::UmaHistogramEnumeration(kOmniboxEscapeHistogramName, OmniboxEscapeAction::kClosePopup); if (view_) { @@ -1250,22 +1249,18 @@ // This in turn allows the user to use escape to quickly select all the text // for ease of replacement, and matches other browsers. bool user_input_was_in_progress = user_input_in_progress_; - bool popup_was_open = PopupIsOpen(); // TODO(crbug.com/1340378): If the popup was open, `user_input_in_progress_` // *should* also be true; checking `user_text_` in the DCHECK below, and // checking `popup_was_open` in the if predicate below *should* be // unnecessary. However, that's not always the case (see // `user_input_in_progress_` comment in the header). - DCHECK(!popup_was_open || user_input_was_in_progress || user_text_.empty()); if (view_) { view_->RevertAll(); view_->SelectAll(true); } - if (user_input_was_in_progress || popup_was_open) { - base::UmaHistogramEnumeration( - kOmniboxEscapeHistogramName, - popup_was_open ? OmniboxEscapeAction::kClosePopupAndClearUserInput - : OmniboxEscapeAction::kClearUserInput); + if (user_input_was_in_progress) { + base::UmaHistogramEnumeration(kOmniboxEscapeHistogramName, + OmniboxEscapeAction::kClearUserInput); // If the user was in the midst of editing, don't cancel any underlying page // load. This doesn't match IE or Firefox, but seems more correct. Note // that we do allow the page load to be stopped in the case where
diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc index 4f38817..2d0739e 100644 --- a/components/omnibox/browser/omnibox_edit_model_unittest.cc +++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc
@@ -1177,150 +1177,77 @@ } TEST_F(OmniboxEditModelTest, OmniboxEscapeHistogram) { + // Escape should incrementally revert temporary text, close the popup, clear + // input, and blur the omnibox. + AutocompleteMatch match; + match.type = AutocompleteMatchType::NAVSUGGEST; + match.destination_url = GURL("https://google.com"); + model()->SetCurrentMatchForTest(match); + + view()->SetUserText(u"user text"); + model()->OnSetFocus(false); + model()->SetInputInProgress(true); + model()->SetPopupIsOpen(true); + model()->OnPopupDataChanged(/*temporary_text=*/u"fake_temporary_text", + /*is_temporary_text=*/true, std::u16string(), + std::u16string(), std::u16string(), false, + std::u16string(), {}); + + EXPECT_TRUE(model()->HasTemporaryText()); + EXPECT_TRUE(model()->PopupIsOpen()); + EXPECT_EQ(view()->GetText(), u"fake_temporary_text"); + EXPECT_TRUE(model()->user_input_in_progress()); + EXPECT_TRUE(model()->has_focus()); + { - // With `kClosePopupWithEscape` enabled, escape should incrementally revert - // temporary text, close the popup, clear input, and blur the omnibox. - base::test::ScopedFeatureList feature_list{omnibox::kClosePopupWithEscape}; - - AutocompleteMatch match; - match.type = AutocompleteMatchType::NAVSUGGEST; - match.destination_url = GURL("https://google.com"); - model()->SetCurrentMatchForTest(match); - - view()->SetUserText(u"user text"); - model()->OnSetFocus(false); - model()->SetInputInProgress(true); - model()->SetPopupIsOpen(true); - model()->OnPopupDataChanged(/*temporary_text=*/u"fake_temporary_text", - /*is_temporary_text=*/true, std::u16string(), - std::u16string(), std::u16string(), false, - std::u16string(), {}); - - EXPECT_TRUE(model()->HasTemporaryText()); + // Revert temporary text. + base::HistogramTester histogram_tester; + EXPECT_TRUE(model()->OnEscapeKeyPressed()); + histogram_tester.ExpectUniqueSample("Omnibox.Escape", 1, 1); + EXPECT_FALSE(model()->HasTemporaryText()); EXPECT_TRUE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u"fake_temporary_text"); + EXPECT_EQ(view()->GetText(), u""); EXPECT_TRUE(model()->user_input_in_progress()); EXPECT_TRUE(model()->has_focus()); - - { - // Revert temporary text. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 1, 1); - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_TRUE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_TRUE(model()->user_input_in_progress()); - EXPECT_TRUE(model()->has_focus()); - } - - { - // Close the popup. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 2, 1); - model()->SetPopupIsOpen( - false); // `TestOmniboxEditModel` stubs the popup. - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_FALSE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_TRUE(model()->user_input_in_progress()); - EXPECT_TRUE(model()->has_focus()); - } - - { - // Clear user input. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 3, 1); - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_FALSE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_FALSE(model()->user_input_in_progress()); - EXPECT_TRUE(model()->has_focus()); - } - - { - // Blur the omnibox. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 5, 1); - model()->OnKillFocus(); // `TestOmniboxEditModel` stubs the client which - // handles blurring the omnibox. - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_FALSE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_FALSE(model()->user_input_in_progress()); - EXPECT_FALSE(model()->has_focus()); - } } { - // With `kClosePopupWithEscape` disabled, escape should incrementally revert - // temporary text then simultaneously close the popup & clear input, and - // lastly blur the omnibox. - base::test::ScopedFeatureList feature_list; - feature_list.InitWithFeatures({}, {omnibox::kClosePopupWithEscape}); - - AutocompleteMatch match; - match.type = AutocompleteMatchType::NAVSUGGEST; - match.destination_url = GURL("https://google.com"); - model()->SetCurrentMatchForTest(match); - - view()->SetUserText(u"user text"); - model()->OnSetFocus(false); - model()->SetInputInProgress(true); - model()->SetPopupIsOpen(true); - model()->OnPopupDataChanged(/*temporary_text=*/u"fake_temporary_text", - /*is_temporary_text=*/true, std::u16string(), - std::u16string(), std::u16string(), false, - std::u16string(), {}); - - EXPECT_TRUE(model()->HasTemporaryText()); - EXPECT_TRUE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u"fake_temporary_text"); + // Close the popup. + base::HistogramTester histogram_tester; + EXPECT_TRUE(model()->OnEscapeKeyPressed()); + histogram_tester.ExpectUniqueSample("Omnibox.Escape", 2, 1); + model()->SetPopupIsOpen(false); // `TestOmniboxEditModel` stubs the popup. + EXPECT_FALSE(model()->HasTemporaryText()); + EXPECT_FALSE(model()->PopupIsOpen()); + EXPECT_EQ(view()->GetText(), u""); EXPECT_TRUE(model()->user_input_in_progress()); EXPECT_TRUE(model()->has_focus()); + } - { - // Revert temporary text. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 1, 1); - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_TRUE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_TRUE(model()->user_input_in_progress()); - EXPECT_TRUE(model()->has_focus()); - } + { + // Clear user input. + base::HistogramTester histogram_tester; + EXPECT_TRUE(model()->OnEscapeKeyPressed()); + histogram_tester.ExpectUniqueSample("Omnibox.Escape", 3, 1); + EXPECT_FALSE(model()->HasTemporaryText()); + EXPECT_FALSE(model()->PopupIsOpen()); + EXPECT_EQ(view()->GetText(), u""); + EXPECT_FALSE(model()->user_input_in_progress()); + EXPECT_TRUE(model()->has_focus()); + } - { - // Close the popup & clear input. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 4, 1); - model()->SetPopupIsOpen( - false); // `TestOmniboxEditModel` stubs the popup. - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_FALSE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_FALSE(model()->user_input_in_progress()); - EXPECT_TRUE(model()->has_focus()); - } - - { - // Blur the omnibox. - base::HistogramTester histogram_tester; - EXPECT_TRUE(model()->OnEscapeKeyPressed()); - histogram_tester.ExpectUniqueSample("Omnibox.Escape", 5, 1); - model()->OnKillFocus(); // `TestOmniboxEditModel` stubs the client which - // handles blurring the omnibox. - EXPECT_FALSE(model()->HasTemporaryText()); - EXPECT_FALSE(model()->PopupIsOpen()); - EXPECT_EQ(view()->GetText(), u""); - EXPECT_FALSE(model()->user_input_in_progress()); - EXPECT_FALSE(model()->has_focus()); - } + { + // Blur the omnibox. + base::HistogramTester histogram_tester; + EXPECT_TRUE(model()->OnEscapeKeyPressed()); + histogram_tester.ExpectUniqueSample("Omnibox.Escape", 5, 1); + model()->OnKillFocus(); // `TestOmniboxEditModel` stubs the client which + // handles blurring the omnibox. + EXPECT_FALSE(model()->HasTemporaryText()); + EXPECT_FALSE(model()->PopupIsOpen()); + EXPECT_EQ(view()->GetText(), u""); + EXPECT_FALSE(model()->user_input_in_progress()); + EXPECT_FALSE(model()->has_focus()); } }
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc index d118022..6d3ac0a 100644 --- a/components/omnibox/common/omnibox_features.cc +++ b/components/omnibox/common/omnibox_features.cc
@@ -580,12 +580,6 @@ "OmniboxDiscardTemporaryInputOnTabSwitch", base::FEATURE_DISABLED_BY_DEFAULT); -// TODO(manukh): Enabled by default 4/5/23 m114. Clean up feature code 5/30 when -// m114 reaches stable. -BASE_FEATURE(kClosePopupWithEscape, - "OmniboxClosePopupWithEscape", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enable new Omnibox & Suggestions visual style. BASE_FEATURE(kOmniboxModernizeVisualUpdate, "OmniboxModernizeVisualUpdate",
diff --git a/components/omnibox/common/omnibox_features.h b/components/omnibox/common/omnibox_features.h index 85dfe377..ab70fb0 100644 --- a/components/omnibox/common/omnibox_features.h +++ b/components/omnibox/common/omnibox_features.h
@@ -132,7 +132,6 @@ // Omnibox & Suggestions UI - these affect both the omnibox and the suggestions // popup. -BASE_DECLARE_FEATURE(kClosePopupWithEscape); BASE_DECLARE_FEATURE(kOmniboxModernizeVisualUpdate); // Experiment to introduce new security indicators for HTTPS.
diff --git a/components/page_info/android/BUILD.gn b/components/page_info/android/BUILD.gn index 2300f84..edded76 100644 --- a/components/page_info/android/BUILD.gn +++ b/components/page_info/android/BUILD.gn
@@ -55,6 +55,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/page_info/CertificateChainHelper.java", "java/src/org/chromium/components/page_info/CertificateViewer.java", @@ -116,7 +117,6 @@ ] resources_package = "org.chromium.components.page_info" - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/paint_preview/player/android/BUILD.gn b/components/paint_preview/player/android/BUILD.gn index 2d5eefe..188b0f5 100644 --- a/components/paint_preview/player/android/BUILD.gn +++ b/components/paint_preview/player/android/BUILD.gn
@@ -55,7 +55,6 @@ } android_library("java") { - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.components.paintpreview.player" sources = [ @@ -87,7 +86,10 @@ "java/src/org/chromium/components/paintpreview/player/frame/PlayerFrameViewport.java", ] - srcjar_deps = [ ":compositor_status_generated_enum" ] + srcjar_deps = [ + ":compositor_status_generated_enum", + ":jni_headers", + ] deps = [ "//base:base_java", @@ -108,8 +110,8 @@ android_library("player_java_test_support") { testonly = true - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":javatests_jni_headers" ] sources = [ "javatests/src/org/chromium/components/paintpreview/player/FrameData.java", "javatests/src/org/chromium/components/paintpreview/player/PaintPreviewTestRule.java",
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java index b90959ca..064c127 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureMap.java
@@ -34,7 +34,7 @@ return PaymentFeatureMapJni.get().getNativeMap(); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { long getNativeMap();
diff --git a/components/prefs/android/BUILD.gn b/components/prefs/android/BUILD.gn index 3601135..7562f32a 100644 --- a/components/prefs/android/BUILD.gn +++ b/components/prefs/android/BUILD.gn
@@ -9,13 +9,13 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/prefs/PrefService.java" ] deps = [ "//base:jni_java", "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } robolectric_library("junit") {
diff --git a/components/query_tiles/BUILD.gn b/components/query_tiles/BUILD.gn index ae1df76..6501fd9 100644 --- a/components/query_tiles/BUILD.gn +++ b/components/query_tiles/BUILD.gn
@@ -90,6 +90,7 @@ } android_library("public_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/query_tiles/QueryTileConstants.java", "android/java/src/org/chromium/components/query_tiles/TileProvider.java", @@ -108,8 +109,6 @@ "//ui/android:ui_java", "//url:gurl_java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/safe_browsing/android/BUILD.gn b/components/safe_browsing/android/BUILD.gn index bdde59a..fcfbf01f 100644 --- a/components/safe_browsing/android/BUILD.gn +++ b/components/safe_browsing/android/BUILD.gn
@@ -14,7 +14,8 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/safe_browsing/SafeBrowsingApiBridge.java", "java/src/org/chromium/components/safe_browsing/SafetyNetApiHandler.java", @@ -138,7 +139,8 @@ "//base:jni_java", "//third_party/junit", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":native_j_unittests_jni_headers" ] sources = [ "native_java_unittests/src/org/chromium/components/safe_browsing/SafeBrowsingApiHandlerBridgeNativeUnitTestHelper.java" ] }
diff --git a/components/search_engines/android/BUILD.gn b/components/search_engines/android/BUILD.gn index 2db17323..8152c1a 100644 --- a/components/search_engines/android/BUILD.gn +++ b/components/search_engines/android/BUILD.gn
@@ -13,8 +13,8 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//url:gurl_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/search_engines/TemplateUrl.java", "java/src/org/chromium/components/search_engines/TemplateUrlService.java",
diff --git a/components/security_interstitials/content/android/BUILD.gn b/components/security_interstitials/content/android/BUILD.gn index a8f7d6f..142931b 100644 --- a/components/security_interstitials/content/android/BUILD.gn +++ b/components/security_interstitials/content/android/BUILD.gn
@@ -13,7 +13,7 @@ } android_library("java") { - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/security_interstitials/CaptivePortalHelper.java", "java/src/org/chromium/components/security_interstitials/DateAndTimeSettingsHelper.java",
diff --git a/components/security_state/content/android/BUILD.gn b/components/security_state/content/android/BUILD.gn index 603c4629..1ac0424 100644 --- a/components/security_state/content/android/BUILD.gn +++ b/components/security_state/content/android/BUILD.gn
@@ -21,6 +21,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/security_state/SecurityStateModel.java", ] @@ -31,7 +32,6 @@ "//content/public/android:content_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/security_state/content/android/java/src/org/chromium/components/security_state/SecurityStateModel.java b/components/security_state/content/android/java/src/org/chromium/components/security_state/SecurityStateModel.java index f3d8fc95..d90a34c9 100644 --- a/components/security_state/content/android/java/src/org/chromium/components/security_state/SecurityStateModel.java +++ b/components/security_state/content/android/java/src/org/chromium/components/security_state/SecurityStateModel.java
@@ -33,7 +33,7 @@ private SecurityStateModel() {} @NativeMethods - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public interface Natives { int getSecurityLevelForWebContents(WebContents webContents); }
diff --git a/components/segmentation_platform/internal/BUILD.gn b/components/segmentation_platform/internal/BUILD.gn index 1532beb6..597db03 100644 --- a/components/segmentation_platform/internal/BUILD.gn +++ b/components/segmentation_platform/internal/BUILD.gn
@@ -382,6 +382,7 @@ if (is_android) { android_library("internal_java") { visibility = [ "//chrome/android:chrome_all_java" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "android/java/src/org/chromium/components/segmentation_platform/SegmentationPlatformServiceImpl.java", "android/java/src/org/chromium/components/segmentation_platform/execution/processing/CustomDeviceUtils.java", @@ -394,7 +395,6 @@ "//components/optimization_guide/proto:optimization_guide_proto_java", "//components/segmentation_platform/public:public_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/segmentation_platform/internal/database/segment_info_cache.cc b/components/segmentation_platform/internal/database/segment_info_cache.cc index 89dadf1..c7026f5 100644 --- a/components/segmentation_platform/internal/database/segment_info_cache.cc +++ b/components/segmentation_platform/internal/database/segment_info_cache.cc
@@ -18,8 +18,9 @@ SegmentInfoCache::~SegmentInfoCache() = default; absl::optional<SegmentInfo> SegmentInfoCache::GetSegmentInfo( - SegmentId segment_id) const { - auto it = segment_info_cache_.find(segment_id); + SegmentId segment_id, + ModelSource model_source) const { + auto it = segment_info_cache_.find(std::make_pair(segment_id, model_source)); return (it == segment_info_cache_.end()) ? absl::nullopt : absl::make_optional(it->second); } @@ -30,7 +31,8 @@ std::unique_ptr<SegmentInfoCache::SegmentInfoList> segments_found = std::make_unique<SegmentInfoCache::SegmentInfoList>(); for (SegmentId target : segment_ids) { - absl::optional<SegmentInfo> info = GetSegmentInfo(target); + absl::optional<SegmentInfo> info = + GetSegmentInfo(target, ModelSource::SERVER_MODEL_SOURCE); if (info.has_value()) { segments_found->emplace_back( std::make_pair(target, std::move(info.value()))); @@ -41,11 +43,14 @@ void SegmentInfoCache::UpdateSegmentInfo( SegmentId segment_id, + ModelSource model_source, absl::optional<SegmentInfo> segment_info) { if (segment_info.has_value()) { - segment_info_cache_[segment_id] = std::move(segment_info.value()); + segment_info_cache_[std::make_pair(segment_id, model_source)] = + std::move(segment_info.value()); } else { - segment_info_cache_.erase(segment_info_cache_.find(segment_id)); + segment_info_cache_.erase( + segment_info_cache_.find(std::make_pair(segment_id, model_source))); } }
diff --git a/components/segmentation_platform/internal/database/segment_info_cache.h b/components/segmentation_platform/internal/database/segment_info_cache.h index 0ddd5cf..c8fdc58 100644 --- a/components/segmentation_platform/internal/database/segment_info_cache.h +++ b/components/segmentation_platform/internal/database/segment_info_cache.h
@@ -17,6 +17,7 @@ namespace segmentation_platform { +using proto::ModelSource; using proto::SegmentId; using proto::SegmentInfo; @@ -34,22 +35,26 @@ SegmentInfoCache(const SegmentInfoCache&) = delete; SegmentInfoCache& operator=(const SegmentInfoCache&) = delete; - // Returns an optional SegmentInfo for a `segment_id`. - absl::optional<SegmentInfo> GetSegmentInfo(SegmentId segment_id) const; + // Returns an optional SegmentInfo for a `segment_id` based on `model_source`. + absl::optional<SegmentInfo> GetSegmentInfo(SegmentId segment_id, + ModelSource model_source) const; // Returns list of segment info for list of `segment_ids` found in the cache. // If segment info is not found for a segment id, nothing is returned for it. + // This only returns segment info list for server side segments. std::unique_ptr<SegmentInfoList> GetSegmentInfoForSegments( const base::flat_set<SegmentId>& segment_ids) const; - // Updates cache with `segment_info` for a `segment_id`. - // It deletes the entry in cache if `segment_info` is nullopt. + // Updates cache with `segment_info` for a `segment_id` based on + // `model_source`. It deletes the entry in cache if `segment_info` is nullopt. void UpdateSegmentInfo(SegmentId segment_id, + ModelSource model_source, absl::optional<SegmentInfo> segment_info); private: - // Map storing SegmentInfo for a SegmentId. - base::flat_map<SegmentId, SegmentInfo> segment_info_cache_; + // Map storing SegmentInfo for a SegmentId and ModelSource. + base::flat_map<std::pair<SegmentId, ModelSource>, SegmentInfo> + segment_info_cache_; }; } // namespace segmentation_platform
diff --git a/components/segmentation_platform/internal/database/segment_info_cache_unittest.cc b/components/segmentation_platform/internal/database/segment_info_cache_unittest.cc index a7750093..5c73b1fe7 100644 --- a/components/segmentation_platform/internal/database/segment_info_cache_unittest.cc +++ b/components/segmentation_platform/internal/database/segment_info_cache_unittest.cc
@@ -20,9 +20,11 @@ const proto::SegmentId kSegmentId2 = proto::SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHOPPING_USER; -proto::SegmentInfo CreateSegment(SegmentId segment_id) { +proto::SegmentInfo CreateSegment(SegmentId segment_id, + ModelSource model_source) { proto::SegmentInfo info; info.set_segment_id(segment_id); + info.set_model_source(model_source); return info; } } // namespace @@ -45,34 +47,58 @@ }; TEST_F(SegmentInfoCacheTest, GetSegmentInfoFromEmptyCache) { - auto segment_info_ = segment_info_cache_->GetSegmentInfo(kSegmentId); + auto segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE); EXPECT_EQ(absl::nullopt, segment_info_); } TEST_F(SegmentInfoCacheTest, GetSegmentInfoFromCache) { - segment_info_cache_->UpdateSegmentInfo(kSegmentId, CreateSegment(kSegmentId)); - auto segment_info_ = segment_info_cache_->GetSegmentInfo(kSegmentId); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE, + CreateSegment(kSegmentId, ModelSource::SERVER_MODEL_SOURCE)); + auto segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE); EXPECT_TRUE(segment_info_.has_value()); EXPECT_EQ(kSegmentId, segment_info_.value().segment_id()); // Calling GetSegmentInfo method again. - segment_info_ = segment_info_cache_->GetSegmentInfo(kSegmentId); + segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE); + EXPECT_TRUE(segment_info_.has_value()); EXPECT_EQ(kSegmentId, segment_info_.value().segment_id()); + + // Calling GetSegmentInfo method again for default model. + segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::DEFAULT_MODEL_SOURCE); + EXPECT_FALSE(segment_info_.has_value()); } TEST_F(SegmentInfoCacheTest, GetSegmentInfoForSegmentsFromCache) { // Updating SegmentInfo for 'kSegmentId' and calling // GetSegmentInfoForSegments with superset of segment ids. - segment_info_cache_->UpdateSegmentInfo(kSegmentId, CreateSegment(kSegmentId)); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE, + CreateSegment(kSegmentId, ModelSource::SERVER_MODEL_SOURCE)); auto segments_found = segment_info_cache_->GetSegmentInfoForSegments({kSegmentId, kSegmentId2}); EXPECT_EQ(1u, segments_found.get()->size()); EXPECT_EQ(kSegmentId, segments_found.get()->at(0).first); + // Creating default model segment for 'kSegmentId2' and calling + // GetSegmentInfoForSegments with all segment ids. + segment_info_cache_->UpdateSegmentInfo( + kSegmentId2, ModelSource::DEFAULT_MODEL_SOURCE, + CreateSegment(kSegmentId2, ModelSource::DEFAULT_MODEL_SOURCE)); + segments_found = + segment_info_cache_->GetSegmentInfoForSegments({kSegmentId, kSegmentId2}); + EXPECT_EQ(1u, segments_found.get()->size()); + EXPECT_EQ(kSegmentId, segments_found.get()->at(0).first); + // Updating SegmentInfo for 'kSegmentId2' and calling // GetSegmentInfoForSegments with all segment ids. - segment_info_cache_->UpdateSegmentInfo(kSegmentId2, - CreateSegment(kSegmentId2)); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId2, ModelSource::SERVER_MODEL_SOURCE, + CreateSegment(kSegmentId2, ModelSource::SERVER_MODEL_SOURCE)); segments_found = segment_info_cache_->GetSegmentInfoForSegments({kSegmentId, kSegmentId2}); EXPECT_EQ(2u, segments_found.get()->size()); @@ -81,7 +107,8 @@ // Updating absl::nullopt for 'kSegmentId2' and calling // GetSegmentInfoForSegments with all segment ids. - segment_info_cache_->UpdateSegmentInfo(kSegmentId2, absl::nullopt); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId2, ModelSource::SERVER_MODEL_SOURCE, absl::nullopt); segments_found = segment_info_cache_->GetSegmentInfoForSegments({kSegmentId, kSegmentId2}); EXPECT_EQ(1u, segments_found.get()->size()); @@ -89,18 +116,23 @@ } TEST_F(SegmentInfoCacheTest, UpdateSegmentInfo) { - proto::SegmentInfo created_segment_info = CreateSegment(kSegmentId); - segment_info_cache_->UpdateSegmentInfo(kSegmentId, created_segment_info); + proto::SegmentInfo created_segment_info = + CreateSegment(kSegmentId, ModelSource::SERVER_MODEL_SOURCE); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE, created_segment_info); - auto segment_info_ = segment_info_cache_->GetSegmentInfo(kSegmentId); + auto segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE); EXPECT_TRUE(segment_info_.has_value()); EXPECT_EQ(kSegmentId, segment_info_.value().segment_id()); // Update model_version of segment_info created_segment_info.set_model_version(4); - segment_info_cache_->UpdateSegmentInfo(kSegmentId, created_segment_info); + segment_info_cache_->UpdateSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE, created_segment_info); - segment_info_ = segment_info_cache_->GetSegmentInfo(kSegmentId); + segment_info_ = segment_info_cache_->GetSegmentInfo( + kSegmentId, ModelSource::SERVER_MODEL_SOURCE); EXPECT_TRUE(segment_info_.has_value()); EXPECT_EQ(kSegmentId, segment_info_.value().segment_id()); EXPECT_EQ(4, segment_info_.value().model_version());
diff --git a/components/segmentation_platform/internal/database/segment_info_database.cc b/components/segmentation_platform/internal/database/segment_info_database.cc index 7652a3e..3ca02fe 100644 --- a/components/segmentation_platform/internal/database/segment_info_database.cc +++ b/components/segmentation_platform/internal/database/segment_info_database.cc
@@ -17,8 +17,19 @@ namespace { -std::string ToString(SegmentId segment_id) { - return base::NumberToString(static_cast<int>(segment_id)); +std::string ToString(SegmentId segment_id, ModelSource model_source) { + std::string prefix = + (model_source == ModelSource::DEFAULT_MODEL_SOURCE ? "DEFAULT_" : ""); + return prefix + base::NumberToString(static_cast<int>(segment_id)); +} + +ModelSource GetModelSource(ModelSource model_source) { + // If model source is not set in some segment info present in database, we + // consider it to be from server models. + if (model_source == ModelSource::UNKNOWN_MODEL_SOURCE) { + model_source = ModelSource::SERVER_MODEL_SOURCE; + } + return model_source; } } // namespace @@ -48,15 +59,15 @@ } void SegmentInfoDatabase::GetSegmentInfo(SegmentId segment_id, - ModelSource model_source, + proto::ModelSource model_source, SegmentInfoCallback callback) { - std::move(callback).Run(cache_->GetSegmentInfo(segment_id)); + std::move(callback).Run(cache_->GetSegmentInfo(segment_id, model_source)); } absl::optional<SegmentInfo> SegmentInfoDatabase::GetCachedSegmentInfo( SegmentId segment_id, - ModelSource model_source) { - return cache_->GetSegmentInfo(segment_id); + proto::ModelSource model_source) { + return cache_->GetSegmentInfo(segment_id, model_source); } void SegmentInfoDatabase::GetTrainingData(SegmentId segment_id, @@ -64,7 +75,8 @@ TrainingRequestId request_id, bool delete_from_db, TrainingDataCallback callback) { - absl::optional<SegmentInfo> segment_info = cache_->GetSegmentInfo(segment_id); + absl::optional<SegmentInfo> segment_info = + cache_->GetSegmentInfo(segment_id, model_source); absl::optional<proto::TrainingData> result; // Ignore results if the metadata no longer exists. @@ -90,7 +102,8 @@ segment_info->mutable_training_data()->DeleteSubrange(i, 1); } } - UpdateSegment(segment_id, std::move(segment_info), base::DoNothing()); + UpdateSegment(segment_id, model_source, std::move(segment_info), + base::DoNothing()); } // Notify the client with the result. @@ -99,9 +112,11 @@ void SegmentInfoDatabase::UpdateSegment( SegmentId segment_id, + ModelSource model_source, absl::optional<proto::SegmentInfo> segment_info, SuccessCallback callback) { - cache_->UpdateSegmentInfo(segment_id, segment_info); + model_source = GetModelSource(model_source); + cache_->UpdateSegmentInfo(segment_id, model_source, segment_info); // The cache has been updated now. We can notify the client synchronously. std::move(callback).Run(/*success=*/true); @@ -111,10 +126,10 @@ std::vector<std::pair<std::string, proto::SegmentInfo>>>(); auto keys_to_delete = std::make_unique<std::vector<std::string>>(); if (segment_info.has_value()) { - entries_to_save->emplace_back( - std::make_pair(ToString(segment_id), segment_info.value())); + entries_to_save->emplace_back(std::make_pair( + ToString(segment_id, model_source), segment_info.value())); } else { - keys_to_delete->emplace_back(ToString(segment_id)); + keys_to_delete->emplace_back(ToString(segment_id, model_source)); } database_->UpdateEntries(std::move(entries_to_save), std::move(keys_to_delete), base::DoNothing()); @@ -122,7 +137,8 @@ void SegmentInfoDatabase::UpdateMultipleSegments( const SegmentInfoList& segments_to_update, - const std::vector<proto::SegmentId>& segments_to_delete, + const std::vector<std::pair<proto::SegmentId, ModelSource>>& + segments_to_delete, SuccessCallback callback) { auto entries_to_save = std::make_unique< std::vector<std::pair<std::string, proto::SegmentInfo>>>(); @@ -130,21 +146,24 @@ for (auto& segment : segments_to_update) { const proto::SegmentId segment_id = segment.first; auto& segment_info = segment.second; - + ModelSource model_source = GetModelSource(segment_info.model_source()); // Updating the cache. - cache_->UpdateSegmentInfo(segment_id, absl::make_optional(segment_info)); + cache_->UpdateSegmentInfo(segment_id, model_source, + absl::make_optional(segment_info)); // Determining entries to save for database. - entries_to_save->emplace_back( - std::make_pair(ToString(segment_id), std::move(segment_info))); + entries_to_save->emplace_back(std::make_pair( + ToString(segment_id, model_source), std::move(segment_info))); } // The cache has been updated now. We can notify the client synchronously. std::move(callback).Run(/*success=*/true); + // TODO (ritikagup@) : Add handling for default models, if required. // Now write to the database asyncrhonously. - for (auto& segment_id : segments_to_delete) { - entries_to_delete->emplace_back(ToString(segment_id)); + for (auto& segment_id_and_model_source : segments_to_delete) { + entries_to_delete->emplace_back(ToString( + segment_id_and_model_source.first, segment_id_and_model_source.second)); } database_->UpdateEntries(std::move(entries_to_save), @@ -156,7 +175,7 @@ ModelSource model_source, absl::optional<proto::PredictionResult> result, SuccessCallback callback) { - auto segment_info = cache_->GetSegmentInfo(segment_id); + auto segment_info = cache_->GetSegmentInfo(segment_id, model_source); // Ignore results if the metadata no longer exists. if (!segment_info.has_value()) { @@ -177,14 +196,15 @@ segment_info->clear_prediction_result(); } - UpdateSegment(segment_id, std::move(segment_info), std::move(callback)); + UpdateSegment(segment_id, model_source, std::move(segment_info), + std::move(callback)); } void SegmentInfoDatabase::SaveTrainingData(SegmentId segment_id, ModelSource model_source, const proto::TrainingData& data, SuccessCallback callback) { - auto segment_info = cache_->GetSegmentInfo(segment_id); + auto segment_info = cache_->GetSegmentInfo(segment_id, model_source); // Ignore data if the metadata no longer exists. if (!segment_info.has_value()) { @@ -195,7 +215,8 @@ // Update training data. segment_info->add_training_data()->CopyFrom(data); - UpdateSegment(segment_id, std::move(segment_info), std::move(callback)); + UpdateSegment(segment_id, model_source, std::move(segment_info), + std::move(callback)); } void SegmentInfoDatabase::OnDatabaseInitialized( @@ -222,7 +243,8 @@ if (success) { // Add all the entries to the cache on startup. for (auto info : *all_infos.get()) { - cache_->UpdateSegmentInfo(info.segment_id(), info); + ModelSource model_source = GetModelSource(info.model_source()); + cache_->UpdateSegmentInfo(info.segment_id(), model_source, info); } } std::move(callback).Run(success);
diff --git a/components/segmentation_platform/internal/database/segment_info_database.h b/components/segmentation_platform/internal/database/segment_info_database.h index 75c8c832..347a79f 100644 --- a/components/segmentation_platform/internal/database/segment_info_database.h +++ b/components/segmentation_platform/internal/database/segment_info_database.h
@@ -84,6 +84,7 @@ // The database will be updated asynchronously after. // TODO(shaktisahu): How does the client know if a segment is to be deleted? virtual void UpdateSegment(SegmentId segment_id, + ModelSource model_source, absl::optional<proto::SegmentInfo> segment_info, SuccessCallback callback); @@ -93,7 +94,7 @@ // segment ids to be deleted from the database. virtual void UpdateMultipleSegments( const SegmentInfoList& segments_to_update, - const std::vector<SegmentId>& segments_to_delete, + const std::vector<std::pair<SegmentId, ModelSource>>& segments_to_delete, SuccessCallback callback); // Called to write the model execution results for a given segment. It will
diff --git a/components/segmentation_platform/internal/database/segment_info_database_unittest.cc b/components/segmentation_platform/internal/database/segment_info_database_unittest.cc index f62bea5..aa34b035 100644 --- a/components/segmentation_platform/internal/database/segment_info_database_unittest.cc +++ b/components/segmentation_platform/internal/database/segment_info_database_unittest.cc
@@ -24,10 +24,13 @@ SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB; const SegmentId kSegmentId2 = SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_SHARE; +const ModelSource kDefaultModelSource = ModelSource::DEFAULT_MODEL_SOURCE; const ModelSource kServerModelSource = ModelSource::SERVER_MODEL_SOURCE; std::string ToString(SegmentId segment_id, ModelSource model_source) { - return base::NumberToString(static_cast<int>(segment_id)); + std::string prefix = + (model_source == ModelSource::DEFAULT_MODEL_SOURCE ? "DEFAULT_" : ""); + return prefix + base::NumberToString(static_cast<int>(segment_id)); } proto::SegmentInfo CreateSegment(SegmentId segment_id, @@ -104,7 +107,8 @@ ? absl::make_optional(prediction_result) : absl::nullopt, base::DoNothing()); - if (!segment_info_cache_->GetSegmentInfo(segment_id).has_value()) { + if (!segment_info_cache_->GetSegmentInfo(segment_id, model_source) + .has_value()) { db_->GetCallback(true); } db_->UpdateCallback(true); @@ -120,7 +124,8 @@ segment_db_->SaveTrainingData(segment_id, model_source, training_data, base::DoNothing()); - if (!segment_info_cache_->GetSegmentInfo(segment_id).has_value()) { + if (!segment_info_cache_->GetSegmentInfo(segment_id, model_source) + .has_value()) { db_->GetCallback(true); } db_->UpdateCallback(true); @@ -135,7 +140,8 @@ segment_id, model_source, base::BindOnce(&SegmentInfoDatabaseTest::OnGetSegment, base::Unretained(this))); - if (!segment_info_cache_->GetSegmentInfo(segment_id).has_value()) { + if (!segment_info_cache_->GetSegmentInfo(segment_id, model_source) + .has_value()) { db_->GetCallback(true); } @@ -166,7 +172,8 @@ base::Unretained(this), loop.QuitClosure())); for (SegmentId segment_id : segment_ids) { - if (!segment_info_cache_->GetSegmentInfo(segment_id).has_value()) { + if (!segment_info_cache_->GetSegmentInfo(segment_id, kServerModelSource) + .has_value()) { db_->LoadCallback(true); break; } @@ -211,7 +218,8 @@ kSegmentId, kServerModelSource, base::BindOnce(&SegmentInfoDatabaseTest::OnGetSegment, base::Unretained(this))); - if (!segment_info_cache_->GetSegmentInfo(kSegmentId).has_value()) { + if (!segment_info_cache_->GetSegmentInfo(kSegmentId, kServerModelSource) + .has_value()) { db_->GetCallback(true); } EXPECT_TRUE(get_segment_result_.has_value()); @@ -230,19 +238,20 @@ db_->LoadCallback(true); // Delete a segment. - segment_db_->UpdateSegment(kSegmentId, absl::nullopt, base::DoNothing()); + segment_db_->UpdateSegment(kSegmentId, kServerModelSource, absl::nullopt, + base::DoNothing()); db_->UpdateCallback(true); VerifyDb({}); // Insert a segment and verify. - segment_db_->UpdateSegment(kSegmentId, + segment_db_->UpdateSegment(kSegmentId, kServerModelSource, CreateSegment(kSegmentId, kServerModelSource), base::DoNothing()); db_->UpdateCallback(true); VerifyDb({std::make_pair(kSegmentId, kServerModelSource)}); // Insert another segment and verify. - segment_db_->UpdateSegment(kSegmentId2, + segment_db_->UpdateSegment(kSegmentId2, kServerModelSource, CreateSegment(kSegmentId2, kServerModelSource), base::DoNothing()); db_->UpdateCallback(true); @@ -257,6 +266,37 @@ ExecuteAndVerifyGetSegmentInfoForSegments({kSegmentId, kSegmentId2}); } +TEST_F(SegmentInfoDatabaseTest, UpdateWithModelSource) { + // Initialize DB with one entry. + db_entries_.insert( + std::make_pair(ToString(kSegmentId, kServerModelSource), + CreateSegment(kSegmentId, kServerModelSource))); + SetUpDB(); + + segment_db_->Initialize(base::DoNothing()); + db_->InitStatusCallback(leveldb_proto::Enums::InitStatus::kOK); + db_->LoadCallback(true); + + // Insert a segment and verify. + segment_db_->UpdateSegment( + kSegmentId, ModelSource::UNKNOWN_MODEL_SOURCE, + CreateSegment(kSegmentId, ModelSource::UNKNOWN_MODEL_SOURCE), + base::DoNothing()); + db_->UpdateCallback(true); + VerifyDb({std::make_pair(kSegmentId, ModelSource::UNKNOWN_MODEL_SOURCE)}); + + // Insert another segment and verify. + segment_db_->UpdateSegment(kSegmentId2, kDefaultModelSource, + CreateSegment(kSegmentId2, kDefaultModelSource), + base::DoNothing()); + db_->UpdateCallback(true); + VerifyDb({std::make_pair(kSegmentId, kServerModelSource), + std::make_pair(kSegmentId2, kDefaultModelSource)}); + + // Verify GetSegmentInfoForSegments. + ExecuteAndVerifyGetSegmentInfoForSegments({kSegmentId}); +} + TEST_F(SegmentInfoDatabaseTest, UpdateMultipleSegments) { // Initialize DB with two entry. db_entries_.insert( @@ -272,8 +312,11 @@ db_->LoadCallback(true); // Delete both segments. - segment_db_->UpdateMultipleSegments({}, {kSegmentId, kSegmentId2}, - base::DoNothing()); + segment_db_->UpdateMultipleSegments( + {}, + {std::make_pair(kSegmentId, kServerModelSource), + std::make_pair(kSegmentId2, kServerModelSource)}, + base::DoNothing()); db_->UpdateCallback(true); VerifyDb({}); @@ -322,11 +365,15 @@ segment_db_->Initialize(base::DoNothing()); db_->InitStatusCallback(leveldb_proto::Enums::InitStatus::kOK); - EXPECT_FALSE(segment_info_cache_->GetSegmentInfo(kSegmentId).has_value()); + EXPECT_FALSE( + segment_info_cache_->GetSegmentInfo(kSegmentId, kServerModelSource) + .has_value()); // Verify that all DB entries are loaded into cache on initialization. db_->LoadCallback(true); - EXPECT_TRUE(segment_info_cache_->GetSegmentInfo(kSegmentId).has_value()); + EXPECT_TRUE( + segment_info_cache_->GetSegmentInfo(kSegmentId, kServerModelSource) + .has_value()); // Update results and verify that db is updated. WriteResult(kSegmentId, kServerModelSource, 0.4f); @@ -353,7 +400,9 @@ segment_db_->Initialize(base::DoNothing()); db_->InitStatusCallback(leveldb_proto::Enums::InitStatus::kOK); db_->LoadCallback(true); - EXPECT_TRUE(segment_info_cache_->GetSegmentInfo(kSegmentId).has_value()); + EXPECT_TRUE( + segment_info_cache_->GetSegmentInfo(kSegmentId, kServerModelSource) + .has_value()); std::vector<ModelProvider::Request> expected_training_inputs;
diff --git a/components/segmentation_platform/internal/database/test_segment_info_database.cc b/components/segmentation_platform/internal/database/test_segment_info_database.cc index fa8e116ca..8c41a81 100644 --- a/components/segmentation_platform/internal/database/test_segment_info_database.cc +++ b/components/segmentation_platform/internal/database/test_segment_info_database.cc
@@ -55,6 +55,7 @@ void TestSegmentInfoDatabase::UpdateSegment( SegmentId segment_id, + ModelSource model_source, absl::optional<proto::SegmentInfo> segment_info, SuccessCallback callback) { if (segment_info.has_value()) {
diff --git a/components/segmentation_platform/internal/database/test_segment_info_database.h b/components/segmentation_platform/internal/database/test_segment_info_database.h index ffe54247..188586e 100644 --- a/components/segmentation_platform/internal/database/test_segment_info_database.h +++ b/components/segmentation_platform/internal/database/test_segment_info_database.h
@@ -35,6 +35,7 @@ SegmentId segment_id, ModelSource model_source) override; void UpdateSegment(SegmentId segment_id, + ModelSource model_score, absl::optional<proto::SegmentInfo> segment_info, SuccessCallback callback) override; void SaveSegmentResult(SegmentId segment_id,
diff --git a/components/segmentation_platform/internal/execution/model_execution_manager_impl.cc b/components/segmentation_platform/internal/execution/model_execution_manager_impl.cc index b9ba9c9..f858aa19 100644 --- a/components/segmentation_platform/internal/execution/model_execution_manager_impl.cc +++ b/components/segmentation_platform/internal/execution/model_execution_manager_impl.cc
@@ -153,7 +153,8 @@ // Now that we've merged the old and the new SegmentInfo, we want to store // the new version in the database. segment_database_->UpdateSegment( - segment_id, absl::make_optional(new_segment_info), + segment_id, new_segment_info.model_source(), + absl::make_optional(new_segment_info), base::BindOnce(&ModelExecutionManagerImpl::OnUpdatedSegmentInfoStored, weak_ptr_factory_.GetWeakPtr(), new_segment_info)); }
diff --git a/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc b/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc index 0c1263d5..3741c8b 100644 --- a/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc +++ b/components/segmentation_platform/internal/execution/model_execution_manager_impl_unittest.cc
@@ -65,6 +65,7 @@ MOCK_METHOD(void, UpdateSegment, (SegmentId segment_id, + ModelSource model_source, absl::optional<proto::SegmentInfo> segment_info, SuccessCallback callback), (override));
diff --git a/components/segmentation_platform/internal/service_proxy_impl_unittest.cc b/components/segmentation_platform/internal/service_proxy_impl_unittest.cc index a0ed635a..7ebc95b 100644 --- a/components/segmentation_platform/internal/service_proxy_impl_unittest.cc +++ b/components/segmentation_platform/internal/service_proxy_impl_unittest.cc
@@ -259,8 +259,8 @@ service_proxy_impl_->OnServiceStatusChanged(true, 7); segment_db_->UpdateSegment( - SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB, *info, - base::DoNothing()); + SegmentId::OPTIMIZATION_TARGET_SEGMENTATION_NEW_TAB, + ModelSource::SERVER_MODEL_SOURCE, *info, base::DoNothing()); auto scheduler_moved = std::make_unique<MockModelExecutionScheduler>(); MockModelExecutionScheduler* scheduler = scheduler_moved.get();
diff --git a/components/segmentation_platform/public/BUILD.gn b/components/segmentation_platform/public/BUILD.gn index 54afaf57..ec946758 100644 --- a/components/segmentation_platform/public/BUILD.gn +++ b/components/segmentation_platform/public/BUILD.gn
@@ -115,9 +115,10 @@ "//url:gurl_java", ] - srcjar_deps = [ ":processed_value_enums_java" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":jni_headers", + ":processed_value_enums_java", + ] public_deps = [ "//components/segmentation_platform/public/proto:segmentation_platform_proto_java" ] }
diff --git a/components/services/storage/shared_storage/async_shared_storage_database.h b/components/services/storage/shared_storage/async_shared_storage_database.h index 2dc7beb..76a4dd9 100644 --- a/components/services/storage/shared_storage/async_shared_storage_database.h +++ b/components/services/storage/shared_storage/async_shared_storage_database.h
@@ -171,10 +171,10 @@ base::OnceCallback<void(OperationResult)> callback) = 0; // Clears all origins that match `storage_key_matcher` run on the owning - // StoragePartition's `SpecialStoragePolicy` and have `last_used_time` between - // the times `begin` and `end`. If `perform_storage_cleanup` is true, vacuums - // the database afterwards. The parameter of `callback` reports whether the - // transaction was successful. + // StoragePartition's `SpecialStoragePolicy` and have any key with + // `last_used_time` between the times `begin` and `end`. If + // `perform_storage_cleanup` is true, vacuums the database afterwards. The + // parameter of `callback` reports whether the transaction was successful. // // Note that `storage_key_matcher` is accessed on a different sequence than // where it was created.
diff --git a/components/services/storage/shared_storage/async_shared_storage_database_impl_unittest.cc b/components/services/storage/shared_storage/async_shared_storage_database_impl_unittest.cc index 010853fb..2e4e4ab 100644 --- a/components/services/storage/shared_storage/async_shared_storage_database_impl_unittest.cc +++ b/components/services/storage/shared_storage/async_shared_storage_database_impl_unittest.cc
@@ -2042,383 +2042,90 @@ TEST_P(AsyncSharedStorageDatabaseImplPurgeMatchingOriginsParamTest, SinceThreshold) { + // Create keys for two origins. Origin1 will create keys before the expiration + // time, and Origin2 will create keys after the expiration time. After purge, + // only Origin2 should have been deleted. url::Origin kOrigin1 = url::Origin::Create(GURL("http://www.example1.test")); url::Origin kOrigin2 = url::Origin::Create(GURL("http://www.example2.test")); - url::Origin kOrigin3 = url::Origin::Create(GURL("http://www.example3.test")); - url::Origin kOrigin4 = url::Origin::Create(GURL("http://www.example4.test")); - url::Origin kOrigin5 = url::Origin::Create(GURL("http://www.example5.test")); - std::queue<DBOperation> operation_list; - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - operation_list.push(DBOperation(Type::DB_IS_OPEN)); - operation_list.push(DBOperation(Type::DB_STATUS)); - - base::Time threshold1 = base::Time::Now(); StorageKeyPolicyMatcherFunctionUtility matcher_utility; - size_t matcher_id1 = matcher_utility.RegisterMatcherFunction({kOrigin1}); - operation_list.push(DBOperation( - Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id1), - TestDatabaseOperationReceiver::SerializeTime(threshold1), - TestDatabaseOperationReceiver::SerializeTime(base::Time::Max()), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin1, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_IS_OPEN)); - operation_list.push(DBOperation(Type::DB_STATUS)); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin1, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin2, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key3", u"value3", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key3", u"value3", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key4", u"value4", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); - - operation_list.push( - DBOperation(Type::DB_SET, kOrigin5, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); - - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - base::Time threshold2 = base::Time::Now() + base::Seconds(100); - base::Time override_time1 = threshold2 + base::Milliseconds(5); - operation_list.push(DBOperation( - Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin1, - {TestDatabaseOperationReceiver::SerializeTime(override_time1)})); - - size_t matcher_id2 = - matcher_utility.RegisterMatcherFunction({kOrigin1, kOrigin2, kOrigin5}); - operation_list.push(DBOperation( - Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id2), - TestDatabaseOperationReceiver::SerializeTime(threshold2), - TestDatabaseOperationReceiver::SerializeTime(base::Time::Max()), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); - - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); - - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - base::Time threshold3 = base::Time::Now() + base::Seconds(200); - operation_list.push( - DBOperation(Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin3, - {TestDatabaseOperationReceiver::SerializeTime(threshold3)})); - - base::Time threshold4 = threshold3 + base::Seconds(100); - operation_list.push( - DBOperation(Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin5, - {TestDatabaseOperationReceiver::SerializeTime(threshold4)})); - - size_t matcher_id3 = matcher_utility.RegisterMatcherFunction( - {kOrigin2, kOrigin3, kOrigin4, kOrigin5}); - operation_list.push( - DBOperation(Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id3), - TestDatabaseOperationReceiver::SerializeTime(threshold3), - TestDatabaseOperationReceiver::SerializeTime(threshold4), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); - - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); - - operation_list.push(DBOperation(Type::DB_TRIM_MEMORY)); - - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - operation_list.push(DBOperation(Type::DB_GET, kOrigin2, {u"key1"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key1"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key2"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key3"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key4"})); - - operation_list.push(DBOperation(Type::DB_DESTROY)); - - SetExpectedOperationList(std::move(operation_list)); - - // Check that origin list is initially empty due to the database not being - // initialized. - std::vector<mojom::StorageUsageInfoPtr> infos1; - FetchOrigins(&infos1); - - // Check that calling `PurgeMatchingOrigins()` on the uninitialized database - // doesn't give an error. - bool open1 = false; - IsOpen(&open1); - InitStatus status1 = InitStatus::kUnattempted; - DBStatus(&status1); - - OperationResult result1 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id1, threshold1, - base::Time::Max(), &result1, - GetParam().perform_storage_cleanup); - - OperationResult result2 = OperationResult::kSqlError; - Set(kOrigin1, u"key1", u"value1", &result2); - - bool open2 = false; - IsOpen(&open2); - InitStatus status2 = InitStatus::kUnattempted; - DBStatus(&status2); - - OperationResult result3 = OperationResult::kSqlError; - Set(kOrigin1, u"key2", u"value2", &result3); - int length1 = -1; - Length(kOrigin1, &length1); - - OperationResult result4 = OperationResult::kSqlError; - Set(kOrigin2, u"key1", u"value1", &result4); - int length2 = -1; - Length(kOrigin2, &length2); - - OperationResult result5 = OperationResult::kSqlError; - Set(kOrigin3, u"key1", u"value1", &result5); - OperationResult result6 = OperationResult::kSqlError; - Set(kOrigin3, u"key2", u"value2", &result6); - OperationResult result7 = OperationResult::kSqlError; - Set(kOrigin3, u"key3", u"value3", &result7); - int length3 = -1; - Length(kOrigin3, &length3); - - OperationResult result8 = OperationResult::kSqlError; - Set(kOrigin4, u"key1", u"value1", &result8); - OperationResult result9 = OperationResult::kSqlError; - Set(kOrigin4, u"key2", u"value2", &result9); - OperationResult result10 = OperationResult::kSqlError; - Set(kOrigin4, u"key3", u"value3", &result10); - OperationResult result11 = OperationResult::kSqlError; - Set(kOrigin4, u"key4", u"value4", &result11); - int length4 = -1; - Length(kOrigin4, &length4); - - OperationResult result12 = OperationResult::kSqlError; - Set(kOrigin5, u"key1", u"value1", &result12); - int length5 = -1; - Length(kOrigin5, &length5); - - std::vector<mojom::StorageUsageInfoPtr> infos2; - FetchOrigins(&infos2); - - bool success1 = false; - OverrideCreationTime(kOrigin1, override_time1, &success1); - - // Verify that the only match we get is for `kOrigin1`, whose `last_used_time` - // is between the time parameters. - OperationResult result13 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id2, threshold2, - base::Time::Max(), &result13, - GetParam().perform_storage_cleanup); - - int length6 = -1; - Length(kOrigin1, &length6); - int length7 = -1; - Length(kOrigin2, &length7); - int length8 = -1; - Length(kOrigin3, &length8); - int length9 = -1; - Length(kOrigin4, &length9); - int length10 = -1; - Length(kOrigin5, &length10); - - std::vector<mojom::StorageUsageInfoPtr> infos3; - FetchOrigins(&infos3); - - bool success2 = false; - OverrideCreationTime(kOrigin3, threshold3, &success2); - bool success3 = false; - OverrideCreationTime(kOrigin5, threshold4, &success3); - - // Verify that we still get matches for `kOrigin3`, whose `last_used_time` is - // exactly at the `begin` time, as well as for `kOrigin5`, whose - // `last_used_time` is exactly at the `end` time. - OperationResult result14 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id3, threshold3, threshold4, - &result14, GetParam().perform_storage_cleanup); - - int length11 = -1; - Length(kOrigin1, &length11); - int length12 = -1; - Length(kOrigin2, &length12); - int length13 = -1; - Length(kOrigin3, &length13); - int length14 = -1; - Length(kOrigin4, &length14); - int length15 = -1; - Length(kOrigin5, &length15); - - TrimMemory(); - - std::vector<mojom::StorageUsageInfoPtr> infos4; - FetchOrigins(&infos4); - - GetResult value1; - Get(kOrigin2, u"key1", &value1); - GetResult value2; - Get(kOrigin4, u"key1", &value2); - GetResult value3; - Get(kOrigin4, u"key2", &value3); - GetResult value4; - Get(kOrigin4, u"key3", &value4); - GetResult value5; - Get(kOrigin4, u"key4", &value5); - - bool success4 = false; - Destroy(&success4); - - WaitForOperations(); - EXPECT_TRUE(is_finished()); - - // Database is not yet initialized. `FetchOrigins()` returns an empty vector. - EXPECT_TRUE(infos1.empty()); - EXPECT_EQ(!GetParam().in_memory_only, open1); - EXPECT_EQ(InitStatus::kUnattempted, status1); - - // No error from calling `PurgeMatchingOrigins()` on an uninitialized - // database. - EXPECT_EQ(OperationResult::kSuccess, result1); - - // The call to `Set()` initializes the database. - EXPECT_EQ(OperationResult::kSet, result2); - EXPECT_TRUE(open2); - EXPECT_EQ(InitStatus::kSuccess, status2); - - EXPECT_EQ(OperationResult::kSet, result3); - EXPECT_EQ(2, length1); - - EXPECT_EQ(OperationResult::kSet, result4); - EXPECT_EQ(1, length2); - - EXPECT_EQ(OperationResult::kSet, result5); - EXPECT_EQ(OperationResult::kSet, result6); - EXPECT_EQ(OperationResult::kSet, result7); - EXPECT_EQ(3, length3); - - EXPECT_EQ(OperationResult::kSet, result8); - EXPECT_EQ(OperationResult::kSet, result9); - EXPECT_EQ(OperationResult::kSet, result10); - EXPECT_EQ(OperationResult::kSet, result11); - EXPECT_EQ(4, length4); - - EXPECT_EQ(OperationResult::kSet, result12); - EXPECT_EQ(1, length5); - - std::vector<url::Origin> origins; - for (const auto& info : infos2) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, - ElementsAre(kOrigin1, kOrigin2, kOrigin3, kOrigin4, kOrigin5)); - - EXPECT_TRUE(success1); - EXPECT_EQ(OperationResult::kSuccess, result13); - - // `kOrigin1` is cleared. The other origins are not. - EXPECT_EQ(0, length6); - EXPECT_EQ(1, length7); - EXPECT_EQ(3, length8); - EXPECT_EQ(4, length9); - EXPECT_EQ(1, length10); - - origins.clear(); - for (const auto& info : infos3) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin2, kOrigin3, kOrigin4, kOrigin5)); - - EXPECT_TRUE(success2); - EXPECT_TRUE(success3); - - EXPECT_EQ(OperationResult::kSuccess, result14); - - // `kOrigin3` and `kOrigin5` are cleared. The others weren't modified within - // the given time period. - EXPECT_EQ(0, length11); - EXPECT_EQ(1, length12); - EXPECT_EQ(0, length13); - EXPECT_EQ(4, length14); - EXPECT_EQ(0, length15); - - origins.clear(); - for (const auto& info : infos4) { - origins.push_back(info->storage_key.origin()); + // Check that the db is unopened. + { + base::test::TestFuture<bool> future; + GetImpl()->IsOpenForTesting(future.GetCallback()); + EXPECT_EQ(false, future.Get()); } - EXPECT_THAT(origins, ElementsAre(kOrigin2, kOrigin4)); + { + base::test::TestFuture<InitStatus> future; + GetImpl()->DBStatusForTesting(future.GetCallback()); + EXPECT_EQ(InitStatus::kUnattempted, future.Get()); + } - // Database is still intact after trimming memory (and possibly performing - // storage cleanup). - EXPECT_EQ(value1.data, u"value1"); - EXPECT_EQ(OperationResult::kSuccess, value1.result); - EXPECT_EQ(value2.data, u"value1"); - EXPECT_EQ(OperationResult::kSuccess, value2.result); - EXPECT_EQ(value3.data, u"value2"); - EXPECT_EQ(OperationResult::kSuccess, value3.result); - EXPECT_EQ(value4.data, u"value3"); - EXPECT_EQ(OperationResult::kSuccess, value4.result); - EXPECT_EQ(value5.data, u"value4"); - EXPECT_EQ(OperationResult::kSuccess, value5.result); + size_t matcher_id = + matcher_utility.RegisterMatcherFunction({kOrigin1, kOrigin2}); - EXPECT_TRUE(success4); + // Running purge on an unopened db is fine. + { + base::test::TestFuture<OperationResult> future; + GetImpl()->PurgeMatchingOrigins( + matcher_utility.TakeMatcherFunctionForId(matcher_id), base::Time::Now(), + base::Time::Max(), future.GetCallback(), + GetParam().perform_storage_cleanup); + EXPECT_EQ(OperationResult::kSuccess, future.Get()); + } + + // Add a key for origin1. + { + base::test::TestFuture<OperationResult> future; + GetImpl()->Set(kOrigin1, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(OperationResult::kSet, future.Get()); + } + + // Ideally this would use an injected clock, but a 1ms sleep isn't terrible. + base::PlatformThread::Sleep(base::Milliseconds(1)); + base::Time start_time = base::Time::Now(); + + // Now that we're in the future, add a key for origin2. + { + base::test::TestFuture<OperationResult> future; + GetImpl()->Set(kOrigin2, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(OperationResult::kSet, future.Get()); + } + + // Each origin should have 1 key. + { + base::test::TestFuture<int> future; + GetImpl()->Length(kOrigin1, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetImpl()->Length(kOrigin2, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + + // Purge newer stuff, origin2 should be deleted. + { + base::test::TestFuture<OperationResult> future; + GetImpl()->PurgeMatchingOrigins( + matcher_utility.TakeMatcherFunctionForId(matcher_id), start_time, + base::Time::Max(), future.GetCallback(), + GetParam().perform_storage_cleanup); + EXPECT_EQ(OperationResult::kSuccess, future.Get()); + } + + // Only origin1 should have a key. + { + base::test::TestFuture<int> future; + GetImpl()->Length(kOrigin1, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetImpl()->Length(kOrigin2, future.GetCallback()); + EXPECT_EQ(0, future.Get()); + } } } // namespace storage
diff --git a/components/services/storage/shared_storage/shared_storage_database.cc b/components/services/storage/shared_storage/shared_storage_database.cc index 8c0da90e..9181efa 100644 --- a/components/services/storage/shared_storage/shared_storage_database.cc +++ b/components/services/storage/shared_storage/shared_storage_database.cc
@@ -704,17 +704,17 @@ } static constexpr char kSelectSql[] = - "SELECT context_origin FROM per_origin_mapping " - "WHERE creation_time BETWEEN ? AND ? " - "ORDER BY creation_time"; + "SELECT distinct context_origin FROM values_mapping " + "WHERE last_used_time BETWEEN ? AND ? "; sql::Statement statement(db_.GetCachedStatement(SQL_FROM_HERE, kSelectSql)); statement.BindTime(0, begin); statement.BindTime(1, end); std::vector<std::string> origins; - while (statement.Step()) + while (statement.Step()) { origins.push_back(statement.ColumnString(0)); + } if (!statement.Succeeded()) return OperationResult::kSqlError; @@ -1141,39 +1141,6 @@ return -1; } -bool SharedStorageDatabase::PopulateDatabaseForTesting(url::Origin origin1, - url::Origin origin2, - url::Origin origin3) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - // We use `CHECK_EQ()` and `CHECK()` macros instead of early returns because - // the latter made the test coverage delta too low. - CHECK_EQ(OperationResult::kSet, - Set(origin1, u"key1", u"value1", SetBehavior::kDefault)); - - CHECK_EQ(OperationResult::kSet, - Set(origin1, u"key2", u"value1", SetBehavior::kDefault)); - - CHECK_EQ(OperationResult::kSet, - Set(origin2, u"key1", u"value2", SetBehavior::kDefault)); - - CHECK(OverrideCreationTimeForTesting( // IN-TEST - origin2, clock_->Now() - base::Days(1))); - - CHECK_EQ(OperationResult::kSet, - Set(origin3, u"key1", u"value1", SetBehavior::kDefault)); - - CHECK_EQ(OperationResult::kSet, - Set(origin3, u"key2", u"value2", SetBehavior::kDefault)); - - CHECK(OverrideCreationTimeForTesting( // IN-TEST - origin3, clock_->Now() - base::Days(60))); - - // We return a bool in order to facilitate use of `base::test::TestFuture` - // with this method. - return true; -} - SharedStorageDatabase::InitStatus SharedStorageDatabase::LazyInit( DBCreationPolicy policy) { // Early return in case of previous failure, to prevent an unbounded
diff --git a/components/services/storage/shared_storage/shared_storage_database.h b/components/services/storage/shared_storage/shared_storage_database.h index 5fded91..f0c2c947 100644 --- a/components/services/storage/shared_storage/shared_storage_database.h +++ b/components/services/storage/shared_storage/shared_storage_database.h
@@ -318,9 +318,10 @@ pending_listener); // Clears all origins that match `storage_key_matcher` run on the owning - // StoragePartition's `SpecialStoragePolicy` and have `creation_time` between - // the times `begin` and `end`. If `perform_storage_cleanup` is true, vacuums - // the database afterwards. Returns whether the transaction was successful. + // StoragePartition's `SpecialStoragePolicy` and have any key with a + // `last_used_time` between the times `begin` and `end`. If + // `perform_storage_cleanup` is true, vacuums the database afterwards. Returns + // whether the transaction was successful. [[nodiscard]] OperationResult PurgeMatchingOrigins( StorageKeyPolicyMatcherFunction storage_key_matcher, base::Time begin, @@ -403,19 +404,6 @@ // case of database initialization failure or SQL error. [[nodiscard]] int64_t GetTotalNumBudgetEntriesForTesting(); - // Populates the database in order to test integration with - // `content::StoragePartitionImpl` while keeping in this file the parts of - // those tests that depend on implementation details of - // `SharedStorageDatabase`. - // - // Sets two example key-value pairs for `origin1`, one example pair for - // `origin2`, and two example pairs for `origin3`, while also overriding the - // `creation_time` for `origin2` so that it is 1 day earlier and the - // `creation_time` for `origin3` so that it is 60 days earlier. - [[nodiscard]] bool PopulateDatabaseForTesting(url::Origin origin1, - url::Origin origin2, - url::Origin origin3); - private: // Policy to tell `LazyInit()` whether or not to create a new database if a // pre-existing on-disk database is not found.
diff --git a/components/services/storage/shared_storage/shared_storage_database_unittest.cc b/components/services/storage/shared_storage/shared_storage_database_unittest.cc index fbb3536..548f49b6 100644 --- a/components/services/storage/shared_storage/shared_storage_database_unittest.cc +++ b/components/services/storage/shared_storage/shared_storage_database_unittest.cc
@@ -1455,96 +1455,105 @@ TEST_P(SharedStorageDatabasePurgeMatchingOriginsParamTest, SinceThreshold) { EXPECT_TRUE(db_->FetchOrigins().empty()); - const url::Origin kOrigin1 = + // Origin0 is created at time 0, and key0 is written at time 0, key1 at 1 + // Origin1 is created at time 1, and key1 is written at time 1, key2 at 2 + // Origin2 is created at time 2, and key2 is written at time 2, key3 at 3 + // Origin00 is created at time 0, and key0 is written at time 0, key3 is + // written at time 3 + const url::Origin kOrigin0 = url::Origin::Create(GURL("http://www.example1.test")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin1, u"key1", u"value1")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin1, u"key2", u"value2")); - EXPECT_EQ(2L, db_->Length(kOrigin1)); - - clock_.Advance(base::Milliseconds(50)); - - // Time threshold that will be used as a starting point for deletion. - base::Time threshold1 = clock_.Now(); - - const url::Origin kOrigin2 = + const url::Origin kOrigin1 = url::Origin::Create(GURL("http://www.example2.test")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin2, u"key1", u"value1")); - EXPECT_EQ(1L, db_->Length(kOrigin2)); - - const url::Origin kOrigin3 = + const url::Origin kOrigin2 = url::Origin::Create(GURL("http://www.example3.test")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin3, u"key1", u"value1")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin3, u"key2", u"value2")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin3, u"key3", u"value3")); - EXPECT_EQ(3L, db_->Length(kOrigin3)); - - const url::Origin kOrigin4 = + const url::Origin kOrigin00 = url::Origin::Create(GURL("http://www.example4.test")); - clock_.Advance(base::Milliseconds(50)); + // Time = 0. + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin0, u"key0", u"value1")); + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin00, u"key0", u"value1")); - // Time threshold that will be used as a starting point for deletion. - base::Time threshold2 = clock_.Now(); + clock_.Advance(base::Milliseconds(1)); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin4, u"key1", u"value1")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin4, u"key2", u"value2")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin4, u"key3", u"value3")); - EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin4, u"key4", u"value4")); - EXPECT_EQ(4L, db_->Length(kOrigin4)); + // Time = 1. + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin0, u"key1", u"value1")); + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin1, u"key1", u"value1")); + clock_.Advance(base::Milliseconds(1)); + + // Time = 2. + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin1, u"key2", u"value1")); + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin2, u"key2", u"value1")); + clock_.Advance(base::Milliseconds(1)); + + // Time = 3. + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin2, u"key3", u"value1")); + EXPECT_EQ(OperationResult::kSet, db_->Set(kOrigin00, u"key3", u"value1")); + + // Read a key from origin0 at this time. That should not cause it to get + // purged when we purge at time 3 since only sets should cause the + // `last_used_time` to update. + EXPECT_EQ(db_->Get(kOrigin0, u"key0").data, u"value1"); std::vector<url::Origin> origins; - for (const auto& info : db_->FetchOrigins()) + for (const auto& info : db_->FetchOrigins()) { origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin1, kOrigin2, kOrigin3, kOrigin4)); + } + EXPECT_THAT(origins, ElementsAre(kOrigin0, kOrigin1, kOrigin2, kOrigin00)); - // Read from `kOrigin1`. - EXPECT_EQ(db_->Get(kOrigin1, u"key1").data, u"value1"); + // Nothing should be deleted if the start time is in the future. + EXPECT_EQ(OperationResult::kSuccess, + db_->PurgeMatchingOrigins( + StorageKeyPolicyMatcherFunctionUtility::MakeMatcherFunction( + {kOrigin0, kOrigin00, kOrigin1, kOrigin2}), + clock_.Now() + base::Milliseconds(1), base::Time::Max(), + GetParam().perform_storage_cleanup)); + EXPECT_EQ(2L, db_->Length(kOrigin0)); + EXPECT_EQ(2L, db_->Length(kOrigin00)); + EXPECT_EQ(2L, db_->Length(kOrigin1)); + EXPECT_EQ(2L, db_->Length(kOrigin2)); + // Origin00 and Origin2 should be deleted if we start at the current time + // since they both created a key then. Origin0 read a key then, but reads + // don't update the `last_used_time`. EXPECT_EQ( OperationResult::kSuccess, db_->PurgeMatchingOrigins( StorageKeyPolicyMatcherFunctionUtility::MakeMatcherFunction( - {kOrigin2, kOrigin4}), - threshold2, base::Time::Max(), GetParam().perform_storage_cleanup)); - - // `kOrigin4` is cleared. The other origins are not. + {kOrigin0, kOrigin00, kOrigin1, kOrigin2}), + clock_.Now(), base::Time::Max(), GetParam().perform_storage_cleanup)); + EXPECT_EQ(2L, db_->Length(kOrigin0)); + EXPECT_EQ(0L, db_->Length(kOrigin00)); EXPECT_EQ(2L, db_->Length(kOrigin1)); - EXPECT_EQ(1L, db_->Length(kOrigin2)); - EXPECT_EQ(3L, db_->Length(kOrigin3)); - EXPECT_EQ(0L, db_->Length(kOrigin4)); + EXPECT_EQ(0L, db_->Length(kOrigin2)); origins.clear(); - for (const auto& info : db_->FetchOrigins()) + for (const auto& info : db_->FetchOrigins()) { origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin1, kOrigin2, kOrigin3)); + } + EXPECT_THAT(origins, ElementsAre(kOrigin0, kOrigin1)); - EXPECT_EQ( - OperationResult::kSuccess, - db_->PurgeMatchingOrigins( - StorageKeyPolicyMatcherFunctionUtility::MakeMatcherFunction( - {kOrigin1, kOrigin3, kOrigin4}), - threshold1, base::Time::Max(), GetParam().perform_storage_cleanup)); - - // `kOrigin3` is cleared. The others weren't modified within the given time - // period. - EXPECT_EQ(2L, db_->Length(kOrigin1)); - EXPECT_EQ(1L, db_->Length(kOrigin2)); - EXPECT_EQ(0L, db_->Length(kOrigin3)); - EXPECT_EQ(0L, db_->Length(kOrigin4)); - - origins.clear(); - for (const auto& info : db_->FetchOrigins()) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin1, kOrigin2)); - - // There is no error from trying to clear an origin that isn't in the - // database. + // Nothing should be deleted if the origins don't match. EXPECT_EQ( OperationResult::kSuccess, db_->PurgeMatchingOrigins( StorageKeyPolicyMatcherFunctionUtility::MakeMatcherFunction( {"http://www.example5.test"}), - threshold2, base::Time::Max(), GetParam().perform_storage_cleanup)); + base::Time(), base::Time::Max(), GetParam().perform_storage_cleanup)); + EXPECT_EQ(2L, db_->Length(kOrigin0)); + EXPECT_EQ(2L, db_->Length(kOrigin1)); + + // Delete from before any keys were written, and everything should be gone. + EXPECT_EQ( + OperationResult::kSuccess, + db_->PurgeMatchingOrigins( + StorageKeyPolicyMatcherFunctionUtility::MakeMatcherFunction( + {kOrigin0, kOrigin00, kOrigin1, kOrigin2}), + base::Time(), base::Time::Max(), GetParam().perform_storage_cleanup)); + origins.clear(); + for (const auto& info : db_->FetchOrigins()) { + origins.push_back(info->storage_key.origin()); + } + EXPECT_THAT(origins, ElementsAre()); } TEST_P(SharedStorageDatabaseParamTest, PurgeStale) {
diff --git a/components/services/storage/shared_storage/shared_storage_manager_unittest.cc b/components/services/storage/shared_storage/shared_storage_manager_unittest.cc index a3211ee..7458fa3d 100644 --- a/components/services/storage/shared_storage/shared_storage_manager_unittest.cc +++ b/components/services/storage/shared_storage/shared_storage_manager_unittest.cc
@@ -26,6 +26,7 @@ #include "base/test/test_simple_task_runner.h" #include "base/threading/sequence_bound.h" #include "base/threading/thread.h" +#include "base/time/time.h" #include "components/services/storage/public/mojom/storage_usage_info.mojom.h" #include "components/services/storage/shared_storage/async_shared_storage_database.h" #include "components/services/storage/shared_storage/shared_storage_database.h" @@ -1929,358 +1930,108 @@ url::Origin kOrigin1 = url::Origin::Create(GURL("http://www.example1.test")); url::Origin kOrigin2 = url::Origin::Create(GURL("http://www.example2.test")); url::Origin kOrigin3 = url::Origin::Create(GURL("http://www.example3.test")); - url::Origin kOrigin4 = url::Origin::Create(GURL("http://www.example4.test")); - url::Origin kOrigin5 = url::Origin::Create(GURL("http://www.example5.test")); - std::queue<DBOperation> operation_list; - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); + // Add a key for origin1. + { + base::test::TestFuture<OperationResult> future; + GetManager()->Set(kOrigin1, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(OperationResult::kSet, future.Get()); + } - base::Time threshold1 = base::Time::Now(); - StorageKeyPolicyMatcherFunctionUtility matcher_utility; - size_t matcher_id1 = matcher_utility.RegisterMatcherFunction({kOrigin1}); + // Move forward 1ms and add a key for origin2. + task_environment_.FastForwardBy(base::Milliseconds(1)); + base::Time time1 = base::Time::Now(); + { + base::test::TestFuture<OperationResult> future; + GetManager()->Set(kOrigin2, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(OperationResult::kSet, future.Get()); + } - operation_list.push(DBOperation( - Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id1), - TestDatabaseOperationReceiver::SerializeTime(threshold1), - TestDatabaseOperationReceiver::SerializeTime(base::Time::Max()), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); + // Move forward 1ms and add a key for origin3. + task_environment_.FastForwardBy(base::Milliseconds(5)); + base::Time time2 = base::Time::Now(); + { + base::test::TestFuture<OperationResult> future; + GetManager()->Set(kOrigin3, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(OperationResult::kSet, future.Get()); + } - operation_list.push( - DBOperation(Type::DB_SET, kOrigin1, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); + // All three origins have 1 key each. + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin1, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin2, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin3, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } - operation_list.push( - DBOperation(Type::DB_SET, kOrigin1, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); + // Purge starting after time1 and ending at time2, origin3 should be deleted. + { + StorageKeyPolicyMatcherFunctionUtility matcher_utility; - operation_list.push( - DBOperation(Type::DB_SET, kOrigin2, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); + size_t matcher_id = + matcher_utility.RegisterMatcherFunction({kOrigin1, kOrigin2, kOrigin3}); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin3, - {u"key3", u"value3", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); + base::test::TestFuture<OperationResult> future; + GetManager()->PurgeMatchingOrigins( + matcher_utility.TakeMatcherFunctionForId(matcher_id), + time1 + base::Milliseconds(1), time2, future.GetCallback(), + GetParam().perform_storage_cleanup); + EXPECT_EQ(OperationResult::kSuccess, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin1, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin2, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin3, future.GetCallback()); + EXPECT_EQ(0, future.Get()); + } - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key2", u"value2", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key3", u"value3", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push( - DBOperation(Type::DB_SET, kOrigin4, - {u"key4", u"value4", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); + // Purge starting at time1, origin2 should be deleted as well. + { + StorageKeyPolicyMatcherFunctionUtility matcher_utility; - operation_list.push( - DBOperation(Type::DB_SET, kOrigin5, - {u"key1", u"value1", - TestDatabaseOperationReceiver::SerializeSetBehavior( - SetBehavior::kDefault)})); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); + size_t matcher_id = + matcher_utility.RegisterMatcherFunction({kOrigin1, kOrigin2, kOrigin3}); - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - base::Time threshold2 = base::Time::Now() + base::Days(1); - base::Time override_time1 = threshold2 + base::Milliseconds(5); - operation_list.push(DBOperation( - Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin1, - {TestDatabaseOperationReceiver::SerializeTime(override_time1)})); - - size_t matcher_id2 = - matcher_utility.RegisterMatcherFunction({kOrigin1, kOrigin2, kOrigin5}); - operation_list.push(DBOperation( - Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id2), - TestDatabaseOperationReceiver::SerializeTime(threshold2), - TestDatabaseOperationReceiver::SerializeTime(base::Time::Max()), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); - - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); - - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - base::Time threshold3 = threshold2 + base::Days(1); - operation_list.push( - DBOperation(Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin3, - {TestDatabaseOperationReceiver::SerializeTime(threshold3)})); - - base::Time threshold4 = threshold3 + base::Seconds(100); - operation_list.push( - DBOperation(Type::DB_OVERRIDE_TIME_ORIGIN, kOrigin5, - {TestDatabaseOperationReceiver::SerializeTime(threshold4)})); - - size_t matcher_id3 = matcher_utility.RegisterMatcherFunction( - {kOrigin2, kOrigin3, kOrigin4, kOrigin5}); - operation_list.push( - DBOperation(Type::DB_PURGE_MATCHING, - {base::NumberToString16(matcher_id3), - TestDatabaseOperationReceiver::SerializeTime(threshold3), - TestDatabaseOperationReceiver::SerializeTime(threshold4), - TestDatabaseOperationReceiver::SerializeBool( - GetParam().perform_storage_cleanup)})); - - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin1)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin2)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin3)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin4)); - operation_list.push(DBOperation(Type::DB_LENGTH, kOrigin5)); - - operation_list.push( - DBOperation(Type::DB_ON_MEMORY_PRESSURE, - {TestDatabaseOperationReceiver::SerializeMemoryPressureLevel( - MemoryPressureLevel::MEMORY_PRESSURE_LEVEL_CRITICAL)})); - - operation_list.push(DBOperation(Type::DB_FETCH_ORIGINS)); - - operation_list.push(DBOperation(Type::DB_GET, kOrigin2, {u"key1"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key1"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key2"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key3"})); - operation_list.push(DBOperation(Type::DB_GET, kOrigin4, {u"key4"})); - - SetExpectedOperationList(std::move(operation_list)); - - // Check that origin list is initially empty due to the database not being - // initialized. - std::vector<mojom::StorageUsageInfoPtr> infos1; - FetchOrigins(&infos1); - - OperationResult result1 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id1, threshold1, - base::Time::Max(), &result1, - GetParam().perform_storage_cleanup); - - OperationResult result2 = OperationResult::kSqlError; - Set(kOrigin1, u"key1", u"value1", &result2); - - OperationResult result3 = OperationResult::kSqlError; - Set(kOrigin1, u"key2", u"value2", &result3); - int length1 = -1; - Length(kOrigin1, &length1); - - OperationResult result4 = OperationResult::kSqlError; - Set(kOrigin2, u"key1", u"value1", &result4); - int length2 = -1; - Length(kOrigin2, &length2); - - OperationResult result5 = OperationResult::kSqlError; - Set(kOrigin3, u"key1", u"value1", &result5); - OperationResult result6 = OperationResult::kSqlError; - Set(kOrigin3, u"key2", u"value2", &result6); - OperationResult result7 = OperationResult::kSqlError; - Set(kOrigin3, u"key3", u"value3", &result7); - int length3 = -1; - Length(kOrigin3, &length3); - - OperationResult result8 = OperationResult::kSqlError; - Set(kOrigin4, u"key1", u"value1", &result8); - OperationResult result9 = OperationResult::kSqlError; - Set(kOrigin4, u"key2", u"value2", &result9); - OperationResult result10 = OperationResult::kSqlError; - Set(kOrigin4, u"key3", u"value3", &result10); - OperationResult result11 = OperationResult::kSqlError; - Set(kOrigin4, u"key4", u"value4", &result11); - int length4 = -1; - Length(kOrigin4, &length4); - - OperationResult result12 = OperationResult::kSqlError; - Set(kOrigin5, u"key1", u"value1", &result12); - int length5 = -1; - Length(kOrigin5, &length5); - - std::vector<mojom::StorageUsageInfoPtr> infos2; - FetchOrigins(&infos2); - - bool success1 = false; - OverrideCreationTime(kOrigin1, override_time1, &success1); - - // Verify that the only match we get is for `kOrigin1`, whose `last_used_time` - // is between the time parameters. - OperationResult result13 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id2, threshold2, - base::Time::Max(), &result13, - GetParam().perform_storage_cleanup); - - int length6 = -1; - Length(kOrigin1, &length6); - int length7 = -1; - Length(kOrigin2, &length7); - int length8 = -1; - Length(kOrigin3, &length8); - int length9 = -1; - Length(kOrigin4, &length9); - int length10 = -1; - Length(kOrigin5, &length10); - - std::vector<mojom::StorageUsageInfoPtr> infos3; - FetchOrigins(&infos3); - - bool success2 = false; - OverrideCreationTime(kOrigin3, threshold3, &success2); - bool success3 = false; - OverrideCreationTime(kOrigin5, threshold4, &success3); - - // Verify that we still get matches for `kOrigin3`, whose `last_used_time` is - // exactly at the `begin` time, as well as for `kOrigin5`, whose - // `last_used_time` is exactly at the `end` time. - OperationResult result14 = OperationResult::kSqlError; - PurgeMatchingOrigins(&matcher_utility, matcher_id3, threshold3, threshold4, - &result14, GetParam().perform_storage_cleanup); - - int length11 = -1; - Length(kOrigin1, &length11); - int length12 = -1; - Length(kOrigin2, &length12); - int length13 = -1; - Length(kOrigin3, &length13); - int length14 = -1; - Length(kOrigin4, &length14); - int length15 = -1; - Length(kOrigin5, &length15); - - EXPECT_FALSE(memory_trimmed_); - OnMemoryPressure(MemoryPressureLevel::MEMORY_PRESSURE_LEVEL_CRITICAL); - - std::vector<mojom::StorageUsageInfoPtr> infos4; - FetchOrigins(&infos4); - - GetResult value1; - Get(kOrigin2, u"key1", &value1); - GetResult value2; - Get(kOrigin4, u"key1", &value2); - GetResult value3; - Get(kOrigin4, u"key2", &value3); - GetResult value4; - Get(kOrigin4, u"key3", &value4); - GetResult value5; - Get(kOrigin4, u"key4", &value5); - - WaitForOperations(); - EXPECT_TRUE(is_finished()); - - // No error from calling `PurgeMatchingOrigins()` on an uninitialized - // database. - EXPECT_EQ(OperationResult::kSuccess, result1); - - // The call to `Set()` initializes the database. - EXPECT_EQ(OperationResult::kSet, result2); - - EXPECT_EQ(OperationResult::kSet, result3); - EXPECT_EQ(2, length1); - - EXPECT_EQ(OperationResult::kSet, result4); - EXPECT_EQ(1, length2); - - EXPECT_EQ(OperationResult::kSet, result5); - EXPECT_EQ(OperationResult::kSet, result6); - EXPECT_EQ(OperationResult::kSet, result7); - EXPECT_EQ(3, length3); - - EXPECT_EQ(OperationResult::kSet, result8); - EXPECT_EQ(OperationResult::kSet, result9); - EXPECT_EQ(OperationResult::kSet, result10); - EXPECT_EQ(OperationResult::kSet, result11); - EXPECT_EQ(4, length4); - - EXPECT_EQ(OperationResult::kSet, result12); - EXPECT_EQ(1, length5); - - std::vector<url::Origin> origins; - for (const auto& info : infos2) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, - ElementsAre(kOrigin1, kOrigin2, kOrigin3, kOrigin4, kOrigin5)); - - EXPECT_EQ(value1.data, u"value1"); - EXPECT_EQ(OperationResult::kSuccess, value1.result); - - EXPECT_TRUE(success1); - EXPECT_EQ(OperationResult::kSuccess, result13); - - // `kOrigin1` is cleared. The other origins are not. - EXPECT_EQ(0, length6); - EXPECT_EQ(1, length7); - EXPECT_EQ(3, length8); - EXPECT_EQ(4, length9); - EXPECT_EQ(1, length10); - - origins.clear(); - for (const auto& info : infos3) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin2, kOrigin3, kOrigin4, kOrigin5)); - - EXPECT_TRUE(success2); - EXPECT_TRUE(success3); - - EXPECT_EQ(OperationResult::kSuccess, result14); - - // `kOrigin3` and `kOrigin5` are cleared. The others weren't modified within - // the given time period. - EXPECT_EQ(0, length11); - EXPECT_EQ(1, length12); - EXPECT_EQ(0, length13); - EXPECT_EQ(4, length14); - EXPECT_EQ(0, length15); - - EXPECT_TRUE(memory_trimmed_); - - origins.clear(); - for (const auto& info : infos4) - origins.push_back(info->storage_key.origin()); - EXPECT_THAT(origins, ElementsAre(kOrigin2, kOrigin4)); - - // Database is still intact after trimming memory (and possibly performing - // storage cleanup). - EXPECT_EQ(value1.data, u"value1"); - EXPECT_EQ(OperationResult::kSuccess, value1.result); - EXPECT_EQ(value2.data, u"value1"); - EXPECT_EQ(OperationResult::kSuccess, value2.result); - EXPECT_EQ(value3.data, u"value2"); - EXPECT_EQ(OperationResult::kSuccess, value3.result); - EXPECT_EQ(value4.data, u"value3"); - EXPECT_EQ(OperationResult::kSuccess, value4.result); - EXPECT_EQ(value5.data, u"value4"); - EXPECT_EQ(OperationResult::kSuccess, value5.result); + base::test::TestFuture<OperationResult> future; + GetManager()->PurgeMatchingOrigins( + matcher_utility.TakeMatcherFunctionForId(matcher_id), time1, + base::Time::Max(), future.GetCallback(), + GetParam().perform_storage_cleanup); + EXPECT_EQ(OperationResult::kSuccess, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin1, future.GetCallback()); + EXPECT_EQ(1, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin2, future.GetCallback()); + EXPECT_EQ(0, future.Get()); + } + { + base::test::TestFuture<int> future; + GetManager()->Length(kOrigin3, future.GetCallback()); + EXPECT_EQ(0, future.Get()); + } } } // namespace storage
diff --git a/components/signin/public/android/BUILD.gn b/components/signin/public/android/BUILD.gn index 272dfa47..89bf2f56 100644 --- a/components/signin/public/android/BUILD.gn +++ b/components/signin/public/android/BUILD.gn
@@ -15,6 +15,7 @@ srcjar_deps = [ ":account_capabilities_constants_javagen", + ":jni_headers", ":tribool_javagen", "//components/signin/public/base:consent_level_enum_javagen", "//components/signin/public/base:signin_metrics_enum_javagen", @@ -54,8 +55,6 @@ "java/src/org/chromium/components/signin/identitymanager/ProfileOAuth2TokenServiceDelegate.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - # Add the actual implementation where necessary so that downstream targets # can provide their own implementations. jar_excluded_patterns = [ "*/AccountEmailDomainDisplayability.class" ]
diff --git a/components/site_engagement/content/android/BUILD.gn b/components/site_engagement/content/android/BUILD.gn index d3318ef..37d93aa 100644 --- a/components/site_engagement/content/android/BUILD.gn +++ b/components/site_engagement/content/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/site_engagement/SiteEngagementService.java" ] deps = [ "//base:base_java", @@ -12,7 +13,6 @@ "//build/android:build_java", "//content/public/android:content_full_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/spellcheck/browser/android/BUILD.gn b/components/spellcheck/browser/android/BUILD.gn index 9e585c107..7f545fa 100644 --- a/components/spellcheck/browser/android/BUILD.gn +++ b/components/spellcheck/browser/android/BUILD.gn
@@ -14,7 +14,7 @@ "//base:jni_java", "//build/android:build_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/spellcheck/SpellCheckerSessionBridge.java" ] }
diff --git a/components/subresource_filter/android/BUILD.gn b/components/subresource_filter/android/BUILD.gn index 762cc74..f24f6dc 100644 --- a/components/subresource_filter/android/BUILD.gn +++ b/components/subresource_filter/android/BUILD.gn
@@ -13,6 +13,7 @@ } android_library("java") { + srcjar_deps = [ ":subresource_filter_jni_headers" ] sources = [ "java/src/org/chromium/components/subresource_filter/AdsBlockedDialog.java", "java/src/org/chromium/components/subresource_filter/AdsBlockedInfoBar.java", @@ -30,7 +31,7 @@ "//third_party/androidx:androidx_appcompat_appcompat_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + resources_package = "org.chromium.components.subresource_filter" }
diff --git a/components/thin_webview/internal/BUILD.gn b/components/thin_webview/internal/BUILD.gn index fcaa42b8..c3628d5 100644 --- a/components/thin_webview/internal/BUILD.gn +++ b/components/thin_webview/internal/BUILD.gn
@@ -29,6 +29,7 @@ } android_library("internal_java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/thinwebview/internal/CompositorViewImpl.java", "java/src/org/chromium/components/thinwebview/internal/ThinWebViewImpl.java", @@ -44,7 +45,6 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/tracing/common/background_tracing_metrics_provider.cc b/components/tracing/common/background_tracing_metrics_provider.cc index 10658d9..09169d9 100644 --- a/components/tracing/common/background_tracing_metrics_provider.cc +++ b/components/tracing/common/background_tracing_metrics_provider.cc
@@ -48,14 +48,14 @@ } metrics::TraceLog* log = uma_proto->add_trace_log(); - ProvideEmbedderMetrics(*uma_proto, std::move(serialized_trace), *log, + ProvideEmbedderMetrics(uma_proto, std::move(serialized_trace), log, snapshot_manager, std::move(done_callback)); } void BackgroundTracingMetricsProvider::ProvideEmbedderMetrics( - metrics::ChromeUserMetricsExtension& uma_proto, + metrics::ChromeUserMetricsExtension* uma_proto, std::string&& serialized_trace, - metrics::TraceLog& log, + metrics::TraceLog* log, base::HistogramSnapshotManager* snapshot_manager, base::OnceCallback<void(bool)> done_callback) { SetTrace(log, std::move(serialized_trace)); @@ -68,13 +68,14 @@ std::move(done_callback).Run(true); } +// static void BackgroundTracingMetricsProvider::SetTrace( - metrics::TraceLog& log, + metrics::TraceLog* log, std::string&& serialized_trace) { base::UmaHistogramCounts100000("Tracing.Background.UploadingTraceSizeInKB", serialized_trace.size() / 1024); - log.set_raw_data(std::move(serialized_trace)); + log->set_raw_data(std::move(serialized_trace)); } } // namespace tracing
diff --git a/components/tracing/common/background_tracing_metrics_provider.h b/components/tracing/common/background_tracing_metrics_provider.h index 29ac36e5..618445a1 100644 --- a/components/tracing/common/background_tracing_metrics_provider.h +++ b/components/tracing/common/background_tracing_metrics_provider.h
@@ -43,14 +43,14 @@ // before it is sent. This includes processing of the trace itself (e.g. // compression). virtual void ProvideEmbedderMetrics( - metrics::ChromeUserMetricsExtension& uma_proto, + metrics::ChromeUserMetricsExtension* uma_proto, std::string&& serialized_trace, - metrics::TraceLog& log, + metrics::TraceLog* log, base::HistogramSnapshotManager* snapshot_manager, base::OnceCallback<void(bool)> done_callback); // Writes |serialized_trace| into |logs|'s |raw_data| field. - void SetTrace(metrics::TraceLog& log, std::string&& serialized_trace); + static void SetTrace(metrics::TraceLog* log, std::string&& serialized_trace); std::vector<std::unique_ptr<metrics::MetricsProvider>> system_profile_providers_;
diff --git a/components/translate/content/android/BUILD.gn b/components/translate/content/android/BUILD.gn index 4060de0..f6b4a307 100644 --- a/components/translate/content/android/BUILD.gn +++ b/components/translate/content/android/BUILD.gn
@@ -26,6 +26,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/translate/TranslateFeatureMap.java", "java/src/org/chromium/components/translate/TranslateMenu.java", @@ -52,7 +53,6 @@ "//third_party/androidx:androidx_core_core_java", "//ui/android:ui_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } static_library("android") {
diff --git a/components/ukm/android/BUILD.gn b/components/ukm/android/BUILD.gn index 8855060..b5632d0 100644 --- a/components/ukm/android/BUILD.gn +++ b/components/ukm/android/BUILD.gn
@@ -5,6 +5,7 @@ import("//build/config/android/rules.gni") android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/ukm/UkmRecorder.java" ] deps = [ @@ -13,7 +14,6 @@ "//content/public/android:content_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("jni_headers") {
diff --git a/components/url_formatter/android/BUILD.gn b/components/url_formatter/android/BUILD.gn index 854417c..acc7dd1a 100644 --- a/components/url_formatter/android/BUILD.gn +++ b/components/url_formatter/android/BUILD.gn
@@ -12,9 +12,11 @@ "//url:gurl_java", "//url:origin_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ "//components/url_formatter:url_formatter_java_enums_srcjar" ] + srcjar_deps = [ + ":jni_headers", + "//components/url_formatter:url_formatter_java_enums_srcjar", + ] sources = [ "java/src/org/chromium/components/url_formatter/UrlFormatter.java" ]
diff --git a/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java b/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java index 5b6820f..e245eb8 100644 --- a/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java +++ b/components/url_formatter/android/java/src/org/chromium/components/url_formatter/UrlFormatter.java
@@ -232,7 +232,7 @@ return UrlFormatterJni.get().formatStringUrlForSecurityDisplay(uri, schemeDisplay); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { GURL fixupUrl(String url);
diff --git a/components/user_prefs/android/BUILD.gn b/components/user_prefs/android/BUILD.gn index 4b0b2f05..be2e831d 100644 --- a/components/user_prefs/android/BUILD.gn +++ b/components/user_prefs/android/BUILD.gn
@@ -9,6 +9,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/user_prefs/UserPrefs.java" ] deps = [ "//base:jni_java", @@ -17,5 +18,4 @@ "//content/public/android:content_full_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] }
diff --git a/components/user_prefs/android/java/src/org/chromium/components/user_prefs/UserPrefs.java b/components/user_prefs/android/java/src/org/chromium/components/user_prefs/UserPrefs.java index d1a452f..07224d3 100644 --- a/components/user_prefs/android/java/src/org/chromium/components/user_prefs/UserPrefs.java +++ b/components/user_prefs/android/java/src/org/chromium/components/user_prefs/UserPrefs.java
@@ -22,7 +22,7 @@ return UserPrefsJni.get().get(browserContextHandle); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { PrefService get(BrowserContextHandle browserContextHandle);
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn index 55832333..5c86cab9 100644 --- a/components/viz/service/BUILD.gn +++ b/components/viz/service/BUILD.gn
@@ -671,7 +671,8 @@ "//build/android:build_java", "//ui/android:ui_no_recycler_view_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + + srcjar_deps = [ ":service_jni_headers" ] sources = [ "java/src/org/chromium/components/viz/service/frame_sinks/ExternalBeginFrameSourceAndroid.java", "java/src/org/chromium/components/viz/service/gl/ThrowUncaughtException.java",
diff --git a/components/webapps/browser/android/BUILD.gn b/components/webapps/browser/android/BUILD.gn index 968fea8..74f3d13 100644 --- a/components/webapps/browser/android/BUILD.gn +++ b/components/webapps/browser/android/BUILD.gn
@@ -49,9 +49,9 @@ ] srcjar_deps = [ ":webapps_java_enums_srcjar", + ":webapps_jni_headers", "//components/webapps/browser/android/webapk:enums_srcjar", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } generate_jni("webapps_jni_headers") {
diff --git a/components/webauthn/android/BUILD.gn b/components/webauthn/android/BUILD.gn index c049eb9..09219d88a 100644 --- a/components/webauthn/android/BUILD.gn +++ b/components/webauthn/android/BUILD.gn
@@ -14,6 +14,7 @@ } android_library("java") { + srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/components/webauthn/AuthenticatorFactory.java", "java/src/org/chromium/components/webauthn/AuthenticatorImpl.java", @@ -30,7 +31,7 @@ "java/src/org/chromium/components/webauthn/WebAuthnBrowserBridge.java", "java/src/org/chromium/components/webauthn/WebAuthnCredentialDetails.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ "$google_play_services_package:google_play_services_base_java", "$google_play_services_package:google_play_services_basement_java",
diff --git a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2CredentialRequest.java b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2CredentialRequest.java index 2a97b9c..b5f2a4ae 100644 --- a/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2CredentialRequest.java +++ b/components/webauthn/android/java/src/org/chromium/components/webauthn/Fido2CredentialRequest.java
@@ -1341,7 +1341,7 @@ return passwordCredentialOption; } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { String createOptionsToJson(ByteBuffer serializedOptions);
diff --git a/components/webauthn/android/java/src/org/chromium/components/webauthn/InternalAuthenticator.java b/components/webauthn/android/java/src/org/chromium/components/webauthn/InternalAuthenticator.java index e655543..bd1c036 100644 --- a/components/webauthn/android/java/src/org/chromium/components/webauthn/InternalAuthenticator.java +++ b/components/webauthn/android/java/src/org/chromium/components/webauthn/InternalAuthenticator.java
@@ -153,7 +153,7 @@ mAuthenticator.cancel(); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { void invokeMakeCredentialResponse(
diff --git a/components/webxr/android/BUILD.gn b/components/webxr/android/BUILD.gn index 78e5c8a..df86b79 100644 --- a/components/webxr/android/BUILD.gn +++ b/components/webxr/android/BUILD.gn
@@ -152,7 +152,10 @@ public_deps += [ "//third_party/arcore-android-sdk-client:com_google_ar_core_java" ] - srcjar_deps = [ ":webxr_ar_android_enums" ] + srcjar_deps = [ + ":webxr_ar_android_enums", + ":xr_jni_headers", + ] } else if (enable_cardboard || enable_openxr) { # These stub classes are needed for the general Xr infrastructure code, but # are not needed for the more broad always-available code. So we check that @@ -180,7 +183,6 @@ sources += [ "//components/webxr/android/stubs/java/src/org/chromium/components/webxr/CardboardClassProvider.java" ] } - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.components.webxr" }
diff --git a/content/browser/devtools/devtools_instrumentation.cc b/content/browser/devtools/devtools_instrumentation.cc index 78ece6c5..7cdaad714 100644 --- a/content/browser/devtools/devtools_instrumentation.cc +++ b/content/browser/devtools/devtools_instrumentation.cc
@@ -446,12 +446,14 @@ host->WillInitiatePrerender(frame_tree.root()); } -void DidActivatePrerender( - const NavigationRequest& nav_request, - const base::UnguessableToken& initiator_devtools_navigation_token) { +void DidActivatePrerender(const NavigationRequest& nav_request, + const absl::optional<base::UnguessableToken>& + initiator_devtools_navigation_token) { FrameTreeNode* ftn = nav_request.frame_tree_node(); - DispatchToAgents(ftn, &protocol::PreloadHandler::DidActivatePrerender, - initiator_devtools_navigation_token, nav_request); + if (initiator_devtools_navigation_token.has_value()) { + DispatchToAgents(ftn, &protocol::PreloadHandler::DidActivatePrerender, + initiator_devtools_navigation_token.value(), nav_request); + } UpdateChildFrameTrees(ftn, /* update_target_info= */ true); }
diff --git a/content/browser/devtools/devtools_instrumentation.h b/content/browser/devtools/devtools_instrumentation.h index c05a8d32..7e32eff 100644 --- a/content/browser/devtools/devtools_instrumentation.h +++ b/content/browser/devtools/devtools_instrumentation.h
@@ -193,9 +193,9 @@ bool IsPrerenderAllowed(FrameTree& frame_tree); void WillInitiatePrerender(FrameTree& frame_tree); -void DidActivatePrerender( - const NavigationRequest& nav_request, - const base::UnguessableToken& initiator_devtools_navigation_token); +void DidActivatePrerender(const NavigationRequest& nav_request, + const absl::optional<base::UnguessableToken>& + initiator_devtools_navigation_token); // This function reports cancellation status to DevTools with the // `disallowed_api_method`, which is used to give users more information about // the cancellation details if the prerendering uses disallowed API method, and
diff --git a/content/browser/preloading/prerender/prerender_host.cc b/content/browser/preloading/prerender/prerender_host.cc index d839ed7..e2aed040 100644 --- a/content/browser/preloading/prerender/prerender_host.cc +++ b/content/browser/preloading/prerender/prerender_host.cc
@@ -580,10 +580,8 @@ // Prerender is activated. Set the status to kSuccess. SetTriggeringOutcome(PreloadingTriggeringOutcome::kSuccess); - if (initiator_devtools_navigation_token().has_value()) { - devtools_instrumentation::DidActivatePrerender( - navigation_request, initiator_devtools_navigation_token().value()); - } + devtools_instrumentation::DidActivatePrerender( + navigation_request, initiator_devtools_navigation_token()); return page; }
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc index 734c873c1..2d765c2 100644 --- a/content/browser/storage_partition_impl_unittest.cc +++ b/content/browser/storage_partition_impl_unittest.cc
@@ -761,7 +761,8 @@ class StoragePartitionImplTest : public testing::Test { public: StoragePartitionImplTest() - : task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP), + : task_environment_(content::BrowserTaskEnvironment::IO_MAINLOOP, + base::test::TaskEnvironment::TimeSource::MOCK_TIME), browser_context_(new TestBrowserContext()) { // Prevent test flakiness as a result of randomized responses in the // Attribution Reporting API. @@ -2376,18 +2377,33 @@ GetSpecialStoragePolicy(), storage::SharedStorageOptions::Create()->GetDatabaseOptions()); - base::test::TestFuture<bool> future; + // Add a key for origin1. + { + base::test::TestFuture<storage::SharedStorageDatabase::OperationResult> + future; + database->Set(origin1, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(storage::SharedStorageDatabase::OperationResult::kSet, + future.Get()); + } + // Add a key for origin2. + { + base::test::TestFuture<storage::SharedStorageDatabase::OperationResult> + future; + database->Set(origin2, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(storage::SharedStorageDatabase::OperationResult::kSet, + future.Get()); + } - DCHECK(database); - DCHECK(static_cast<storage::AsyncSharedStorageDatabaseImpl*>(database.get()) - ->GetSequenceBoundDatabaseForTesting()); - static_cast<storage::AsyncSharedStorageDatabaseImpl*>(database.get()) - ->GetSequenceBoundDatabaseForTesting() - ->AsyncCall(&storage::SharedStorageDatabase::PopulateDatabaseForTesting) - .WithArgs(origin1, origin2, origin3) - .Then(future.GetCallback()); + task_environment()->AdvanceClock(base::Milliseconds(10)); - EXPECT_TRUE(future.Get()); + // Add a key for origin3. + { + base::test::TestFuture<storage::SharedStorageDatabase::OperationResult> + future; + database->Set(origin3, u"key1", u"value1", future.GetCallback()); + EXPECT_EQ(storage::SharedStorageDatabase::OperationResult::kSet, + future.Get()); + } // Ensure that this database is fully closed before checking for existence. database.reset(); @@ -2496,28 +2512,30 @@ EXPECT_FALSE(SharedStorageExistsForOrigin(kOrigin3)); } -TEST_F(StoragePartitionImplSharedStorageTest, RemoveSharedStorageForLastWeek) { +TEST_F(StoragePartitionImplSharedStorageTest, RemoveSharedStorageRecent) { const url::Origin kOrigin1 = url::Origin::Create(GURL("http://host1:1/")); const url::Origin kOrigin2 = url::Origin::Create(GURL("http://host2:1/")); const url::Origin kOrigin3 = url::Origin::Create(GURL("http://host3:1/")); + base::Time start = base::Time::Now(); AddSharedStorageTestData(kOrigin1, kOrigin2, kOrigin3); StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( browser_context()->GetDefaultStoragePartition()); DCHECK(partition); - base::Time a_week_ago = base::Time::Now() - base::Days(7); + // Origins 1 and 2 wrote their keys at time start, origin 3 wrote its key + // at time start+10. Delete from start+5 -> infinity. base::RunLoop clear_run_loop; base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask( FROM_HERE, - base::BindOnce(&ClearStuff, - StoragePartitionImpl::REMOVE_DATA_MASK_SHARED_STORAGE, - partition, a_week_ago, base::Time::Max(), - /*filter_builder=*/nullptr, - base::BindRepeating( - &DoesOriginMatchForBothProtectedAndUnprotectedWeb), - &clear_run_loop)); + base::BindOnce( + &ClearStuff, StoragePartitionImpl::REMOVE_DATA_MASK_SHARED_STORAGE, + partition, start + base::Milliseconds(5), base::Time::Max(), + /*filter_builder=*/nullptr, + base::BindRepeating( + &DoesOriginMatchForBothProtectedAndUnprotectedWeb), + &clear_run_loop)); clear_run_loop.Run(); // ClearData only guarantees that tasks to delete data are scheduled when its @@ -2525,10 +2543,10 @@ // So run all scheduled tasks to make sure data is cleared. base::RunLoop().RunUntilIdle(); - // kOrigin1 and kOrigin2 do not have age more than a week. - EXPECT_FALSE(SharedStorageExistsForOrigin(kOrigin1)); - EXPECT_FALSE(SharedStorageExistsForOrigin(kOrigin2)); - EXPECT_TRUE(SharedStorageExistsForOrigin(kOrigin3)); + // Only kOrigin3 should have been cleared. + EXPECT_TRUE(SharedStorageExistsForOrigin(kOrigin1)); + EXPECT_TRUE(SharedStorageExistsForOrigin(kOrigin2)); + EXPECT_FALSE(SharedStorageExistsForOrigin(kOrigin3)); } } // namespace content
diff --git a/content/public/browser/browser_or_resource_context.h b/content/public/browser/browser_or_resource_context.h index 9cf4618..04a9d03 100644 --- a/content/public/browser/browser_or_resource_context.h +++ b/content/public/browser/browser_or_resource_context.h
@@ -50,7 +50,7 @@ // TODO(dcheng): Change this to return a ref. BrowserContext* ToBrowserContext() const { DCHECK_CURRENTLY_ON(BrowserThread::UI); - return &absl::get<raw_ref<BrowserContext>>(storage_).get(); + return &*absl::get<raw_ref<BrowserContext>>(storage_); } // To be called only on the UI thread. Will CHECK() if `this` does not hold a @@ -58,7 +58,7 @@ // TODO(dcheng): Change this to return a ref. ResourceContext* ToResourceContext() const { DCHECK_CURRENTLY_ON(BrowserThread::IO); - return &absl::get<raw_ref<ResourceContext>>(storage_).get(); + return &*absl::get<raw_ref<ResourceContext>>(storage_); } private:
diff --git a/content/public/test/android/BUILD.gn b/content/public/test/android/BUILD.gn index c901125..7ae596d 100644 --- a/content/public/test/android/BUILD.gn +++ b/content/public/test/android/BUILD.gn
@@ -17,7 +17,7 @@ android_library("content_java_test_support") { testonly = true - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + deps = [ ":android_test_message_pump_support_java", "//base:base_java", @@ -42,6 +42,7 @@ "//url:gurl_java", "//url:origin_java", ] + srcjar_deps = [ ":content_test_jni" ] sources = [ "javatests/src/org/chromium/content_public/browser/test/ChildProcessAllocatorSettings.java", "javatests/src/org/chromium/content_public/browser/test/ChildProcessAllocatorSettingsHook.java",
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc index a790f20..5a8afeb7 100644 --- a/content/renderer/renderer_blink_platform_impl.cc +++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -865,11 +865,16 @@ std::unique_ptr<network::PendingSharedURLLoaderFactory> fallback_factory, mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver, scoped_refptr<base::SequencedTaskRunner> task_runner) { + // TODO(crbug.com/1371756): plumb `router_rules` with the function callers + // if there is such use case. As of 2023-06-01, only + // `DedicatedOrSharedWorkerFetchContextImpl` calls the function, and + // no need to allow it set the `router_rules`. ServiceWorkerSubresourceLoaderFactory::Create( base::MakeRefCounted<ControllerServiceWorkerConnector>( std::move(service_worker_container_host), /*remote_controller=*/mojo::NullRemote(), client_id.Utf8(), - blink::mojom::ServiceWorkerFetchHandlerBypassOption::kDefault), + blink::mojom::ServiceWorkerFetchHandlerBypassOption::kDefault, + /*router_rules=*/absl::nullopt), network::SharedURLLoaderFactory::Create(std::move(fallback_factory)), std::move(receiver), std::move(task_runner)); }
diff --git a/content/renderer/service_worker/controller_service_worker_connector.cc b/content/renderer/service_worker/controller_service_worker_connector.cc index f26cf080..b46c746 100644 --- a/content/renderer/service_worker/controller_service_worker_connector.cc +++ b/content/renderer/service_worker/controller_service_worker_connector.cc
@@ -17,9 +17,11 @@ remote_controller, const std::string& client_id, blink::mojom::ServiceWorkerFetchHandlerBypassOption - fetch_handler_bypass_option) + fetch_handler_bypass_option, + absl::optional<blink::ServiceWorkerRouterRules> router_rules) : client_id_(client_id), - fetch_handler_bypass_option_(fetch_handler_bypass_option) { + fetch_handler_bypass_option_(fetch_handler_bypass_option), + router_evaluator_(router_rules) { container_host_.Bind(std::move(remote_container_host)); container_host_.set_disconnect_handler(base::BindOnce( &ControllerServiceWorkerConnector::OnContainerHostConnectionClosed,
diff --git a/content/renderer/service_worker/controller_service_worker_connector.h b/content/renderer/service_worker/controller_service_worker_connector.h index 01a75b9..579eb61 100644 --- a/content/renderer/service_worker/controller_service_worker_connector.h +++ b/content/renderer/service_worker/controller_service_worker_connector.h
@@ -10,6 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "content/common/content_export.h" +#include "content/common/service_worker/service_worker_router_evaluator.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -72,7 +73,8 @@ remote_controller, const std::string& client_id, blink::mojom::ServiceWorkerFetchHandlerBypassOption - fetch_handler_bypass_option); + fetch_handler_bypass_option, + absl::optional<blink::ServiceWorkerRouterRules> router_rules); ControllerServiceWorkerConnector(const ControllerServiceWorkerConnector&) = delete; @@ -139,6 +141,7 @@ blink::mojom::ServiceWorkerFetchHandlerBypassOption fetch_handler_bypass_option_ = blink::mojom::ServiceWorkerFetchHandlerBypassOption::kDefault; + absl::optional<content::ServiceWorkerRouterEvaluator> router_evaluator_; }; } // namespace content
diff --git a/content/renderer/service_worker/service_worker_provider_context.cc b/content/renderer/service_worker/service_worker_provider_context.cc index f5ea643e..c8e0827 100644 --- a/content/renderer/service_worker/service_worker_provider_context.cc +++ b/content/renderer/service_worker/service_worker_provider_context.cc
@@ -41,6 +41,7 @@ const std::string& client_id, blink::mojom::ServiceWorkerFetchHandlerBypassOption fetch_handler_bypass_option, + absl::optional<blink::ServiceWorkerRouterRules> router_rules, std::unique_ptr<network::PendingSharedURLLoaderFactory> pending_fallback_factory, mojo::PendingReceiver<blink::mojom::ControllerServiceWorkerConnector> @@ -49,7 +50,7 @@ scoped_refptr<base::SequencedTaskRunner> task_runner) { auto connector = base::MakeRefCounted<ControllerServiceWorkerConnector>( std::move(remote_container_host), std::move(remote_controller), client_id, - fetch_handler_bypass_option); + fetch_handler_bypass_option, router_rules); connector->AddBinding(std::move(connector_receiver)); ServiceWorkerSubresourceLoaderFactory::Create( std::move(connector), @@ -184,7 +185,7 @@ base::BindOnce(&CreateSubresourceLoaderFactoryForProviderContext, std::move(remote_container_host), std::move(remote_controller_), client_id_, - fetch_handler_bypass_option_, + fetch_handler_bypass_option_, router_rules_, fallback_loader_factory_->Clone(), controller_connector_.BindNewPipeAndPassReceiver(), subresource_loader_factory_.BindNewPipeAndPassReceiver(), @@ -379,6 +380,7 @@ remote_controller_ = std::move(controller_info->remote_controller); fetch_handler_bypass_option_ = controller_info->fetch_handler_bypass_option; sha256_script_checksum_ = controller_info->sha256_script_checksum; + router_rules_ = controller_info->router_rules; // Propagate the controller to workers related to this provider. if (controller_) {
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h index 75c43e3..adea8ab9 100644 --- a/content/renderer/service_worker/service_worker_provider_context.h +++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -291,6 +291,8 @@ absl::optional<std::string> sha256_script_checksum_; + absl::optional<blink::ServiceWorkerRouterRules> router_rules_; + // Tracks feature usage for UseCounter. std::set<blink::mojom::WebFeature> used_features_;
diff --git a/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc b/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc index faeeff0..2e2ad5f 100644 --- a/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc +++ b/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc
@@ -30,6 +30,7 @@ #include "services/network/test/test_data_pipe_getter.h" #include "services/network/test/test_url_loader_client.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/public/common/service_worker/service_worker_router_rule.h" #include "third_party/blink/public/mojom/blob/blob.mojom.h" #include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom.h" #include "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom.h" @@ -558,7 +559,8 @@ connector_ = base::MakeRefCounted<ControllerServiceWorkerConnector>( std::move(remote_container_host), mojo::NullRemote() /*remote_controller*/, "" /*client_id*/, - blink::mojom::ServiceWorkerFetchHandlerBypassOption::kDefault); + blink::mojom::ServiceWorkerFetchHandlerBypassOption::kDefault, + absl::nullopt); } mojo::Remote<network::mojom::URLLoaderFactory> service_worker_url_loader_factory;
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index 3910668..2cafb29 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn
@@ -98,13 +98,12 @@ "//ui/base/cursor/mojom:cursor_type_java", "//url:gurl_java", ] + srcjar_deps = [ ":content_shell_jni_headers" ] sources = [ "java/src/org/chromium/content_shell/Shell.java", "java/src/org/chromium/content_shell/ShellManager.java", "java/src/org/chromium/content_shell/ShellViewAndroidDelegate.java", ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } jinja_template("content_shell_manifest") {
diff --git a/content/shell/browser/shell_javascript_dialog.h b/content/shell/browser/shell_javascript_dialog.h index 259a65c..fecc6ce 100644 --- a/content/shell/browser/shell_javascript_dialog.h +++ b/content/shell/browser/shell_javascript_dialog.h
@@ -7,6 +7,7 @@ #include "base/functional/callback.h" #include "base/memory/raw_ptr.h" +#include "base/memory/raw_ptr_exclusion.h" #include "build/build_config.h" #include "content/public/browser/javascript_dialog_manager.h" @@ -41,7 +42,9 @@ private: #if BUILDFLAG(IS_MAC) - ShellJavaScriptDialogHelper* helper_; // owned + // This field is not a raw_ptr<> because it is a pointer to Objective-C + // object. + RAW_PTR_EXCLUSION ShellJavaScriptDialogHelper* helper_; // owned #elif BUILDFLAG(IS_WIN) JavaScriptDialogManager::DialogClosedCallback callback_; raw_ptr<ShellJavaScriptDialogManager> manager_;
diff --git a/device/gamepad/BUILD.gn b/device/gamepad/BUILD.gn index e702c864..369f1a37 100644 --- a/device/gamepad/BUILD.gn +++ b/device/gamepad/BUILD.gn
@@ -218,8 +218,11 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":java_enums_srcjar" ] + + srcjar_deps = [ + ":java_enums_srcjar", + ":jni_headers", + ] } java_cpp_enum("java_enums_srcjar") {
diff --git a/device/vr/openxr/openxr_device.cc b/device/vr/openxr/openxr_device.cc index 82e2705..afa5a79 100644 --- a/device/vr/openxr/openxr_device.cc +++ b/device/vr/openxr/openxr_device.cc
@@ -139,7 +139,7 @@ mojom::XRRuntime::RequestSessionCallback callback) { // TODO(https://crbug.com/1450707): Strengthen the guarantees from the browser // process that we will not get a session request while one is pending. - if (request_session_callback_) { + if (request_session_callback_ || HasExclusiveSession()) { LOG(ERROR) << __func__ << " New session request while processing previous request."; std::move(callback).Run(nullptr);
diff --git a/extensions/shell/browser/shell_native_app_window_mac.mm b/extensions/shell/browser/shell_native_app_window_mac.mm index 6262ad3..5da7fd1 100644 --- a/extensions/shell/browser/shell_native_app_window_mac.mm +++ b/extensions/shell/browser/shell_native_app_window_mac.mm
@@ -7,6 +7,7 @@ #import <Cocoa/Cocoa.h> #include "base/mac/foundation_util.h" +#include "base/memory/raw_ptr_exclusion.h" #include "base/notreached.h" #include "base/strings/sys_string_conversions.h" #include "content/public/browser/web_contents.h" @@ -20,7 +21,10 @@ #endif @implementation ShellNativeAppWindowController { - extensions::ShellNativeAppWindowMac* _appWindow; // Owns us. + // This field is not a raw_ptr<> because it is a pointer to Objective-C + // object. + RAW_PTR_EXCLUSION extensions::ShellNativeAppWindowMac* + _appWindow; // Owns us. } @synthesize appWindow = _appWindow;
diff --git a/gpu/command_buffer/service/webgpu_decoder_impl.cc b/gpu/command_buffer/service/webgpu_decoder_impl.cc index a4e2195..582e482c 100644 --- a/gpu/command_buffer/service/webgpu_decoder_impl.cc +++ b/gpu/command_buffer/service/webgpu_decoder_impl.cc
@@ -1098,10 +1098,8 @@ // Only allow unsafe APIs if the allow_unsafe_apis toggle is explicitly // enabled. - // TODO(dawn:1685) Remove disallow case once it is fully deprecated. allow_unsafe_apis_ = - base::Contains(require_enabled_toggles_, "allow_unsafe_apis") || - base::Contains(require_disabled_toggles_, "disallow_unsafe_apis"); + base::Contains(require_enabled_toggles_, "allow_unsafe_apis"); // Force adapters to report their limits in predetermined tiers unless the // adapter_limit_tiers toggle is explicitly disabled.
diff --git a/infra/config/generated/testing/gn_isolate_map.pyl b/infra/config/generated/testing/gn_isolate_map.pyl index f2dbe19..26afa2b 100644 --- a/infra/config/generated/testing/gn_isolate_map.pyl +++ b/infra/config/generated/testing/gn_isolate_map.pyl
@@ -1433,6 +1433,10 @@ "label": "//chrome/browser/metrics/perf:profile_provider_unittest", "type": "console_test_launcher", }, + "pthreadpool_unittests": { + "label": "//third_party/pthreadpool:pthreadpool_unittests", + "type": "console_test_launcher", + }, "push_apps_to_background_apk": { "label": "//tools/android/push_apps_to_background:push_apps_to_background_apk", "type": "additional_compile_target",
diff --git a/infra/config/targets/targets.star b/infra/config/targets/targets.star index 018b699..8c7a754 100644 --- a/infra/config/targets/targets.star +++ b/infra/config/targets/targets.star
@@ -1755,6 +1755,11 @@ label = "//chrome/browser/metrics/perf:profile_provider_unittest", ) +targets.console_test_launcher( + name = "pthreadpool_unittests", + label = "//third_party/pthreadpool:pthreadpool_unittests", +) + targets.compile_target( name = "push_apps_to_background_apk", label = "//tools/android/push_apps_to_background:push_apps_to_background_apk",
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index a8e39bdd..83d06787 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1567,6 +1567,9 @@ <message name="IDS_IOS_LONG_PRESS_TOOLBAR_IPH_PROMOTION_TEXT" desc="Text for the LongPress Toolbar Tip in-product help promotion, explaining that the user can long press on the toolbar's button to display more options. [iOS only]"> Touch & hold for more tab options </message> + <message name="IDS_IOS_MAGIC_STACK_SEE_MORE" desc="The See More button in Magic Stack modules to show a detailed view. [Length: 10em]"> + See More + </message> <message name="IDS_IOS_MANAGE_YOUR_GOOGLE_ACCOUNT_TITLE" desc="Title for the view in the Settings to open 'Google Account' web page."> Manage Your Google Account </message>
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_MAGIC_STACK_SEE_MORE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_MAGIC_STACK_SEE_MORE.png.sha1 new file mode 100644 index 0000000..a9963813 --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_MAGIC_STACK_SEE_MORE.png.sha1
@@ -0,0 +1 @@ +ef1cf51f2320cb437b8109d5889089abbf112976 \ No newline at end of file
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container.mm b/ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container.mm index 09998ac..34b830c 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container.mm
@@ -5,11 +5,13 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container.h" #import "base/notreached.h" +#import "ios/chrome/browser/shared/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/content_suggestions/cells/magic_stack_module_container_delegate.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_constants.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h" #import "ios/chrome/common/ui/colors/semantic_color_names.h" #import "ios/chrome/common/ui/util/constraints_ui_util.h" +#import "ios/chrome/common/ui/util/ui_util.h" #import "ios/chrome/grit/ios_strings.h" #import "ui/base/l10n/l10n_util_mac.h" @@ -39,6 +41,12 @@ const int kModuleWidthCompact = 343; const int kModuleWidthRegular = 382; +const CGFloat kSeparatorHeight = 0.5; + +// The margin spacing between the top horizontal StackView (containing the title +// and "See More" button) and the module's overall vertical container StackView. +const CGFloat kTitleStackViewTrailingMargin = 16.0f; + } // namespace @interface MagicStackModuleContainer () @@ -71,13 +79,37 @@ self.layer.cornerRadius = kCornerRadius; self.backgroundColor = [UIColor colorNamed:kBackgroundColor]; + UIStackView* titleStackView = [[UIStackView alloc] init]; + titleStackView.alignment = UIStackViewAlignmentCenter; + titleStackView.axis = UILayoutConstraintAxisHorizontal; + titleStackView.distribution = UIStackViewDistributionFill; + UILabel* title = [[UILabel alloc] init]; title.text = [MagicStackModuleContainer titleStringForModule:type]; - title.font = [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]; + title.font = + CreateDynamicFont(UIFontTextStyleFootnote, UIFontWeightSemibold); + title.adjustsFontForContentSizeCategory = YES; title.textColor = [UIColor colorNamed:kTextPrimaryColor]; title.accessibilityTraits |= UIAccessibilityTraitHeader; title.accessibilityIdentifier = [MagicStackModuleContainer titleStringForModule:type]; + [titleStackView addArrangedSubview:title]; + + if ([self shouldShowSeeMore]) { + UIButton* showMoreButton = [[UIButton alloc] init]; + [showMoreButton + setTitle:l10n_util::GetNSString(IDS_IOS_MAGIC_STACK_SEE_MORE) + forState:UIControlStateNormal]; + [showMoreButton setTitleColor:[UIColor colorNamed:kBlueColor] + forState:UIControlStateNormal]; + [showMoreButton.titleLabel + setFont:[UIFont preferredFontForTextStyle:UIFontTextStyleFootnote]]; + showMoreButton.titleLabel.adjustsFontForContentSizeCategory = YES; + [showMoreButton addTarget:self + action:@selector(seeMoreButtonWasTapped:) + forControlEvents:UIControlEventTouchUpInside]; + [titleStackView addArrangedSubview:showMoreButton]; + } UIStackView* stackView = [[UIStackView alloc] init]; stackView.translatesAutoresizingMaskIntoConstraints = NO; @@ -86,7 +118,27 @@ stackView.spacing = kContentVerticalSpacing; stackView.distribution = UIStackViewDistributionFill; if ([title.text length] > 0) { - [stackView addArrangedSubview:title]; + [stackView addArrangedSubview:titleStackView]; + [NSLayoutConstraint activateConstraints:@[ + [titleStackView.leadingAnchor + constraintEqualToAnchor:stackView.leadingAnchor], + [titleStackView.trailingAnchor + constraintEqualToAnchor:stackView.trailingAnchor + constant:-kTitleStackViewTrailingMargin], + ]]; + } + if ([self shouldShowSeparator]) { + UIView* separator = [[UIView alloc] init]; + separator.backgroundColor = [UIColor colorNamed:kSeparatorColor]; + [stackView addArrangedSubview:separator]; + [NSLayoutConstraint activateConstraints:@[ + [separator.heightAnchor + constraintEqualToConstant:AlignValueToPixel(kSeparatorHeight)], + [separator.leadingAnchor + constraintEqualToAnchor:stackView.leadingAnchor], + [separator.trailingAnchor + constraintEqualToAnchor:stackView.trailingAnchor], + ]]; } [stackView addArrangedSubview:contentView]; @@ -186,6 +238,31 @@ #pragma mark - Helpers +- (void)seeMoreButtonWasTapped:(UIButton*)button { + // TODO(crbug.com/1432252): Implement presenting views for different module + // types. +} + +- (BOOL)shouldShowSeeMore { + switch (_type) { + case ContentSuggestionsModuleType::kCompactedSetUpList: + return YES; + default: + return NO; + } +} + +- (BOOL)shouldShowSeparator { + switch (_type) { + case ContentSuggestionsModuleType::kSetUpListSync: + case ContentSuggestionsModuleType::kSetUpListDefaultBrowser: + case ContentSuggestionsModuleType::kSetUpListAutofill: + return YES; + default: + return NO; + } +} + // Returns the expected width of the contentView subview. - (CGFloat)contentViewWidth { NSDirectionalEdgeInsets insets = [self contentMargins];
diff --git a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 index 7e1e6f0..71916c7 100644 --- a/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -77b8b84b09eb61811bd0e290771d0fdecc651765 \ No newline at end of file +4b7d8e79bf939206c4c129c11c3fa60669b8b0c9 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 index 703c8118..8364c95a 100644 --- a/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1 +++ b/ios/google_internal/frameworks/ChromeSSOInternal.framework.dSYM.ios.zip.sha1
@@ -1 +1 @@ -976cda68df045ae912bd45cfc8cf14c0be19a8a0 \ No newline at end of file +5bf2da17d7a4a6bfa2139a5a3e971f31b6db8fca \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 2f02e11..256035c7 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 @@ -2313fa464b8b0d82930afb927ebcdb08f321b822 \ No newline at end of file +b726020f0c02e8f0600560c980b379f09c9d7636 \ 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 c52c4ec..e4d4a27f 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 @@ -33da169466cb3742cf008d9bc9bb500e28f5c260 \ No newline at end of file +78372e35483685c3f6a10fe55d544816dbaa19b4 \ 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 46c3f9be..18dfdac7 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 @@ -8c7ed2a572951ce78036d9be87d37ffc829008d0 \ No newline at end of file +24df63b3376c3395f475a3c26adf0129d5e72717 \ 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 40ed4311..f3db3de0 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 @@ -8748b15f3c5cab662813f6da96b12020868dab0b \ No newline at end of file +a3f2a2002e98067214e740e5f69dc7492debf038 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 index cad157c0..8c898ca1 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -40dc89aa5834987ee7005b700d6447387f51e3fe \ No newline at end of file +05b150679af447ac87dfdbb665e0aa2a3ad7a0b2 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 index f7c5e39..c6b1cbf 100644 --- a/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_test_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -0551e64eb8ba47486f79f246f29ea871d7d5f55f \ No newline at end of file +fc0091dd1f2b8b97014f615ad4a9592b35d6f488 \ 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 170430c..580d15c 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 @@ -58f3b61035e9b727346e3a7b86aeb709681d2ca2 \ No newline at end of file +803a503daa053d828da4f966d637bf8cec32250e \ 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 92d706b..f12d1ac 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 @@ -686964929c1babee17dd58856be175ad4a02a787 \ No newline at end of file +1974df1983e7d9eca930625988508b2e50d31149 \ 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 0e2e8df..3d7c7a2 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 @@ -9d46f42e0a4490fcbf19e942f93e263dec3d1c04 \ No newline at end of file +87025fc3cc0958e9cfab7ca1591122e7e09e49cf \ 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 39d6ea7..42917f18 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 @@ -64608c46cf1cfde61abfaeaaf56c4c727ffe7e76 \ No newline at end of file +a8b6fbe78ee1b18b684123628e6cc002d2cb5257 \ No newline at end of file
diff --git a/media/base/android/BUILD.gn b/media/base/android/BUILD.gn index 003afea..0a103a8 100644 --- a/media/base/android/BUILD.gn +++ b/media/base/android/BUILD.gn
@@ -170,10 +170,11 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":java_enums", ":java_switches", + ":media_jni_headers", "//media/base:java_enums", ] resources_package = "org.chromium.media"
diff --git a/media/capture/content/android/BUILD.gn b/media/capture/content/android/BUILD.gn index 29b3a94..64b3d39 100644 --- a/media/capture/content/android/BUILD.gn +++ b/media/capture/content/android/BUILD.gn
@@ -40,6 +40,6 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] + srcjar_deps = [ ":screen_capture_jni_headers" ] sources = [ "java/src/org/chromium/media/ScreenCapture.java" ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] }
diff --git a/media/capture/video/android/BUILD.gn b/media/capture/video/android/BUILD.gn index 6ac5958d..75dcf1f 100644 --- a/media/capture/video/android/BUILD.gn +++ b/media/capture/video/android/BUILD.gn
@@ -55,9 +55,11 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] - srcjar_deps = [ ":media_java_enums_srcjar" ] + srcjar_deps = [ + ":capture_jni_headers", + ":media_java_enums_srcjar", + ] sources = [ "java/src/org/chromium/media/PhotoCapabilities.java",
diff --git a/media/midi/BUILD.gn b/media/midi/BUILD.gn index 9e2ac18..5a68720 100644 --- a/media/midi/BUILD.gn +++ b/media/midi/BUILD.gn
@@ -54,8 +54,8 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ ":midi_jni_headers" ] sources = [ "java/src/org/chromium/midi/MidiDeviceAndroid.java", "java/src/org/chromium/midi/MidiInputPortAndroid.java",
diff --git a/media/renderers/video_renderer_impl.cc b/media/renderers/video_renderer_impl.cc index dea05810..362a782 100644 --- a/media/renderers/video_renderer_impl.cc +++ b/media/renderers/video_renderer_impl.cc
@@ -909,7 +909,7 @@ return; const bool have_frames_after_start_time = - algorithm_->frames_queued() && + algorithm_->frames_queued() > 1 && !IsBeforeStartTime(algorithm_->last_frame()); // Don't fire ended if time isn't moving and we have frames. @@ -922,18 +922,21 @@ base::TimeDelta ended_event_delay; bool should_render_end_of_stream = false; if (!algorithm_->effective_frames_queued()) { + // The best frame doesn't exist or was already rendered; end immediately. should_render_end_of_stream = true; } else if (algorithm_->frames_queued() == 1u && - algorithm_->average_frame_duration().is_zero()) { + (algorithm_->average_frame_duration().is_zero() || + algorithm_->render_interval().is_zero() || !time_progressing)) { + // We'll end up here if playback never started or there was only one frame. should_render_end_of_stream = true; } else if (algorithm_->frames_queued() == 1u && - algorithm_->render_interval().is_zero()) { - should_render_end_of_stream = true; - } else if (algorithm_->frames_queued() == 1u && - algorithm_->effective_frames_queued() == 1) { + algorithm_->effective_frames_queued() == 1 && time_progressing) { const auto end_delay = std::max(base::TimeDelta(), algorithm_->last_frame_end_time() - tick_clock_->NowTicks()); + + // We should only be here if time is progressing, so only fire the ended + // event now if we have less than one render interval before our next check. if (end_delay < algorithm_->render_interval()) { should_render_end_of_stream = true; ended_event_delay = end_delay;
diff --git a/media/renderers/video_renderer_impl_unittest.cc b/media/renderers/video_renderer_impl_unittest.cc index f5749f5..cb68d60 100644 --- a/media/renderers/video_renderer_impl_unittest.cc +++ b/media/renderers/video_renderer_impl_unittest.cc
@@ -504,6 +504,34 @@ Destroy(); } +TEST_F(VideoRendererImplTest, StartPlayingAfterEndOfStream) { + Initialize(); + QueueFrames("0d10 10d10 20d10 30d10 40d10"); + EXPECT_CALL(mock_cb_, OnVideoNaturalSizeChange(_)).Times(1); + EXPECT_CALL(mock_cb_, FrameReceived(HasTimestampMatcher(40))); + EXPECT_CALL(mock_cb_, OnStatisticsUpdate(_)).Times(AnyNumber()); + EXPECT_CALL(mock_cb_, OnVideoOpacityChange(_)).Times(1); + StartPlayingFrom(40); + WaitForPendingDecode(); + { + SCOPED_TRACE("Waiting for BUFFERING_HAVE_ENOUGH"); + WaitableMessageLoopEvent event; + { + // Buffering state changes must happen before end of stream. + testing::InSequence in_sequence; + EXPECT_CALL(mock_cb_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH, _)) + .WillOnce(RunOnceClosure(event.GetClosure())); + EXPECT_CALL(mock_cb_, OnEnded()); + } + SatisfyPendingDecodeWithEndOfStream(); + event.RunAndWait(); + } + // Firing a time state changed to true should be ignored... + renderer_->OnTimeProgressing(); + EXPECT_FALSE(null_video_sink_->is_started()); + Destroy(); +} + TEST_F(VideoRendererImplTest, InitializeAndEndOfStreamOneStaleFrame) { Initialize(); StartPlayingFrom(10000);
diff --git a/mojo/core/ipcz_driver/transport.cc b/mojo/core/ipcz_driver/transport.cc index 0fe087e..631f8e3b 100644 --- a/mojo/core/ipcz_driver/transport.cc +++ b/mojo/core/ipcz_driver/transport.cc
@@ -11,6 +11,7 @@ #include "base/containers/stack_container.h" #include "base/functional/overloaded.h" #include "base/memory/scoped_refptr.h" +#include "base/no_destructor.h" #include "base/numerics/safe_conversions.h" #include "base/process/process.h" #include "base/task/single_thread_task_runner.h"
diff --git a/net/android/java/src/org/chromium/net/GURLUtils.java b/net/android/java/src/org/chromium/net/GURLUtils.java index a51070d..dd0564b 100644 --- a/net/android/java/src/org/chromium/net/GURLUtils.java +++ b/net/android/java/src/org/chromium/net/GURLUtils.java
@@ -26,7 +26,7 @@ return GURLUtilsJni.get().getOrigin(url); } - @VisibleForTesting + @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) @NativeMethods public interface Natives { String getOrigin(String url);
diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 0892e875..4fd22f3 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn
@@ -494,6 +494,7 @@ "//third_party/androidx:androidx_annotation_annotation_java", "//ui/android:ui_java", ] + srcjar_deps = [ ":printing_jni_headers" ] sources = [ "android/java/src/org/chromium/printing/PrintDocumentAdapterWrapper.java", "android/java/src/org/chromium/printing/PrintManagerDelegate.java", @@ -503,6 +504,5 @@ "android/java/src/org/chromium/printing/PrintingController.java", "android/java/src/org/chromium/printing/PrintingControllerImpl.java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } }
diff --git a/printing/backend/cups_helper.cc b/printing/backend/cups_helper.cc index 7b577e9d..c5db139b 100644 --- a/printing/backend/cups_helper.cc +++ b/printing/backend/cups_helper.cc
@@ -25,6 +25,7 @@ #include "printing/print_job_constants_cups.h" #include "printing/printing_utils.h" #include "printing/units.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" @@ -109,6 +110,34 @@ } } +absl::optional<gfx::Size> ParseResolutionString(const char* input) { + int len = strlen(input); + if (len == 0) { + VLOG(1) << "Bad PPD resolution choice: null string"; + return absl::nullopt; + } + + int n = 0; // number of chars successfully parsed by sscanf() + int dpi_x; + int dpi_y; + sscanf(input, "%ddpi%n", &dpi_x, &n); + if (n == len) { + dpi_y = dpi_x; + } else { + sscanf(input, "%dx%ddpi%n", &dpi_x, &dpi_y, &n); + if (n != len) { + VLOG(1) << "Bad PPD resolution choice: " << input; + return absl::nullopt; + } + } + if (dpi_x <= 0 || dpi_y <= 0) { + VLOG(1) << "Invalid PPD resolution dimensions: " << dpi_x << " " << dpi_y; + return absl::nullopt; + } + + return gfx::Size(dpi_x, dpi_y); +} + void GetResolutionSettings(ppd_file_t* ppd, std::vector<gfx::Size>* dpis, gfx::Size* default_dpi) { @@ -127,8 +156,6 @@ // found. #if BUILDFLAG(IS_MAC) constexpr gfx::Size kDefaultMissingDpi(kDefaultMacDpi, kDefaultMacDpi); -#elif BUILDFLAG(IS_LINUX) - constexpr gfx::Size kDefaultMissingDpi(kPixelsPerInch, kPixelsPerInch); #else constexpr gfx::Size kDefaultMissingDpi(kDefaultPdfDpi, kDefaultPdfDpi); #endif @@ -140,30 +167,13 @@ } for (int i = 0; i < res->num_choices; i++) { char* choice = res->choices[i].choice; - DCHECK(choice); - int len = strlen(choice); - if (len == 0) { - VLOG(1) << "Bad PPD resolution choice: null string"; + CHECK(choice); + absl::optional<gfx::Size> parsed_size = ParseResolutionString(choice); + if (!parsed_size.has_value()) { continue; } - int n = 0; // number of chars successfully parsed by sscanf() - int dpi_x; - int dpi_y; - sscanf(choice, "%ddpi%n", &dpi_x, &n); - if (n == len) { - dpi_y = dpi_x; - } else { - sscanf(choice, "%dx%ddpi%n", &dpi_x, &dpi_y, &n); - if (n != len) { - VLOG(1) << "Bad PPD resolution choice: " << choice; - continue; - } - } - if (dpi_x <= 0 || dpi_y <= 0) { - VLOG(1) << "Invalid PPD resolution dimensions: " << dpi_x << " " << dpi_y; - continue; - } - dpis->push_back({dpi_x, dpi_y}); + + dpis->push_back(parsed_size.value()); if (!strcmp(choice, res->defchoice)) *default_dpi = dpis->back(); }
diff --git a/printing/backend/cups_helper_unittest.cc b/printing/backend/cups_helper_unittest.cc index 93db3559..7ddb7bb 100644 --- a/printing/backend/cups_helper_unittest.cc +++ b/printing/backend/cups_helper_unittest.cc
@@ -769,8 +769,6 @@ // an OS-dependent default value. #if BUILDFLAG(IS_MAC) constexpr gfx::Size kExpectedDpi(kDefaultMacDpi, kDefaultMacDpi); -#elif BUILDFLAG(IS_LINUX) - constexpr gfx::Size kExpectedDpi(kPixelsPerInch, kPixelsPerInch); #else constexpr gfx::Size kExpectedDpi(kDefaultPdfDpi, kDefaultPdfDpi); #endif
diff --git a/printing/units.h b/printing/units.h index d9c51bdd..24a416a 100644 --- a/printing/units.h +++ b/printing/units.h
@@ -35,7 +35,8 @@ constexpr int kDefaultMacDpi = 72; #endif // BUILDFLAG(IS_MAC) -// Dpi used to save to PDF or Cloud Print. +// DPI used for Save to PDF. Also used as the default DPI in various use cases +// where there is no specified DPI. constexpr int kDefaultPdfDpi = 300; // LETTER: 8.5 x 11 inches
diff --git a/services/device/geolocation/BUILD.gn b/services/device/geolocation/BUILD.gn index 30930943..67932f5b 100644 --- a/services/device/geolocation/BUILD.gn +++ b/services/device/geolocation/BUILD.gn
@@ -157,6 +157,7 @@ } android_library("geolocation_java") { + srcjar_deps = [ ":geolocation_jni_headers" ] sources = [ "android/java/src/org/chromium/device/geolocation/LocationProviderAdapter.java", "android/java/src/org/chromium/device/geolocation/LocationProviderAndroid.java", @@ -178,7 +179,6 @@ "//third_party/android_deps:chromium_play_services_availability_java", "//third_party/androidx:androidx_annotation_annotation_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } }
diff --git a/services/device/time_zone_monitor/BUILD.gn b/services/device/time_zone_monitor/BUILD.gn index f6d326a9..30b804a 100644 --- a/services/device/time_zone_monitor/BUILD.gn +++ b/services/device/time_zone_monitor/BUILD.gn
@@ -74,7 +74,7 @@ if (is_android) { generate_jni("time_zone_monitor_jni_headers") { - visibility = [ ":time_zone_monitor" ] + visibility = [ ":*" ] sources = [ "android/java/src/org/chromium/device/time_zone_monitor/TimeZoneMonitor.java" ] } @@ -83,12 +83,12 @@ # However, various generated targets also need to see this target as a # result of //services/device:java depending on it. visibility = [ "//services/device:*" ] + srcjar_deps = [ ":time_zone_monitor_jni_headers" ] sources = [ "android/java/src/org/chromium/device/time_zone_monitor/TimeZoneMonitor.java" ] deps = [ "//base:base_java", "//base:jni_java", "//build/android:build_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } }
diff --git a/services/webnn/BUILD.gn b/services/webnn/BUILD.gn index ae8d864..96d76412 100644 --- a/services/webnn/BUILD.gn +++ b/services/webnn/BUILD.gn
@@ -22,6 +22,7 @@ "dml/command_queue.h", "dml/command_recorder.cc", "dml/command_recorder.h", + "dml/error.h", "dml/platform_functions.cc", "dml/platform_functions.h", ]
diff --git a/services/webnn/dml/command_queue.cc b/services/webnn/dml/command_queue.cc index faa8310..27fc2dd 100644 --- a/services/webnn/dml/command_queue.cc +++ b/services/webnn/dml/command_queue.cc
@@ -7,6 +7,7 @@ #include "base/check_is_test.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/numerics/safe_conversions.h" namespace webnn::dml { @@ -49,10 +50,14 @@ new CommandQueue(std::move(command_queue), std::move(fence))); } +HRESULT CommandQueue::ExecuteCommandList(ID3D12CommandList* command_list) { + return ExecuteCommandLists(base::make_span(&command_list, 1u)); +} + HRESULT CommandQueue::ExecuteCommandLists( - const std::vector<ID3D12CommandList*>& command_lists) { - command_queue_->ExecuteCommandLists(command_lists.size(), - command_lists.data()); + base::span<ID3D12CommandList*> command_lists) { + command_queue_->ExecuteCommandLists( + base::checked_cast<uint32_t>(command_lists.size()), command_lists.data()); ++last_fence_value_; return command_queue_->Signal(fence_.Get(), last_fence_value_); } @@ -111,6 +116,14 @@ } } +uint64_t CommandQueue::GetCompletedValue() const { + return fence_->GetCompletedValue(); +} + +uint64_t CommandQueue::GetLastFenceValue() const { + return last_fence_value_; +} + CommandQueue::QueuedObject::QueuedObject(uint64_t fence_value, ComPtr<IUnknown> object) : fence_value(fence_value), object(std::move(object)) {}
diff --git a/services/webnn/dml/command_queue.h b/services/webnn/dml/command_queue.h index 479cc4b..4f9c520 100644 --- a/services/webnn/dml/command_queue.h +++ b/services/webnn/dml/command_queue.h
@@ -10,6 +10,7 @@ #include <deque> #include <vector> +#include "base/containers/span.h" #include "base/functional/callback_forward.h" #include "base/gtest_prod_util.h" #include "base/win/object_watcher.h" @@ -29,8 +30,8 @@ CommandQueue& operator=(const CommandQueue&) = delete; ~CommandQueue() override; - HRESULT ExecuteCommandLists( - const std::vector<ID3D12CommandList*>& command_lists); + HRESULT ExecuteCommandList(ID3D12CommandList* command_list); + HRESULT ExecuteCommandLists(base::span<ID3D12CommandList*> command_lists); // It's a synchronous method only for testing, which will block the CPU until // the fence is signaled with the last fence value. Calling it on the GPU main @@ -43,6 +44,9 @@ void ReferenceUntilCompleted(ComPtr<IUnknown> object); void ReleaseCompletedResources(); + uint64_t GetCompletedValue() const; + uint64_t GetLastFenceValue() const; + private: FRIEND_TEST_ALL_PREFIXES(WebNNCommandQueueTest, ReferenceAndRelease);
diff --git a/services/webnn/dml/command_queue_test.cc b/services/webnn/dml/command_queue_test.cc index 3712972..2a95f110 100644 --- a/services/webnn/dml/command_queue_test.cc +++ b/services/webnn/dml/command_queue_test.cc
@@ -61,7 +61,7 @@ CommandQueue::Create(d3d12_device_.Get()); ASSERT_NE(command_queue.get(), nullptr); ASSERT_EQ(command_list->Close(), S_OK); - EXPECT_EQ(command_queue->ExecuteCommandLists({command_list.Get()}), S_OK); + EXPECT_EQ(command_queue->ExecuteCommandList(command_list.Get()), S_OK); EXPECT_EQ(command_queue->WaitSyncForTesting(), S_OK); EXPECT_EQ(command_allocator->Reset(), S_OK); EXPECT_EQ(command_list->Reset(command_allocator.Get(), nullptr), S_OK); @@ -85,7 +85,7 @@ CommandQueue::Create(d3d12_device_.Get()); ASSERT_NE(command_queue.get(), nullptr); ASSERT_EQ(command_list->Close(), S_OK); - EXPECT_EQ(command_queue->ExecuteCommandLists({command_list.Get()}), S_OK); + EXPECT_EQ(command_queue->ExecuteCommandList(command_list.Get()), S_OK); bool is_signaled = false; base::RunLoop run_loop; @@ -119,7 +119,7 @@ CommandQueue::Create(d3d12_device_.Get()); ASSERT_NE(command_queue.get(), nullptr); ASSERT_EQ(command_list->Close(), S_OK); - EXPECT_EQ(command_queue->ExecuteCommandLists({command_list.Get()}), S_OK); + EXPECT_EQ(command_queue->ExecuteCommandList(command_list.Get()), S_OK); int32_t count = 2; base::RunLoop run_loop; @@ -139,7 +139,7 @@ // Call WaitAsync for the second time with fence value 2. ASSERT_EQ(command_list->Close(), S_OK); - EXPECT_EQ(command_queue->ExecuteCommandLists({command_list.Get()}), S_OK); + EXPECT_EQ(command_queue->ExecuteCommandList(command_list.Get()), S_OK); EXPECT_EQ(command_queue->WaitAsync(base::BindLambdaForTesting([&]() { if (--count) { return; @@ -173,7 +173,7 @@ CommandQueue::Create(d3d12_device_.Get()); ASSERT_NE(command_queue.get(), nullptr); ASSERT_EQ(command_list->Close(), S_OK); - EXPECT_EQ(command_queue->ExecuteCommandLists({command_list.Get()}), S_OK); + EXPECT_EQ(command_queue->ExecuteCommandList(command_list.Get()), S_OK); int32_t count = 2; base::RunLoop run_loop;
diff --git a/services/webnn/dml/command_recorder.cc b/services/webnn/dml/command_recorder.cc index 64c5f62..35b1c97 100644 --- a/services/webnn/dml/command_recorder.cc +++ b/services/webnn/dml/command_recorder.cc
@@ -8,72 +8,78 @@ #include "base/memory/ptr_util.h" #include "base/notreached.h" #include "services/webnn/dml/adapter.h" +#include "services/webnn/dml/error.h" namespace webnn::dml { // Static std::unique_ptr<CommandRecorder> CommandRecorder::Create( scoped_refptr<Adapter> adapter) { - ID3D12Device* d3d12_device = adapter->d3d12_device(); - IDMLDevice* dml_device = adapter->dml_device(); - ComPtr<ID3D12CommandAllocator> command_allocator; - HRESULT hr = d3d12_device->CreateCommandAllocator( - D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&command_allocator)); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to create command allocator : " - << logging::SystemErrorCodeToString(hr); - return nullptr; - } + RETURN_NULL_IF_FAILED(adapter->d3d12_device()->CreateCommandAllocator( + D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&command_allocator))); - ComPtr<ID3D12GraphicsCommandList> command_list; - hr = d3d12_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, - command_allocator.Get(), nullptr, - IID_PPV_ARGS(&command_list)); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to create command list : " - << logging::SystemErrorCodeToString(hr); - return nullptr; - } - - ComPtr<IDMLOperatorInitializer> operator_initializer; - hr = dml_device->CreateOperatorInitializer( - 0, nullptr, IID_PPV_ARGS(&operator_initializer)); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to create dml operator initializer : " - << logging::SystemErrorCodeToString(hr); - return nullptr; - } + // The command list will be created upon the first call to `Open()` method. + // Because the command list will be created in the open state, we won't want + // to close it right after its creation. ComPtr<IDMLCommandRecorder> command_recorder; - hr = dml_device->CreateCommandRecorder(IID_PPV_ARGS(&command_recorder)); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to create command recorder : " - << logging::SystemErrorCodeToString(hr); - return nullptr; - } + RETURN_NULL_IF_FAILED(adapter->dml_device()->CreateCommandRecorder( + IID_PPV_ARGS(&command_recorder))); - return base::WrapUnique(new CommandRecorder( - std::move(adapter), std::move(command_allocator), std::move(command_list), - std::move(operator_initializer), std::move(command_recorder))); + return base::WrapUnique(new CommandRecorder(std::move(adapter), + std::move(command_allocator), + std::move(command_recorder))); } CommandRecorder::CommandRecorder( scoped_refptr<Adapter> adapter, ComPtr<ID3D12CommandAllocator> command_allocator, - ComPtr<ID3D12GraphicsCommandList> command_list, - ComPtr<IDMLOperatorInitializer> operator_initializer, ComPtr<IDMLCommandRecorder> command_recorder) : adapter_(std::move(adapter)), command_allocator_(std::move(command_allocator)), - command_list_(std::move(command_list)), - operator_initializer_(std::move(operator_initializer)), command_recorder_(std::move(command_recorder)) {} CommandRecorder::~CommandRecorder() = default; +CommandQueue* CommandRecorder::GetCommandQueue() const { + return adapter_->command_queue(); +} + +HRESULT CommandRecorder::Open() { + CHECK(!is_open_); + if (last_submitted_fence_value_ <= + adapter_->command_queue()->GetCompletedValue()) { + // When the execution of last submitted command list is completed, it's + // safe to reset the command allocator. + RETURN_IF_FAILED(command_allocator_->Reset()); + } + if (!command_list_) { + // `CreateCommandList()` creates a command list in the open state. + RETURN_IF_FAILED(adapter_->d3d12_device()->CreateCommandList( + 0, D3D12_COMMAND_LIST_TYPE_DIRECT, command_allocator_.Get(), nullptr, + IID_PPV_ARGS(&command_list_))); + } else { + // It's safe to reset the command list while it is still being executed. + RETURN_IF_FAILED(command_list_->Reset(command_allocator_.Get(), nullptr)); + } + is_open_ = true; + return S_OK; +} + +HRESULT CommandRecorder::CloseAndExecute() { + CHECK(is_open_); + RETURN_IF_FAILED(command_list_->Close()); + RETURN_IF_FAILED( + adapter_->command_queue()->ExecuteCommandList(command_list_.Get())); + last_submitted_fence_value_ = adapter_->command_queue()->GetLastFenceValue(); + is_open_ = false; + return S_OK; +} + void CommandRecorder::ResourceBarrier( const std::vector<const D3D12_RESOURCE_BARRIER>& barriers) { + CHECK(is_open_); command_list_->ResourceBarrier(barriers.size(), barriers.data()); } @@ -82,6 +88,7 @@ ID3D12Resource* src_buffer, uint64_t src_offset, uint64_t byte_length) { + CHECK(is_open_); command_list_->CopyBufferRegion(dst_buffer, dst_offset, src_buffer, src_offset, byte_length); } @@ -89,6 +96,7 @@ HRESULT CommandRecorder::InitializeGraph( GraphDMLImpl* graph, const DML_BINDING_DESC& input_array_binding) { + CHECK(is_open_); CHECK(graph); // TODO(crbug.com/1273291): This method will be implemented after the // GraphDMLImpl class has been defined. @@ -100,6 +108,7 @@ GraphDMLImpl* graph, const std::vector<DML_BINDING_DESC>& input_bindings, const std::vector<DML_BINDING_DESC>& output_bindings) { + CHECK(is_open_); CHECK(graph); // TODO(crbug.com/1273291): This method will be implemented after the // GraphDMLImpl class has been defined. @@ -107,29 +116,4 @@ return S_OK; } -HRESULT CommandRecorder::CloseAndExecute() const { - HRESULT hr = command_list_->Close(); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to close commandlist : " - << logging::SystemErrorCodeToString(hr); - return hr; - } - - hr = adapter_->command_queue()->ExecuteCommandLists({command_list_.Get()}); - if (FAILED(hr)) { - DLOG(ERROR) << "Failed to execute commandlist : " - << logging::SystemErrorCodeToString(hr); - return hr; - } - return S_OK; -} - -HRESULT CommandRecorder::ResetCommandList() const { - HRESULT hr = command_allocator_->Reset(); - if (FAILED(hr)) { - return hr; - } - return command_list_->Reset(command_allocator_.Get(), nullptr); -} - } // namespace webnn::dml
diff --git a/services/webnn/dml/command_recorder.h b/services/webnn/dml/command_recorder.h index fbf151e..e9e215d 100644 --- a/services/webnn/dml/command_recorder.h +++ b/services/webnn/dml/command_recorder.h
@@ -20,11 +20,9 @@ class GraphDMLImpl; // CommandRecorder is mainly responsible for the initialization and execution of -// a DirectML graph. It's a wrapper of D3D12 command recorder, and own's the -// D3D12 command list, D3D12 command allocator, DirectML operator initializer -// and so on. CommandRecorder will be owned and called by an execution context -// class which performs GPU work, and manages command list recording and -// submission to queues. +// a DirectML graph. It wraps a DirectML command recorder, and manages the +// Direct3D 12 command list and command allocator for GPU work recording and +// submission. class CommandRecorder final { public: static std::unique_ptr<CommandRecorder> Create( @@ -34,6 +32,23 @@ CommandRecorder(const CommandRecorder&) = delete; CommandRecorder& operator=(const CommandRecorder&) = delete; + // Get the command queue that this command recorder submits command list to. + CommandQueue* GetCommandQueue() const; + + // Call the `Open()` method before recording any new commands. The `Open()` + // method would prepare the underlying command list and command allocator. + // After recording the commands, call the `CloseAndExecute()` method to submit + // the recorded command list to the command queue for GPU execution. The + // caller may need to call the `CommandQueue::WaitAsync()` method on the + // command queue to wait for the GPU execution to complete. + // + // The caller is allowed to open the command recorder without waiting for the + // GPU to complete execution of previous recorded commands. The `Open()` + // method would ensure the command allocator is not reset while the previous + // command list is still being used by the GPU. + HRESULT Open(); + HRESULT CloseAndExecute(); + void ResourceBarrier( const std::vector<const D3D12_RESOURCE_BARRIER>& barriers); @@ -50,19 +65,15 @@ const std::vector<DML_BINDING_DESC>& input_bindings, const std::vector<DML_BINDING_DESC>& output_bindings); - HRESULT CloseAndExecute() const; - // TODO(crbug.com/1273291): The command allocator can't be reset while a - // command list is still executing, so reset the command allocator when - // opening a new command recorder. - HRESULT ResetCommandList() const; - private: CommandRecorder(scoped_refptr<Adapter> adapter, ComPtr<ID3D12CommandAllocator> command_allocator, - ComPtr<ID3D12GraphicsCommandList> command_list, - ComPtr<IDMLOperatorInitializer> operator_initializer, ComPtr<IDMLCommandRecorder> command_recorder); + bool is_open_ = false; + // The first call to `CloseAndExecute()` sets the first submitted fence value. + uint64_t last_submitted_fence_value_ = UINT64_MAX; + scoped_refptr<Adapter> adapter_; ComPtr<ID3D12CommandAllocator> command_allocator_; ComPtr<ID3D12GraphicsCommandList> command_list_;
diff --git a/services/webnn/dml/command_recorder_test.cc b/services/webnn/dml/command_recorder_test.cc index 7e5d4ad..4abd4a8 100644 --- a/services/webnn/dml/command_recorder_test.cc +++ b/services/webnn/dml/command_recorder_test.cc
@@ -7,6 +7,7 @@ #include "services/webnn/dml/adapter.h" #include "services/webnn/dml/command_recorder.h" +#include "services/webnn/dml/error.h" #include "services/webnn/dml/test_base.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gl/gl_angle_util_win.h" @@ -15,11 +16,22 @@ using Microsoft::WRL::ComPtr; +const size_t kBufferSize = 16; + class WebNNCommandRecorderTest : public TestBase { public: void SetUp() override; protected: + D3D12_HEAP_PROPERTIES CreateHeapProperties(D3D12_HEAP_TYPE type); + D3D12_RESOURCE_DESC CreateResourceDesc(D3D12_RESOURCE_FLAGS flags); + HRESULT CreateUploadBuffer(ComPtr<ID3D12Resource>& resource); + HRESULT CreateDefaultBuffer(ComPtr<ID3D12Resource>& resource); + HRESULT CreateReadbackBuffer(ComPtr<ID3D12Resource>& resource); + D3D12_RESOURCE_BARRIER CreateTransitionBarrier(ID3D12Resource* resource, + D3D12_RESOURCE_STATES before, + D3D12_RESOURCE_STATES after); + scoped_refptr<Adapter> adapter_; }; @@ -37,127 +49,172 @@ ASSERT_NE(adapter_.get(), nullptr); } -TEST_F(WebNNCommandRecorderTest, CreateCommandRecoder) { +D3D12_HEAP_PROPERTIES WebNNCommandRecorderTest::CreateHeapProperties( + D3D12_HEAP_TYPE type) { + return {.Type = type, + .CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN, + .MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN, + .CreationNodeMask = 1, + .VisibleNodeMask = 1}; +} + +D3D12_RESOURCE_DESC WebNNCommandRecorderTest::CreateResourceDesc( + D3D12_RESOURCE_FLAGS flags) { + return {.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER, + .Alignment = 0, + .Width = kBufferSize, + .Height = 1, + .DepthOrArraySize = 1, + .MipLevels = 1, + .Format = DXGI_FORMAT_UNKNOWN, + .SampleDesc = {1, 0}, + .Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR, + .Flags = flags}; +} + +HRESULT WebNNCommandRecorderTest::CreateUploadBuffer( + ComPtr<ID3D12Resource>& resource) { + auto heap_properties = CreateHeapProperties(D3D12_HEAP_TYPE_UPLOAD); + auto resource_desc = CreateResourceDesc(D3D12_RESOURCE_FLAG_NONE); + RETURN_IF_FAILED(adapter_->d3d12_device()->CreateCommittedResource( + &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, + D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, IID_PPV_ARGS(&resource))); + CHECK(resource.Get()); + return S_OK; +} + +HRESULT +WebNNCommandRecorderTest::CreateDefaultBuffer( + ComPtr<ID3D12Resource>& resource) { + auto heap_properties = CreateHeapProperties(D3D12_HEAP_TYPE_DEFAULT); + auto resource_desc = + CreateResourceDesc(D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS); + RETURN_IF_FAILED(adapter_->d3d12_device()->CreateCommittedResource( + &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr, IID_PPV_ARGS(&resource))); + CHECK(resource.Get()); + return S_OK; +} + +HRESULT +WebNNCommandRecorderTest::CreateReadbackBuffer( + ComPtr<ID3D12Resource>& resource) { + auto heap_properties = CreateHeapProperties(D3D12_HEAP_TYPE_READBACK); + auto resource_desc = CreateResourceDesc(D3D12_RESOURCE_FLAG_NONE); + RETURN_IF_FAILED(adapter_->d3d12_device()->CreateCommittedResource( + &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, + D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&resource))); + CHECK(resource.Get()); + return S_OK; +} + +D3D12_RESOURCE_BARRIER WebNNCommandRecorderTest::CreateTransitionBarrier( + ID3D12Resource* resource, + D3D12_RESOURCE_STATES before, + D3D12_RESOURCE_STATES after) { + return {.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION, + .Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE, + .Transition = {.pResource = resource, + .Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, + .StateBefore = before, + .StateAfter = after}}; +} + +TEST_F(WebNNCommandRecorderTest, Create) { EXPECT_NE(CommandRecorder::Create(adapter_), nullptr); } -TEST_F(WebNNCommandRecorderTest, CopyBufferRegionFromCPUToGPU) { - D3D12_HEAP_PROPERTIES heap_properties; - heap_properties.Type = D3D12_HEAP_TYPE_UPLOAD; - heap_properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; - heap_properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; - heap_properties.CreationNodeMask = 1; - heap_properties.VisibleNodeMask = 1; - - D3D12_RESOURCE_DESC resource_desc; - resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; - resource_desc.Alignment = 0; - resource_desc.Width = 16; - resource_desc.Height = 1; - resource_desc.DepthOrArraySize = 1; - resource_desc.MipLevels = 1; - resource_desc.Format = DXGI_FORMAT_UNKNOWN; - resource_desc.SampleDesc = {1, 0}; - resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; - resource_desc.Flags = D3D12_RESOURCE_FLAG_NONE; - - ComPtr<ID3D12Resource> src_resource; - ASSERT_EQ(adapter_->d3d12_device()->CreateCommittedResource( - &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, - D3D12_RESOURCE_STATE_GENERIC_READ, nullptr, - IID_PPV_ARGS(&src_resource)), - S_OK); - ASSERT_NE(src_resource.Get(), nullptr); - - ComPtr<ID3D12Resource> dest_resource; - heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT; - resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; - ASSERT_EQ(adapter_->d3d12_device()->CreateCommittedResource( - &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, - D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr, - IID_PPV_ARGS(&dest_resource)), - S_OK); - ASSERT_NE(dest_resource.Get(), nullptr); - - D3D12_RESOURCE_BARRIER transition_barrier; - transition_barrier.Transition.pResource = dest_resource.Get(); - transition_barrier.Transition.StateBefore = - D3D12_RESOURCE_STATE_UNORDERED_ACCESS; - transition_barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_COPY_DEST; - transition_barrier.Transition.Subresource = - D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; - transition_barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; - transition_barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; - +TEST_F(WebNNCommandRecorderTest, OpenCloseAndExecute) { auto command_recorder = CommandRecorder::Create(adapter_); ASSERT_NE(command_recorder.get(), nullptr); - command_recorder->ResourceBarrier({transition_barrier}); - command_recorder->CopyBufferRegion(dest_resource.Get(), 0, src_resource.Get(), - 0, 16); - transition_barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST; - transition_barrier.Transition.StateAfter = - D3D12_RESOURCE_STATE_UNORDERED_ACCESS; - command_recorder->ResourceBarrier({transition_barrier}); - EXPECT_EQ(command_recorder->CloseAndExecute(), S_OK); + EXPECT_HRESULT_SUCCEEDED(command_recorder->Open()); + EXPECT_HRESULT_SUCCEEDED(command_recorder->CloseAndExecute()); + EXPECT_HRESULT_SUCCEEDED( + command_recorder->GetCommandQueue()->WaitSyncForTesting()); } -TEST_F(WebNNCommandRecorderTest, CopyBufferRegionFromGPUToCPU) { - D3D12_HEAP_PROPERTIES heap_properties; - heap_properties.Type = D3D12_HEAP_TYPE_READBACK; - heap_properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; - heap_properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; - heap_properties.CreationNodeMask = 1; - heap_properties.VisibleNodeMask = 1; - - D3D12_RESOURCE_DESC resource_desc; - resource_desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; - resource_desc.Alignment = 0; - resource_desc.Width = 16; - resource_desc.Height = 1; - resource_desc.DepthOrArraySize = 1; - resource_desc.MipLevels = 1; - resource_desc.Format = DXGI_FORMAT_UNKNOWN; - resource_desc.SampleDesc = {1, 0}; - resource_desc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; - resource_desc.Flags = D3D12_RESOURCE_FLAG_NONE; - - ComPtr<ID3D12Resource> dest_resource; - ASSERT_EQ(adapter_->d3d12_device()->CreateCommittedResource( - &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, - D3D12_RESOURCE_STATE_COPY_DEST, nullptr, - IID_PPV_ARGS(&dest_resource)), - S_OK); - ASSERT_NE(dest_resource.Get(), nullptr); - +TEST_F(WebNNCommandRecorderTest, CopyBufferRegionFromUploadToDefault) { + // Test copying data from upload buffer to default GPU buffer. ComPtr<ID3D12Resource> src_resource; - heap_properties.Type = D3D12_HEAP_TYPE_DEFAULT; - resource_desc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS; - ASSERT_EQ(adapter_->d3d12_device()->CreateCommittedResource( - &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, - D3D12_RESOURCE_STATE_UNORDERED_ACCESS, nullptr, - IID_PPV_ARGS(&src_resource)), - S_OK); - ASSERT_NE(src_resource.Get(), nullptr); - + ASSERT_HRESULT_SUCCEEDED(CreateUploadBuffer(src_resource)); + ComPtr<ID3D12Resource> dst_resource; + ASSERT_HRESULT_SUCCEEDED(CreateDefaultBuffer(dst_resource)); auto command_recorder = CommandRecorder::Create(adapter_); ASSERT_NE(command_recorder.get(), nullptr); - D3D12_RESOURCE_BARRIER transition_barrier; - transition_barrier.Transition.pResource = src_resource.Get(); - transition_barrier.Transition.StateBefore = - D3D12_RESOURCE_STATE_UNORDERED_ACCESS; - transition_barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_COPY_SOURCE; - transition_barrier.Transition.Subresource = - D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES; - transition_barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION; - transition_barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE; - command_recorder->ResourceBarrier({transition_barrier}); - command_recorder->CopyBufferRegion(dest_resource.Get(), 0, src_resource.Get(), - 0, 16); - transition_barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_SOURCE; - transition_barrier.Transition.StateAfter = - D3D12_RESOURCE_STATE_UNORDERED_ACCESS; - command_recorder->ResourceBarrier({transition_barrier}); - EXPECT_EQ(command_recorder->CloseAndExecute(), S_OK); + EXPECT_HRESULT_SUCCEEDED(command_recorder->Open()); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + dst_resource.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_COPY_DEST)}); + command_recorder->CopyBufferRegion(dst_resource.Get(), 0, src_resource.Get(), + 0, kBufferSize); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + dst_resource.Get(), D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}); + EXPECT_HRESULT_SUCCEEDED(command_recorder->CloseAndExecute()); + EXPECT_HRESULT_SUCCEEDED( + command_recorder->GetCommandQueue()->WaitSyncForTesting()); +} + +TEST_F(WebNNCommandRecorderTest, CopyBufferRegionFromDefaultToReadback) { + // Testing copying data from default GPU buffer to readback buffer. + ComPtr<ID3D12Resource> src_resource; + ASSERT_HRESULT_SUCCEEDED(CreateDefaultBuffer(src_resource)); + ComPtr<ID3D12Resource> dst_resource; + ASSERT_HRESULT_SUCCEEDED(CreateReadbackBuffer(dst_resource)); + auto command_recorder = CommandRecorder::Create(adapter_); + ASSERT_NE(command_recorder.get(), nullptr); + EXPECT_HRESULT_SUCCEEDED(command_recorder->Open()); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + src_resource.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_COPY_SOURCE)}); + command_recorder->CopyBufferRegion(dst_resource.Get(), 0, src_resource.Get(), + 0, kBufferSize); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + src_resource.Get(), D3D12_RESOURCE_STATE_COPY_SOURCE, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}); + EXPECT_HRESULT_SUCCEEDED(command_recorder->CloseAndExecute()); + EXPECT_HRESULT_SUCCEEDED( + command_recorder->GetCommandQueue()->WaitSyncForTesting()); +} + +TEST_F(WebNNCommandRecorderTest, MultipleSubmissionsWithOneWait) { + // Test submitting multiple command lists with one wait for GPU to complete. + // Submit the command that copies data from upload buffer to default GPU + // buffer. + ComPtr<ID3D12Resource> upload_resource; + ASSERT_HRESULT_SUCCEEDED(CreateUploadBuffer(upload_resource)); + ComPtr<ID3D12Resource> default_resource; + ASSERT_HRESULT_SUCCEEDED(CreateDefaultBuffer(default_resource)); + auto command_recorder = CommandRecorder::Create(adapter_); + ASSERT_NE(command_recorder.get(), nullptr); + EXPECT_HRESULT_SUCCEEDED(command_recorder->Open()); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + default_resource.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_COPY_DEST)}); + command_recorder->CopyBufferRegion(default_resource.Get(), 0, + upload_resource.Get(), 0, kBufferSize); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + default_resource.Get(), D3D12_RESOURCE_STATE_COPY_DEST, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}); + EXPECT_HRESULT_SUCCEEDED(command_recorder->CloseAndExecute()); + + // Submit the command that copies data from default buffer to readback buffer. + ComPtr<ID3D12Resource> readback_resource; + ASSERT_HRESULT_SUCCEEDED(CreateReadbackBuffer(readback_resource)); + EXPECT_HRESULT_SUCCEEDED(command_recorder->Open()); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + default_resource.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS, + D3D12_RESOURCE_STATE_COPY_SOURCE)}); + command_recorder->CopyBufferRegion(readback_resource.Get(), 0, + default_resource.Get(), 0, kBufferSize); + command_recorder->ResourceBarrier({CreateTransitionBarrier( + default_resource.Get(), D3D12_RESOURCE_STATE_COPY_SOURCE, + D3D12_RESOURCE_STATE_UNORDERED_ACCESS)}); + EXPECT_HRESULT_SUCCEEDED(command_recorder->CloseAndExecute()); + + // Wait for GPU to complete the execution of both command lists. + EXPECT_HRESULT_SUCCEEDED( + command_recorder->GetCommandQueue()->WaitSyncForTesting()); } } // namespace webnn::dml
diff --git a/services/webnn/dml/error.h b/services/webnn/dml/error.h new file mode 100644 index 0000000..f5b9db4 --- /dev/null +++ b/services/webnn/dml/error.h
@@ -0,0 +1,36 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_WEBNN_DML_ERROR_H_ +#define SERVICES_WEBNN_DML_ERROR_H_ + +#include <winerror.h> + +#include "base/logging.h" + +namespace webnn::dml { + +#define RETURN_IF_FAILED(d3d_func) \ + do { \ + HRESULT hr = d3d_func; \ + if (FAILED(hr)) { \ + DLOG(ERROR) << "Failed to call " << #d3d_func << ": " \ + << logging::SystemErrorCodeToString(hr); \ + return hr; \ + } \ + } while (0) + +#define RETURN_NULL_IF_FAILED(d3d_func) \ + do { \ + HRESULT hr = d3d_func; \ + if (FAILED(hr)) { \ + DLOG(ERROR) << "Failed to call " << #d3d_func << ": " \ + << logging::SystemErrorCodeToString(hr); \ + return nullptr; \ + } \ + } while (0) + +} // namespace webnn::dml + +#endif // SERVICES_WEBNN_DML_ERROR_H_
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 80d436c..c521f60b 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -3389,6 +3389,25 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04", + "pool": "chrome.tests", + "ssd": "0" + } + ], + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" },
diff --git a/testing/buildbot/chromium.cft.json b/testing/buildbot/chromium.cft.json index a43fe4f..91e88249 100644 --- a/testing/buildbot/chromium.cft.json +++ b/testing/buildbot/chromium.cft.json
@@ -1187,6 +1187,25 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "arm64", + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -3369,6 +3388,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -7457,6 +7494,25 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index f35b79db..eb8c5210 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -5669,9 +5669,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -5682,8 +5682,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -5834,9 +5834,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -5847,8 +5847,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -5981,9 +5981,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -5994,8 +5994,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 6ce2b84..e38183e 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -1059,6 +1059,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -2589,6 +2606,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -4138,6 +4173,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -11415,6 +11468,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -13039,6 +13109,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -14523,6 +14613,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -15990,6 +16097,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04", + "pool": "chrome.tests" + } + ], + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -18117,6 +18242,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -19535,6 +19677,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -26322,6 +26481,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -27906,6 +28082,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -29454,6 +29647,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -31106,6 +31316,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -32787,6 +33015,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -34468,6 +34714,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -36917,6 +37181,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10", + "pool": "chrome.tests" + } + ], + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -38598,6 +38880,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10", + "pool": "chrome.tests" + } + ], + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -41954,6 +42254,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" },
diff --git a/testing/buildbot/chromium.coverage.json b/testing/buildbot/chromium.coverage.json index 7eefa60..364be3f 100644 --- a/testing/buildbot/chromium.coverage.json +++ b/testing/buildbot/chromium.coverage.json
@@ -22166,6 +22166,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -23701,6 +23719,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -25493,9 +25529,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -25506,8 +25542,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -25658,9 +25694,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -25671,8 +25707,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -25805,9 +25841,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -25818,8 +25854,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -26189,6 +26225,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -29190,6 +29244,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index bf8a41e7..3c4a7d9 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -2855,6 +2855,17 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": false + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43191,9 +43202,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43203,8 +43214,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -43356,9 +43367,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43368,8 +43379,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -43503,9 +43514,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -43515,8 +43526,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -43887,6 +43898,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04", + "ssd": "0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -44980,9 +45009,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -44992,8 +45021,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -45145,9 +45174,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -45157,8 +45186,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -45292,9 +45321,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -45304,8 +45333,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -45676,6 +45705,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04", + "ssd": "0" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -46040,9 +46087,9 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome" + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -46052,8 +46099,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -47578,6 +47625,26 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04", + "pool": "chromium.tests.no-external-ip" + } + ], + "expiration": 43200, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -53066,6 +53133,27 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045", + "pool": "chromium.tests.no-external-ip" + } + ], + "expiration": 43200, + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 61377f6..88a4336f 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -2984,6 +2984,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -5316,6 +5334,28 @@ "--use-weston", "--ozone-platform=wayland" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--no-xvfb", + "--use-weston", + "--ozone-platform=wayland" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -6811,6 +6851,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" },
diff --git a/testing/buildbot/chromium.memory.fyi.json b/testing/buildbot/chromium.memory.fyi.json index b0d6eaf..22afd43 100644 --- a/testing/buildbot/chromium.memory.fyi.json +++ b/testing/buildbot/chromium.memory.fyi.json
@@ -1281,6 +1281,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -2952,6 +2972,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -4470,6 +4510,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index b9b88dcc..e5c40326 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -1281,6 +1281,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -2842,6 +2862,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -4511,6 +4548,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -6371,6 +6428,27 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -8146,6 +8224,27 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-20.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -9817,6 +9916,26 @@ "args": [ "--test-launcher-print-test-stdio=always" ], + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-22.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -18080,12 +18199,12 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.interactive_ui_tests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -18096,8 +18215,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -18265,12 +18384,12 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -18281,8 +18400,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -18427,12 +18546,12 @@ { "args": [ "--test-launcher-filter-file=../../testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter", - "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome", + "--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome", "--test-launcher-print-test-stdio=always", "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], - "description": "Run with ash-chrome version 116.0.5813.0", + "description": "Run with ash-chrome version 116.0.5814.0", "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -18443,8 +18562,8 @@ "cipd_packages": [ { "cipd_package": "chromium/testing/linux-ash-chromium/x86_64/ash.zip", - "location": "lacros_version_skew_tests_v116.0.5813.0", - "revision": "version:116.0.5813.0" + "location": "lacros_version_skew_tests_v116.0.5814.0", + "revision": "version:116.0.5814.0" } ], "dimension_sets": [ @@ -18910,6 +19029,29 @@ "--combine-ash-logs-on-bots", "--asan-symbolize-output" ], + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always", + "--combine-ash-logs-on-bots", + "--asan-symbolize-output" + ], "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -20379,6 +20521,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-18.04" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -21847,6 +22006,23 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" },
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index 28f0a5d..1e07fc3 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -1438,6 +1438,25 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" @@ -3524,6 +3543,24 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-19045" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py" }, @@ -5500,6 +5537,25 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-11-22000" + } + ], + "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter b/testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter index 7db7cc46..80d98c3f 100644 --- a/testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter +++ b/testing/buildbot/filters/linux-lacros.lacros_chrome_browsertests.skew.filter
@@ -13,3 +13,4 @@ # crbug.com/1451234 -WebAppIntegration* +-LacrosTtsApiTest*
diff --git a/testing/buildbot/generate_buildbot_json.py b/testing/buildbot/generate_buildbot_json.py index 5b66c3bc..da6848ac 100755 --- a/testing/buildbot/generate_buildbot_json.py +++ b/testing/buildbot/generate_buildbot_json.py
@@ -17,7 +17,6 @@ import itertools import json import os -import six import string import sys @@ -450,9 +449,8 @@ try: return ast.literal_eval(self.read_file(pyl_file_path)) except (SyntaxError, ValueError) as e: # pragma: no cover - six.raise_from( - BBGenErr('Failed to parse pyl file "%s": %s' % - (pyl_file_path, e)), e) # pragma: no cover + raise BBGenErr('Failed to parse pyl file "%s": %s' % + (pyl_file_path, e)) from e # pylint: enable=inconsistent-return-statements # TOOD(kbr): require that os_type be specified for all bots in waterfalls.pyl. @@ -641,11 +639,10 @@ path + [str(key), str(idx)], update=update) except (IndexError, TypeError) as e: - six.raise_from( - BBGenErr('Error merging lists by key "%s" from source %s ' - 'into target %s at index %s. Verify target list ' - 'length is equal or greater than source' % - (str(key), str(b), str(a), str(idx))), e) + raise BBGenErr('Error merging lists by key "%s" from source %s ' + 'into target %s at index %s. Verify target list ' + 'length is equal or greater than source' % + (str(key), str(b), str(a), str(idx))) from e elif update: if b[key] is None: del a[key]
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index f2dbe19..26afa2b 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1433,6 +1433,10 @@ "label": "//chrome/browser/metrics/perf:profile_provider_unittest", "type": "console_test_launcher", }, + "pthreadpool_unittests": { + "label": "//third_party/pthreadpool:pthreadpool_unittests", + "type": "console_test_launcher", + }, "push_apps_to_background_apk": { "label": "//tools/android/push_apps_to_background:push_apps_to_background_apk", "type": "additional_compile_target",
diff --git a/testing/buildbot/internal.chrome.fyi.json b/testing/buildbot/internal.chrome.fyi.json index 2845200..51ef1ea7 100644 --- a/testing/buildbot/internal.chrome.fyi.json +++ b/testing/buildbot/internal.chrome.fyi.json
@@ -1756,6 +1756,28 @@ "test_id_prefix": "ninja://printing:printing_unittests/" }, { + "ci_only": true, + "isolate_profile_data": true, + "merge": { + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": null, + "os": "Windows-11", + "pool": "chrome.tests.arm64" + } + ], + "expiration": 64800, + "hard_timeout": 43200, + "service_account": "chrome-tester@chops-service-accounts.iam.gserviceaccount.com" + }, + "test": "pthreadpool_unittests", + "test_id_prefix": "ninja://third_party/pthreadpool:pthreadpool_unittests/" + }, + { "isolate_profile_data": true, "merge": { "script": "//testing/merge_scripts/standard_gtest_merge.py"
diff --git a/testing/buildbot/manage.py b/testing/buildbot/manage.py index d5d73906..55e37a94 100755 --- a/testing/buildbot/manage.py +++ b/testing/buildbot/manage.py
@@ -15,7 +15,6 @@ import glob import json import os -import six import subprocess import sys @@ -220,8 +219,7 @@ try: config = json.loads(content) except ValueError as e: - six.raise_from( - Error('Exception raised while checking %s: %s' % (filepath, e)), e) + raise Error('Exception raised while checking %s: %s' % (filepath, e)) from e for builder, data in sorted(config.items()): if builder in SKIP:
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 82f3067..ceaa7d0 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -3640,6 +3640,14 @@ }, }, }, + 'pthreadpool_unittests': { + 'remove_from': [ + # pthreadpool is not built for ChromeOS currently. + 'linux-chromeos-dbg', + 'linux-chromeos-rel', + 'linux-lacros-tester-rel', + ], + }, 'sandbox_linux_unittests': { 'modifications': { # If you change this, make similar changes in android-x86-code-coverage below
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 4252f45..43b54881 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -1086,6 +1086,12 @@ }, 'chromium_gtests_for_win_and_linux_only': { + # pthreadpool is only built on Windows and Linux platforms, that is + # determined by `build_tflite_with_xnnpack` defined in + # third_party/tflite/features.gni. + 'pthreadpool_unittests': { + 'ci_only': True, + }, }, 'chromium_ios_scripts': {
diff --git a/testing/buildbot/variants.pyl b/testing/buildbot/variants.pyl index d1df5d6..ad8fc0b 100644 --- a/testing/buildbot/variants.pyl +++ b/testing/buildbot/variants.pyl
@@ -22,16 +22,16 @@ }, 'LACROS_VERSION_SKEW_CANARY': { 'args': [ - '--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5813.0/test_ash_chrome', + '--ash-chrome-path-override=../../lacros_version_skew_tests_v116.0.5814.0/test_ash_chrome', ], - 'description': 'Run with ash-chrome version 116.0.5813.0', + 'description': 'Run with ash-chrome version 116.0.5814.0', 'identifier': 'Lacros version skew testing ash canary', 'swarming': { 'cipd_packages': [ { 'cipd_package': 'chromium/testing/linux-ash-chromium/x86_64/ash.zip', - 'location': 'lacros_version_skew_tests_v116.0.5813.0', - 'revision': 'version:116.0.5813.0', + 'location': 'lacros_version_skew_tests_v116.0.5814.0', + 'revision': 'version:116.0.5814.0', }, ], },
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 6d22cbc..c41cde2 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -8835,15 +8835,7 @@ "experiments": [ { "name": "DesktopExperiments", - "params": { - "EntitySuggestionsReduceLatencyDecoderTimeout": "405" - }, "enable_features": [ - "OmniboxBlurWithEscape", - "OmniboxClosePopupWithEscape", - "OmniboxEntitySuggestionsReduceLatency", - "OmniboxKeywordSearchButton", - "OmniboxPreserveLongerShortcutsText", "OmniboxRemoveSuggestionsFromClipboard", "OmniboxUIExperimentMaxAutocompleteMatches" ], @@ -15192,6 +15184,28 @@ ] } ], + "WebRtcInitializeEncoderOnFirstFrame": [ + { + "platforms": [ + "android", + "android_webview", + "chromeos", + "chromeos_lacros", + "ios", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "WebRtcInitializeEncoderOnFirstFrame" + ] + } + ] + } + ], "WebRtcLegacyGetStatsThrows": [ { "platforms": [
diff --git a/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom b/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom index 4359f51e..84d0bdc8e 100644 --- a/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom +++ b/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom
@@ -13,6 +13,7 @@ import "third_party/blink/public/mojom/service_worker/service_worker_fetch_handler_type.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; +import "third_party/blink/public/mojom/service_worker/service_worker_router_rule.mojom"; import "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom"; // Represents a service worker that is a 'controller'. @@ -89,6 +90,16 @@ // this value. string? sha256_script_checksum; + // Experimental feature (crbug.com/1371756). + // https://github.com/yoshisatoyanagisawa/service-worker-static-routing-api + // + // The static routing API allows flexible routings to pages under the + // ServiceWorker control. If the routes are well configured, this brings the + // performance improvement to the pages under the ServiceWorker control. + // + // This router rules is used for routing subresourcecs in the renderer-side. + ServiceWorkerRouterRules? router_rules; + // Non-null iff there is a controller and it has a fetch event handler. pending_remote<ControllerServiceWorker>? remote_controller;
diff --git a/third_party/blink/renderer/core/layout/box_layout_extra_input.h b/third_party/blink/renderer/core/layout/box_layout_extra_input.h index c3b095f..aefb4d06 100644 --- a/third_party/blink/renderer/core/layout/box_layout_extra_input.h +++ b/third_party/blink/renderer/core/layout/box_layout_extra_input.h
@@ -43,13 +43,9 @@ // purposes of percent block-size resolution. bool is_override_block_size_definite = true; - // If an 'auto' inline/block-size should stretch to the available size. - bool stretch_inline_size_if_auto = false; + // If an 'auto' block-size should stretch to the available size. bool stretch_block_size_if_auto = false; - // Available inline size. https://drafts.csswg.org/css-sizing/#available - LayoutUnit available_inline_size; - // The content size of the containing block. These are somewhat vague legacy // layout values, that typically either mean available size or percentage // resolution size.
diff --git a/third_party/blink/renderer/core/layout/layout_box.cc b/third_party/blink/renderer/core/layout/layout_box.cc index 1650a5c..f37e7f68 100644 --- a/third_party/blink/renderer/core/layout/layout_box.cc +++ b/third_party/blink/renderer/core/layout/layout_box.cc
@@ -2038,11 +2038,6 @@ return extra_input_ && extra_input_->is_override_block_size_definite; } -bool LayoutBox::StretchInlineSizeIfAuto() const { - NOT_DESTROYED(); - return extra_input_ && extra_input_->stretch_inline_size_if_auto; -} - bool LayoutBox::StretchBlockSizeIfAuto() const { NOT_DESTROYED(); return extra_input_ && extra_input_->stretch_block_size_if_auto; @@ -2129,14 +2124,6 @@ EnsureRareData().has_override_containing_block_content_logical_width_ = false; } -LayoutUnit LayoutBox::OverrideAvailableInlineSize() const { - NOT_DESTROYED(); - DCHECK(HasOverrideAvailableInlineSize()); - if (extra_input_) - return extra_input_->available_inline_size; - return LayoutUnit(); -} - LayoutUnit LayoutBox::AdjustBorderBoxLogicalWidthForBoxSizing( float width) const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index 444c734..feb05f3 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -859,7 +859,6 @@ LayoutUnit OverrideLogicalHeight() const; LayoutUnit OverrideLogicalWidth() const; bool IsOverrideLogicalHeightDefinite() const; - bool StretchInlineSizeIfAuto() const; bool StretchBlockSizeIfAuto() const; bool HasOverrideLogicalHeight() const; bool HasOverrideLogicalWidth() const; @@ -874,15 +873,6 @@ void SetOverrideContainingBlockContentLogicalWidth(LayoutUnit); void ClearOverrideContainingBlockContentSize(); - // When an available inline size override has been set, we'll use that to fill - // available inline size, rather than deducing it from the containing block - // (and then subtract space taken up by adjacent floats). - LayoutUnit OverrideAvailableInlineSize() const; - bool HasOverrideAvailableInlineSize() const { - NOT_DESTROYED(); - return extra_input_; - } - LayoutUnit AdjustBorderBoxLogicalWidthForBoxSizing(float width) const; LayoutUnit AdjustBorderBoxLogicalHeightForBoxSizing(float height) const; LayoutUnit AdjustContentBoxLogicalWidthForBoxSizing(float width) const;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc index d9da70c..1af3a34a 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_layout_algorithm.cc
@@ -1275,7 +1275,7 @@ if (!column_spanner_path_) { const TextWrap text_wrap = Style().GetTextWrap(); initiate_balancing = text_wrap == TextWrap::kBalance && !break_token; - if (UNLIKELY(text_wrap == TextWrap::kPretty)) { + if (UNLIKELY(text_wrap == TextWrap::kPretty || initiate_balancing)) { score_line_break_context = context_->ScoreLineBreakContext(); use_score_line_break = score_line_break_context && score_line_break_context->IsActive(); @@ -1336,9 +1336,21 @@ DCHECK_GT(line_opportunity.AvailableInlineSize(), LayoutUnit()); DCHECK_EQ(opportunity.rect.BlockEndOffset(), LayoutUnit::Max()); DCHECK(!opportunity.HasShapeExclusions()); - context_->SetBalancedAvailableWidth( - NGParagraphLineBreaker::AttemptParagraphBalancing( - Node(), ConstraintSpace(), line_opportunity)); + if (use_score_line_break) { + DCHECK(RuntimeEnabledFeatures::CSSTextWrapBalanceByScoreEnabled()); + DCHECK_EQ(ConstraintSpace().AvailableSize().inline_size, + line_opportunity.AvailableInlineSize()); + DCHECK(score_line_break_context->LineBreakPoints().empty()); + DCHECK_EQ(score_line_break_context->LineBreakPointsIndex(), 0u); + NGScoreLineBreaker optimizer(Node(), ConstraintSpace(), + line_opportunity, break_token, + &ExclusionSpace()); + optimizer.BalanceBreakPoints(*score_line_break_context); + } else { + context_->SetBalancedAvailableWidth( + NGParagraphLineBreaker::AttemptParagraphBalancing( + Node(), ConstraintSpace(), line_opportunity)); + } } else if (use_score_line_break) { DCHECK(score_line_break_context->LineBreakPoints().empty()); DCHECK_EQ(score_line_break_context->LineBreakPointsIndex(), 0u);
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc index 6893d2e..a6bfe44 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.cc
@@ -1330,8 +1330,6 @@ }; ShapingLineBreaker breaker(&item_shape_result, &break_iterator_, hyphenation_, shape_callback, &shape_callback_context); - if (!enable_soft_hyphen_) - breaker.DisableSoftHyphen(); // Use kStartShouldBeSafe if at the beginning of a line. unsigned options = ShapingLineBreaker::kDefaultOptions; @@ -1588,14 +1586,6 @@ if (wtf_size_t word_len = non_hangable_run_end - start_offset) { // Ignore soft-hyphen opportunities if `hyphens: none`. bool has_hyphen = text[non_hangable_run_end - 1] == kSoftHyphenCharacter; - if (UNLIKELY(has_hyphen && !enable_soft_hyphen_ && - non_hangable_run_end == end_offset)) { - ++end_offset; - if (end_offset < item.EndOffset()) - continue; - has_hyphen = false; - } - if (UNLIKELY(hyphenation_)) { // When 'hyphens: auto', compute all hyphenation opportunities. if (!hyphen_inline_size) { @@ -1828,12 +1818,7 @@ wtf_size_t next_offset; if (auto_wrap_) { const wtf_size_t len = std::min(offset.end + 1, text_content.length()); - next_offset = offset.start; - do { - next_offset = - break_iterator_.NextBreakOpportunity(next_offset + 1, len); - } while (UNLIKELY(!enable_soft_hyphen_) && next_offset < len && - text_content[next_offset - 1] == kSoftHyphenCharacter); + next_offset = break_iterator_.NextBreakOpportunity(offset.start + 1, len); } else { next_offset = offset.end + 1; } @@ -1996,7 +1981,6 @@ } const wtf_size_t next_offset = break_iterator_.NextBreakOpportunity(offset.start + 1); - // TODO: soft-hyphen return next_offset < offset.end; } @@ -3411,7 +3395,8 @@ // Check that cache fields are already setup correctly. DCHECK_EQ(auto_wrap_, ShouldAutoWrap(style)); if (auto_wrap_) { - DCHECK_EQ(enable_soft_hyphen_, style.GetHyphens() != Hyphens::kNone); + DCHECK_EQ(break_iterator_.IsSoftHyphenEnabled(), + style.GetHyphens() != Hyphens::kNone); DCHECK_EQ(break_iterator_.Locale(), style.LocaleForLineBreakIterator()); } ShapeResultSpacing<String> spacing(spacing_.Text(), is_svg_text_); @@ -3456,7 +3441,7 @@ } break_iterator_.SetBreakType(line_break_type); - enable_soft_hyphen_ = style.GetHyphens() != Hyphens::kNone; + break_iterator_.EnableSoftHyphen(style.GetHyphens() != Hyphens::kNone); hyphenation_ = style.GetHyphenationWithLimits(); if (style.ShouldBreakSpaces()) {
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h index e99323b..0f4283c 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_line_breaker.h
@@ -311,9 +311,6 @@ // boundaries for 'break-word' after overflow. bool override_break_anywhere_ = false; - // True when breaking at soft hyphens (U+00AD) is allowed. - bool enable_soft_hyphen_ = true; - bool disable_score_line_break_ = false; // True when the line should be non-empty if |IsLastLine|..
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index bddb2a4b..9ed5452 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -215,6 +215,10 @@ DCHECK(RuntimeEnabledFeatures::CSSTextWrapPrettyEnabled()); return !node.IsScoreLineBreakDisabled(); } + if (UNLIKELY(wrap == TextWrap::kBalance)) { + return RuntimeEnabledFeatures::CSSTextWrapBalanceByScoreEnabled() && + !node.IsScoreLineBreakDisabled(); + } return false; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 0096ee84..19b2e89f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -270,8 +270,6 @@ // resolve percentages. DCHECK_GE(input->containing_block_content_inline_size, LayoutUnit()); - input->available_inline_size = space.AvailableSize().inline_size; - if (space.IsFixedInlineSize()) input->override_inline_size = space.AvailableSize().inline_size; if (space.IsFixedBlockSize()) { @@ -279,7 +277,6 @@ input->is_override_block_size_definite = !space.IsInitialBlockSizeIndefinite(); } - input->stretch_inline_size_if_auto = space.IsInlineAutoBehaviorStretch(); input->stretch_block_size_if_auto = space.IsBlockAutoBehaviorStretch() && space.AvailableSize().block_size != kIndefiniteSize;
diff --git a/third_party/blink/renderer/core/layout/ng/svg/layout_ng_svg_foreign_object_test.cc b/third_party/blink/renderer/core/layout/ng/svg/layout_ng_svg_foreign_object_test.cc index 3a8249f..a3ce42fc 100644 --- a/third_party/blink/renderer/core/layout/ng/svg/layout_ng_svg_foreign_object_test.cc +++ b/third_party/blink/renderer/core/layout/ng/svg/layout_ng_svg_foreign_object_test.cc
@@ -488,4 +488,22 @@ // Pass if no DCHECK failures. } +TEST_F(LayoutNGSVGForeignObjectTest, LocalToAncestorPoint) { + SetBodyInnerHTML(R"HTML( +<style>body { margin:0; }</style> +<div style="height:3px"></div> +<svg width="200" height="100"> +<foreignObject id="foreign" width="200" height="100"> +<body xmlns="http://www.w3.org/1999/xhtml"> +<div style="height:17px"></div> +<div id="target">b</div> +</body> +</foreignObject> +</svg>)HTML"); + LayoutObject* target = GetLayoutObjectByElementId("target"); + LayoutBox* foreign = GetLayoutBoxByElementId("foreign"); + EXPECT_NE(target->LocalToAbsolutePoint(PhysicalOffset()), + target->LocalToAncestorPoint(PhysicalOffset(), foreign)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc index f6b8e23..c1faa76 100644 --- a/third_party/blink/renderer/core/layout/scroll_anchor_test.cc +++ b/third_party/blink/renderer/core/layout/scroll_anchor_test.cc
@@ -21,6 +21,8 @@ #include "third_party/blink/renderer/core/page/print_context.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" #include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" +#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" +#include "third_party/blink/renderer/core/testing/scoped_mock_overlay_scrollbars.h" #include "third_party/blink/renderer/core/testing/sim/sim_request.h" #include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h" @@ -1268,4 +1270,36 @@ // anchor, so we should have selected one of the spacers as the anchor. EXPECT_NE(old_bounds->y(), new_bounds->y()); } + +class ScrollAnchorPageTest : public RenderingTest {}; + +// crbug.com/1443633 +TEST_F(ScrollAnchorPageTest, SvgRelativeBoundsCrashAfterClearLayoutResults) { + USE_NON_OVERLAY_SCROLLBARS(); + SetBodyInnerHTML(R"HTML( +<style>body { font-size: 18px; }</style> +<div style="overflow:auto; columns:1; column-fill:auto; width:300px; height:350px;"> + <svg viewbox="0 0 100 100"> + <foreignObject style="width:100px; height:2px;"> + <span id="target"><br>foo</span> + </foreignObject> + </svg> + <div id="scrollbarSummoner" style="display:none;"> + <div style="height:200px;"></div> + </div> +</div>)HTML"); + Document& doc = GetDocument(); + doc.UpdateStyleAndLayout(DocumentUpdateReason::kTest); + + doc.getElementById("target")->scrollIntoView(); + doc.getElementById("scrollbarSummoner") + ->setAttribute(html_names::kStyleAttr, + "display:block; contain:size; height:0"); + + // During the following layout, ClearLayoutResults() for the first <div> was + // called, then ScrollAnchor::NotifyBeforeLayout() for <foreignObject> was + // called. It accessed the geometry of the first <div>. + doc.UpdateStyleAndLayout(DocumentUpdateReason::kTest); + // Pass if no crashes. +} }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_inline_test.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_inline_test.cc index 3927bc9..435ce72 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_inline_test.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_inline_test.cc
@@ -22,4 +22,20 @@ EXPECT_FALSE(a->SlowFirstChild()); } +TEST_F(LayoutSVGInlineTest, LocalToAncestorPoint) { + SetBodyInnerHTML(R"HTML( +<style>body { margin:0; }</style> +<div style="height:3px"></div> +<svg width="200" height="100"> +<text> +<tspan id="container">abc<a id="target">foo</a></tspan> +</text> +</svg>)HTML"); + LayoutObject* target = GetLayoutObjectByElementId("target"); + LayoutSVGInline* container = + To<LayoutSVGInline>(GetLayoutObjectByElementId("container")); + EXPECT_NE(target->LocalToAbsolutePoint(PhysicalOffset()), + target->LocalToAncestorPoint(PhysicalOffset(), container)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc b/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc index 5a3fd42..7a9626c 100644 --- a/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc +++ b/third_party/blink/renderer/core/layout/svg/svg_layout_support.cc
@@ -191,6 +191,10 @@ const LayoutBoxModelObject* ancestor, TransformState& transform_state, MapCoordinatesFlags flags) { + if (RuntimeEnabledFeatures::SvgMapLocalToAncestorFixEnabled() && + object == ancestor) { + return; + } transform_state.ApplyTransform(object->LocalToSVGParentTransform()); LayoutObject* parent = object->Parent();
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc index 0d5fc25f..89133b72 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.cc
@@ -20,8 +20,7 @@ shape_callback_context_(shape_callback_context), result_(result), break_iterator_(break_iterator), - hyphenation_(hyphenation), - is_soft_hyphen_enabled_(true) { + hyphenation_(hyphenation) { // Line breaking performance relies on high-performance x-position to // character offset lookup. Ensure that the desired cache has been computed. DCHECK(result_); @@ -159,24 +158,12 @@ ShapingLineBreaker::BreakOpportunity ShapingLineBreaker::PreviousBreakOpportunity(unsigned offset, unsigned start) const { - const String& text = GetText(); - if (UNLIKELY(!IsSoftHyphenEnabled())) { - for (;; offset--) { - offset = break_iterator_->PreviousBreakOpportunity(offset, start); - if (offset <= start || offset >= text.length() || - text[offset - 1] != kSoftHyphenCharacter) { - if (IsBreakableSpace(text[offset - 1])) - return {offset, FindNonHangableEnd(text, offset - 1), false}; - return {offset, false}; - } - } - } - if (UNLIKELY(hyphenation_)) return Hyphenate(offset, start, true); // If the break opportunity is preceded by trailing spaces, find the // end of non-hangable character (i.e., start of the space run). + const String& text = GetText(); unsigned break_offset = break_iterator_->PreviousBreakOpportunity(offset, start); if (IsBreakableSpace(text[break_offset - 1])) @@ -189,24 +176,13 @@ unsigned offset, unsigned start, unsigned len) const { - const String& text = GetText(); - if (UNLIKELY(!IsSoftHyphenEnabled())) { - for (;; offset++) { - offset = break_iterator_->NextBreakOpportunity(offset); - if (offset >= text.length() || text[offset - 1] != kSoftHyphenCharacter) { - if (IsBreakableSpace(text[offset - 1])) - return {offset, FindNonHangableEnd(text, offset - 1), false}; - return {offset, false}; - } - } - } - if (UNLIKELY(hyphenation_)) return Hyphenate(offset, start, false); // We should also find the beginning of the space run to find the // end of non-hangable character (i.e., start of the space run), // which may be useful to avoid reshaping. + const String& text = GetText(); unsigned break_offset = break_iterator_->NextBreakOpportunity(offset, len); if (IsBreakableSpace(text[break_offset - 1])) return {break_offset, FindNonHangableEnd(text, break_offset - 1), false};
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h index 54c9713..5bd6d79 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h +++ b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker.h
@@ -106,10 +106,6 @@ unsigned end, unsigned options); - // Disable breaking at soft hyphens (U+00AD). - bool IsSoftHyphenEnabled() const { return is_soft_hyphen_enabled_; } - void DisableSoftHyphen() { is_soft_hyphen_enabled_ = false; } - private: const String& GetText() const; @@ -167,7 +163,6 @@ scoped_refptr<const ShapeResult> result_; const LazyLineBreakIterator* break_iterator_; const Hyphenation* hyphenation_; - bool is_soft_hyphen_enabled_; friend class ShapingLineBreakerTest; };
diff --git a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker_test.cc b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker_test.cc index 5936dc3..a82d529 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/shaping_line_breaker_test.cc
@@ -408,7 +408,7 @@ testing::ElementsAreArray(data.break_positions)); if (!data.break_positions_with_soft_hyphen_disabled.empty()) { - breaker.DisableSoftHyphen(); + break_iterator.EnableSoftHyphen(false); EXPECT_THAT(BreakPositionsByNext(breaker, string), testing::ElementsAreArray( data.break_positions_with_soft_hyphen_disabled)); @@ -430,7 +430,7 @@ testing::ElementsAreArray(data.break_positions)); if (!data.break_positions_with_soft_hyphen_disabled.empty()) { - breaker.DisableSoftHyphen(); + break_iterator.EnableSoftHyphen(false); EXPECT_THAT(BreakPositionsByPrevious(breaker, string), testing::ElementsAreArray( data.break_positions_with_soft_hyphen_disabled));
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index de23f4da2..83e49901 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -3416,6 +3416,10 @@ base_feature: "none", }, { + name: "SvgMapLocalToAncestorFix", + status: "stable", + }, + { name: "SvgRasterOptimizations", status: "experimental", },
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 d305427..adaaf17 100644 --- a/third_party/blink/renderer/platform/text/text_break_iterator.cc +++ b/third_party/blink/renderer/platform/text/text_break_iterator.cc
@@ -374,8 +374,11 @@ // Adjust the offset by |start_offset_| because |break_iterator| has // text after |start_offset_|. DCHECK_GE(i + prior_context.length, start_offset_); - next_break = break_iterator->following( - i - 1 + prior_context.length - start_offset_); + next_break = i - 1 + prior_context.length - start_offset_; + do { + next_break = break_iterator->following(next_break); + } while (UNLIKELY(disable_soft_hyphen_ && next_break > 0 && + str[next_break - 1] == kSoftHyphenCharacter)); if (next_break >= 0) { next_break = next_break + start_offset_ - prior_context.length; }
diff --git a/third_party/blink/renderer/platform/text/text_break_iterator.h b/third_party/blink/renderer/platform/text/text_break_iterator.h index 091f10f6..59aff8e2 100644 --- a/third_party/blink/renderer/platform/text/text_break_iterator.h +++ b/third_party/blink/renderer/platform/text/text_break_iterator.h
@@ -236,6 +236,10 @@ BreakSpaceType BreakSpace() const { return break_space_; } void SetBreakSpace(BreakSpaceType break_space) { break_space_ = break_space; } + // Enable/disable breaking at soft hyphens (U+00AD). Enabled by default. + bool IsSoftHyphenEnabled() const { return !disable_soft_hyphen_; } + void EnableSoftHyphen(bool value) { disable_soft_hyphen_ = !value; } + inline bool IsBreakable(int pos, int& next_breakable, LineBreakType line_break_type) const { @@ -344,6 +348,7 @@ unsigned start_offset_ = 0; LineBreakType break_type_; BreakSpaceType break_space_ = BreakSpaceType::kBeforeEverySpace; + bool disable_soft_hyphen_ = false; }; // Iterates over "extended grapheme clusters", as defined in UAX #29.
diff --git a/third_party/blink/renderer/platform/text/text_break_iterator_test.cc b/third_party/blink/renderer/platform/text/text_break_iterator_test.cc index decf6a4..98f5ea4 100644 --- a/third_party/blink/renderer/platform/text/text_break_iterator_test.cc +++ b/third_party/blink/renderer/platform/text/text_break_iterator_test.cc
@@ -79,7 +79,7 @@ return result; } - private: + protected: String test_string_; }; @@ -297,4 +297,13 @@ Vector<unsigned>({0, 0})); } +TEST_F(TextBreakIteratorTest, SoftHyphen) { + SetTestString("xy\u00ADxy\u00ADxy xy\u00ADxy"); + LazyLineBreakIterator break_iterator(test_string_); + break_iterator.SetBreakSpace(BreakSpaceType::kAfterSpaceRun); + TestNextBreakOpportunity({3, 6, 9, 12, 14}, break_iterator); + break_iterator.EnableSoftHyphen(false); + TestNextBreakOpportunity({9, 14}, break_iterator); +} + } // namespace blink
diff --git a/third_party/blink/tools/blinkpy/wpt_tests/product.py b/third_party/blink/tools/blinkpy/wpt_tests/product.py new file mode 100644 index 0000000..e6d7be0 --- /dev/null +++ b/third_party/blink/tools/blinkpy/wpt_tests/product.py
@@ -0,0 +1,384 @@ +# Copyright 2018 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +"""Product classes that encapsulate the interfaces for the testing targets""" + +import contextlib +import subprocess +import logging + +from blinkpy.common import path_finder +from blinkpy.common.memoized import memoized + +try: + # Packages here are only isolated when running test for Android + # This import adds `devil` to `sys.path`. + path_finder.add_build_android_to_sys_path() + import devil_chromium + from devil import devil_env + from devil.android import apk_helper + from devil.android import device_utils + from devil.android.device_errors import CommandFailedError + from devil.android.tools import webview_app + from devil.utils.parallelizer import SyncParallelizer + from pylib.local.emulator import avd + _ANDROID_ENABLED = True +except ImportError: + _ANDROID_ENABLED = False + + +@memoized +def make_product_registry(): + """Create a mapping from all product names (including aliases) to their + respective classes. + """ + product_registry = {} + product_classes = [Chrome, ContentShell, ChromeiOS, ChromeAndroid, WebView] + for product_cls in product_classes: + names = [product_cls.name] + product_cls.aliases + product_registry.update((name, product_cls) for name in names) + return product_registry + + +class Product: + """A product (browser or browser component) that can run web platform tests. + + Attributes: + name (str): The official wpt-accepted name of this product. + aliases (list[str]): Human-friendly aliases for the official name. + """ + name = '' + aliases = [] + + def __init__(self, port, options): + self._port = port + self._host = port.host + self._options = options + self._tasks = contextlib.ExitStack() + + @contextlib.contextmanager + def test_env(self): + """Set up and clean up the test environment.""" + with self._tasks: + yield + + def product_specific_options(self): + """Product-specific wptrunner parameters needed to run tests.""" + return {} + + def additional_webdriver_args(self): + """Additional webdriver parameters for the product""" + return [] + + def get_version(self): + """Get the product version, if available.""" + return None + + @property + def default_webdriver_binary(self): + """Path to the default webdriver binary, if available.""" + return None + + @property + def default_binary(self): + return None + + +class Chrome(Product): + name = 'chrome' + + def product_specific_options(self): + """Product-specific wptrunner parameters needed to run tests.""" + return { + 'binary': self.default_binary, + 'webdriver_binary': self.default_webdriver_binary, + 'processes': self._port.default_child_processes() + } + + @property + def default_binary(self): + binary_path = 'chrome' + if self._host.platform.is_win(): + binary_path += '.exe' + elif self._host.platform.is_mac(): + binary_path = self._host.filesystem.join('Chromium.app', + 'Contents', 'MacOS', + 'Chromium') + return self._port._build_path(binary_path) + + @property + def default_webdriver_binary(self): + if self._host.platform.is_win(): + path = 'chromedriver.exe' + else: + path = 'chromedriver' #linux and mac + return self._port._build_path(path) + + +class ContentShell(Product): + name = 'content_shell' + + def product_specific_options(self): + """Product-specific wptrunner parameters needed to run tests.""" + return { + 'binary': self.default_binary, + 'processes': self._port.default_child_processes() + } + + @property + def default_binary(self): + binary_path = 'content_shell' + if self._host.platform.is_win(): + binary_path += '.exe' + elif self._host.platform.is_mac(): + binary_path = self._host.filesystem.join('Content Shell.app', + 'Contents', 'MacOS', + 'Content Shell') + return self._port._build_path(binary_path) + + +class ChromeiOS(Product): + name = 'chrome_ios' + + def __init__(self, port, options): + super().__init__(port, options) + self.xcode_build_version = options.xcode_build_version + + def product_specific_options(self): + """Product-specific wptrunner parameters needed to run tests.""" + return {'webdriver_binary': self.default_webdriver_binary} + + @property + def default_webdriver_binary(self) -> str: + return self._port._path_finder.path_from_chromium_base( + 'ios', 'chrome', 'test', 'wpt', 'tools', + 'run_cwt_chromedriver_wrapper.py') + + def additional_webdriver_args(self): + # Set up xcode log output dir. + output_dir = self._host.filesystem.join( + self._port.artifacts_directory(), "xcode-output") + return ['--out-dir=' + output_dir, '--os=16.0'] + + @contextlib.contextmanager + def test_env(self): + path_finder.add_build_ios_to_sys_path() + import xcode_util as xcode + with super().test_env(): + # Install xcode. + if self.xcode_build_version: + try: + runtime_cache_folder = xcode.construct_runtime_cache_folder( + '../../Runtime-ios-', '16.0') + self._host.filesystem.maybe_make_directory( + runtime_cache_folder) + xcode.install('../../mac_toolchain', + self._options.xcode_build_version, + '../../Xcode.app', + runtime_cache_folder=runtime_cache_folder, + ios_version='16.0') + xcode.select('../../Xcode.app') + except subprocess.CalledProcessError as e: + logging.error( + 'Xcode build version %s failed to install: %s ', + self.xcode_build_version, e) + else: + logging.info( + 'Xcode build version %s successfully installed.', + self.xcode_build_version) + else: + logging.warning('Skip the Xcode installation, no ' + '--xcode-build-version') + yield + + +class ChromeAndroidBase(Product): + def __init__(self, port, options): + super().__init__(port, options) + if options.browser_apk: + self.browser_apk = options.browser_apk + else: + self.browser_apk = self.default_browser_apk + self.adb_binary = devil_env.config.FetchPath('adb') + self.devices = [] + + @contextlib.contextmanager + def _install_apk(self, device, path): + """Helper context manager for ensuring a device uninstalls an APK.""" + device.Install(path) + try: + yield + finally: + device.Uninstall(path) + + @contextlib.contextmanager + def get_devices(self): + if not _ANDROID_ENABLED: + raise Exception('Packages required for Android are not available') + instances = [] + try: + if self._options.avd_config: + logging.info( + f'Installing emulator from {self._options.avd_config}') + config = avd.AvdConfig(self._options.avd_config) + config.Install() + + # use '--child-processes' to decide how many emulators to launch + for _ in range(max(self._options.child_processes or 1, 1)): + instance = config.CreateInstance() + instances.append(instance) + + SyncParallelizer(instances).Start( + writable_system=True, + window=self._options.emulator_window, + require_fast_start=True) + + #TODO(weizhong): when choose device, make sure abi matches with target + yield device_utils.DeviceUtils.HealthyDevices() + finally: + SyncParallelizer(instances).Stop() + + @contextlib.contextmanager + def test_env(self): + with super().test_env(): + devil_chromium.Initialize(adb_path=self.adb_binary) + self.devices = self._tasks.enter_context(self.get_devices()) + if not self.devices: + raise Exception('No devices attached to this host. ' + "Make sure to provide '--avd-config' " + 'if using only emulators.') + + if not self._options.no_install: + self.provision_devices() + yield + + def product_specific_options(self): + return { + 'adb_binary': self.adb_binary, + 'device_serial': [device.serial for device in self.devices], + 'package_name': self.get_browser_package_name(), + 'browser_version': self.get_version(), + 'webdriver_binary': self.default_webdriver_binary + } + + def get_version(self): + version_provider = self.get_version_provider_package_name() + if self.devices and version_provider: + # Assume devices are identically provisioned, so select any. + device = self.devices[0] + try: + version = device.GetApplicationVersion(version_provider) + logging.info('Product version: %s %s (package: %r)', self.name, + version, version_provider) + return version + except CommandFailedError: + logging.warning( + 'Failed to retrieve version of %s (package: %r)', + self.name, version_provider) + return None + + @property + def default_webdriver_binary(self): + return self._port._build_path('clang_x64', 'chromedriver') + + def get_browser_package_name(self): + """Get the name of the package to run tests against. + + For WebView, this package is the shell. + + Returns: + Optional[str]: The name of a package installed on the devices or + `None` to use wpt's best guess of the runnable package. + + See Also: + https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/browser.py#L867-L924 + """ + if self.browser_apk: + with contextlib.suppress(apk_helper.ApkHelperError): + return apk_helper.GetPackageName(self.browser_apk) + return None + + def get_version_provider_package_name(self): + """Get the name of the package containing the product version. + + Some Android products are made up of multiple packages with decoupled + "versionName" fields. This method identifies the package whose + "versionName" should be consider the product's version. + + Returns: + Optional[str]: The name of a package installed on the devices or + `None` to use wpt's best guess of the version. + + See Also: + https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/run.py#L810-L816 + https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/browser.py#L850-L924 + """ + # Assume the product is a single APK. + return self.get_browser_package_name() + + def provision_devices(self): + """Provisions a set of Android devices in parallel.""" + contexts = [self._provision_device(device) for device in self.devices] + self._tasks.enter_context(SyncParallelizer(contexts)) + + @contextlib.contextmanager + def _provision_device(self, device): + """Provision a single Android device for a test. + + This method will be executed in parallel on all devices, so + it is crucial that it is thread safe. + """ + with contextlib.ExitStack() as exit_stack: + exit_stack.enter_context( + self._install_apk(device, self.browser_apk)) + logging.info('Provisioned device (serial: %s)', device.serial) + yield + + +class WebView(ChromeAndroidBase): + name = 'android_webview' + aliases = ['webview'] + + def __init__(self, port, options): + super().__init__(port, options) + if options.webview_provider: + self.webview_provider = options.webview_provider + else: + self.webview_provider = self.default_webview_provider + + @property + def default_browser_apk(self): + return self._port._build_path('apks', 'SystemWebViewShell.apk') + + @property + def default_webview_provider(self): + return self._port._build_path('apks', 'SystemWebView.apk') + + def _install_webview(self, device): + # Prioritize local builds. + return webview_app.UseWebViewProvider(device, self.webview_provider) + + def get_browser_package_name(self): + return (super().get_browser_package_name() + or 'org.chromium.webview_shell') + + def get_version_provider_package_name(self): + # Use the version from the webview provider, not the shell, since the + # provider is distributed to end users. The shell is developer-facing, + # so its version is usually not actively updated. + with contextlib.suppress(apk_helper.ApkHelperError): + return apk_helper.GetPackageName(self.webview_provider) + + @contextlib.contextmanager + def _provision_device(self, device): + with self._install_webview(device), super()._provision_device(device): + yield + + +class ChromeAndroid(ChromeAndroidBase): + name = 'chrome_android' + aliases = ['clank'] + + @property + def default_browser_apk(self): + return self._port._build_path('apks', 'ChromePublic.apk')
diff --git a/third_party/blink/tools/run_wpt_tests.py b/third_party/blink/tools/run_wpt_tests.py index deca5b90..6af5c40 100755 --- a/third_party/blink/tools/run_wpt_tests.py +++ b/third_party/blink/tools/run_wpt_tests.py
@@ -15,7 +15,6 @@ import optparse import re import signal -import subprocess import sys from typing import List, Tuple @@ -25,10 +24,8 @@ from blinkpy.w3c.wpt_results_processor import WPTResultsProcessor from blinkpy.web_tests.port.base import Port from blinkpy.web_tests.port import factory +from blinkpy.wpt_tests.product import make_product_registry -path_finder.add_testing_dir_to_sys_path() -path_finder.add_build_android_to_sys_path() -path_finder.add_build_ios_to_sys_path() path_finder.bootstrap_wpt_imports() import mozlog @@ -39,26 +36,6 @@ UPSTREAM_GIT_URL = 'https://github.com/web-platform-tests/wpt.git' -try: - # This import adds `devil` to `sys.path`. - import devil_chromium - from devil import devil_env - from devil.utils.parallelizer import SyncParallelizer - from devil.android import apk_helper - from devil.android import device_utils - from devil.android.device_errors import CommandFailedError - from devil.android.tools import webview_app - from pylib.local.emulator import avd - _ANDROID_ENABLED = True -except ImportError: - _ANDROID_ENABLED = False - -try: - import xcode_util as xcode - _IOS_ENABLED = True -except ImportError: - _IOS_ENABLED = False - class GroupingFormatter(mozlog.formatters.GroupingFormatter): def __init__(self, *args, **kwargs): @@ -566,366 +543,12 @@ return functools.partial(run.run, dummy_venv) -def make_product(port, options) -> 'Product': +def make_product(port, options): name = options.product product_cls = make_product_registry()[name] return product_cls(port, options) -def make_product_registry(): - """Create a mapping from all product names (including aliases) to their - respective classes. - """ - product_registry = {} - product_classes = [Chrome, ContentShell, ChromeiOS, ChromeAndroid, WebView] - for product_cls in product_classes: - names = [product_cls.name] + product_cls.aliases - product_registry.update((name, product_cls) for name in names) - return product_registry - - -class Product: - """A product (browser or browser component) that can run web platform tests. - - Attributes: - name (str): The official wpt-accepted name of this product. - aliases (list[str]): Human-friendly aliases for the official name. - """ - name = '' - aliases = [] - - def __init__(self, port, options): - self._port = port - self._host = port.host - self._options = options - self._tasks = contextlib.ExitStack() - - @contextlib.contextmanager - def test_env(self): - """Set up and clean up the test environment.""" - with self._tasks: - yield - - def product_specific_options(self): - """Product-specific wptrunner parameters needed to run tests.""" - return {} - - def additional_webdriver_args(self): - """Additional webdriver parameters for the product""" - return [] - - def get_version(self): - """Get the product version, if available.""" - return None - - @property - def default_webdriver_binary(self): - """Path to the default webdriver binary, if available.""" - return None - - @property - def default_binary(self): - return None - - -class Chrome(Product): - name = 'chrome' - - def product_specific_options(self): - """Product-specific wptrunner parameters needed to run tests.""" - return { - 'binary': self.default_binary, - 'webdriver_binary': self.default_webdriver_binary, - 'processes': self._port.default_child_processes() - } - - @property - def default_binary(self): - binary_path = 'chrome' - if self._host.platform.is_win(): - binary_path += '.exe' - elif self._host.platform.is_mac(): - binary_path = self._host.filesystem.join('Chromium.app', - 'Contents', 'MacOS', - 'Chromium') - return self._port._build_path(binary_path) - - @property - def default_webdriver_binary(self): - if self._host.platform.is_win(): - path = 'chromedriver.exe' - else: - path = 'chromedriver' #linux and mac - return self._port._build_path(path) - - -class ContentShell(Product): - name = 'content_shell' - - def product_specific_options(self): - """Product-specific wptrunner parameters needed to run tests.""" - return { - 'binary': self.default_binary, - 'processes': self._port.default_child_processes() - } - - @property - def default_binary(self): - binary_path = 'content_shell' - if self._host.platform.is_win(): - binary_path += '.exe' - elif self._host.platform.is_mac(): - binary_path = self._host.filesystem.join('Content Shell.app', - 'Contents', 'MacOS', - 'Content Shell') - return self._port._build_path(binary_path) - - -class ChromeiOS(Product): - name = 'chrome_ios' - - def __init__(self, port, options): - super().__init__(port, options) - self.xcode_build_version = options.xcode_build_version - - def product_specific_options(self): - """Product-specific wptrunner parameters needed to run tests.""" - return {'webdriver_binary': self.default_webdriver_binary} - - @property - def default_webdriver_binary(self) -> str: - return self._port._path_finder.path_from_chromium_base( - 'ios', 'chrome', 'test', 'wpt', 'tools', - 'run_cwt_chromedriver_wrapper.py') - - def additional_webdriver_args(self): - # Set up xcode log output dir. - output_dir = self._host.filesystem.join( - self._port.artifacts_directory(), "xcode-output") - return ['--out-dir=' + output_dir, '--os=16.0'] - - @contextlib.contextmanager - def test_env(self): - with super().test_env(): - # Install xcode. - if self.xcode_build_version: - try: - runtime_cache_folder = xcode.construct_runtime_cache_folder( - '../../Runtime-ios-', '16.0') - self._host.filesystem.maybe_make_directory( - runtime_cache_folder) - xcode.install('../../mac_toolchain', - self._options.xcode_build_version, - '../../Xcode.app', - runtime_cache_folder=runtime_cache_folder, - ios_version='16.0') - xcode.select('../../Xcode.app') - except subprocess.CalledProcessError as e: - logger.error( - 'Xcode build version %s failed to install: %s ', - self.xcode_build_version, e) - else: - logger.info( - 'Xcode build version %s successfully installed.', - self.xcode_build_version) - else: - logger.warning('Skip the Xcode installation, no ' - '--xcode-build-version') - yield - - -class ChromeAndroidBase(Product): - def __init__(self, port, options): - super().__init__(port, options) - if options.browser_apk: - self.browser_apk = options.browser_apk - else: - self.browser_apk = self.default_browser_apk - self.adb_binary = devil_env.config.FetchPath('adb') - self.devices = [] - - @contextlib.contextmanager - def _install_apk(self, device, path): - """Helper context manager for ensuring a device uninstalls an APK.""" - device.Install(path) - try: - yield - finally: - device.Uninstall(path) - - @contextlib.contextmanager - def get_devices(self): - if not _ANDROID_ENABLED: - raise Exception('Android is not available') - instances = [] - try: - if self._options.avd_config: - logger.info( - f'Installing emulator from {self._options.avd_config}') - config = avd.AvdConfig(self._options.avd_config) - config.Install() - - # use '--child-processes' to decide how many emulators to launch - for _ in range(max(self._options.child_processes or 1, 1)): - instance = config.CreateInstance() - instances.append(instance) - - SyncParallelizer(instances).Start( - writable_system=True, - window=self._options.emulator_window, - require_fast_start=True) - - #TODO(weizhong): when choose device, make sure abi matches with target - yield device_utils.DeviceUtils.HealthyDevices() - finally: - SyncParallelizer(instances).Stop() - - @contextlib.contextmanager - def test_env(self): - with super().test_env(): - devil_chromium.Initialize(adb_path=self.adb_binary) - self.devices = self._tasks.enter_context(self.get_devices()) - if not self.devices: - raise Exception('No devices attached to this host. ' - "Make sure to provide '--avd-config' " - 'if using only emulators.') - - if not self._options.no_install: - self.provision_devices() - yield - - def product_specific_options(self): - return { - 'adb_binary': self.adb_binary, - 'device_serial': [device.serial for device in self.devices], - 'package_name': self.get_browser_package_name(), - 'browser_version': self.get_version(), - 'webdriver_binary': self.default_webdriver_binary - } - - def get_version(self): - version_provider = self.get_version_provider_package_name() - if self.devices and version_provider: - # Assume devices are identically provisioned, so select any. - device = self.devices[0] - try: - version = device.GetApplicationVersion(version_provider) - logger.info('Product version: %s %s (package: %r)', self.name, - version, version_provider) - return version - except CommandFailedError: - logger.warning( - 'Failed to retrieve version of %s (package: %r)', - self.name, version_provider) - return None - - @property - def default_webdriver_binary(self): - return self._port._build_path('clang_x64', 'chromedriver') - - def get_browser_package_name(self): - """Get the name of the package to run tests against. - - For WebView, this package is the shell. - - Returns: - Optional[str]: The name of a package installed on the devices or - `None` to use wpt's best guess of the runnable package. - - See Also: - https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/browser.py#L867-L924 - """ - if self.browser_apk: - with contextlib.suppress(apk_helper.ApkHelperError): - return apk_helper.GetPackageName(self.browser_apk) - return None - - def get_version_provider_package_name(self): - """Get the name of the package containing the product version. - - Some Android products are made up of multiple packages with decoupled - "versionName" fields. This method identifies the package whose - "versionName" should be consider the product's version. - - Returns: - Optional[str]: The name of a package installed on the devices or - `None` to use wpt's best guess of the version. - - See Also: - https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/run.py#L810-L816 - https://github.com/web-platform-tests/wpt/blob/merge_pr_33203/tools/wpt/browser.py#L850-L924 - """ - # Assume the product is a single APK. - return self.get_browser_package_name() - - def provision_devices(self): - """Provisions a set of Android devices in parallel.""" - contexts = [self._provision_device(device) for device in self.devices] - self._tasks.enter_context(SyncParallelizer(contexts)) - - @contextlib.contextmanager - def _provision_device(self, device): - """Provision a single Android device for a test. - - This method will be executed in parallel on all devices, so - it is crucial that it is thread safe. - """ - with contextlib.ExitStack() as exit_stack: - exit_stack.enter_context( - self._install_apk(device, self.browser_apk)) - logger.info('Provisioned device (serial: %s)', device.serial) - yield - - -class WebView(ChromeAndroidBase): - name = 'android_webview' - aliases = ['webview'] - - def __init__(self, port, options): - super().__init__(port, options) - if options.webview_provider: - self.webview_provider = options.webview_provider - else: - self.webview_provider = self.default_webview_provider - - @property - def default_browser_apk(self): - return self._port._build_path('apks', 'SystemWebViewShell.apk') - - @property - def default_webview_provider(self): - return self._port._build_path('apks', 'SystemWebView.apk') - - def _install_webview(self, device): - # Prioritize local builds. - return webview_app.UseWebViewProvider(device, self.webview_provider) - - def get_browser_package_name(self): - return (super().get_browser_package_name() - or 'org.chromium.webview_shell') - - def get_version_provider_package_name(self): - # Use the version from the webview provider, not the shell, since the - # provider is distributed to end users. The shell is developer-facing, - # so its version is usually not actively updated. - with contextlib.suppress(apk_helper.ApkHelperError): - return apk_helper.GetPackageName(self.webview_provider) - - @contextlib.contextmanager - def _provision_device(self, device): - with self._install_webview(device), super()._provision_device(device): - yield - - -class ChromeAndroid(ChromeAndroidBase): - name = 'chrome_android' - aliases = ['clank'] - - @property - def default_browser_apk(self): - return self._port._build_path('apks', 'ChromePublic.apk') - - def handle_interrupt_signals(): def termination_handler(_signum, _unused_frame): raise KeyboardInterrupt()
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index d073a5af..81f6f379 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4118,6 +4118,8 @@ # Sheriff 2019-06-26 crbug.com/978966 [ Mac ] paint/markers/ellipsis-mixed-text-in-ltr-flow-with-markers.html [ Failure Pass ] +crbug.com/1451329 [ Mac11-arm64 ] paint/markers/marker-invalidation.html [ Failure Pass ] +crbug.com/1451329 [ Mac12-arm64 ] paint/markers/marker-invalidation.html [ Failure Pass ] # Sheriff 2019-06-27 crbug.com/979243 [ Mac10.14 Release ] editing/selection/inline-closest-leaf-child.html [ Failure Pass ]
diff --git a/third_party/libavif/BUILD.gn b/third_party/libavif/BUILD.gn index 3e1bb489..eb195b3 100644 --- a/third_party/libavif/BUILD.gn +++ b/third_party/libavif/BUILD.gn
@@ -5,8 +5,11 @@ import("//media/media_options.gni") source_set("libavif") { - sources = [ + public = [ "src/include/avif/avif.h", + ] + + sources = [ "src/include/avif/internal.h", "src/src/alpha.c", "src/src/avif.c",
diff --git a/third_party/metrics_proto/README.chromium b/third_party/metrics_proto/README.chromium index 6114dc8..8aa822d 100644 --- a/third_party/metrics_proto/README.chromium +++ b/third_party/metrics_proto/README.chromium
@@ -1,8 +1,8 @@ Name: Metrics Protos Short Name: metrics_proto URL: This is the canonical public repository -Version: 532567645 -Date: 2023/05/16 UTC +Version: 537929221 +Date: 2023/06/05 UTC License: BSD Security Critical: Yes
diff --git a/third_party/metrics_proto/omnibox_event.proto b/third_party/metrics_proto/omnibox_event.proto index 33132bc..39e7231 100644 --- a/third_party/metrics_proto/omnibox_event.proto +++ b/third_party/metrics_proto/omnibox_event.proto
@@ -253,8 +253,19 @@ HISTORY_CLUSTER = 20; // Suggestions from history derived from input with automatic corrections. HISTORY_FUZZY = 21; - // URLs amongst the user's currently open tabs. + // URLs amongst the user's currently open tabs. These are not separately + // attached TAB_SWITCH actions; they're full dedicated suggestions produced + // by the OpenTabProvider (used by @tabs keyword scope and CrOS launcher). OPEN_TAB = 22; + // Tab switch actions that attach to matches when the URL is equivalent + // to a URL in another open tab. Note this is distinct from OPEN_TAB above. + // This is a pseudo-provider for a TabSwitchAction attached to a suggestion + // when AutocompleteResult::ConvertOpenTabMatches finds matching open tabs. + TAB_SWITCH = 23; + // Omnibox Pedals: specialized actions that may be attached to matches. + // This is a pseudo-provider for actions produced by OmniboxPedalProvider + // and attached to suggestions by AutocompleteResult::AttachPedalsToMatches. + PEDALS = 24; } // The result set displayed on the completion popup @@ -338,8 +349,12 @@ // might not also match the title or URL of // this page). OPEN_TAB = 32; // A currently open tab whose URL contains the input. + // Note: This is for dedicated matches produced by + // OpenTabProvider, not a general TAB_SWITCH action. STARTER_PACK = 33; // A built-in URL suggestion specifically created for // the starter pack keyword mode chip to attach to. + TAB_SWITCH = 34; // A tab-switch action (distinct from OPEN_TAB). + PEDAL = 35; // A pedal action. } optional ResultType result_type = 2;
diff --git a/third_party/pthreadpool/BUILD.gn b/third_party/pthreadpool/BUILD.gn index f2a6864..91ccea8 100644 --- a/third_party/pthreadpool/BUILD.gn +++ b/third_party/pthreadpool/BUILD.gn
@@ -3,15 +3,25 @@ # found in the LICENSE file. import("//build/config/android/config.gni") +import("//testing/test.gni") config("pthreadpool_config") { include_dirs = [ "src/include", "src/src", ] - defines = [ "PTHREADPOOL_USE_GCD=0" ] + + # The platform-specific synchronizations are not needed for Chromium Jobs + # API integration. + defines = [ + "PTHREADPOOL_USE_EVENT=0", + "PTHREADPOOL_USE_FUTEX=0", + "PTHREADPOOL_USE_GCD=0", + "PTHREADPOOL_USE_CONDVAR=0", + ] } +# This is a target that depends on //base. source_set("pthreadpool") { public = [ "src/include/pthreadpool.h" ] @@ -25,11 +35,8 @@ "src/src/threadpool-utils.h", ] - if (is_win) { - sources += [ "src/src/windows.c" ] - } else { - sources += [ "src/src/pthreads.c" ] - } + # Use Chromium Jobs API. + sources += [ "chromium/jobs.cc" ] configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] @@ -37,7 +44,33 @@ public_configs = [ ":pthreadpool_config" ] - deps = [ "//third_party/fxdiv" ] + deps = [ + "//base", + "//third_party/fxdiv", + ] +} + +test("pthreadpool_unittests") { + testonly = true + + sources = [ "chromium/pthreadpool_unittests.cc" ] + + public_configs = [ ":pthreadpool_config" ] + + deps = [ + ":pthreadpool", + "//base/test:run_all_unittests", + "//base/test:test_support", + "//testing/gtest", + ] +} + +config("pthreadpool_standalone_config") { + include_dirs = [ + "src/include", + "src/src", + ] + defines = [ "PTHREADPOOL_USE_GCD=0" ] } # This is a target that cannot depend on //base. @@ -68,7 +101,7 @@ configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/sanitizers:cfi_icall_disable" ] - public_configs = [ ":pthreadpool_config" ] + public_configs = [ ":pthreadpool_standalone_config" ] deps = [ "//third_party/fxdiv" ] }
diff --git a/third_party/pthreadpool/DEPS b/third_party/pthreadpool/DEPS new file mode 100644 index 0000000..c69decc --- /dev/null +++ b/third_party/pthreadpool/DEPS
@@ -0,0 +1,9 @@ +specific_include_rules = { + "jobs.cc": [ + "+base", + ], + "pthreadpool_unittests.cc": [ + "+base/test", + "+testing/gtest", + ] +}
diff --git a/third_party/pthreadpool/README.chromium b/third_party/pthreadpool/README.chromium index 2e1018a..7b232d5 100644 --- a/third_party/pthreadpool/README.chromium +++ b/third_party/pthreadpool/README.chromium
@@ -12,3 +12,6 @@ similar functionality to #pragma omp parallel for, but with additional features. This library supports //third_party/xnnpack, which in turn supports //third_party/tflite. +chromium/jobs.cc implements a shim of `pthreadpool_parallelize()` that uses +Chromium Jobs API to schedule the parallel tasks with Chromium's ThreadPool +workers.
diff --git a/third_party/pthreadpool/chromium/jobs.cc b/third_party/pthreadpool/chromium/jobs.cc new file mode 100644 index 0000000..eeecbbb --- /dev/null +++ b/third_party/pthreadpool/chromium/jobs.cc
@@ -0,0 +1,268 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// `_Static_assert` is used by threadpool-common.h for GCC build. Because +// `_Static_assert` is not defined in GCC C++ backend, define `_Static_assert` +// by `static_assert` as a work-around. +#if defined(__GNUC__) && \ + ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) +#define _Static_assert(predicate, message) static_assert(predicate, message) +#endif + +// Configuration header. +#include "threadpool-common.h" + +// Public library header. +#include <pthreadpool.h> + +#if defined(_MSC_VER) && defined(_M_ARM64) +#include <arm64intr.h> + +// The following ARM64 intrinsics are used by threadpool-atomics.h and should be +// defined in arm64intr.h. If arm64intr.h is not included correctly, e.g. due to +// LLVM issue: https://github.com/llvm/llvm-project/issues/62942, declare them +// here as a work-around. +// +// TODO(crbug.com/1228275): Remove this work-around once the LLVM issue is +// fixed. +#ifndef ARM64_FPCR +extern "C" { +unsigned __int32 __ldar32(unsigned __int32 volatile* _Target); +unsigned __int64 __ldar64(unsigned __int64 volatile* _Target); +void __stlr32(unsigned __int32 volatile* _Target, unsigned __int32 _Value); +void __stlr64(unsigned __int64 volatile* _Target, unsigned __int64 _Value); +} +#endif +#endif // defined(_MSC_VER) && defined(_M_ARM64) + +// Internal library headers. +#include "threadpool-atomics.h" +#include "threadpool-utils.h" + +// Redeclare the following three pthreadpool internal functions with extern "C" +// linkage that are used by this C++ implementation. +#define pthreadpool_allocate _pthreadpool_allocate +#define pthreadpool_deallocate _pthreadpool_deallocate +#define pthreadpool_parallelize _pthreadpool_parallelize + +#include "threadpool-object.h" + +#undef pthreadpool_allocate +#undef pthreadpool_deallocate +#undef pthreadpool_parallelize + +extern "C" { +PTHREADPOOL_INTERNAL struct pthreadpool* pthreadpool_allocate( + size_t threads_count); + +PTHREADPOOL_INTERNAL void pthreadpool_deallocate( + struct pthreadpool* threadpool); + +PTHREADPOOL_INTERNAL void pthreadpool_parallelize( + struct pthreadpool* threadpool, + thread_function_t thread_function, + const void* params, + size_t params_size, + void* task, + void* context, + size_t linear_range, + uint32_t flags); +} + +// Chromium headers. +#include "base/functional/bind.h" +#include "base/synchronization/lock.h" +#include "base/system/sys_info.h" +#include "base/task/post_job.h" +#include "base/task/task_traits.h" + +// According to the tests on multiple systems, there will be a performance +// regression of XNNPACK model inference when the number of work items is +// greater than `kMaxNumWorkItems`. +// +// TODO(crbug.com/1228275): Ensure `kMaxNumWorkItems` value setting makes sense. +constexpr size_t kMaxNumWorkItems = 4; + +// Processes `threadpool` which represents the parallel computation task +// dispatched by `pthreadpool_parallelize()` in `num_work_items` items with +// `Run()` from `base::PostJob`. `GetMaxConcurrency()` is a callback used in +// `base::PostJob()` to control the maximum number of threads calling `Run()` +// concurrently. +class PthreadPoolJob { + public: + PthreadPoolJob(struct pthreadpool* threadpool, size_t num_work_items) + : threadpool_(threadpool), + num_work_items_(num_work_items), + num_remaining_work_items_(num_work_items) {} + ~PthreadPoolJob() = default; + + void Run(base::JobDelegate* delegate) { + CHECK(delegate); + while (!delegate->ShouldYield()) { + size_t index = GetNextIndex(); + if (index >= num_work_items_) { + return; + } + + DoWork(index); + + if (CompleteWork()) { + return; + } + } + } + + size_t GetMaxConcurrency(size_t worker_count) const { + // `num_remaining_work_items_` includes the work items that other workers + // are currently working on, so we can safely ignore the `worker_count` and + // just return the current number of remaining work items. + return num_remaining_work_items_.load(std::memory_order_relaxed); + } + + private: + void DoWork(size_t index) { + struct thread_info* thread = &threadpool_->threads[index]; + const uint32_t flags = + pthreadpool_load_relaxed_uint32_t(&threadpool_->flags); + const thread_function_t thread_function = + reinterpret_cast<thread_function_t>( + pthreadpool_load_relaxed_void_p(&threadpool_->thread_function)); + + // To avoid performance degradation of handling denormalized floating-point + // numbers, the caller may set PTHREADPOOL_FLAG_DISABLE_DENORMALS flag that + // instructs the thread pool workers to disable support for denormalized + // numbers before running the computation and restore the state after the + // computation is complete. + // + // See pthreadpool document for more details: + // https://source.chromium.org/chromium/chromium/src/+/main:third_party/pthreadpool/src/include/pthreadpool.h;l=51 + struct fpu_state saved_fpu_state = {0}; + if (flags & PTHREADPOOL_FLAG_DISABLE_DENORMALS) { + saved_fpu_state = get_fpu_state(); + disable_fpu_denormals(); + } + + thread_function(threadpool_, thread); + + if (flags & PTHREADPOOL_FLAG_DISABLE_DENORMALS) { + set_fpu_state(saved_fpu_state); + } + } + + // Returns the index of the next work item to process. + size_t GetNextIndex() { + // `index_` may exceeed `num_work_items_`, but only by the number of + // workers at worst, thus it can't exceed 2 * `num_work_items_` and + // overflow shouldn't happen. + return index_.fetch_add(1, std::memory_order_relaxed); + } + + // Returns true if the last work item was completed. + bool CompleteWork() { + size_t num_remaining_work_items = + num_remaining_work_items_.fetch_sub(1, std::memory_order_relaxed); + CHECK_GE(num_remaining_work_items, 1); + return num_remaining_work_items == 1; + } + + struct pthreadpool* threadpool_; + const size_t num_work_items_; + std::atomic<size_t> index_{0}; + std::atomic<size_t> num_remaining_work_items_; +}; + +struct pthreadpool* pthreadpool_create(size_t threads_count) { + // When using Jobs API, the `threads_count` only means the number of work + // items will be scheduled by ThreadPool for each `pthreadpool_parallelize()` + // call. Jobs API won't guarantee scheduling the same number of physical + // threads according to that. + + if (threads_count == 0) { + threads_count = std::max(1, base::SysInfo::NumberOfProcessors()); + } + + // Cap to `kMaxNumWorkItems` that avoids too much scheduling overhead. + threads_count = std::min(threads_count, kMaxNumWorkItems); + CHECK_GT(threads_count, 0u); + + struct pthreadpool* threadpool = pthreadpool_allocate(threads_count); + if (threadpool == nullptr) { + return nullptr; + } + + threadpool->threads_count = fxdiv_init_size_t(threads_count); + for (size_t tid = 0; tid < threads_count; tid++) { + threadpool->threads[tid].thread_number = tid; + threadpool->threads[tid].threadpool = threadpool; + } + + return threadpool; +} + +// The `threadpool` struct is accessed by this method without holding a lock. +// The caller should ensure accessing a `threadpool` struct from the same +// sequence that inherently provides thread-safety. +PTHREADPOOL_INTERNAL void pthreadpool_parallelize( + struct pthreadpool* threadpool, + thread_function_t thread_function, + const void* params, + size_t params_size, + void* task, + void* context, + size_t linear_range, + uint32_t flags) { + CHECK(threadpool); + CHECK(thread_function); + CHECK(task); + CHECK_GT(linear_range, 1); + + // Setup global arguments. + pthreadpool_store_relaxed_void_p(&threadpool->thread_function, + (void*)thread_function); + pthreadpool_store_relaxed_void_p(&threadpool->task, task); + pthreadpool_store_relaxed_void_p(&threadpool->argument, context); + pthreadpool_store_relaxed_uint32_t(&threadpool->flags, flags); + + const struct fxdiv_divisor_size_t threads_count = threadpool->threads_count; + + if (params_size != 0) { + memcpy(&threadpool->params, params, params_size); + } + + // Spread the work between threads. + const struct fxdiv_result_size_t range_params = + fxdiv_divide_size_t(linear_range, threads_count); + size_t range_start = 0; + for (size_t tid = 0; tid < threads_count.value; tid++) { + struct thread_info* thread = &threadpool->threads[tid]; + // Besides taking `quotient` items, each of the first `remainder` threads + // also takes one extra item if the `remainder` is not 0. + const size_t range_length = + range_params.quotient + (tid < range_params.remainder ? 1 : 0); + const size_t range_end = range_start + range_length; + pthreadpool_store_relaxed_size_t(&thread->range_start, range_start); + pthreadpool_store_relaxed_size_t(&thread->range_end, range_end); + pthreadpool_store_relaxed_size_t(&thread->range_length, range_length); + + // The next subrange starts where the previous ended. + range_start = range_end; + } + + // Request ThreadPool workers to process `threads_count.value` number of work + // items in parallel. + auto job = std::make_unique<PthreadPoolJob>(threadpool, threads_count.value); + auto handle = base::PostJob( + FROM_HERE, {}, + base::BindRepeating(&PthreadPoolJob::Run, base::Unretained(job.get())), + base::BindRepeating(&PthreadPoolJob::GetMaxConcurrency, + base::Unretained(job.get()))); + handle.Join(); +} + +void pthreadpool_destroy(struct pthreadpool* threadpool) { + if (threadpool != nullptr) { + // Release resources. + pthreadpool_deallocate(threadpool); + } +}
diff --git a/third_party/pthreadpool/chromium/pthreadpool_unittests.cc b/third_party/pthreadpool/chromium/pthreadpool_unittests.cc new file mode 100644 index 0000000..99cdb9f --- /dev/null +++ b/third_party/pthreadpool/chromium/pthreadpool_unittests.cc
@@ -0,0 +1,201 @@ +// Copyright 2023 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <pthreadpool.h> + +#include "base/test/task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +typedef std::unique_ptr<pthreadpool, decltype(&pthreadpool_destroy)> + auto_pthreadpool_t; + +TEST(CreateAndDestroy, NullThreadPool) { + pthreadpool* threadpool = nullptr; + pthreadpool_destroy(threadpool); +} + +TEST(CreateAndDestroy, SingleThreadPool) { + pthreadpool* threadpool = pthreadpool_create(1); + ASSERT_TRUE(threadpool); + pthreadpool_destroy(threadpool); +} + +TEST(CreateAndDestroy, MultiThreadPool) { + pthreadpool* threadpool = pthreadpool_create(0); + ASSERT_TRUE(threadpool); + pthreadpool_destroy(threadpool); +} + +struct ElementWiseAdd1DTester { + struct pthreadpool* threadpool; + size_t size; + std::vector<float> lhs; + std::vector<float> rhs; + std::vector<float> sum; + + static void Compute(ElementWiseAdd1DTester* tester, size_t i) { + EXPECT_LT(i, tester->size); + tester->sum[i] = tester->lhs[i] + tester->rhs[i]; + } + + void Run(uint32_t flags = 0) { + pthreadpool_parallelize_1d(threadpool, + reinterpret_cast<pthreadpool_task_1d_t>(Compute), + static_cast<void*>(this), size, flags); + } +}; + +TEST(ElementWiseAdd1D, SingleThreadPool) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(1), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kSize = 100; + ElementWiseAdd1DTester tester{.threadpool = threadpool.get(), + .size = kSize, + .lhs = std::vector<float>(kSize, 1.0), + .rhs = std::vector<float>(kSize, 2.0), + .sum = std::vector<float>(kSize, 0.0)}; + tester.Run(); + + for (size_t i = 0; i < kSize; i++) { + EXPECT_EQ(tester.sum[i], tester.lhs[i] + tester.rhs[i]); + } +} + +TEST(ElementWiseAdd1D, MultiThreadPool) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(0), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kSize = 200; + ElementWiseAdd1DTester tester{.threadpool = threadpool.get(), + .size = kSize, + .lhs = std::vector<float>(kSize, 1.0), + .rhs = std::vector<float>(kSize, 2.0), + .sum = std::vector<float>(kSize, 0.0)}; + tester.Run(); + + for (size_t i = 0; i < kSize; i++) { + EXPECT_EQ(tester.sum[i], tester.lhs[i] + tester.rhs[i]); + } +} + +TEST(ElementWiseAdd1D, WithDisableDenormalsFlag) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(0), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kSize = 300; + ElementWiseAdd1DTester tester{.threadpool = threadpool.get(), + .size = kSize, + .lhs = std::vector<float>(kSize, 1.0), + .rhs = std::vector<float>(kSize, 2.0), + .sum = std::vector<float>(kSize, 0.0)}; + tester.Run(PTHREADPOOL_FLAG_DISABLE_DENORMALS); + + for (size_t i = 0; i < kSize; i++) { + EXPECT_EQ(tester.sum[i], tester.lhs[i] + tester.rhs[i]); + } +} + +struct ElementWiseAdd2DTester { + struct pthreadpool* threadpool; + size_t width; + size_t height; + std::vector<float> lhs; + std::vector<float> rhs; + std::vector<float> sum; + + static void Compute(ElementWiseAdd2DTester* tester, size_t i, size_t j) { + EXPECT_LT(i, tester->width); + EXPECT_LT(i, tester->height); + const size_t offset = i * tester->height + j; + tester->sum[offset] = tester->lhs[offset] + tester->rhs[offset]; + } + + void Run(uint32_t flags = 0) { + pthreadpool_parallelize_2d(threadpool, + reinterpret_cast<pthreadpool_task_2d_t>(Compute), + static_cast<void*>(this), width, height, flags); + } +}; + +TEST(ElementWiseAdd2D, SingleThreadPool) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(1), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kWidth = 10; + const size_t kHeight = 10; + ElementWiseAdd2DTester tester{ + .threadpool = threadpool.get(), + .width = kWidth, + .height = kHeight, + .lhs = std::vector<float>(kWidth * kHeight, 1.0), + .rhs = std::vector<float>(kWidth * kHeight, 2.0), + .sum = std::vector<float>(kWidth * kHeight, 0.0)}; + tester.Run(); + + for (size_t i = 0; i < kWidth; i++) { + for (size_t j = 0; j < kHeight; j++) { + const size_t index = i * kHeight + j; + EXPECT_EQ(tester.sum[index], tester.lhs[index] + tester.rhs[index]); + } + } +} + +TEST(ElementWiseAdd2D, MultiThreadPool) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(0), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kWidth = 20; + const size_t kHeight = 20; + ElementWiseAdd2DTester tester{ + .threadpool = threadpool.get(), + .width = kWidth, + .height = kHeight, + .lhs = std::vector<float>(kWidth * kHeight, 1.0), + .rhs = std::vector<float>(kWidth * kHeight, 2.0), + .sum = std::vector<float>(kWidth * kHeight, 0.0)}; + tester.Run(); + + for (size_t i = 0; i < kWidth; i++) { + for (size_t j = 0; j < kHeight; j++) { + const size_t index = i * kHeight + j; + EXPECT_EQ(tester.sum[index], tester.lhs[index] + tester.rhs[index]); + } + } +} + +TEST(ElementWiseAdd2D, WithDisableDenormalsFlag) { + base::test::TaskEnvironment task_environment; + + auto_pthreadpool_t threadpool(pthreadpool_create(0), pthreadpool_destroy); + ASSERT_TRUE(threadpool.get()); + + const size_t kWidth = 30; + const size_t kHeight = 30; + ElementWiseAdd2DTester tester{ + .threadpool = threadpool.get(), + .width = kWidth, + .height = kHeight, + .lhs = std::vector<float>(kWidth * kHeight, 1.0), + .rhs = std::vector<float>(kWidth * kHeight, 2.0), + .sum = std::vector<float>(kWidth * kHeight, 0.0)}; + tester.Run(PTHREADPOOL_FLAG_DISABLE_DENORMALS); + + for (size_t i = 0; i < kWidth; i++) { + for (size_t j = 0; j < kHeight; j++) { + const size_t index = i * kHeight + j; + EXPECT_EQ(tester.sum[index], tester.lhs[index] + tester.rhs[index]); + } + } +}
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index a580353..44facc31 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -16112,44 +16112,44 @@ </enum> <enum name="ChromeOSIioServiceSensorUsage"> - <int value="0" label="ACCEL_lid"/> - <int value="1" label="ACCEL_base"/> + <int value="0" label="ACCEL_base"/> + <int value="1" label="ACCEL_lid"/> <int value="2" label="ACCEL_camera"/> <int value="3" label="ACCEL_others"/> - <int value="4" label="ANGLVEL_lid"/> - <int value="5" label="ANGLVEL_base"/> + <int value="4" label="ANGLVEL_base"/> + <int value="5" label="ANGLVEL_lid"/> <int value="6" label="ANGLVEL_camera"/> <int value="7" label="ANGLVEL_others"/> - <int value="8" label="LIGHT_lid"/> - <int value="9" label="LIGHT_base"/> + <int value="8" label="LIGHT_base"/> + <int value="9" label="LIGHT_lid"/> <int value="10" label="LIGHT_camera"/> <int value="11" label="LIGHT_others"/> - <int value="12" label="COUNT_lid"/> - <int value="13" label="COUNT_base"/> + <int value="12" label="COUNT_base"/> + <int value="13" label="COUNT_lid"/> <int value="14" label="COUNT_camera"/> <int value="15" label="COUNT_others"/> - <int value="16" label="MAGN_lid"/> - <int value="17" label="MAGN_base"/> + <int value="16" label="MAGN_base"/> + <int value="17" label="MAGN_lid"/> <int value="18" label="MAGN_camera"/> <int value="19" label="MAGN_others"/> - <int value="20" label="ANGL_lid"/> - <int value="21" label="ANGL_base"/> + <int value="20" label="ANGL_base"/> + <int value="21" label="ANGL_lid"/> <int value="22" label="ANGL_camera"/> <int value="23" label="ANGL_others"/> - <int value="24" label="BARO_lid"/> - <int value="25" label="BARO_base"/> + <int value="24" label="BARO_base"/> + <int value="25" label="BARO_lid"/> <int value="26" label="BARO_camera"/> <int value="27" label="BARO_others"/> - <int value="28" label="ACCEL_UNCALIBRATED_lid"/> - <int value="29" label="ACCEL_UNCALIBRATED_base"/> + <int value="28" label="ACCEL_UNCALIBRATED_base"/> + <int value="29" label="ACCEL_UNCALIBRATED_lid"/> <int value="30" label="ACCEL_UNCALIBRATED_camera"/> <int value="31" label="ACCEL_UNCALIBRATED_others"/> - <int value="32" label="ANGLVEL_UNCALIBRATED_lid"/> - <int value="33" label="ANGLVEL_UNCALIBRATED_base"/> + <int value="32" label="ANGLVEL_UNCALIBRATED_base"/> + <int value="33" label="ANGLVEL_UNCALIBRATED_lid"/> <int value="34" label="ANGLVEL_UNCALIBRATED_camera"/> <int value="35" label="ANGLVEL_UNCALIBRATED_others"/> - <int value="36" label="MAGN_UNCALIBRATED_lid"/> - <int value="37" label="MAGN_UNCALIBRATED_base"/> + <int value="36" label="MAGN_UNCALIBRATED_base"/> + <int value="37" label="MAGN_UNCALIBRATED_lid"/> <int value="38" label="MAGN_UNCALIBRATED_camera"/> <int value="39" label="MAGN_UNCALIBRATED_others"/> </enum> @@ -70234,6 +70234,13 @@ <int value="1" label="Not muted"/> </enum> +<enum name="Microsoft365Availability"> + <int value="0" label="Neither MS365 PWA nor ODFS set up"/> + <int value="1" label="Only MS365 PWA set up"/> + <int value="2" label="Only ODFS set up"/> + <int value="3" label="Both MS365 PWA and ODFS set up"/> +</enum> + <enum name="MidiResult"> <obsolete> Removed 06/2019.
diff --git a/tools/metrics/histograms/metadata/file/histograms.xml b/tools/metrics/histograms/metadata/file/histograms.xml index 2f514da4..b3cf2cd 100644 --- a/tools/metrics/histograms/metadata/file/histograms.xml +++ b/tools/metrics/histograms/metadata/file/histograms.xml
@@ -986,6 +986,17 @@ </summary> </histogram> +<histogram + name="FileBrowser.OfficeFiles.Setup.FirstTimeMicrosoft365Availability" + enum="Microsoft365Availability" expires_after="M124"> + <owner>austinct@chromium.org</owner> + <owner>src/ui/file_manager/OWNERS</owner> + <summary> + Chrome OS File Browser: The state of MS365 PWA and ODFS on first setup + launch. + </summary> +</histogram> + <histogram name="FileBrowser.OfficeFiles.TaskResult.{ProviderName}" enum="OfficeTaskResult" expires_after="M124"> <owner>simmonsjosh@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/omnibox/histograms.xml b/tools/metrics/histograms/metadata/omnibox/histograms.xml index 248a900..c11b953 100644 --- a/tools/metrics/histograms/metadata/omnibox/histograms.xml +++ b/tools/metrics/histograms/metadata/omnibox/histograms.xml
@@ -754,8 +754,7 @@ 1) If there is temporary text (i.e. a non default suggestion is selected), it is cleared. - 2) If the popup is open and the `kClosePopupWithEscape` feature is enabled, - the popup is closed. + 2) If the popup is open, the popup is closed. 3) If the popup is open, which is considered as user input in progress, then the popup is closed and user input is cleared.
diff --git a/tools/metrics/histograms/metadata/power/histograms.xml b/tools/metrics/histograms/metadata/power/histograms.xml index 34acb1f..2e67464d9 100644 --- a/tools/metrics/histograms/metadata/power/histograms.xml +++ b/tools/metrics/histograms/metadata/power/histograms.xml
@@ -2374,7 +2374,7 @@ </histogram> <histogram name="Power.SmartCharging.Messages" enum="SmartChargingMessages" - expires_after="2023-06-01"> + expires_after="2023-12-01"> <owner>thanhdng@chromium.org</owner> <owner>napper@chromium.org</owner> <summary>Type of messages that are reported by smart charging.</summary>
diff --git a/tools/metrics/histograms/metadata/uma/histograms.xml b/tools/metrics/histograms/metadata/uma/histograms.xml index 9ac01fd26..cba1b276 100644 --- a/tools/metrics/histograms/metadata/uma/histograms.xml +++ b/tools/metrics/histograms/metadata/uma/histograms.xml
@@ -321,7 +321,7 @@ </histogram> <histogram name="UMA.IndependentLog.{Provider}.FinalizeTime" units="ms" - expires_after="2023-07-01"> + expires_after="2023-12-01"> <owner>lucnguyen@google.com</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -330,6 +330,7 @@ are successfully closed. </summary> <token key="Provider"> + <variant name="AwBackgroundTracingMetricsProvider"/> <variant name="BackgroundTracingMetricsProvider"/> <variant name="FileMetricsProvider"/> <variant name="StructuredMetricsProvider"/>
diff --git a/tools/metrics/histograms/metadata/webapps/histograms.xml b/tools/metrics/histograms/metadata/webapps/histograms.xml index cf15917..cbe3c72f 100644 --- a/tools/metrics/histograms/metadata/webapps/histograms.xml +++ b/tools/metrics/histograms/metadata/webapps/histograms.xml
@@ -1069,7 +1069,11 @@ </histogram> <histogram name="WebApp.Preinstalled.AppDuplicationFixApplied" units="apps" - expires_after="2023-12-01"> + expires_after="2023-06-01"> + <obsolete> + Deprecated on 2023-06. Metrics show the fix got applied in a large burst and + has been sitting at low numbers for months: go/nejyv + </obsolete> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary> @@ -1200,7 +1204,11 @@ </histogram> <histogram name="WebApp.Preinstalled.MigratingWebAppAbsentChromeAppAbsent" - units="apps" expires_after="2023-12-01"> + units="apps" expires_after="2023-06-01"> + <obsolete> + Deprecated on 2023-06. Metrics show the fix got applied in a large burst and + has been sitting at low numbers for months: go/nejyv + </obsolete> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary> @@ -1211,7 +1219,11 @@ </histogram> <histogram name="WebApp.Preinstalled.MigratingWebAppAbsentChromeAppPresent" - units="apps" expires_after="2023-12-01"> + units="apps" expires_after="2023-06-01"> + <obsolete> + Deprecated on 2023-06. Metrics show the fix got applied in a large burst and + has been sitting at low numbers for months: go/nejyv + </obsolete> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary> @@ -1222,7 +1234,11 @@ </histogram> <histogram name="WebApp.Preinstalled.MigratingWebAppPresentChromeAppAbsent" - units="apps" expires_after="2023-12-01"> + units="apps" expires_after="2023-06-01"> + <obsolete> + Deprecated on 2023-06. Metrics show the fix got applied in a large burst and + has been sitting at low numbers for months: go/nejyv + </obsolete> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary> @@ -1233,7 +1249,11 @@ </histogram> <histogram name="WebApp.Preinstalled.MigratingWebAppPresentChromeAppPresent" - units="apps" expires_after="2023-12-01"> + units="apps" expires_after="2023-06-01"> + <obsolete> + Deprecated on 2023-06. Metrics show the fix got applied in a large burst and + has been sitting at low numbers for months: go/nejyv + </obsolete> <owner>alancutter@chromium.org</owner> <owner>desktop-pwas-team@google.com</owner> <summary>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 7ddccb2..3ee4e0c4d 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,16 +5,16 @@ "full_remote_path": "perfetto-luci-artifacts/v34.0/linux-arm64/trace_processor_shell" }, "win": { - "hash": "7fc90812791d74914cbeb83830922c679e81110a", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/bcbe569710dbd97b0d7d9e95d87e93be7d1f8065/trace_processor_shell.exe" + "hash": "93930949986b4ef594e64b97e9065b578bea374a", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/win/55c4abdb8736d8618e0d6c1c0c6a7df5a41559a0/trace_processor_shell.exe" }, "linux_arm": { "hash": "336a42cb9ec3c417e13a97816271fec10cdf67e5", "full_remote_path": "perfetto-luci-artifacts/v34.0/linux-arm/trace_processor_shell" }, "mac": { - "hash": "11ea9c8cb641bb0112e92e4e8b88d5ae259e5118", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/bcbe569710dbd97b0d7d9e95d87e93be7d1f8065/trace_processor_shell" + "hash": "e301de7845f1a7f09494eb552311e38f597cdea9", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/55c4abdb8736d8618e0d6c1c0c6a7df5a41559a0/trace_processor_shell" }, "mac_arm64": { "hash": "c32364e05e22cdf82ee0866aedd11c0e2050809c",
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index 78ad0d0b..8ecfe82 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -470,6 +470,7 @@ } android_library("ax_base_java") { + srcjar_deps = [ ":ax_jni_headers" ] sources = [ "android/java/src/org/chromium/ui/accessibility/AccessibilityState.java", ] @@ -479,7 +480,6 @@ "//build/android:build_java", "//third_party/androidx:androidx_annotation_annotation_jvm_java", ] - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } }
diff --git a/ui/base/cocoa/menu_controller_unittest.mm b/ui/base/cocoa/menu_controller_unittest.mm index b312df7..2fec924 100644 --- a/ui/base/cocoa/menu_controller_unittest.mm +++ b/ui/base/cocoa/menu_controller_unittest.mm
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/memory/raw_ptr.h" - #import <Cocoa/Cocoa.h> +#include "base/memory/raw_ptr.h" +#include "base/memory/raw_ptr_exclusion.h" #include "base/run_loop.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -31,7 +31,8 @@ @end @implementation WatchedLifetimeMenuController { - BOOL* _deallocCalled; + // This field is not a raw_ptr<> because it requires @property rewrite. + RAW_PTR_EXCLUSION BOOL* _deallocCalled; } @synthesize deallocCalled = _deallocCalled;
diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h index 46a639b..5199fc6c 100644 --- a/ui/gfx/native_widget_types.h +++ b/ui/gfx/native_widget_types.h
@@ -170,6 +170,7 @@ #else // This field is not a raw_ptr<> because it was filtered by the rewriter // for: #constexpr-ctor-field-initializer, #global-scope, #union + // This field also points to Objective-C object. RAW_PTR_EXCLUSION NSView* ns_view_ = nullptr; #endif }; @@ -202,6 +203,7 @@ #else // This field is not a raw_ptr<> because it was filtered by the rewriter // for: #constexpr-ctor-field-initializer, #global-scope, #union + // This field also points to Objective-C object. RAW_PTR_EXCLUSION NSWindow* ns_window_ = nullptr; #endif };
diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc index a11b029..f2d18e43 100644 --- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc +++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc
@@ -92,6 +92,26 @@ return false; } +// Whether the input method requires fixes for b/268467697 +// (kWaylandCancelComposition and kWaylandKeepSelectionFix). If so, then we need +// to keep the fixes enabled for b/268467697 in Lacros even if the flag for the +// fixes are disabled. This avoids breakages due to version skew between Ash and +// Lacros. Only ever true for Lacros. +bool ImeRequiresFixesFor268467697() { +#if BUILDFLAG(IS_CHROMEOS_LACROS) + // On Lacros chrome, we check whether ash-chrome supports IME, then + // enable IME if so. This allows us to control IME enabling state in + // Lacros-chrome side, which helps us on releasing. + // TODO(crbug.com/1159237): In the future, we may want to unify the behavior + // of ozone/wayland across platforms. + auto capabilities = chromeos::BrowserParamsProxy::Get()->AshCapabilities(); + if (capabilities && base::Contains(*capabilities, "b/265853952")) { + return true; + } +#endif + return false; +} + // Returns ImeTextSpan style to be assigned. Maybe nullopt if it is not // supported. absl::optional<std::pair<ImeTextSpan::Type, ImeTextSpan::Thickness>> @@ -313,7 +333,8 @@ void WaylandInputMethodContext::Reset() { character_composer_.Reset(); - if (base::FeatureList::IsEnabled(features::kWaylandCancelComposition)) { + if (base::FeatureList::IsEnabled(features::kWaylandCancelComposition) || + ImeRequiresFixesFor268467697()) { // TODO(b/269964109): In ChromeOS, 'reset' means to reset the composition // only, excluding surrounding text etc. In Wayland, text-input-v1 doesn't // define what state is reset in a 'reset' call. However, based on the @@ -598,7 +619,8 @@ } const gfx::Range new_selection_range = - base::FeatureList::IsEnabled(features::kWaylandKeepSelectionFix) + base::FeatureList::IsEnabled(features::kWaylandKeepSelectionFix) || + ImeRequiresFixesFor268467697() ? gfx::Range(offsets[1] + utf16_offset, offsets[0] + utf16_offset) : gfx::Range(offsets[0] + utf16_offset, offsets[1] + utf16_offset); #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index c596d35..c3a9163 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -655,7 +655,11 @@ } void WaylandWindow::OnDragSessionClose(DragOperation operation) { - DCHECK(drag_finished_callback_); + if (!drag_finished_callback_) { + // WaylandWindow::PrepareForShutdown() is already called. This window + // is about to shut down. Do nothing and return. + return; + } std::move(drag_finished_callback_).Run(operation); connection()->event_source()->ResetPointerFlags(); std::move(drag_loop_quit_closure_).Run();
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 7d93e75..1c780a08 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -340,6 +340,12 @@ MouseEvent test_mouse_event_; }; +// Regression test for crbug.com/1433175 +TEST_P(WaylandWindowTest, Shutdown) { + window_->PrepareForShutdown(); + window_->OnDragSessionClose(mojom::DragOperation::kNone); +} + TEST_P(WaylandWindowTest, SetTitle) { window_->SetTitle(u"hello"); PostToServerAndWait([id = surface_id_](wl::TestWaylandServerThread* server) {
diff --git a/weblayer/test/BUILD.gn b/weblayer/test/BUILD.gn index aee3df36..9d29af3 100644 --- a/weblayer/test/BUILD.gn +++ b/weblayer/test/BUILD.gn
@@ -54,9 +54,10 @@ "//weblayer/public/java", "//weblayer/public/javatestutil:test_java", ] - srcjar_deps = [ ":generated_enums" ] - - annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + srcjar_deps = [ + ":generated_enums", + ":weblayer_browsertests_jni", + ] } generate_jni("weblayer_browsertests_jni") {