[Eraser strings] Remove unused Supervised User infobar and corresponding strings
[chromium-blink-merge.git] / chrome / browser / resources / print_preview / search / fedex_tos.js
blob7aa45f2e0be804ac0447244ebb5c056d9bb80bf9
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 cr.define('print_preview', function() {
6 'use strict';
8 /**
9 * Widget that renders a terms-of-service agreement for using the FedEx Office
10 * print destination.
11 * @constructor
12 * @extends {print_preview.Component}
14 function FedexTos() {
15 print_preview.Component.call(this);
18 /**
19 * Enumeration of event types dispatched by the widget.
20 * @enum {string}
22 FedexTos.EventType = {
23 // Dispatched when the user agrees to the terms-of-service.
24 AGREE: 'print_preview.FedexTos.AGREE'
27 FedexTos.prototype = {
28 __proto__: print_preview.Component.prototype,
30 /** @param {boolean} isVisible Whether the widget is visible. */
31 setIsVisible: function(isVisible) {
32 if (isVisible) {
33 var heightHelperEl = this.getElement().querySelector('.height-helper');
34 this.getElement().style.height = heightHelperEl.offsetHeight + 'px';
35 } else {
36 this.getElement().style.height = 0;
40 /** @override */
41 createDom: function() {
42 this.setElementInternal(this.cloneTemplateInternal('fedex-tos-template'));
43 var tosTextEl = this.getElement().querySelector('.tos-text');
44 tosTextEl.innerHTML = loadTimeData.getStringF(
45 'fedexTos',
46 '<a href="http://www.fedex.com/us/office/copyprint/online/' +
47 'googlecloudprint/termsandconditions">',
48 '</a>');
51 /** @override */
52 enterDocument: function() {
53 var agreeCheckbox = this.getElement().querySelector('.agree-checkbox');
54 this.tracker.add(
55 agreeCheckbox, 'click', this.onAgreeCheckboxClick_.bind(this));
58 /**
59 * Called when the agree checkbox is clicked. Dispatches a AGREE event.
60 * @private
62 onAgreeCheckboxClick_: function() {
63 cr.dispatchSimpleEvent(this, FedexTos.EventType.AGREE);
67 // Export
68 return {
69 FedexTos: FedexTos
71 });