Enable screenshot control based on enterprise rule and data controls [chromium/src : main]

0 views
Skip to first unread message

Alex Chen (Gerrit)

unread,
Jul 2, 2026, 2:48:39 PM (6 days ago) Jul 2
to chromium...@chromium.org

Alex Chen abandoned this change.

View Change

Abandoned

Alex Chen abandoned this change

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: abandon
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I611240ffd416445a73b18e848ce55200f181e56c
Gerrit-Change-Number: 8016890
Gerrit-PatchSet: 1
Gerrit-Owner: Alex Chen <alx...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Alex Chen (Gerrit)

unread,
Jul 3, 2026, 3:25:44 PM (5 days ago) Jul 3
to Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
Attention needed from Alex Chen

Message from Alex Chen

Set Ready For Review

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Chen
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
Gerrit-Change-Number: 8036164
Gerrit-PatchSet: 7
Gerrit-Owner: Alex Chen <alx...@google.com>
Gerrit-Reviewer: Alex Chen <alx...@google.com>
Gerrit-Attention: Alex Chen <alx...@google.com>
Gerrit-Comment-Date: Fri, 03 Jul 2026 19:25:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Dominique Fauteux-Chapleau (Gerrit)

unread,
Jul 3, 2026, 3:37:04 PM (5 days ago) Jul 3
to Alex Chen, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
Attention needed from Alex Chen

Dominique Fauteux-Chapleau added 2 comments

File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
Line 38, Patchset 7 (Latest):public class ScreenshotProtectionController implements TabModelObserver, DestroyObserver {
Dominique Fauteux-Chapleau . unresolved

I'm still not sure we need ani JNI for this considering all the tab observer methods you have in TabModelObserver. What do you specifically need from `DataProtectionNavigationController` that you can't do in Java?

Line 123, Patchset 7 (Latest): if (model.isIncognitoBranded()) {
Dominique Fauteux-Chapleau . unresolved

I don't think this should be here, won't this mean you never block screenshots in incognito? DC is supposed to be able to do that.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Chen
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
    Gerrit-Change-Number: 8036164
    Gerrit-PatchSet: 7
    Gerrit-Owner: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
    Gerrit-Attention: Alex Chen <alx...@google.com>
    Gerrit-Comment-Date: Fri, 03 Jul 2026 19:36:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alex Chen (Gerrit)

    unread,
    Jul 3, 2026, 3:44:25 PM (5 days ago) Jul 3
    to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
    Attention needed from Dominique Fauteux-Chapleau

    Alex Chen added 2 comments

    File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
    Line 38, Patchset 7 (Latest):public class ScreenshotProtectionController implements TabModelObserver, DestroyObserver {
    Dominique Fauteux-Chapleau . unresolved

    I'm still not sure we need ani JNI for this considering all the tab observer methods you have in TabModelObserver. What do you specifically need from `DataProtectionNavigationController` that you can't do in Java?

    Alex Chen

    Registering the `setCurrentTabState` cb with `DataProtectionNavigationController` allows this class to be notified, on each navigation commit, if either cloud DLP or DC determines that the newly committed page should not have screenshots allowed. AFAIK blocking navs and getting DLP/DC are not available in Java. This class should only take that notif and control the state of the window property for protecting screenshots.

    Line 123, Patchset 7 (Latest): if (model.isIncognitoBranded()) {
    Dominique Fauteux-Chapleau . resolved

    I don't think this should be here, won't this mean you never block screenshots in incognito? DC is supposed to be able to do that.

    Alex Chen

    Unlike desktop, by default, clank does not allow any screenshots in incognito at all. Will add a comment explaining that's why we don't need to observe here

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dominique Fauteux-Chapleau
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
    Gerrit-Change-Number: 8036164
    Gerrit-PatchSet: 7
    Gerrit-Owner: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
    Gerrit-Attention: Dominique Fauteux-Chapleau <do...@chromium.org>
    Gerrit-Comment-Date: Fri, 03 Jul 2026 19:44:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dominique Fauteux-Chapleau <do...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alex Chen (Gerrit)

    unread,
    Jul 3, 2026, 4:25:37 PM (5 days ago) Jul 3
    to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
    Attention needed from Alex Chen

    Alex Chen added 1 comment

    Patchset-level comments
    File-level comment, Patchset 8 (Latest):
    Alex Chen . resolved

    synced offline, alex to try java navigation observer and only 1 jni interface for "isscreenshotallowed(tab)". concern is race conditions if both dp nav and java nav are listening for the same nav commit event

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Chen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
    Gerrit-Change-Number: 8036164
    Gerrit-PatchSet: 8
    Gerrit-Owner: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
    Gerrit-Attention: Alex Chen <alx...@google.com>
    Gerrit-Comment-Date: Fri, 03 Jul 2026 20:25:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dominique Fauteux-Chapleau (Gerrit)

    unread,
    Jul 3, 2026, 4:25:56 PM (5 days ago) Jul 3
    to Alex Chen, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
    Attention needed from Alex Chen

    Dominique Fauteux-Chapleau added 1 comment

    Patchset-level comments
    Dominique Fauteux-Chapleau . unresolved

    Removing myself from the attention set for now until you test out what we discussed

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Alex Chen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
    Gerrit-Change-Number: 8036164
    Gerrit-PatchSet: 8
    Gerrit-Owner: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Alex Chen <alx...@google.com>
    Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
    Gerrit-Attention: Alex Chen <alx...@google.com>
    Gerrit-Comment-Date: Fri, 03 Jul 2026 20:25:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alex Chen (Gerrit)

    unread,
    Jul 7, 2026, 12:21:09 AM (yesterday) Jul 7
    to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
    Attention needed from Dominique Fauteux-Chapleau

    Alex Chen added 2 comments

    Patchset-level comments
    File-level comment, Patchset 8:
    Dominique Fauteux-Chapleau . resolved

    Removing myself from the attention set for now until you test out what we discussed

    Alex Chen

    Done

    File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
    Line 38, Patchset 7:public class ScreenshotProtectionController implements TabModelObserver, DestroyObserver {
    Dominique Fauteux-Chapleau . resolved

    I'm still not sure we need ani JNI for this considering all the tab observer methods you have in TabModelObserver. What do you specifically need from `DataProtectionNavigationController` that you can't do in Java?

    Alex Chen

    Registering the `setCurrentTabState` cb with `DataProtectionNavigationController` allows this class to be notified, on each navigation commit, if either cloud DLP or DC determines that the newly committed page should not have screenshots allowed. AFAIK blocking navs and getting DLP/DC are not available in Java. This class should only take that notif and control the state of the window property for protecting screenshots.

    Alex Chen
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dominique Fauteux-Chapleau
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
      Gerrit-Change-Number: 8036164
      Gerrit-PatchSet: 10
      Gerrit-Owner: Alex Chen <alx...@google.com>
      Gerrit-Reviewer: Alex Chen <alx...@google.com>
      Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
      Gerrit-Attention: Dominique Fauteux-Chapleau <do...@chromium.org>
      Gerrit-Comment-Date: Tue, 07 Jul 2026 04:20:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Dominique Fauteux-Chapleau <do...@chromium.org>
      Comment-In-Reply-To: Alex Chen <alx...@google.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dominique Fauteux-Chapleau (Gerrit)

      unread,
      Jul 7, 2026, 9:32:20 AM (yesterday) Jul 7
      to Alex Chen, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
      Attention needed from Alex Chen

      Dominique Fauteux-Chapleau added 3 comments

      File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
      Line 80, Patchset 10 (Latest): boolean enterpriseObserveSelectTab = false;
      Dominique Fauteux-Chapleau . unresolved

      Considering the policies are dynamic, does making this check here really make sense? IIUC this constructor won't be called on every new tab being opened or every navigation, so this could become a gap.

      Line 122, Patchset 10 (Latest): if (!mAllowIncognitoScreenshot) {
      Dominique Fauteux-Chapleau . unresolved

      This is an odd condition to check outside of a `currentTab.isIncognito()` branch. Why can't we run this unconditionally like the previous version of the function?

      Line 130, Patchset 10 (Latest): if (mAllowIncognitoScreenshot) {
      return false;
      }
      Dominique Fauteux-Chapleau . unresolved

      Same comment for this check, having `isIncognitoBranded()` not checked at all doesn't seem right here.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Chen
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 10
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Alex Chen <alx...@google.com>
        Gerrit-Comment-Date: Tue, 07 Jul 2026 13:32:12 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Alex Chen (Gerrit)

        unread,
        Jul 7, 2026, 6:09:08 PM (yesterday) Jul 7
        to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Dominique Fauteux-Chapleau

        Alex Chen added 4 comments

        Patchset-level comments
        File-level comment, Patchset 11 (Latest):
        Alex Chen . resolved

        Sorry its gotten a bit large, its not clear how I could split this.

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 80, Patchset 10: boolean enterpriseObserveSelectTab = false;
        Dominique Fauteux-Chapleau . unresolved

        Considering the policies are dynamic, does making this check here really make sense? IIUC this constructor won't be called on every new tab being opened or every navigation, so this could become a gap.

        Alex Chen

        This is a good point that applies to the code below as well -- `shouldObserveSelectTab(` is also called once on browser startup and does not refresh for policy updates.

        The newest patchset observes when the profile's policies change, and re-initializes the controller when they do.

        Line 122, Patchset 10: if (!mAllowIncognitoScreenshot) {
        Dominique Fauteux-Chapleau . resolved

        This is an odd condition to check outside of a `currentTab.isIncognito()` branch. Why can't we run this unconditionally like the previous version of the function?

        Alex Chen

        I will add a comment for this. If incog screenshot is allowed, we never need to set screenshot state, so it is skipped. Had updateScreenshot been unconditional, the screen would be protected when in an incognito Chrome Custom Tab AND the incognito screenshot feature is turned on.

        Line 130, Patchset 10: if (mAllowIncognitoScreenshot) {
        return false;
        }
        Dominique Fauteux-Chapleau . resolved

        Same comment for this check, having `isIncognitoBranded()` not checked at all doesn't seem right here.

        Alex Chen

        Perhaps renaming the variable would make this easier to read -- I made it `mForceAllowIncognitoScreenshot`

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Dominique Fauteux-Chapleau
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 11
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Comment-Date: Tue, 07 Jul 2026 22:08:56 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Dominique Fauteux-Chapleau <do...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Dominique Fauteux-Chapleau (Gerrit)

        unread,
        10:41 AM (11 hours ago) 10:41 AM
        to Alex Chen, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Alex Chen

        Dominique Fauteux-Chapleau added 5 comments

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 86, Patchset 11 (Latest): if (profile != null && !profile.isIncognitoBranded()) {
        Dominique Fauteux-Chapleau . unresolved

        I'm not sure I understand this condition, won't that skip policy updates on incognito tabs? What about the DC policy being updated in those tabs?

        Line 122, Patchset 10: if (!mAllowIncognitoScreenshot) {
        Dominique Fauteux-Chapleau . unresolved

        This is an odd condition to check outside of a `currentTab.isIncognito()` branch. Why can't we run this unconditionally like the previous version of the function?

        Alex Chen

        I will add a comment for this. If incog screenshot is allowed, we never need to set screenshot state, so it is skipped. Had updateScreenshot been unconditional, the screen would be protected when in an incognito Chrome Custom Tab AND the incognito screenshot feature is turned on.

        Dominique Fauteux-Chapleau

        What if the policies used to disable screenshots, but were then turned off?

        Line 135, Patchset 11 (Latest): for (TabModel model : mTabModelSelector.getModels()) {
        if (shouldObserveSelectTab(model)) {
        Dominique Fauteux-Chapleau . unresolved

        Why do we need a loop instead of using something like `TabModelSelector::getCurrentModel` ? Is there a case where this won't return the right one?

        Line 146, Patchset 11 (Latest): }
        Dominique Fauteux-Chapleau . unresolved

        Can we return here since there is only supposed to be one active model?


        ```suggestion
        return;
        }
        ```

        If not, then how do we ensure only one callback is registered at a time?

        Line 277, Patchset 11 (Latest): if (profile != null && !profile.isIncognitoBranded()) {
        Dominique Fauteux-Chapleau . unresolved

        Same comment as in the constructor.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Chen
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 11
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Alex Chen <alx...@google.com>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 14:40:44 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Dominique Fauteux-Chapleau <do...@chromium.org>
        Comment-In-Reply-To: Alex Chen <alx...@google.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Alex Chen (Gerrit)

        unread,
        2:50 PM (7 hours ago) 2:50 PM
        to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Dominique Fauteux-Chapleau

        Alex Chen added 6 comments

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 80, Patchset 10: boolean enterpriseObserveSelectTab = false;
        Dominique Fauteux-Chapleau . resolved

        Considering the policies are dynamic, does making this check here really make sense? IIUC this constructor won't be called on every new tab being opened or every navigation, so this could become a gap.

        Alex Chen

        This is a good point that applies to the code below as well -- `shouldObserveSelectTab(` is also called once on browser startup and does not refresh for policy updates.

        The newest patchset observes when the profile's policies change, and re-initializes the controller when they do.

        Alex Chen

        Done

        Line 86, Patchset 11: if (profile != null && !profile.isIncognitoBranded()) {
        Dominique Fauteux-Chapleau . resolved

        I'm not sure I understand this condition, won't that skip policy updates on incognito tabs? What about the DC policy being updated in those tabs?

        Alex Chen

        Thanks for pointing this out. This condition indeed needs to be removed, otherwise incognito CCT won't apply machine policy updates.

        Line 122, Patchset 10: if (!mAllowIncognitoScreenshot) {
        Dominique Fauteux-Chapleau . unresolved

        This is an odd condition to check outside of a `currentTab.isIncognito()` branch. Why can't we run this unconditionally like the previous version of the function?

        Alex Chen

        I will add a comment for this. If incog screenshot is allowed, we never need to set screenshot state, so it is skipped. Had updateScreenshot been unconditional, the screen would be protected when in an incognito Chrome Custom Tab AND the incognito screenshot feature is turned on.

        Dominique Fauteux-Chapleau

        What if the policies used to disable screenshots, but were then turned off?

        Alex Chen

        The current code should still listen for policy changes, and re-`initialize()` the listeners after.

        Line 135, Patchset 11: for (TabModel model : mTabModelSelector.getModels()) {
        if (shouldObserveSelectTab(model)) {
        Dominique Fauteux-Chapleau . unresolved

        Why do we need a loop instead of using something like `TabModelSelector::getCurrentModel` ? Is there a case where this won't return the right one?

        Alex Chen

        We can't use `::getCurrentModel` bc it is possible to directly launch into incognito model, and in that case we would not override the IncognitoScreenshots featureflag

        Dominique Fauteux-Chapleau . unresolved

        Can we return here since there is only supposed to be one active model?


        ```suggestion
        return;
        }
        ```

        If not, then how do we ensure only one callback is registered at a time?

        Alex Chen

        Yes, we can return here; we at most only want to observe the regular tabmodel. ensuring only one callback is registered at a time is achieved by only having one tabID (with the implicit non-re-entrence invariant above)
        I've refactored this function to hopefully be more clear about its intentions.

        Line 277, Patchset 11: if (profile != null && !profile.isIncognitoBranded()) {
        Dominique Fauteux-Chapleau . resolved

        Same comment as in the constructor.

        Alex Chen

        agreed and removed

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Dominique Fauteux-Chapleau
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 12
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 18:50:35 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Dominique Fauteux-Chapleau (Gerrit)

        unread,
        3:49 PM (6 hours ago) 3:49 PM
        to Alex Chen, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Alex Chen

        Dominique Fauteux-Chapleau added 5 comments

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 122, Patchset 10: if (!mAllowIncognitoScreenshot) {
        Dominique Fauteux-Chapleau . resolved

        This is an odd condition to check outside of a `currentTab.isIncognito()` branch. Why can't we run this unconditionally like the previous version of the function?

        Alex Chen

        I will add a comment for this. If incog screenshot is allowed, we never need to set screenshot state, so it is skipped. Had updateScreenshot been unconditional, the screen would be protected when in an incognito Chrome Custom Tab AND the incognito screenshot feature is turned on.

        Dominique Fauteux-Chapleau

        What if the policies used to disable screenshots, but were then turned off?

        Alex Chen

        The current code should still listen for policy changes, and re-`initialize()` the listeners after.

        Dominique Fauteux-Chapleau

        Acknowledged

        Line 135, Patchset 11: for (TabModel model : mTabModelSelector.getModels()) {
        if (shouldObserveSelectTab(model)) {
        Dominique Fauteux-Chapleau . unresolved

        Why do we need a loop instead of using something like `TabModelSelector::getCurrentModel` ? Is there a case where this won't return the right one?

        Alex Chen

        We can't use `::getCurrentModel` bc it is possible to directly launch into incognito model, and in that case we would not override the IncognitoScreenshots featureflag

        Dominique Fauteux-Chapleau

        How is that worked around by using a loop? Do you have a guarantee that the incognito model is later in the `mTabModelSelector.getModels()` list?

        Beyond that, why is it OK to bypass incognito models? Won't that lead to gaps for DC?

        Line 146, Patchset 11: }
        Dominique Fauteux-Chapleau . resolved

        Can we return here since there is only supposed to be one active model?


        ```suggestion
        return;
        }
        ```

        If not, then how do we ensure only one callback is registered at a time?

        Alex Chen

        Yes, we can return here; we at most only want to observe the regular tabmodel. ensuring only one callback is registered at a time is achieved by only having one tabID (with the implicit non-re-entrence invariant above)
        I've refactored this function to hopefully be more clear about its intentions.

        Dominique Fauteux-Chapleau

        Let's keep discussing this in the other comment thread. I feel like there's an implicit assumption about the loop I'm not understanding that might explain why you're not returning early.

        Line 156, Patchset 12 (Latest): if (!model.isIncognito()) {
        Dominique Fauteux-Chapleau . unresolved

        Shouldn't this be removed under the same rationale as this comment?
        https://chromium-review.git.corp.google.com/c/chromium/src/+/8036164/comment/df59871d_cda2ae9d/

        We should be observing changes to incognito since DC can apply to it.

        Line 176, Patchset 12 (Latest): mForceAllowIncognitoScreenshot =
        !hasEnterpriseScreenshotPolicies
        && ChromeFeatureList.sIncognitoScreenshot.isEnabled();
        Dominique Fauteux-Chapleau . unresolved

        I don't know if this is the right way to go about this flag. Right now the implementation would just bypass the flag and always block incognito screenshots if any DC screenshot rule is set, but semantically we should only ignore the flag when the specific incognito tab is blocked by a specific rule.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Chen
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 12
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Alex Chen <alx...@google.com>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 19:48:48 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Alex Chen (Gerrit)

        unread,
        6:40 PM (3 hours ago) 6:40 PM
        to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Alex Chen

        Alex Chen added 3 comments

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 135, Patchset 11: for (TabModel model : mTabModelSelector.getModels()) {
        if (shouldObserveSelectTab(model)) {
        Dominique Fauteux-Chapleau . unresolved

        Why do we need a loop instead of using something like `TabModelSelector::getCurrentModel` ? Is there a case where this won't return the right one?

        Alex Chen

        We can't use `::getCurrentModel` bc it is possible to directly launch into incognito model, and in that case we would not override the IncognitoScreenshots featureflag

        Dominique Fauteux-Chapleau

        How is that worked around by using a loop? Do you have a guarantee that the incognito model is later in the `mTabModelSelector.getModels()` list?

        Beyond that, why is it OK to bypass incognito models? Won't that lead to gaps for DC?

        Alex Chen

        perhaps worth resurfacing that on non-managed clank, screenshot in incognito is always blocked unless the `IncognitoScreenshot` feature flag is turned off.

        With that, there's two reasons we want to look at all the tabmodels:

        • we want to observe the profiles for all the tabmodels, so that when policies are synced we call `initialize` again.
        • during initialization, we want to walk through all tabmodels so that if one or both tabmodel's profile has screenshot policies, we override the feature flag allowing screenshots in incognito.

        There's is no ordering guarantee nor a need for one in either.

        Line 156, Patchset 12 (Latest): if (!model.isIncognito()) {
        Dominique Fauteux-Chapleau . resolved

        Shouldn't this be removed under the same rationale as this comment?
        https://chromium-review.git.corp.google.com/c/chromium/src/+/8036164/comment/df59871d_cda2ae9d/

        We should be observing changes to incognito since DC can apply to it.

        Alex Chen

        I added this in the documentation at the top of the page, but screenshot protection is always enabled for incognito (overriding the feature flag) if there is a screenshot policy or realtimeurl is turned on. this is different from desktop because on clank by default prevents taking screenshots in incognito.

        Line 176, Patchset 12 (Latest): mForceAllowIncognitoScreenshot =
        !hasEnterpriseScreenshotPolicies
        && ChromeFeatureList.sIncognitoScreenshot.isEnabled();
        Dominique Fauteux-Chapleau . unresolved

        I don't know if this is the right way to go about this flag. Right now the implementation would just bypass the flag and always block incognito screenshots if any DC screenshot rule is set, but semantically we should only ignore the flag when the specific incognito tab is blocked by a specific rule.

        Alex Chen

        Agreed it would be more user friendly to only ignore the flag when DC blocks a page. I think it could work by using CurrentTabModelObserver and will try that.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Chen
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 12
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Alex Chen <alx...@google.com>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 22:40:08 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Alex Chen (Gerrit)

        unread,
        6:42 PM (3 hours ago) 6:42 PM
        to Dominique Fauteux-Chapleau, Chromium LUCI CQ, chromium...@chromium.org, cbe-cep-eng...@google.com
        Attention needed from Alex Chen

        Alex Chen added 1 comment

        File chrome/android/java/src/org/chromium/chrome/browser/screenshot_protection/ScreenshotProtectionController.java
        Line 135, Patchset 11: for (TabModel model : mTabModelSelector.getModels()) {
        if (shouldObserveSelectTab(model)) {
        Dominique Fauteux-Chapleau . unresolved

        Why do we need a loop instead of using something like `TabModelSelector::getCurrentModel` ? Is there a case where this won't return the right one?

        Alex Chen

        We can't use `::getCurrentModel` bc it is possible to directly launch into incognito model, and in that case we would not override the IncognitoScreenshots featureflag

        Dominique Fauteux-Chapleau

        How is that worked around by using a loop? Do you have a guarantee that the incognito model is later in the `mTabModelSelector.getModels()` list?

        Beyond that, why is it OK to bypass incognito models? Won't that lead to gaps for DC?

        Alex Chen

        perhaps worth resurfacing that on non-managed clank, screenshot in incognito is always blocked unless the `IncognitoScreenshot` feature flag is turned off.

        With that, there's two reasons we want to look at all the tabmodels:

        • we want to observe the profiles for all the tabmodels, so that when policies are synced we call `initialize` again.
        • during initialization, we want to walk through all tabmodels so that if one or both tabmodel's profile has screenshot policies, we override the feature flag allowing screenshots in incognito.

        There's is no ordering guarantee nor a need for one in either.

        Alex Chen

        Just to clarify, we don't need ordering because we enable/disable the global tabmodel observation/layoutstate observation based as long as either of the profiles have relevant policies.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Alex Chen
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I1feb9e37068323dfadeed58f52b0d1dc4803c9a0
        Gerrit-Change-Number: 8036164
        Gerrit-PatchSet: 12
        Gerrit-Owner: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Alex Chen <alx...@google.com>
        Gerrit-Reviewer: Dominique Fauteux-Chapleau <do...@chromium.org>
        Gerrit-Attention: Alex Chen <alx...@google.com>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 22:41:53 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages