[Safe Browsing] Reorder PolicyEngine method to enable refactoring
We will need to refactor PolicyEngine::CanPerformFullUrlLookupWithToken() as part of enabling Gaia-keyed URL lookups in WebLayer: the parts that integrate with Chrome signin and sync will need to be pulled out into a separate method. This CL prepares for that refactoring by reordering this method so that the common checks are all first followed by the checks that are specific to signin/sync integration. There is a slight behavioral change in this CL: - Currently, if the user has enabled enhanced protection and the primary account is available, the value of the kRealTimeUrlLookupEnabledWithToken feature is not taken into account. However, if the user has enabled enhanced protection but the primary account is *not* available, PolicyEngine::CanPerformFullUrlLookupWithToken() will short-circuit out if the kRealTimeUrlLookupEnabledWithToken feature is not enabled. - In this CL, if the user has enabled enhanced protection, the value of the kRealTimeUrlLookupEnabledWithToken feature is not taken into account (full stop). This behavioral change reflects the originally-intended behavior (cf. https://chromium-review.googlesource.com/c/chromium/src/+/2103582). The current behavior of considering the value of the feature if the user has enabled enhanced protection but the primary account isn't available came in unintentionally as part of https://chromium-review.googlesource.com/c/chromium/src/+/2138164. This behavioral change also entails a slight modification of the PolicyEngine unittest: the unittest was previously testing a case where enhanced protection was enabled, the user was not signed in, the kRealTimeUrlLookupEnabledWithToken feature was disabled, and sync was enabled. The result in this case differs before/after this CL, but this case also doesn't reflect reality: it's not possible for the user to be syncing browser history without being signed in. We update the test to have the cases reflect reality. Bug: 1080748 Change-Id: I075bdb7567b8b35a266b2c3cc85258db5a91d042 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2610095Reviewed-by:Xinghui Lu <xinghuilu@chromium.org> Commit-Queue: Colin Blundell <blundell@chromium.org> Cr-Commit-Position: refs/heads/master@{#840968}
Showing
Please register or sign in to comment