Commit 1f05b008 authored by Jimmy Gong's avatar Jimmy Gong Committed by Commit Bot

Remove CupsPrintersList from printer settings

- CupsPrintersList is deprecated in favor of CupsSavedPrinters and
  CupsNearbyPrinters.

Bug: 1005905
Test: Browser tests
Change-Id: I3ff1c0cc276e7f846c8b99232478a6cb38d28f5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1938068Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarBailey Berro <baileyberro@chromium.org>
Commit-Queue: jimmy gong <jimmyxgong@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722569}
parent a8c2f818
...@@ -13,7 +13,6 @@ js_type_check("closure_compile") { ...@@ -13,7 +13,6 @@ js_type_check("closure_compile") {
"../../printing_page:cups_printer_dialog_util", "../../printing_page:cups_printer_dialog_util",
"../../printing_page:cups_printers", "../../printing_page:cups_printers",
"../../printing_page:cups_printers_browser_proxy", "../../printing_page:cups_printers_browser_proxy",
"../../printing_page:cups_printers_list",
] ]
} }
......
...@@ -796,12 +796,6 @@ ...@@ -796,12 +796,6 @@
<structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS" <structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS"
file="printing_page/cups_printers_entry_manager.js" file="printing_page/cups_printers_entry_manager.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_LIST_HTML"
file="printing_page/cups_printers_list.html"
type="chrome_html" />
<structure name="IDR_OS_SETTINGS_CUPS_PRINTERS_LIST_JS"
file="printing_page/cups_printers_list.js"
type="chrome_html" />
<structure name="IDR_OS_SETTINGS_CUPS_EDIT_PRINTER_DIALOG_HTML" <structure name="IDR_OS_SETTINGS_CUPS_EDIT_PRINTER_DIALOG_HTML"
file="printing_page/cups_edit_printer_dialog.html" file="printing_page/cups_edit_printer_dialog.html"
type="chrome_html" /> type="chrome_html" />
......
...@@ -23,7 +23,6 @@ js_type_check("closure_compile") { ...@@ -23,7 +23,6 @@ js_type_check("closure_compile") {
":cups_printers_entry", ":cups_printers_entry",
":cups_printers_entry_list_behavior", ":cups_printers_entry_list_behavior",
":cups_printers_entry_manager", ":cups_printers_entry_manager",
":cups_printers_list",
":cups_saved_printers", ":cups_saved_printers",
":printing_browser_proxy", ":printing_browser_proxy",
] ]
...@@ -150,15 +149,6 @@ if (is_chromeos) { ...@@ -150,15 +149,6 @@ if (is_chromeos) {
] ]
} }
js_library("cups_printers_list") {
deps = [
":cups_printers_browser_proxy",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js:icon",
]
}
js_library("cups_saved_printers") { js_library("cups_saved_printers") {
deps = [ deps = [
":cups_printer_types", ":cups_printer_types",
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<link rel="import" href="cups_edit_printer_dialog.html"> <link rel="import" href="cups_edit_printer_dialog.html">
<link rel="import" href="cups_printer_shared_css.html"> <link rel="import" href="cups_printer_shared_css.html">
<link rel="import" href="cups_printers_entry_manager.html"> <link rel="import" href="cups_printers_entry_manager.html">
<link rel="import" href="cups_printers_list.html">
<link rel="import" href="cups_saved_printers.html"> <link rel="import" href="cups_saved_printers.html">
<link rel="import" href="cups_nearby_printers.html"> <link rel="import" href="cups_nearby_printers.html">
<link rel="import" href="../route.html"> <link rel="import" href="../route.html">
...@@ -109,10 +108,6 @@ ...@@ -109,10 +108,6 @@
$i18n{addCupsPrinter} $i18n{addCupsPrinter}
</cr-button> </cr-button>
</div> </div>
<settings-cups-printers-list printers="{{printers}}"
active-printer="{{activePrinter}}"
search-term="[[searchTerm]]">
</settings-cups-printers-list>
<div id="noSearchResultsMessage" <div id="noSearchResultsMessage"
hidden="[[!showNoSearchResultsMessage_(searchTerm)]]"> hidden="[[!showNoSearchResultsMessage_(searchTerm)]]">
......
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_action_menu/cr_action_menu.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="cups_printer_dialog_util.html">
<link rel="import" href="cups_printers_browser_proxy.html">
<link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-cups-printers-list">
<template>
<style include="settings-shared">
.printer-name {
flex: 1;
}
</style>
<cr-action-menu role-description="$i18n{menu}">
<button class="dropdown-item" on-click="onEditTap_">
$i18n{editPrinter}
</button>
<button class="dropdown-item" on-click="onRemoveTap_">
$i18n{removePrinter}
</button>
</cr-action-menu>
<div class="list-frame vertical-list">
<template is="dom-repeat" items="[[printers]]"
filter="[[filterPrinter_(searchTerm)]]"
sort="sort_">
<div class="list-item">
<div class="printer-name text-elide">[[item.printerName]]</div>
<!--TODO(xdai): Add icon for enterprise CUPS printer. -->
<cr-icon-button class="icon-more-vert" on-click="onOpenActionMenuTap_"
title="$i18n{moreActions}"></cr-icon-button>
</div>
</template>
</div>
</template>
<script src="cups_printers_list.js"></script>
</dom-module>
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview 'settings-cups-printers-list' is a component for a list of
* CUPS printers.
*/
Polymer({
is: 'settings-cups-printers-list',
properties: {
/** @type {!Array<!CupsPrinterInfo>} */
printers: {
type: Array,
notify: true,
},
searchTerm: {
type: String,
},
/**
* The model for the printer action menu.
* @type {?CupsPrinterInfo}
*/
activePrinter: {
type: Object,
notify: true,
},
},
/** @private {settings.CupsPrintersBrowserProxy} */
browserProxy_: null,
/** @override */
created: function() {
this.browserProxy_ = settings.CupsPrintersBrowserProxyImpl.getInstance();
},
/**
* @param {!{model: !{item: !CupsPrinterInfo}}} e
* @private
*/
onOpenActionMenuTap_: function(e) {
this.activePrinter = e.model.item;
const menu =
/** @type {!CrActionMenuElement} */ (this.$$('cr-action-menu'));
menu.showAt(/** @type {!Element} */ (/** @type {!Event} */ (e).target));
},
/**
* @param {{model:Object}} event
* @private
*/
onEditTap_: function(event) {
// Event is caught by 'settings-cups-printers'.
this.fire('edit-cups-printer-details');
this.closeDropdownMenu_();
},
/**
* @param {{model:Object}} event
* @private
*/
onRemoveTap_: function(event) {
const index = this.printers.indexOf(assert(this.activePrinter));
this.splice('printers', index, 1);
this.browserProxy_.removeCupsPrinter(
this.activePrinter.printerId, this.activePrinter.printerName);
this.activePrinter = null;
this.closeDropdownMenu_();
},
/** @private */
closeDropdownMenu_: function() {
const menu =
/** @type {!CrActionMenuElement} */ (this.$$('cr-action-menu'));
menu.close();
},
/**
* The filter callback function to show printers based on |searchTerm|.
* @param {string} searchTerm
* @private
*/
filterPrinter_: function(searchTerm) {
if (!searchTerm) {
return null;
}
return function(printer) {
return printer.printerName.toLowerCase().includes(
searchTerm.toLowerCase());
};
},
/**
* @param {!CupsPrinterInfo} first
* @param {!CupsPrinterInfo} second
* @return {number} The result of the comparison.
* @private
*/
sort_: function(first, second) {
return settings.printing.alphabeticalSort(first, second);
},
});
...@@ -999,12 +999,6 @@ ...@@ -999,12 +999,6 @@
<structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS" <structure name="IDR_SETTINGS_CUPS_PRINTERS_ENTRY_MANAGER_JS"
file="printing_page/cups_printers_entry_manager.js" file="printing_page/cups_printers_entry_manager.js"
type="chrome_html" /> type="chrome_html" />
<structure name="IDR_SETTINGS_CUPS_PRINTERS_LIST_HTML"
file="printing_page/cups_printers_list.html"
type="chrome_html" />
<structure name="IDR_SETTINGS_CUPS_PRINTERS_LIST_JS"
file="printing_page/cups_printers_list.js"
type="chrome_html" />
<structure name="IDR_SETTINGS_CUPS_SAVED_PRINTERS_HTML" <structure name="IDR_SETTINGS_CUPS_SAVED_PRINTERS_HTML"
file="printing_page/cups_saved_printers.html" file="printing_page/cups_saved_printers.html"
type="chrome_html" /> type="chrome_html" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment