Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8977)

Unified Diff: chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js

Issue 2861713004: Print Preview: Fix compile errors in settings/ directory (Closed)
Patch Set: Address comments and fix remaining lint errors Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js
diff --git a/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js b/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js
index 7e189922a228ab04151cda1be26bac09ed8d417b..bbba5593aff8a886c9b0e00623e0e3edec7b02c5 100644
--- a/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js
+++ b/chrome/browser/resources/print_preview/settings/advanced_settings/advanced_settings_item.js
@@ -1,30 +1,40 @@
// Copyright 2014 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.
+/**
+ * Specifies a custom vendor capability.
+ * @typedef {{
+ * id: (string),
+ * display_name: (string),
+ * localized_display_name: (string | undefined),
+ * type: (string),
+ * select_cap: ({
+ * option: (Array<{
+ * display_name: (string),
+ * type: (string | undefined),
+ * value: (number | string | boolean),
+ * is_default: (boolean | undefined)
+ * }>|undefined)
+ * }|undefined)
+ * }}
+ */
+print_preview.VendorCapability;
cr.define('print_preview', function() {
'use strict';
/**
* Component that renders a destination item in a destination list.
- * @param {!cr.EventTarget} eventTarget Event target to dispatch selection
- * events to.
* @param {!print_preview.PrintTicketStore} printTicketStore Contains the
* print ticket to print.
- * @param {!Object} capability Capability to render.
+ * @param {!print_preview.VendorCapability} capability Capability to render.
* @constructor
* @extends {print_preview.Component}
*/
- function AdvancedSettingsItem(eventTarget, printTicketStore, capability) {
+ function AdvancedSettingsItem(printTicketStore, capability) {
print_preview.Component.call(this);
/**
- * Event target to dispatch selection events to.
- * @private {!cr.EventTarget}
- */
- this.eventTarget_ = eventTarget;
-
- /**
* Contains the print ticket to print.
* @private {!print_preview.PrintTicketStore}
*/
@@ -32,7 +42,7 @@ cr.define('print_preview', function() {
/**
* Capability this component renders.
- * @private {!Object}
+ * @private {!print_preview.VendorCapability}
*/
this.capability_ = capability;
@@ -58,7 +68,7 @@ cr.define('print_preview', function() {
/** @private {!EventTracker} */
this.tracker_ = new EventTracker();
- };
+ }
AdvancedSettingsItem.prototype = {
__proto__: print_preview.Component.prototype,
@@ -112,20 +122,21 @@ cr.define('print_preview', function() {
},
/**
- * @return {HTMLSelectElement} Select element.
+ * @return {!HTMLSelectElement} Select element.
* @private
*/
get select_() {
- return this.getChildElement(
- '.advanced-settings-item-value-select-control');
+ return /** @type {!HTMLSelectElement} */ (
+ this.getChildElement('.advanced-settings-item-value-select-control'));
},
/**
- * @return {HTMLSelectElement} Text element.
+ * @return {!HTMLSelectElement} Text element.
* @private
*/
get text_() {
- return this.getChildElement('.advanced-settings-item-value-text-control');
+ return /** @type {!HTMLSelectElement} */(
+ this.getChildElement('.advanced-settings-item-value-text-control'));
},
/**
@@ -256,8 +267,8 @@ cr.define('print_preview', function() {
* @private
*/
initializeSelectValue_: function() {
- setIsVisible(
- this.getChildElement('.advanced-settings-item-value-select'), true);
+ setIsVisible(assert(this.getChildElement(
+ '.advanced-settings-item-value-select')), true);
var selectEl = this.select_;
var indexToSelect = 0;
this.capability_.select_cap.option.forEach(function(option, index) {
@@ -268,7 +279,7 @@ cr.define('print_preview', function() {
indexToSelect = index;
selectEl.appendChild(item);
}, this);
- for (var i = 0, option; option = selectEl.options[i]; i++) {
+ for (var i = 0, option; (option = selectEl.options[i]); i++) {
if (option.value == this.selectedValue_) {
indexToSelect = i;
break;
@@ -282,8 +293,8 @@ cr.define('print_preview', function() {
* @private
*/
initializeTextValue_: function() {
- setIsVisible(
- this.getChildElement('.advanced-settings-item-value-text'), true);
+ setIsVisible(assert(this.getChildElement(
+ '.advanced-settings-item-value-text')), true);
var defaultValue = null;
if (this.capability_.type == 'TYPED_VALUE' &&

Powered by Google App Engine
This is Rietveld 408576698