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

Side by Side Diff: chrome/browser/resources/ntp/apps.js

Issue 3342009: Remove old debug code from ntp. (Closed)
Patch Set: Created 10 years, 3 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
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 function getAppsCallback(data) { 5 function getAppsCallback(data) {
6 logEvent('recieved apps'); 6 logEvent('recieved apps');
7 var appsSection = $('apps'); 7 var appsSection = $('apps');
8 var appsSectionContent = $('apps-maxiview'); 8 var appsSectionContent = $('apps-maxiview');
9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; 9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
10 appsSectionContent.textContent = ''; 10 appsSectionContent.textContent = '';
(...skipping 16 matching lines...) Expand all
27 27
28 appsSection.classList.remove('disabled'); 28 appsSection.classList.remove('disabled');
29 layoutSections(); 29 layoutSections();
30 } 30 }
31 31
32 var apps = { 32 var apps = {
33 /** 33 /**
34 * @this {!HTMLAnchorElement} 34 * @this {!HTMLAnchorElement}
35 */ 35 */
36 handleClick_: function() { 36 handleClick_: function() {
37 var launchType = '';
38 var inputElements = document.querySelectorAll(
39 '#apps-launch-control input');
40 for (var i = 0, input; input = inputElements[i]; i++) {
41 if (input.checked) {
42 launchType = input.value;
43 break;
44 }
45 }
46
47 // TODO(arv): Handle zoom? 37 // TODO(arv): Handle zoom?
48 var rect = this.getBoundingClientRect(); 38 var rect = this.getBoundingClientRect();
49 var cs = getComputedStyle(this); 39 var cs = getComputedStyle(this);
50 var size = cs.backgroundSize.split(/\s+/); // background-size has the 40 var size = cs.backgroundSize.split(/\s+/); // background-size has the
51 // format '123px 456px'. 41 // format '123px 456px'.
52 var width = parseInt(size[0], 10); 42 var width = parseInt(size[0], 10);
53 var height = parseInt(size[1], 10); 43 var height = parseInt(size[1], 10);
54 // We are using background-position-x 50%. 44 // We are using background-position-x 50%.
55 var left = rect.left + ((rect.width - width) >> 1); // Integer divide by 2. 45 var left = rect.left + ((rect.width - width) >> 1); // Integer divide by 2.
56 var top = rect.top + parseInt(cs.backgroundPositionY, 10); 46 var top = rect.top + parseInt(cs.backgroundPositionY, 10);
57 47
58 chrome.send('launchApp', [this.getAttribute("app_id"), launchType, 48 chrome.send('launchApp', [this.getAttribute("app_id"),
59 String(left), String(top), 49 String(left), String(top),
60 String(width), String(height)]); 50 String(width), String(height)]);
61 return false; 51 return false;
62 }, 52 },
63 53
64 createElement_: function(app) { 54 createElement_: function(app) {
65 var div = document.createElement('div'); 55 var div = document.createElement('div');
66 div.className = 'app'; 56 div.className = 'app';
67 57
68 var front = div.appendChild(document.createElement('div')); 58 var front = div.appendChild(document.createElement('div'));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 }, 130 },
141 131
142 createWebStoreElement: function() { 132 createWebStoreElement: function() {
143 return this.createElement_({ 133 return this.createElement_({
144 'id': 'web-store-entry', 134 'id': 'web-store-entry',
145 'name': localStrings.getString('web_store_title'), 135 'name': localStrings.getString('web_store_title'),
146 'launch_url': localStrings.getString('web_store_url') 136 'launch_url': localStrings.getString('web_store_url')
147 }); 137 });
148 } 138 }
149 }; 139 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/new_new_tab.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698