Skip to content

Commit

Permalink
[Merge] Allow legacy tech report use top level url
Browse files Browse the repository at this point in the history
Merge into M118 Beta.

Using top-level url may be easy for admin to understand and setup policy
for legacy tech report. But it will reduce the flexibility of the
feature.

Hence the fix will be behind a flag with default off for now.

Also add log for url matching result.


(cherry picked from commit db2c3f5)

Bug: 1480077
Change-Id: I5a41dc717c8d4d89607c8caa63579e71163aa041
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4850692
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1194184}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4853853
Commit-Queue: Rakina Zata Amni <rakina@chromium.org>
Auto-Submit: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/branch-heads/5993@{#195}
Cr-Branched-From: 5113507-refs/heads/main@{#1192594}
  • Loading branch information
Owen Min authored and Chromium LUCI CQ committed Sep 12, 2023
1 parent 7c35922 commit 1eafcb9
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 2 deletions.
6 changes: 6 additions & 0 deletions chrome/browser/about_flags.cc
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down
Expand Up @@ -27,6 +27,9 @@ void LegacyTechService::ReportEvent(const std::string& type,
uint64_t line,
uint64_t column) const {
absl::optional<std::string> 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;
}
Expand Down
5 changes: 5 additions & 0 deletions chrome/browser/flag-metadata.json
Expand Up @@ -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" ],
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/flag_descriptions.cc
Expand Up @@ -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[] =
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/flag_descriptions.h
Expand Up @@ -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[];

Expand Down
7 changes: 5 additions & 2 deletions content/browser/renderer_host/render_frame_host_impl.cc
Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions content/public/common/content_features.cc
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions content/public/common/content_features.h
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/enums.xml
Expand Up @@ -60492,6 +60492,7 @@ from previous Chrome versions.
<int value="-2028232016" label="spurious-power-button-lid-angle-change"/>
<int value="-2028202891"
label="AutofillEnableFixedPaymentsBubbleLogging:disabled"/>
<int value="-2027019131" label="LegacyTechReportTopLevelUrl:enabled"/>
<int value="-2026838590" label="OmniboxSteadyStateHeight:disabled"/>
<int value="-2026156288"
label="LookalikeUrlNavigationSuggestionsUI:disabled"/>
Expand Down Expand Up @@ -63841,6 +63842,7 @@ from previous Chrome versions.
<int value="-364325011" label="enable-files-quick-view"/>
<int value="-364267715" label="disable-native-cups"/>
<int value="-363885137" label="StoragePressureEvent:disabled"/>
<int value="-363145046" label="LegacyTechReportTopLevelUrl:disabled"/>
<int value="-362821234" label="ExperimentalUi:enabled"/>
<int value="-362022976" label="disable-quirks-client"/>
<int value="-361948582" label="material-security-verbose"/>
Expand Down

0 comments on commit 1eafcb9

Please sign in to comment.