| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 * @private {print_preview.Invitation} | 51 * @private {print_preview.Invitation} |
| 52 */ | 52 */ |
| 53 this.invitationInProgress_ = null; | 53 this.invitationInProgress_ = null; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * Event types dispatched by the data store. | 57 * Event types dispatched by the data store. |
| 58 * @enum {string} | 58 * @enum {string} |
| 59 */ | 59 */ |
| 60 InvitationStore.EventType = { | 60 InvitationStore.EventType = { |
| 61 INVITATION_PROCESSED: | 61 INVITATION_PROCESSED: 'print_preview.InvitationStore.INVITATION_PROCESSED', |
| 62 'print_preview.InvitationStore.INVITATION_PROCESSED', | |
| 63 INVITATION_SEARCH_DONE: | 62 INVITATION_SEARCH_DONE: |
| 64 'print_preview.InvitationStore.INVITATION_SEARCH_DONE' | 63 'print_preview.InvitationStore.INVITATION_SEARCH_DONE' |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 /** | 66 /** |
| 68 * @enum {number} | 67 * @enum {number} |
| 69 * @private | 68 * @private |
| 70 */ | 69 */ |
| 71 InvitationStore.LoadStatus_ = { | 70 InvitationStore.LoadStatus_ = {IN_PROGRESS: 1, DONE: 2, FAILED: 3}; |
| 72 IN_PROGRESS: 1, | |
| 73 DONE: 2, | |
| 74 FAILED: 3 | |
| 75 }; | |
| 76 | 71 |
| 77 InvitationStore.prototype = { | 72 InvitationStore.prototype = { |
| 78 __proto__: cr.EventTarget.prototype, | 73 __proto__: cr.EventTarget.prototype, |
| 79 | 74 |
| 80 /** | 75 /** |
| 81 * @return {print_preview.Invitation} Currently processed invitation or | 76 * @return {print_preview.Invitation} Currently processed invitation or |
| 82 * {@code null}. | 77 * {@code null}. |
| 83 */ | 78 */ |
| 84 get invitationInProgress() { | 79 get invitationInProgress() { |
| 85 return this.invitationInProgress_; | 80 return this.invitationInProgress_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 */ | 205 */ |
| 211 onCloudPrintProcessInviteFailed_: function(event) { | 206 onCloudPrintProcessInviteFailed_: function(event) { |
| 212 this.invitationProcessed_(event.invitation); | 207 this.invitationProcessed_(event.invitation); |
| 213 // TODO: Display an error. | 208 // TODO: Display an error. |
| 214 cr.dispatchSimpleEvent( | 209 cr.dispatchSimpleEvent( |
| 215 this, InvitationStore.EventType.INVITATION_PROCESSED); | 210 this, InvitationStore.EventType.INVITATION_PROCESSED); |
| 216 } | 211 } |
| 217 }; | 212 }; |
| 218 | 213 |
| 219 // Export | 214 // Export |
| 220 return { | 215 return {InvitationStore: InvitationStore}; |
| 221 InvitationStore: InvitationStore | |
| 222 }; | |
| 223 }); | 216 }); |
| OLD | NEW |