| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
boolean isPdfPage = nativePage != null && nativePage.isPdf();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)
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
boolean isPdfPage = nativePage != null && nativePage.isPdf();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)
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
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) {
```
Do not show print in app menu for locally stored PDFs
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |