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

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

Issue 2804823002: Revamp the Incognito NTP on Desktop (Closed)
Patch Set: Font sizes Created 3 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2017 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 "use strict";
6
7 // Handle the bookmark bar and theme change requests from the C++ side.
8 cr.define('ntp', function() {
9 /**
10 * Set whether the bookmarks bar is attached or not.
11 * @param {boolean} attached Whether the bar is attached or not.
12 */
13 function setBookmarkBarAttached(attached) {
14 document.documentElement.setAttribute('bookmarkbarattached', !!attached);
15 }
16
17 /** @param {!{hasCustomBackground: boolean}} themeData */
18 function themeChanged(themeData) {
19 document.documentElement.setAttribute('hascustombackground',
20 themeData.hasCustomBackground);
21 $('incognitothemecss').href =
22 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
23 }
24
25 return {
26 setBookmarkBarAttached: setBookmarkBarAttached,
27 themeChanged: themeChanged,
28 };
29 });
30
31 // Let the width of two lists of bulletpoints in a horizontal alignment
32 // determine the maximum content width.
33 window.addEventListener('load', function() {
34 var b1 = $('firstBulletpoints');
35 var b2 = $('secondBulletpoints');
36 var c = document.querySelector('.content');
37
38 var maxWidth = (b1.offsetWidth + b2.offsetWidth +
39 40 /* margin */ + 2 /* offsetWidths may be rounded down */);
40
41 // Limit the maximum width to 600px. That might force the two lists
42 // of bulletpoints under each other, in which case we must swap the left
43 // and right margin.
44 if (maxWidth > 600) {
45 maxWidth = 600;
46
47 b2.className += " tooWide";
48 }
49
50 c.style.maxWidth = maxWidth + "px";
51 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698