1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50

ash / webui / print_management / resources / printer_setup_info.ts [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/ash/common/cr_elements/cros_color_overrides.css.js';
import 'chrome://resources/ash/common/cr_elements/cr_button/cr_button.js';
import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js';
import './print_management_fonts.css.js';
import './print_management_shared.css.js';
import './icons.html.js';

import {I18nMixin} from 'chrome://resources/ash/common/cr_elements/i18n_mixin.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {getPrintManagementHandler} from './mojo_interface_provider.js';
import {getTemplate} from './printer_setup_info.html.js';
import {LaunchSource, PrintManagementHandlerInterface} from './printing_manager.mojom-webui.js';

/**
 * @fileoverview
 * 'printer-setup-info' provides messaging on printer setup when there are no
 * print jobs to display.
 */

const PrinterSetupInfoElementIs = 'printer-setup-info';

const PrinterSetupInfoElementBase = I18nMixin(PolymerElement);

export class PrinterSetupInfoElement extends PrinterSetupInfoElementBase {
  static get is(): string {
    return PrinterSetupInfoElementIs;
  }

  static get template(): HTMLTemplateElement {
    return getTemplate();
  }

  private pageHandler: PrintManagementHandlerInterface;

  constructor() {
    super();
    this.pageHandler = getPrintManagementHandler();
  }

  onManagePrintersClicked(): void {
    this.pageHandler.launchPrinterSettings(LaunchSource.kEmptyStateButton);
  }
}

customElements.define(PrinterSetupInfoElement.is, PrinterSetupInfoElement);