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('options', function() { | 5 cr.define('options', function() { |
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
7 /** @const */ var OptionsPage = options.OptionsPage; | 7 /** @const */ var OptionsPage = options.OptionsPage; |
8 | 8 |
9 /** | 9 /** |
10 * This class is an overlay which allows the user to add or remove media | 10 * This class is an overlay which allows the user to add or remove media |
11 * galleries, and displays known media galleries. | 11 * galleries, and displays known media galleries. |
12 * @constructor | 12 * @constructor |
13 * @extends {OptionsPage} | 13 * @extends {OptionsPage} |
14 */ | 14 */ |
15 function MediaGalleryManager() { | 15 function MediaGalleriesManager() { |
16 OptionsPage.call(this, 'manageGalleries', | 16 OptionsPage.call(this, 'manageGalleries', |
17 loadTimeData.getString('manageMediaGalleriesTabTitle'), | 17 loadTimeData.getString('manageMediaGalleriesTabTitle'), |
18 'manage-media-galleries-overlay'); | 18 'manage-media-galleries-overlay'); |
19 } | 19 } |
20 | 20 |
21 cr.addSingletonGetter(MediaGalleryManager); | 21 cr.addSingletonGetter(MediaGalleriesManager); |
22 | 22 |
23 MediaGalleryManager.prototype = { | 23 MediaGalleriesManager.prototype = { |
24 __proto__: OptionsPage.prototype, | 24 __proto__: OptionsPage.prototype, |
25 | 25 |
26 /** | 26 /** |
27 * Decorate the overlay and set up event handlers. | 27 * Decorate the overlay and set up event handlers. |
28 */ | 28 */ |
29 initializePage: function() { | 29 initializePage: function() { |
30 OptionsPage.prototype.initializePage.call(this); | 30 OptionsPage.prototype.initializePage.call(this); |
31 | 31 |
32 this.availableGalleriesList_ = $('available-galleries-list'); | 32 this.availableGalleriesList_ = $('available-galleries-list'); |
33 options.MediaGalleryList.decorate(this.availableGalleriesList_); | 33 options.MediaGalleriesList.decorate(this.availableGalleriesList_); |
34 | 34 |
35 $('new-media-gallery').addEventListener('click', function() { | 35 $('new-media-gallery').addEventListener('click', function() { |
36 chrome.send('addNewGallery'); | 36 chrome.send('addNewGallery'); |
37 }); | 37 }); |
38 | 38 |
39 $('manage-media-confirm').addEventListener( | 39 $('manage-media-confirm').addEventListener( |
40 'click', OptionsPage.closeOverlay.bind(OptionsPage)); | 40 'click', OptionsPage.closeOverlay.bind(OptionsPage)); |
41 | 41 |
42 this.addEventListener('visibleChange', this.handleVisibleChange_); | 42 this.addEventListener('visibleChange', this.handleVisibleChange_); |
43 }, | 43 }, |
(...skipping 10 matching lines...) Expand all Loading... |
54 this.availableGalleriesList_.redraw(); | 54 this.availableGalleriesList_.redraw(); |
55 }, | 55 }, |
56 | 56 |
57 /** | 57 /** |
58 * @param {Array} galleries List of structs describibing galleries. | 58 * @param {Array} galleries List of structs describibing galleries. |
59 * @private | 59 * @private |
60 */ | 60 */ |
61 setAvailableMediaGalleries_: function(galleries) { | 61 setAvailableMediaGalleries_: function(galleries) { |
62 $('available-galleries-list').dataModel = new ArrayDataModel(galleries); | 62 $('available-galleries-list').dataModel = new ArrayDataModel(galleries); |
63 // TODO(estade): show this section by default. | 63 // TODO(estade): show this section by default. |
64 $('media-gallery-section').hidden = false; | 64 $('media-galleries-section').hidden = false; |
65 }, | 65 }, |
66 }, | 66 }, |
67 | 67 |
68 // Forward public APIs to private implementations. | 68 // Forward public APIs to private implementations. |
69 [ | 69 [ |
70 'setAvailableMediaGalleries', | 70 'setAvailableMediaGalleries', |
71 ].forEach(function(name) { | 71 ].forEach(function(name) { |
72 MediaGalleryManager[name] = function() { | 72 MediaGalleriesManager[name] = function() { |
73 var instance = MediaGalleryManager.getInstance(); | 73 var instance = MediaGalleriesManager.getInstance(); |
74 return instance[name + '_'].apply(instance, arguments); | 74 return instance[name + '_'].apply(instance, arguments); |
75 }; | 75 }; |
76 }); | 76 }); |
77 | 77 |
78 // Export | 78 // Export |
79 return { | 79 return { |
80 MediaGalleryManager: MediaGalleryManager | 80 MediaGalleriesManager: MediaGalleriesManager |
81 }; | 81 }; |
82 }); | 82 }); |
OLD | NEW |