| Index: chrome/browser/resources/new_new_tab.js
|
| ===================================================================
|
| --- chrome/browser/resources/new_new_tab.js (revision 50261)
|
| +++ chrome/browser/resources/new_new_tab.js (working copy)
|
| @@ -11,93 +11,6 @@
|
| $(id).classList.add('hidden');
|
| }
|
|
|
| -function getAppsCallback(data) {
|
| - logEvent('recieved apps');
|
| - var appsSection = $('apps-section');
|
| - var debugSection = $('debug');
|
| - appsSection.innerHTML = '';
|
| -
|
| - data.apps.forEach(function(app) {
|
| - appsSection.appendChild(apps.createElement(app));
|
| - });
|
| -
|
| - if (data.galleryTitle && data.galleryURL) {
|
| - appsSection.appendChild(apps.createGalleryElement(
|
| - data.galleryTitle, data.galleryURL));
|
| - }
|
| -
|
| - // TODO(aa): Figure out what to do with the debug mode when we turn apps on
|
| - // for everyone.
|
| - if (appsSection.hasChildNodes()) {
|
| - appsSection.classList.remove('disabled');
|
| - if (data.showDebugLink) {
|
| - debugSection.classList.remove('disabled');
|
| - }
|
| - } else {
|
| - appsSection.classList.add('disabled');
|
| - debugSection.classList.add('disabled');
|
| - }
|
| -}
|
| -
|
| -var apps = {
|
| - /**
|
| - * @this {!HTMLAnchorElement}
|
| - */
|
| - handleClick_: function() {
|
| - var launchType = '';
|
| - var inputElements = document.querySelectorAll(
|
| - '#apps-launch-control input');
|
| - for (var i = 0, input; input = inputElements[i]; i++) {
|
| - if (input.checked) {
|
| - launchType = input.value;
|
| - break;
|
| - }
|
| - }
|
| -
|
| - // TODO(arv): Handle zoom?
|
| - var rect = this.getBoundingClientRect();
|
| - var cs = getComputedStyle(this);
|
| - var size = cs.backgroundSize.split(/\s+/); // background-size has the
|
| - // format '123px 456px'.
|
| - var width = parseInt(size[0], 10);
|
| - var height = parseInt(size[1], 10);
|
| - // We are using background-position-x 50%.
|
| - var left = rect.left + ((rect.width - width) >> 1); // Integer divide by 2.
|
| - var top = rect.top + parseInt(cs.backgroundPositionY, 10);
|
| -
|
| - chrome.send('launchApp', [this.id, launchType,
|
| - String(left), String(top),
|
| - String(width), String(height)]);
|
| - return false;
|
| - },
|
| -
|
| - createElement: function(app) {
|
| - var a = document.createElement('a');
|
| - a.xtitle = a.textContent = app['name'];
|
| - a.href = app['launch_url'];
|
| - a.id = app['id'];
|
| - a.onclick = apps.handleClick_;
|
| - a.style.backgroundImage = url(app['icon']);
|
| - if (hashParams['app-id'] == app['id']) {
|
| - a.setAttribute('new', 'new');
|
| - // Delay changing the attribute a bit to let the page settle down a bit.
|
| - setTimeout(function() {
|
| - a.setAttribute('new', 'installed');
|
| - }, 500);
|
| - }
|
| - return a;
|
| - },
|
| -
|
| - createGalleryElement: function(title, url) {
|
| - var a = document.createElement('a');
|
| - a.title = title;
|
| - a.href = url;
|
| - a.id = 'gallery-entry';
|
| - a.textContent = title;
|
| - return a;
|
| - }
|
| -};
|
| -
|
| var tipCache = {};
|
|
|
| function tips(data) {
|
|
|