Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(940)

Side by Side Diff: chrome/browser/resources/options2/media_galleries_manager_overlay.js

Issue 10809005: Options: Rename chrome/browser/resources/options2 -> chrome/browser/resources/options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
7 /** @const */ var OptionsPage = options.OptionsPage;
8
9 /**
10 * This class is an overlay which allows the user to add or remove media
11 * galleries, and displays known media galleries.
12 * @constructor
13 * @extends {OptionsPage}
14 */
15 function MediaGalleriesManager() {
16 OptionsPage.call(this, 'manageGalleries',
17 loadTimeData.getString('manageMediaGalleriesTabTitle'),
18 'manage-media-galleries-overlay');
19 }
20
21 cr.addSingletonGetter(MediaGalleriesManager);
22
23 MediaGalleriesManager.prototype = {
24 __proto__: OptionsPage.prototype,
25
26 /**
27 * Decorate the overlay and set up event handlers.
28 */
29 initializePage: function() {
30 OptionsPage.prototype.initializePage.call(this);
31
32 this.availableGalleriesList_ = $('available-galleries-list');
33 options.MediaGalleriesList.decorate(this.availableGalleriesList_);
34
35 $('new-media-gallery').addEventListener('click', function() {
36 chrome.send('addNewGallery');
37 });
38
39 $('manage-media-confirm').addEventListener(
40 'click', OptionsPage.closeOverlay.bind(OptionsPage));
41
42 this.addEventListener('visibleChange', this.handleVisibleChange_);
43 },
44
45 /**
46 * @inheritDoc
47 * @private
48 */
49 handleVisibleChange_: function() {
50 if (!this.visible)
51 return;
52
53 if (this.availableGalleriesList_)
54 this.availableGalleriesList_.redraw();
55 },
56
57 /**
58 * @param {Array} galleries List of structs describibing galleries.
59 * @private
60 */
61 setAvailableMediaGalleries_: function(galleries) {
62 $('available-galleries-list').dataModel = new ArrayDataModel(galleries);
63 // TODO(estade): show this section by default.
64 $('media-galleries-section').hidden = false;
65 },
66 },
67
68 // Forward public APIs to private implementations.
69 [
70 'setAvailableMediaGalleries',
71 ].forEach(function(name) {
72 MediaGalleriesManager[name] = function() {
73 var instance = MediaGalleriesManager.getInstance();
74 return instance[name + '_'].apply(instance, arguments);
75 };
76 });
77
78 // Export
79 return {
80 MediaGalleriesManager: MediaGalleriesManager
81 };
82 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options2/media_galleries_manager_overlay.html ('k') | chrome/browser/resources/options2/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698