| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 * Object used to get and persist the print preview application state. | 9 * Object used to get and persist the print preview application state. |
| 10 * @constructor | 10 * @constructor |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 /** | 22 /** |
| 23 * Whether the app state has been initialized. The app state will ignore all | 23 * Whether the app state has been initialized. The app state will ignore all |
| 24 * writes until it has been initialized. | 24 * writes until it has been initialized. |
| 25 * @type {boolean} | 25 * @type {boolean} |
| 26 * @private | 26 * @private |
| 27 */ | 27 */ |
| 28 this.isInitialized_ = false; | 28 this.isInitialized_ = false; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Enumeration of field names for serialized app state. | |
| 33 * @enum {string} | |
| 34 */ | |
| 35 AppState.Field = { | |
| 36 VERSION: 'version', | |
| 37 SELECTED_DESTINATION_ID: 'selectedDestinationId', | |
| 38 SELECTED_DESTINATION_ACCOUNT: 'selectedDestinationAccount', | |
| 39 SELECTED_DESTINATION_ORIGIN: 'selectedDestinationOrigin', | |
| 40 SELECTED_DESTINATION_CAPABILITIES: 'selectedDestinationCapabilities', | |
| 41 SELECTED_DESTINATION_NAME: 'selectedDestinationName', | |
| 42 IS_GCP_PROMO_DISMISSED: 'isGcpPromoDismissed', | |
| 43 MEDIA_SIZE: 'mediaSize', | |
| 44 MARGINS_TYPE: 'marginsType', | |
| 45 CUSTOM_MARGINS: 'customMargins', | |
| 46 IS_COLOR_ENABLED: 'isColorEnabled', | |
| 47 IS_DUPLEX_ENABLED: 'isDuplexEnabled', | |
| 48 IS_HEADER_FOOTER_ENABLED: 'isHeaderFooterEnabled', | |
| 49 IS_LANDSCAPE_ENABLED: 'isLandscapeEnabled', | |
| 50 IS_COLLATE_ENABLED: 'isCollateEnabled', | |
| 51 IS_CSS_BACKGROUND_ENABLED: 'isCssBackgroundEnabled', | |
| 52 VENDOR_OPTIONS: 'vendorOptions' | |
| 53 }; | |
| 54 | |
| 55 /** | |
| 56 * Current version of the app state. This value helps to understand how to | 32 * Current version of the app state. This value helps to understand how to |
| 57 * parse earlier versions of the app state. | 33 * parse earlier versions of the app state. |
| 58 * @type {number} | 34 * @type {number} |
| 59 * @const | 35 * @const |
| 60 * @private | 36 * @private |
| 61 */ | 37 */ |
| 62 AppState.VERSION_ = 2; | 38 AppState.VERSION_ = 2; |
| 63 | 39 |
| 64 /** | 40 /** |
| 65 * Name of C++ layer function to persist app state. | 41 * Name of C++ layer function to persist app state. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 persist_: function() { | 187 persist_: function() { |
| 212 chrome.send(AppState.NATIVE_FUNCTION_NAME_, | 188 chrome.send(AppState.NATIVE_FUNCTION_NAME_, |
| 213 [JSON.stringify(this.state_)]); | 189 [JSON.stringify(this.state_)]); |
| 214 } | 190 } |
| 215 }; | 191 }; |
| 216 | 192 |
| 217 return { | 193 return { |
| 218 AppState: AppState | 194 AppState: AppState |
| 219 }; | 195 }; |
| 220 }); | 196 }); |
| 197 |
| 198 /** |
| 199 * Enumeration of field names for serialized app state. |
| 200 * @enum {string} |
| 201 */ |
| 202 print_preview.AppState.Field = { |
| 203 VERSION: 'version', |
| 204 SELECTED_DESTINATION_ID: 'selectedDestinationId', |
| 205 SELECTED_DESTINATION_ACCOUNT: 'selectedDestinationAccount', |
| 206 SELECTED_DESTINATION_ORIGIN: 'selectedDestinationOrigin', |
| 207 SELECTED_DESTINATION_CAPABILITIES: 'selectedDestinationCapabilities', |
| 208 SELECTED_DESTINATION_NAME: 'selectedDestinationName', |
| 209 IS_GCP_PROMO_DISMISSED: 'isGcpPromoDismissed', |
| 210 MEDIA_SIZE: 'mediaSize', |
| 211 MARGINS_TYPE: 'marginsType', |
| 212 CUSTOM_MARGINS: 'customMargins', |
| 213 IS_COLOR_ENABLED: 'isColorEnabled', |
| 214 IS_DUPLEX_ENABLED: 'isDuplexEnabled', |
| 215 IS_HEADER_FOOTER_ENABLED: 'isHeaderFooterEnabled', |
| 216 IS_LANDSCAPE_ENABLED: 'isLandscapeEnabled', |
| 217 IS_COLLATE_ENABLED: 'isCollateEnabled', |
| 218 IS_CSS_BACKGROUND_ENABLED: 'isCssBackgroundEnabled', |
| 219 VENDOR_OPTIONS: 'vendorOptions' |
| 220 }; |
| OLD | NEW |