diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c6536a0c292c73..824d9228e5d335 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -177,6 +177,7 @@ #include "device/gamepad/public/cpp/gamepad_features.h" #include "device/vr/buildflags/buildflags.h" #include "extensions/buildflags/buildflags.h" +#include "flag_descriptions.h" #include "gpu/config/gpu_finch_features.h" #include "gpu/config/gpu_switches.h" #include "media/audio/audio_features.h" @@ -6886,6 +6887,11 @@ const FeatureEntry kFeatureEntries[] = { "")}, #endif + {"legacy-tech-report-top-level-url", + flag_descriptions::kLegacyTechReportTopLevelUrlName, + flag_descriptions::kLegacyTechReportTopLevelUrlDescription, kOsAll, + FEATURE_VALUE_TYPE(features::kLegacyTechReportTopLevelUrl)}, + #if BUILDFLAG(IS_CHROMEOS_ASH) {"enable-web-authentication-chromeos-authenticator", flag_descriptions::kEnableWebAuthenticationChromeOSAuthenticatorName, diff --git a/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_service.cc b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_service.cc index 306711e31baa69..a0321e78611e1e 100644 --- a/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_service.cc +++ b/chrome/browser/enterprise/reporting/legacy_tech/legacy_tech_service.cc @@ -27,6 +27,9 @@ void LegacyTechService::ReportEvent(const std::string& type, uint64_t line, uint64_t column) const { absl::optional matched_url = url_matcher_.GetMatchedURL(url); + VLOG(2) << "Get report for URL " << url + << (matched_url ? " and matches a policy." + : " without matching any policie."); if (!matched_url) { return; } diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 6c85075b8c7eb1..645641ca7e9fea 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json @@ -5385,6 +5385,11 @@ "owners": [ "rhalavati", "//ui/accessibility/OWNERS" ], "expiry_milestone": 120 }, + { + "name": "legacy-tech-report-top-level-url", + "owners": ["zmin", "parastoog"], + "expiry_milestone": 122 + }, { "name": "legacy-tls-interstitial", "owners": [ "cthomp" ], diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index a60a882ebc82ff..57259e1d9e7243 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -2113,6 +2113,14 @@ const char kLargeFaviconFromGoogleName[] = "Large favicons from Google"; const char kLargeFaviconFromGoogleDescription[] = "Request large favicons from Google's favicon service"; +const char kLegacyTechReportTopLevelUrlName[] = + "Using top level navigation URL for legacy technology report"; +const char kLegacyTechReportTopLevelUrlDescription[] = + "When a legacy technology report is triggered and uploaded for enterprise " + "users. By default, the URL of the report won't be same as the one in the " + "Omnibox if the event is detected in a sub-frame. Enable this flag will " + "allow browser trace back to the top level URL instead."; + const char kLensCameraAssistedSearchName[] = "Google Lens in Omnibox and New Tab Page"; const char kLensCameraAssistedSearchDescription[] = diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 4d4b9199b06410..21b004b7564fd8 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -1191,6 +1191,9 @@ extern const char kExtractRelatedSearchesFromPrefetchedZPSResponseDescription[]; extern const char kLargeFaviconFromGoogleName[]; extern const char kLargeFaviconFromGoogleDescription[]; +extern const char kLegacyTechReportTopLevelUrlName[]; +extern const char kLegacyTechReportTopLevelUrlDescription[]; + extern const char kLensCameraAssistedSearchName[]; extern const char kLensCameraAssistedSearchDescription[]; diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index 50d873e238b04e..ad0d9cd11022f4 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -8383,8 +8383,11 @@ void RenderFrameHostImpl::SendLegacyTechEvent( const std::string& type, blink::mojom::LegacyTechEventCodeLocationPtr code_location) { GetContentClient()->browser()->ReportLegacyTechEvent( - this, type, GetLastCommittedURL(), code_location->filename, - code_location->line, code_location->column); + this, type, + base::FeatureList::IsEnabled(features::kLegacyTechReportTopLevelUrl) + ? GetOutermostMainFrameOrEmbedder()->GetLastCommittedURL() + : GetLastCommittedURL(), + code_location->filename, code_location->line, code_location->column); } void RenderFrameHostImpl::SendPrivateAggregationRequestsForFencedFrameEvent( diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index e03f5dd5a6de8b..c49cf935a8d511 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc @@ -644,6 +644,12 @@ BASE_FEATURE(kLazyInitializeMediaControls, "LazyInitializeMediaControls", base::FEATURE_ENABLED_BY_DEFAULT); +// Using top-level document URL when create an enterprise report for legacy +// technologies usage +BASE_FEATURE(kLegacyTechReportTopLevelUrl, + "LegacyTechReportTopLevelUrl", + base::FEATURE_DISABLED_BY_DEFAULT); + // Configures whether Blink on Windows 8.0 and below should use out of process // API font fallback calls to retrieve a fallback font family name as opposed to // using a hard-coded font lookup table. diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 2ecca5b5317b07..b68b34e3ae12ca 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h @@ -137,6 +137,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kJavaScriptExperimentalSharedMemory); CONTENT_EXPORT BASE_DECLARE_FEATURE(kIwaControlledFrame); CONTENT_EXPORT BASE_DECLARE_FEATURE(kLazyFrameLoading); CONTENT_EXPORT BASE_DECLARE_FEATURE(kLazyInitializeMediaControls); +CONTENT_EXPORT BASE_DECLARE_FEATURE(kLegacyTechReportTopLevelUrl); CONTENT_EXPORT BASE_DECLARE_FEATURE(kLegacyWindowsDWriteFontFallback); CONTENT_EXPORT BASE_DECLARE_FEATURE(kLogJsConsoleMessages); CONTENT_EXPORT BASE_DECLARE_FEATURE(kLowerPAMemoryLimitForNonMainRenderers); diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index a26fd033048eea..7f3d2be71da06f 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -60492,6 +60492,7 @@ from previous Chrome versions. + @@ -63841,6 +63842,7 @@ from previous Chrome versions. +