| 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..c449fd6abf3120a52af82015ae747e2f9a4d3f64
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/ntp4/md_incognito_tab.js
|
| @@ -0,0 +1,51 @@
|
| +// 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.
|
| +
|
| +"use strict";
|
| +
|
| +// Handle the bookmark bar and theme change requests from the C++ side.
|
| +cr.define('ntp', function() {
|
| + /**
|
| + * Set whether the bookmarks bar is attached or not.
|
| + * @param {boolean} attached Whether the bar is attached or not.
|
| + */
|
| + function setBookmarkBarAttached(attached) {
|
| + document.documentElement.setAttribute('bookmarkbarattached', !!attached);
|
| + }
|
| +
|
| + /** @param {!{hasCustomBackground: boolean}} themeData */
|
| + function themeChanged(themeData) {
|
| + document.documentElement.setAttribute('hascustombackground',
|
| + themeData.hasCustomBackground);
|
| + $('incognitothemecss').href =
|
| + 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
|
| + }
|
| +
|
| + return {
|
| + setBookmarkBarAttached: setBookmarkBarAttached,
|
| + themeChanged: themeChanged,
|
| + };
|
| +});
|
| +
|
| +// Let the width of two lists of bulletpoints in a horizontal alignment
|
| +// determine the maximum content width.
|
| +window.addEventListener('load', function() {
|
| + var b1 = $('firstBulletpoints');
|
| + var b2 = $('secondBulletpoints');
|
| + var c = document.querySelector('.content');
|
| +
|
| + var maxWidth = (b1.offsetWidth + b2.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;
|
| +
|
| + b2.className += " tooWide";
|
| + }
|
| +
|
| + c.style.maxWidth = maxWidth + "px";
|
| +});
|
|
|