Commit fc9a80a8 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Update ToolbarButtonInProductHelpController to use incognito profile

when called incognito.

This CL update the profile passing to TrackerFactory from
ToolbarButtonInProductHelpController. Currently, it is always regular
profile, however it is not safe because of possible data leakage from
incognito to regular profile.

Therefore, this CL uses the profile (i.e., regular or off-the-record
profile) belong to active tab in ToolbarButtonInProductHelpController,
then passes it to TrackerFactory.

Bug: 1041781
Change-Id: Ia140d6a63b63325515af9164c2cc89b7fe559ad8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078477Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748880}
parent 4f331c65
......@@ -86,7 +86,7 @@ public class ToolbarButtonInProductHelpController
long dataSaved = DataReductionProxySettings.getInstance()
.getContentLengthSavedInHistorySummary()
- mDataSavedOnStartPageLoad;
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile());
Tracker tracker = TrackerFactory.getTrackerForProfile(((TabImpl) tab).getProfile());
if (dataSaved > 0L) tracker.notifyEvent(EventConstants.DATA_SAVED_ON_PAGE_LOAD);
if (Previews.isPreview(tab)) {
tracker.notifyEvent(EventConstants.PREVIEWS_PAGE_LOADED);
......@@ -170,7 +170,10 @@ public class ToolbarButtonInProductHelpController
@Override
public void onScreenshotTaken() {
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile());
// TODO (https://crbug.com/1048632): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It works correctly now, but
// it is not safe.
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
tracker.notifyEvent(EventConstants.SCREENSHOT_TAKEN_CHROME_IN_FOREGROUND);
PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment