| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Printer sharing invitations data store. | 9 * Printer sharing invitations data store. |
| 10 * @param {!print_preview.UserInfo} userInfo User information repository. | 10 * @param {!print_preview.UserInfo} userInfo User information repository. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 this.loadStatus_ = {}; | 34 this.loadStatus_ = {}; |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Event tracker used to track event listeners of the destination store. | 37 * Event tracker used to track event listeners of the destination store. |
| 38 * @private {!EventTracker} | 38 * @private {!EventTracker} |
| 39 */ | 39 */ |
| 40 this.tracker_ = new EventTracker(); | 40 this.tracker_ = new EventTracker(); |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * Used to fetch and process invitations. | 43 * Used to fetch and process invitations. |
| 44 * @private {print_preview.CloudPrintInterface} | 44 * @private {cloudprint.CloudPrintInterface} |
| 45 */ | 45 */ |
| 46 this.cloudPrintInterface_ = null; | 46 this.cloudPrintInterface_ = null; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Invitation being processed now. Only one invitation can be processed at | 49 * Invitation being processed now. Only one invitation can be processed at |
| 50 * a time. | 50 * a time. |
| 51 * @private {print_preview.Invitation} | 51 * @private {print_preview.Invitation} |
| 52 */ | 52 */ |
| 53 this.invitationInProgress_ = null; | 53 this.invitationInProgress_ = null; |
| 54 }; | 54 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 * @param {string} account Account to filter invitations by. | 89 * @param {string} account Account to filter invitations by. |
| 90 * @return {!Array.<!print_preview.Invitation>} List of invitations for the | 90 * @return {!Array.<!print_preview.Invitation>} List of invitations for the |
| 91 * {@code account}. | 91 * {@code account}. |
| 92 */ | 92 */ |
| 93 invitations: function(account) { | 93 invitations: function(account) { |
| 94 return this.invitations_[account] || []; | 94 return this.invitations_[account] || []; |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Sets the invitation store's Google Cloud Print interface. | 98 * Sets the invitation store's Google Cloud Print interface. |
| 99 * @param {!print_preview.CloudPrintInterface} cloudPrintInterface Interface | 99 * @param {!cloudprint.CloudPrintInterface} cloudPrintInterface Interface |
| 100 * to set. | 100 * to set. |
| 101 */ | 101 */ |
| 102 setCloudPrintInterface: function(cloudPrintInterface) { | 102 setCloudPrintInterface: function(cloudPrintInterface) { |
| 103 this.cloudPrintInterface_ = cloudPrintInterface; | 103 this.cloudPrintInterface_ = cloudPrintInterface; |
| 104 this.tracker_.add( | 104 this.tracker_.add( |
| 105 this.cloudPrintInterface_, | 105 this.cloudPrintInterface_, |
| 106 cloudprint.CloudPrintInterface.EventType.INVITES_DONE, | 106 cloudprint.CloudPrintInterface.EventType.INVITES_DONE, |
| 107 this.onCloudPrintInvitesDone_.bind(this)); | 107 this.onCloudPrintInvitesDone_.bind(this)); |
| 108 this.tracker_.add( | 108 this.tracker_.add( |
| 109 this.cloudPrintInterface_, | 109 this.cloudPrintInterface_, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 cr.dispatchSimpleEvent( | 214 cr.dispatchSimpleEvent( |
| 215 this, InvitationStore.EventType.INVITATION_PROCESSED); | 215 this, InvitationStore.EventType.INVITATION_PROCESSED); |
| 216 } | 216 } |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 // Export | 219 // Export |
| 220 return { | 220 return { |
| 221 InvitationStore: InvitationStore | 221 InvitationStore: InvitationStore |
| 222 }; | 222 }; |
| 223 }); | 223 }); |
| OLD | NEW |