Skip to content

Commit

Permalink
[CodeHealth] Use is_chromeos in Grit files (/chrome/browser/resourc…
Browse files Browse the repository at this point in the history
…es/print_preview)

This CL was uploaded by git cl split.

R=thestig@chromium.org

Bug: 1316150
Change-Id: I76a771807797b927cfb9e1edcf448adcdf2c893b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3812131
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1032210}
  • Loading branch information
arichiv authored and Chromium LUCI CQ committed Aug 6, 2022
1 parent e32e054 commit ec59293
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/resources/print_preview/data/cdd.ts
Expand Up @@ -134,7 +134,7 @@ export interface CddCapabilities {
page_orientation?: PageOrientationCapability;
media_size?: MediaSizeCapability;
dpi?: DpiCapability;
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
pin?: PinCapability;
// </if>
}
Expand Down
24 changes: 12 additions & 12 deletions chrome/browser/resources/print_preview/data/destination.ts
Expand Up @@ -6,13 +6,13 @@ import '../strings.m.js';

import {assert} from 'chrome://resources/js/assert_ts.js';

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {NativeLayerCrosImpl} from '../native_layer_cros.js';
// </if>

import {Cdd, ColorCapability, ColorOption, CopiesCapability} from './cdd.js';

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {getStatusReasonFromPrinterStatus, PrinterStatus, PrinterStatusReason} from './printer_status_cros.js';
// </if>

Expand All @@ -25,7 +25,7 @@ export enum DestinationOrigin {
// legacy entries in the recent destinations, since we can't guarantee all
// such recent printers have been overridden.
COOKIES = 'cookies',
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
DEVICE = 'device',
// </if>
PRIVET = 'privet',
Expand All @@ -45,7 +45,7 @@ export enum PrinterType {
CLOUD_PRINTER_DEPRECATED = 4
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Enumeration specifying whether a destination is provisional and the reason
* the destination is provisional.
Expand Down Expand Up @@ -78,7 +78,7 @@ export interface RecentDestination {
}

export function isPdfPrinter(id: string): boolean {
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (id === GooglePromotedDestinationId.SAVE_TO_DRIVE_CROS) {
return true;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ export function createRecentDestinationKey(

export interface DestinationOptionalParams {
isEnterprisePrinter?: boolean;
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
provisionalType?: DestinationProvisionalType;
// </if>
extensionId?: string;
Expand Down Expand Up @@ -192,7 +192,7 @@ export class Destination {
*/
private extensionName_: string;

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Different from DestinationProvisionalType.NONE if
* the destination is provisional. Provisional destinations cannot be
Expand Down Expand Up @@ -244,7 +244,7 @@ export class Destination {
this.extensionName_ = (params && params.extensionName) || '';
this.location_ = (params && params.location) || '';
this.type_ = this.computeType_(id, origin);
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
this.provisionalType_ =
(params && params.provisionalType) || DestinationProvisionalType.NONE;

Expand Down Expand Up @@ -324,7 +324,7 @@ export class Destination {
}
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
get eulaUrl(): string {
return this.eulaUrl_;
}
Expand Down Expand Up @@ -436,7 +436,7 @@ export class Destination {

/** @return Path to the SVG for the destination's icon. */
get icon(): string {
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (this.id_ === GooglePromotedDestinationId.SAVE_TO_DRIVE_CROS) {
return 'print-preview:save-to-drive';
}
Expand Down Expand Up @@ -582,7 +582,7 @@ export class Destination {
*/
export enum GooglePromotedDestinationId {
SAVE_AS_PDF = 'Save as PDF',
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
SAVE_TO_DRIVE_CROS = 'Save to Drive CrOS',
// </if>
}
Expand All @@ -591,7 +591,7 @@ export enum GooglePromotedDestinationId {
export const PDF_DESTINATION_KEY: string =
`${GooglePromotedDestinationId.SAVE_AS_PDF}/${DestinationOrigin.LOCAL}/`;

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/* Unique identifier for the Save to Drive CrOS destination */
export const SAVE_TO_DRIVE_CROS_DESTINATION_KEY: string =
`${GooglePromotedDestinationId.SAVE_TO_DRIVE_CROS}/${
Expand Down
32 changes: 16 additions & 16 deletions chrome/browser/resources/print_preview/data/destination_store.ts
Expand Up @@ -7,18 +7,18 @@ import {EventTracker} from 'chrome://resources/js/event_tracker.m.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';

import {CapabilitiesResponse, NativeLayer, NativeLayerImpl} from '../native_layer.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {NativeLayerCros, NativeLayerCrosImpl, PrinterSetupResponse} from '../native_layer_cros.js';

// </if>
import {Cdd, MediaSizeOption} from './cdd.js';
import {createDestinationKey, createRecentDestinationKey, Destination, DestinationOrigin, GooglePromotedDestinationId, isPdfPrinter, PDF_DESTINATION_KEY, PrinterType, RecentDestination} from './destination.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {DestinationProvisionalType} from './destination.js';
// </if>
import {DestinationMatch} from './destination_match.js';
import {ExtensionDestinationInfo, LocalDestinationInfo, parseDestination} from './local_parsers.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {parseExtensionDestination} from './local_parsers.js';
// </if>

Expand Down Expand Up @@ -152,7 +152,7 @@ export enum DestinationStoreEventType {
ERROR = 'DestinationStore.ERROR',
SELECTED_DESTINATION_CAPABILITIES_READY = 'DestinationStore' +
'.SELECTED_DESTINATION_CAPABILITIES_READY',
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
DESTINATION_EULA_READY = 'DestinationStore.DESTINATION_EULA_READY',
// </if>
}
Expand Down Expand Up @@ -188,7 +188,7 @@ export class DestinationStore extends EventTarget {
*/
private nativeLayer_: NativeLayer = NativeLayerImpl.getInstance();

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Used to fetch information about Chrome OS local print destinations.
*/
Expand Down Expand Up @@ -317,10 +317,10 @@ export class DestinationStore extends EventTarget {
*/
init(
pdfPrinterDisabled: boolean,
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
isDriveMounted: boolean,
// </if>
// <if expr="not chromeos_ash and not chromeos_lacros">
// <if expr="not is_chromeos">
_isDriveMounted: boolean,
// </if>
systemDefaultDestinationId: string,
Expand All @@ -331,10 +331,10 @@ export class DestinationStore extends EventTarget {
const systemDefaultType = systemDefaultVirtual ?
PrinterType.PDF_PRINTER :
PrinterType.LOCAL_PRINTER;
// <if expr="not chromeos_ash and not chromeos_lacros">
// <if expr="not is_chromeos">
const systemDefaultOrigin = DestinationOrigin.LOCAL;
// </if>
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
const systemDefaultOrigin = systemDefaultVirtual ?
DestinationOrigin.LOCAL :
DestinationOrigin.CROS;
Expand All @@ -359,7 +359,7 @@ export class DestinationStore extends EventTarget {

this.pdfPrinterEnabled_ = !pdfPrinterDisabled;
this.createLocalPdfPrintDestination_();
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (isDriveMounted) {
this.createLocalDrivePrintDestination_();
}
Expand Down Expand Up @@ -497,7 +497,7 @@ export class DestinationStore extends EventTarget {
this.tracker_.removeAll();
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Attempts to find the EULA URL of the the destination ID.
*/
Expand Down Expand Up @@ -586,7 +586,7 @@ export class DestinationStore extends EventTarget {
return;
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
assert(
!destination.isProvisional, 'Unable to select provisonal destinations');
// </if>
Expand All @@ -610,7 +610,7 @@ export class DestinationStore extends EventTarget {
}
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Attempt to resolve the capabilities for a Chrome OS printer.
*/
Expand Down Expand Up @@ -716,7 +716,7 @@ export class DestinationStore extends EventTarget {
return this.destinationMap_.get(key);
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Removes the provisional destination with ID |provisionalId| from
* |destinationMap_| and |destinations_|.
Expand Down Expand Up @@ -833,7 +833,7 @@ export class DestinationStore extends EventTarget {
}
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
/**
* Creates a local Drive print destination.
*/
Expand Down Expand Up @@ -900,7 +900,7 @@ export class DestinationStore extends EventTarget {
}
dest.capabilities = settingsInfo.capabilities;
this.updateDestination_(dest);
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
// Start the fetch for the PPD EULA URL.
this.fetchEulaUrl(dest.id);
// </if>
Expand Down
6 changes: 3 additions & 3 deletions chrome/browser/resources/print_preview/data/local_parsers.ts
Expand Up @@ -6,7 +6,7 @@ import {assertNotReached} from 'chrome://resources/js/assert_ts.js';
import {isChromeOS, isLacros} from 'chrome://resources/js/cr.m.js';

import {Destination, DestinationOptionalParams, DestinationOrigin, PrinterType} from './destination.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {DestinationProvisionalType} from './destination.js';
// </if>

Expand Down Expand Up @@ -84,7 +84,7 @@ function parseLocalDestination(destinationInfo: LocalDestinationInfo):
*/
export function parseExtensionDestination(
destinationInfo: ExtensionDestinationInfo): Destination {
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
const provisionalType = destinationInfo.provisional ?
DestinationProvisionalType.NEEDS_USB_PERMISSION :
DestinationProvisionalType.NONE;
Expand All @@ -95,7 +95,7 @@ export function parseExtensionDestination(
description: destinationInfo.description || '',
extensionId: destinationInfo.extensionId,
extensionName: destinationInfo.extensionName || '',
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
provisionalType: provisionalType,
// </if>
});
Expand Down
28 changes: 14 additions & 14 deletions chrome/browser/resources/print_preview/data/model.ts
Expand Up @@ -3,14 +3,14 @@
// found in the LICENSE file.

import {assert} from 'chrome://resources/js/assert_ts.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// </if>
import {PromiseResolver} from 'chrome://resources/js/promise_resolver.m.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {BackgroundGraphicsModeRestriction, Policies} from '../native_layer.js';
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
import {ColorModeRestriction, DuplexModeRestriction, PinModeRestriction} from '../native_layer.js';
// </if>
import {CapabilityWithReset, Cdd, CddCapabilities, ColorOption, DpiOption, DuplexOption, MediaSizeOption} from './cdd.js';
Expand Down Expand Up @@ -59,7 +59,7 @@ export interface Settings {
otherOptions: Setting;
ranges: Setting;
pagesPerSheet: Setting;
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
pin: Setting;
pinValue: Setting;
// </if>
Expand All @@ -83,7 +83,7 @@ export interface SerializedSettings {
scalingType?: ScalingType;
scalingTypePdf?: ScalingType;
vendorOptions?: object;
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
isPinEnabled?: boolean;
pinValue?: string;
// </if>
Expand Down Expand Up @@ -167,7 +167,7 @@ export type PrintTicket = Ticket&{
pageCount: number,
pageHeight: number,
pageWidth: number,
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
printToGoogleDrive: boolean,
// </if>
showSystemDialog: boolean,
Expand Down Expand Up @@ -226,7 +226,7 @@ const STICKY_SETTING_NAMES: string[] = [
'scalingTypePdf',
'vendorItems',
];
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
STICKY_SETTING_NAMES.push('pin', 'pinValue');
// </if>

Expand Down Expand Up @@ -497,7 +497,7 @@ export class PrintPreviewModelElement extends PolymerElement {
key: 'recentDestinations',
updatesPreview: false,
},
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
pin: {
value: false,
unavailableValue: false,
Expand Down Expand Up @@ -743,7 +743,7 @@ export class PrintPreviewModelElement extends PolymerElement {
this.setSettingPath_(
'vendorItems.available', !!caps && !!caps.vendor_capability);

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
const pinSupported = !!caps && !!caps.pin && !!caps.pin.supported &&
loadTimeData.getBoolean('isEnterpriseManaged');
this.set('settings.pin.available', pinSupported);
Expand Down Expand Up @@ -1064,7 +1064,7 @@ export class PrintPreviewModelElement extends PolymerElement {
// to free up these spots for supported printers.
const unsupportedOrigins: DestinationOrigin[] = [
DestinationOrigin.COOKIES,
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
DestinationOrigin.DEVICE,
// </if>
DestinationOrigin.PRIVET,
Expand Down Expand Up @@ -1202,7 +1202,7 @@ export class PrintPreviewModelElement extends PolymerElement {
const allowedMode = policiesObject[settingName].allowedMode;
this.configurePolicySetting_(settingName, allowedMode, defaultMode);
});
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (policiesObject['sheets']) {
if (!this.policySettings_) {
this.policySettings_ = {};
Expand Down Expand Up @@ -1297,7 +1297,7 @@ export class PrintPreviewModelElement extends PolymerElement {
for (const [settingName, policy] of Object.entries(
this.policySettings_)) {
const policyEntry = policy as PolicyEntry;
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (settingName === 'sheets') {
this.maxSheets = policyEntry.value;
continue;
Expand Down Expand Up @@ -1469,7 +1469,7 @@ export class PrintPreviewModelElement extends PolymerElement {

private updateManaged_() {
let managedSettings = ['cssBackground', 'headerFooter'];
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
managedSettings =
managedSettings.concat(['color', 'duplex', 'duplexShortEdge', 'pin']);
// </if>
Expand Down Expand Up @@ -1560,7 +1560,7 @@ export class PrintPreviewModelElement extends PolymerElement {
pageWidth: this.pageSize.width,
pageHeight: this.pageSize.height,
showSystemDialog: showSystemDialog,
// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
printToGoogleDrive:
destination.id === GooglePromotedDestinationId.SAVE_TO_DRIVE_CROS,
// </if>
Expand All @@ -1581,7 +1581,7 @@ export class PrintPreviewModelElement extends PolymerElement {
ticket['capabilities'] = JSON.stringify(destination.capabilities);
}

// <if expr="chromeos_ash or chromeos_lacros">
// <if expr="is_chromeos">
if (this.getSettingValue('pin')) {
ticket['pinValue'] = this.getSettingValue('pinValue');
}
Expand Down

0 comments on commit ec59293

Please sign in to comment.