| Index: chrome/browser/resources/ntp4/md_incognito_tab.js
|
| diff --git a/chrome/browser/resources/ntp4/md_incognito_tab.js b/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3918f70126322fd2dc661c8f65c12be8a393ae16
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| @@ -0,0 +1,40 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Handle the bookmark bar and theme change requests from the C++ side.
|
| +var ntp = {
|
| + /** @param {string} attached */
|
| + setBookmarkBarAttached: function(attached) {
|
| + document.documentElement.setAttribute('bookmarkbarattached', attached);
|
| + },
|
| +
|
| + /** @param {!{hasCustomBackground: boolean}} themeData */
|
| + themeChanged: function(themeData) {
|
| + document.documentElement.setAttribute('hascustombackground',
|
| + themeData.hasCustomBackground);
|
| + $('incognitothemecss').href =
|
| + 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
|
| + },
|
| +};
|
| +
|
| +// Let the width of two lists of bulletpoints in a horizontal alignment
|
| +// determine the maximum content width.
|
| +window.addEventListener('load', function() {
|
| + var bulletpoints = document.querySelectorAll('.bulletpoints');
|
| + var content = document.querySelector('.content');
|
| +
|
| + var maxWidth = (bulletpoints[0].offsetWidth + bulletpoints[1].offsetWidth +
|
| + 40 /* margin */ + 2 /* offsetWidths may be rounded down */);
|
| +
|
| + // Limit the maximum width to 600px. That might force the two lists
|
| + // of bulletpoints under each other, in which case we must swap the left
|
| + // and right margin.
|
| + if (maxWidth > 600) {
|
| + maxWidth = 600;
|
| +
|
| + bulletpoints[1].classList.add('tooWide');
|
| + }
|
| +
|
| + content.style.maxWidth = maxWidth + "px";
|
| +});
|
|
|