Do not show print in app menu for locally stored PDFs [chromium/src : main]

0 views
Skip to first unread message

Shu Yang (Gerrit)

unread,
Dec 24, 2025, 4:07:48 AM (3 days ago) Dec 24
to Wenyu Fu, Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Sirisha Kavuluru and Wenyu Fu

Shu Yang added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Sirisha Kavuluru
  • Wenyu Fu
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: I4851a130aa2e7288ce385167576ffb94060d6cc7
Gerrit-Change-Number: 7318746
Gerrit-PatchSet: 2
Gerrit-Owner: Shu Yang <shu...@google.com>
Gerrit-Reviewer: Shu Yang <shu...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Attention: Wenyu Fu <wen...@chromium.org>
Gerrit-Comment-Date: Wed, 24 Dec 2025 09:07:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Wenyu Fu (Gerrit)

unread,
1:36 PM (10 hours ago) 1:36 PM
to Shu Yang, Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Shu Yang and Sirisha Kavuluru

Wenyu Fu voted and added 1 comment

Votes added by Wenyu Fu

Code-Review+1

1 comment

File chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate.java
Line 804, Patchset 2 (Latest): boolean isPdfPage = nativePage != null && nativePage.isPdf();
Wenyu Fu . unresolved

optional nit:

I personally found these condition quite complex. It might be a case where early return can help leverage some of the cognitive load for understanding this.

suggestion:

```
if (!canShareTab) return;

if (!isPrintingEnabled) return;

if (!isPdfPage) return;

return (DeviceInfo.isDesktop() || !isChromeNativeScheme)

```

Open in Gerrit

Related details

Attention is currently required from:
  • Shu Yang
  • Sirisha Kavuluru
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement 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: I4851a130aa2e7288ce385167576ffb94060d6cc7
Gerrit-Change-Number: 7318746
Gerrit-PatchSet: 2
Gerrit-Owner: Shu Yang <shu...@google.com>
Gerrit-Reviewer: Shu Yang <shu...@google.com>
Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
Gerrit-Attention: Shu Yang <shu...@google.com>
Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
Gerrit-Comment-Date: Fri, 26 Dec 2025 18:35:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Shu Yang (Gerrit)

unread,
6:18 PM (5 hours ago) 6:18 PM
to Wenyu Fu, Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org
Attention needed from Sirisha Kavuluru

Shu Yang added 1 comment

File chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate.java
Line 804, Patchset 2: boolean isPdfPage = nativePage != null && nativePage.isPdf();
Wenyu Fu . resolved

optional nit:

I personally found these condition quite complex. It might be a case where early return can help leverage some of the cognitive load for understanding this.

suggestion:

```
if (!canShareTab) return;

if (!isPrintingEnabled) return;

if (!isPdfPage) return;

return (DeviceInfo.isDesktop() || !isChromeNativeScheme)

```

Shu Yang

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Sirisha Kavuluru
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I4851a130aa2e7288ce385167576ffb94060d6cc7
    Gerrit-Change-Number: 7318746
    Gerrit-PatchSet: 4
    Gerrit-Owner: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
    Gerrit-Comment-Date: Fri, 26 Dec 2025 23:18:13 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Wenyu Fu <wen...@chromium.org>
    satisfied_requirement
    open
    diffy

    Shu Yang (Gerrit)

    unread,
    7:13 PM (4 hours ago) 7:13 PM
    to Wenyu Fu, Sirisha Kavuluru, Chromium LUCI CQ, chromium...@chromium.org
    Attention needed from Sirisha Kavuluru

    Shu Yang voted Commit-Queue+2

    Commit-Queue+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sirisha Kavuluru
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I4851a130aa2e7288ce385167576ffb94060d6cc7
    Gerrit-Change-Number: 7318746
    Gerrit-PatchSet: 4
    Gerrit-Owner: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    Gerrit-Attention: Sirisha Kavuluru <skav...@google.com>
    Gerrit-Comment-Date: Sat, 27 Dec 2025 00:13:23 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    7:17 PM (4 hours ago) 7:17 PM
    to Shu Yang, Wenyu Fu, Sirisha Kavuluru, chromium...@chromium.org

    Chromium LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    2 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate.java
    Insertions: 18, Deletions: 11.

    @@ -792,24 +792,31 @@

    // Check if sharing (which includes printing) is generally enabled for this tab's content.
    boolean canShareTab = ShareUtils.shouldEnableShare(currentTab);
    + if (!canShareTab) {
    + return false;
    + }

    // Check if printing is specifically enabled in user preferences for the current profile.
    Profile profile = currentTab.getProfile();
    boolean isPrintingEnabled = UserPrefs.get(profile).getBoolean(Pref.PRINTING_ENABLED);
    + if (!isPrintingEnabled) {
    + return false;
    + }

    - // The print functionality should be displayed in the app menu if the device is Desktop
    - // Android or if the current tab contains a transient PDF page. Printing for locally stored
    - // PDFs is not yet supported.
    + // The print functionality is enabled if:
    + // 1. The device is running Desktop Android, OR
    + // 2. The current tab is a web-based PDF (transient).
    + // Note: Printing local PDFs (chrome-native://) is not yet supported.
    NativePage nativePage = currentTab.getNativePage();
    - boolean isPdfPage = nativePage != null && nativePage.isPdf();
    - boolean isChromeNativeScheme =
    - currentTab.getUrl().getScheme().equals(UrlConstants.CHROME_NATIVE_SCHEME);
    - boolean isTransientPdfPage = isPdfPage && !isChromeNativeScheme;
    - boolean isLocalPdfPage = isPdfPage && isChromeNativeScheme;
    - boolean isEligibleForPrint =
    - !isLocalPdfPage && (DeviceInfo.isDesktop() || isTransientPdfPage);
    + boolean isPdf = nativePage != null && nativePage.isPdf();
    + boolean isLocalPdf =
    + isPdf && currentTab.getUrl().getScheme().equals(UrlConstants.CHROME_NATIVE_SCHEME);

    - return canShareTab && isPrintingEnabled && isEligibleForPrint;
    + if (isLocalPdf) {
    + return false;
    + }
    +
    + return DeviceInfo.isDesktop() || isPdf;
    }

    private MVCListAdapter.ListItem buildPrintItem(Tab currentTab) {
    ```

    Change information

    Commit message:
    Do not show print in app menu for locally stored PDFs
    Bug: 463882238
    Change-Id: I4851a130aa2e7288ce385167576ffb94060d6cc7
    Commit-Queue: Shu Yang <shu...@google.com>
    Reviewed-by: Wenyu Fu <wen...@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1562810}
    Files:
    • M chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedAppMenuPropertiesDelegate.java
    Change size: S
    Delta: 1 file changed, 18 insertions(+), 5 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Wenyu Fu
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4851a130aa2e7288ce385167576ffb94060d6cc7
    Gerrit-Change-Number: 7318746
    Gerrit-PatchSet: 5
    Gerrit-Owner: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Shu Yang <shu...@google.com>
    Gerrit-Reviewer: Sirisha Kavuluru <skav...@google.com>
    Gerrit-Reviewer: Wenyu Fu <wen...@chromium.org>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages