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() {
9 * Widget that renders a terms-of-service agreement for using the FedEx Office
12 * @extends {print_preview.Component}
15 print_preview.Component.call(this);
19 * Enumeration of event types dispatched by the widget.
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) {
33 var heightHelperEl = this.getElement().querySelector('.height-helper');
34 this.getElement().style.height = heightHelperEl.offsetHeight + 'px';
36 this.getElement().style.height = 0;
41 createDom: function() {
42 this.setElementInternal(this.cloneTemplateInternal('fedex-tos-template'));
43 var tosTextEl = this.getElement().querySelector('.tos-text');
44 tosTextEl.innerHTML = localStrings.getStringF(
46 '<a href="http://www.fedex.com/us/office/copyprint/online/' +
47 'googlecloudprint/termsandconditions">',
52 enterDocument: function() {
53 var agreeCheckbox = this.getElement().querySelector('.agree-checkbox');
55 agreeCheckbox, 'click', this.onAgreeCheckboxClick_.bind(this));
59 * Called when the agree checkbox is clicked. Dispatches a AGREE event.
62 onAgreeCheckboxClick_: function() {
63 cr.dispatchSimpleEvent(this, FedexTos.EventType.AGREE);