Commit 80a2bc86 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Update ToolbarManager to use incognito profile when called incognito.

This CL update the profile passing to TrackerFactory from
ToolbarManager. 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 |isIncognito| boolean created from current
tab model to get correct profile object(i.e., regular or
off-the-record profile).

Bug: 1041781
Change-Id: Ie9942d02a345cd6a755da1d8fd0b34089b22425b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2075417Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745982}
parent 0a8d6762
...@@ -1356,7 +1356,11 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF ...@@ -1356,7 +1356,11 @@ public class ToolbarManager implements ScrimObserver, ToolbarTabController, UrlF
// Assume data saver footer is shown only if data reduction proxy is enabled and // Assume data saver footer is shown only if data reduction proxy is enabled and
// Chrome home is not // Chrome home is not
if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) { if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile()); boolean isIncognito = mTabModelSelector.getCurrentModel().isIncognito();
Profile profile = isIncognito
? Profile.getLastUsedRegularProfile().getOffTheRecordProfile()
: Profile.getLastUsedRegularProfile();
Tracker tracker = TrackerFactory.getTrackerForProfile(profile);
tracker.notifyEvent(EventConstants.OVERFLOW_OPENED_WITH_DATA_SAVER_SHOWN); tracker.notifyEvent(EventConstants.OVERFLOW_OPENED_WITH_DATA_SAVER_SHOWN);
} }
}); });
......
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