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

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: move separator out of webstore link 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(shouldSetFocus) { 49 showMenu: function(shouldSetFocus) {
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.apply(this, arguments); 56 MenuButton.prototype.showMenu.apply(this, arguments);
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 this.classList.toggle('invisible', !dataItems.length);
68 }, 67 },
69 68
70 /** 69 /**
71 * Adds an app to the menu. 70 * Adds an app to the menu.
72 * @param {Object} data An object encapsulating all data about the app. 71 * @param {Object} data An object encapsulating all data about the app.
73 * @private 72 * @private
74 */ 73 */
75 addItem_: function(data) { 74 addItem_: function(data) {
76 var isWindow = data.type == 'window'; 75 var isWindow = data.type == 'window';
77 var a = this.ownerDocument.createElement('a'); 76 var a = this.ownerDocument.createElement('a');
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 110
112 this.menu.appendChild(a); 111 this.menu.appendChild(a);
113 cr.ui.decorate(a, MenuItem); 112 cr.ui.decorate(a, MenuItem);
114 }, 113 },
115 }; 114 };
116 115
117 return { 116 return {
118 RecentMenuButton: RecentMenuButton, 117 RecentMenuButton: RecentMenuButton,
119 }; 118 };
120 }); 119 });
OLDNEW
« chrome/browser/resources/ntp4/new_tab.css ('K') | « chrome/browser/resources/ntp4/other_sessions.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698