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

Side by Side Diff: chrome/browser/resources/ntp4/recently_closed.js

Issue 12038090: Layout the NTP footer with flexboxes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
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 /** 5 /**
6 * @fileoverview The recently closed menu: button, model data, and menu. 6 * @fileoverview The recently closed menu: button, model data, and menu.
7 */ 7 */
8 8
9 cr.define('ntp', function() { 9 cr.define('ntp', function() {
10 'use strict'; 10 'use strict';
(...skipping 18 matching lines...) Expand all
29 __proto__: MenuButton.prototype, 29 __proto__: MenuButton.prototype,
30 30
31 decorate: function() { 31 decorate: function() {
32 MenuButton.prototype.decorate.call(this); 32 MenuButton.prototype.decorate.call(this);
33 this.menu = new Menu; 33 this.menu = new Menu;
34 cr.ui.decorate(this.menu, Menu); 34 cr.ui.decorate(this.menu, Menu);
35 this.menu.classList.add('footer-menu'); 35 this.menu.classList.add('footer-menu');
36 document.body.appendChild(this.menu); 36 document.body.appendChild(this.menu);
37 37
38 this.needsRebuild_ = true; 38 this.needsRebuild_ = true;
39 this.hidden = true;
40 this.anchorType = cr.ui.AnchorType.ABOVE; 39 this.anchorType = cr.ui.AnchorType.ABOVE;
41 this.invertLeftRight = true; 40 this.invertLeftRight = true;
42 }, 41 },
43 42
44 /** 43 /**
45 * Shows the menu, first rebuilding it if necessary. 44 * Shows the menu, first rebuilding it if necessary.
46 * TODO(estade): the right of the menu should align with the right of the 45 * TODO(estade): the right of the menu should align with the right of the
47 * button. 46 * button.
48 * @override 47 * @override
49 */ 48 */
50 showMenu: function() { 49 showMenu: function() {
51 if (this.needsRebuild_) { 50 if (this.needsRebuild_) {
52 this.menu.textContent = ''; 51 this.menu.textContent = '';
53 this.dataItems_.forEach(this.addItem_, this); 52 this.dataItems_.forEach(this.addItem_, this);
54 this.needsRebuild_ = false; 53 this.needsRebuild_ = false;
55 } 54 }
56 55
57 MenuButton.prototype.showMenu.call(this); 56 MenuButton.prototype.showMenu.call(this);
58 }, 57 },
59 58
60 /** 59 /**
61 * Sets the menu model data. 60 * Sets the menu model data.
62 * @param {Array} dataItems Array of objects that describe the apps. 61 * @param {Array} dataItems Array of objects that describe the apps.
63 */ 62 */
64 set dataItems(dataItems) { 63 set dataItems(dataItems) {
65 this.dataItems_ = dataItems; 64 this.dataItems_ = dataItems;
66 this.needsRebuild_ = true; 65 this.needsRebuild_ = true;
67 this.hidden = !dataItems.length; 66 if (dataItems.length)
Dan Beam 2013/01/31 20:22:11 same nit re: this.classList.toggle()
dconnelly 2013/02/04 16:40:45 Same comment as other_sessions.js--that form of to
67 this.classList.remove('invisible');
68 else
69 this.classList.add('invisible');
68 }, 70 },
69 71
70 /** 72 /**
71 * Adds an app to the menu. 73 * Adds an app to the menu.
72 * @param {Object} data An object encapsulating all data about the app. 74 * @param {Object} data An object encapsulating all data about the app.
73 * @private 75 * @private
74 */ 76 */
75 addItem_: function(data) { 77 addItem_: function(data) {
76 var isWindow = data.type == 'window'; 78 var isWindow = data.type == 'window';
77 var a = this.ownerDocument.createElement('a'); 79 var a = this.ownerDocument.createElement('a');
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 113
112 this.menu.appendChild(a); 114 this.menu.appendChild(a);
113 cr.ui.decorate(a, MenuItem); 115 cr.ui.decorate(a, MenuItem);
114 }, 116 },
115 }; 117 };
116 118
117 return { 119 return {
118 RecentMenuButton: RecentMenuButton, 120 RecentMenuButton: RecentMenuButton,
119 }; 121 };
120 }); 122 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698