Chromium Code Reviews| Index: chrome/browser/resources/print_preview/data/app_state.js |
| diff --git a/chrome/browser/resources/print_preview/data/app_state.js b/chrome/browser/resources/print_preview/data/app_state.js |
| index d3ffd8f0b653b79aa1858cc059a2d422c9765f37..3dbd8b91243881aad6c72ddb812fca299ba40fdb 100644 |
| --- a/chrome/browser/resources/print_preview/data/app_state.js |
| +++ b/chrome/browser/resources/print_preview/data/app_state.js |
| @@ -18,11 +18,11 @@ cr.define('print_preview', function() { |
| this.selectedDestinationId_ = null; |
| /** |
| - * Whether the selected destination is a local destination. |
| - * @type {?boolean} |
| + * Origin of the selected destination. |
| + * @type {?string} |
| * @private |
| */ |
| - this.isSelectedDestinationLocal_ = null; |
| + this.selectedDestinationOrigin_ = null; |
| /** |
| * Whether the GCP promotion has been dismissed. |
| @@ -95,7 +95,7 @@ cr.define('print_preview', function() { |
| * @const |
| * @private |
| */ |
| - AppState.VERSION_ = 2; |
| + AppState.VERSION_ = 3; |
| /** |
| * Enumeration of field names for serialized app state. |
| @@ -105,7 +105,7 @@ cr.define('print_preview', function() { |
| AppState.Field_ = { |
| VERSION: 'version', |
| SELECTED_DESTINATION_ID: 'selectedDestinationId', |
| - IS_SELECTED_DESTINATION_LOCAL: 'isSelectedDestinationLocal', |
| + SELECTED_DESTINATION_ORIGIN: 'selectedDestinationOrigin', |
| IS_GCP_PROMO_DISMISSED: 'isGcpPromoDismissed', |
| MARGINS_TYPE: 'marginsType', |
| CUSTOM_MARGINS: 'customMargins', |
| @@ -131,9 +131,9 @@ cr.define('print_preview', function() { |
| return this.selectedDestinationId_; |
| }, |
| - /** @return {?boolean} Whether the selected destination is local. */ |
| - get isSelectedDestinationLocal() { |
| - return this.isSelectedDestinationLocal_; |
| + /** @return {?string} Origin of the selected destination. */ |
| + get selectedDestinationOrigin() { |
| + return this.selectedDestinationOrigin_; |
| }, |
| /** @return {boolean} Whether the GCP promotion has been dismissed. */ |
| @@ -195,14 +195,12 @@ cr.define('print_preview', function() { |
| } |
| var state = JSON.parse(serializedAppStateStr); |
| - if (state[AppState.Field_.VERSION] == 2) { |
| + if (state[AppState.Field_.VERSION] == AppState.VERSION_) { |
|
Toscano
2013/04/18 19:26:41
You'll have to handle an AppState whose version is
Vitaly Buka (NO REVIEWS)
2013/04/18 20:48:23
Done.
|
| this.selectedDestinationId_ = |
| state[AppState.Field_.SELECTED_DESTINATION_ID] || null; |
| - if (state.hasOwnProperty( |
| - AppState.Field_.IS_SELECTED_DESTINATION_LOCAL)) { |
| - this.isSelectedDestinationLocal_ = |
| - state[AppState.Field_.IS_SELECTED_DESTINATION_LOCAL]; |
| - } |
| + this.selectedDestinationOrigin_ = |
| + state[AppState.Field_.SELECTED_DESTINATION_ORIGIN] || null; |
| + |
| this.isGcpPromoDismissed_ = |
| state[AppState.Field_.IS_GCP_PROMO_DISMISSED] || false; |
| if (state.hasOwnProperty(AppState.Field_.MARGINS_TYPE)) { |
| @@ -242,7 +240,7 @@ cr.define('print_preview', function() { |
| */ |
| persistSelectedDestination: function(dest) { |
| this.selectedDestinationId_ = dest.id; |
| - this.isSelectedDestinationLocal_ = dest.isLocal; |
| + this.selectedDestinationOrigin_ = dest.origin; |
| this.persist_(); |
| }, |
| @@ -339,8 +337,8 @@ cr.define('print_preview', function() { |
| obj[AppState.Field_.VERSION] = AppState.VERSION_; |
| obj[AppState.Field_.SELECTED_DESTINATION_ID] = |
| this.selectedDestinationId_; |
| - obj[AppState.Field_.IS_SELECTED_DESTINATION_LOCAL] = |
| - this.isSelectedDestinationLocal_; |
| + obj[AppState.Field_.SELECTED_DESTINATION_ORIGIN] = |
| + this.selectedDestinationOrigin_; |
| obj[AppState.Field_.IS_GCP_PROMO_DISMISSED] = this.isGcpPromoDismissed_; |
| obj[AppState.Field_.MARGINS_TYPE] = this.marginsType_; |
| if (this.customMargins_) { |