| 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 /** | 5 /** |
| 6 * The model class for audio player. | 6 * The model class for audio player. |
| 7 * @constructor | 7 * @constructor |
| 8 */ | 8 */ |
| 9 function AudioPlayerModel() {} | 9 function AudioPlayerModel() {} |
| 10 | 10 |
| 11 AudioPlayerModel.prototype.initialize = function(callback) { | 11 AudioPlayerModel.prototype.initialize = function(callback) { |
| 12 'use strict'; | 12 'use strict'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * List of values to be stored into the model. | 15 * List of values to be stored into the model. |
| 16 * @type {!Object<*>} | 16 * @type {!Object<*>} |
| 17 * @const | 17 * @const |
| 18 */ | 18 */ |
| 19 var VALUES = | 19 var VALUES = |
| 20 /** | 20 /** |
| 21 * They will be used as properties of AudioPlayerModel. | 21 * They will be used as properties of AudioPlayerModel. |
| 22 * @lends {AudioPlayerModel.prototype} | 22 * @lends {AudioPlayerModel.prototype} |
| 23 */ | 23 */ |
| 24 { | 24 { |
| 25 shuffle: false, | 25 shuffle: false, |
| 26 repeat: false, | 26 repeat: false, |
| 27 volume: 100, | 27 volume: 100, |
| 28 expanded: false, | 28 expanded: false, |
| 29 volumeSliderShown: false |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 /** | 32 /** |
| 32 * Prefix of the stored values in the storage. | 33 * Prefix of the stored values in the storage. |
| 33 * @type {string} | 34 * @type {string} |
| 34 */ | 35 */ |
| 35 var STORAGE_PREFIX = 'audioplayer-'; | 36 var STORAGE_PREFIX = 'audioplayer-'; |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * Save the values in the model into the storage. | 39 * Save the values in the model into the storage. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // Restores the values from the storage | 78 // Restores the values from the storage |
| 78 var target = this; | 79 var target = this; |
| 79 loadModel(target, function() { | 80 loadModel(target, function() { |
| 80 // Installs observer to watch changes of the values. | 81 // Installs observer to watch changes of the values. |
| 81 Object.observe(target, function(changes) { | 82 Object.observe(target, function(changes) { |
| 82 saveModel(target); | 83 saveModel(target); |
| 83 }); | 84 }); |
| 84 callback(); | 85 callback(); |
| 85 }); | 86 }); |
| 86 } | 87 } |
| OLD | NEW |