OLD | NEW |
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 = ''; |
11 appsMiniview.textContent = ''; | 11 appsMiniview.textContent = ''; |
12 | 12 |
13 if (data.apps.length == 0) { | 13 if (data.apps.length == 0) { |
14 appsSection.classList.add('disabled'); | 14 appsSection.classList.add('disabled'); |
15 return; | 15 return; |
16 } | 16 } |
17 | 17 |
18 data.apps.forEach(function(app) { | 18 data.apps.forEach(function(app) { |
19 appsSectionContent.appendChild(apps.createElement(app)); | 19 appsSectionContent.appendChild(apps.createElement(app)); |
20 }); | 20 }); |
21 | 21 |
22 appsSectionContent.appendChild(apps.createWebStoreElement()); | 22 appsSectionContent.appendChild(apps.createWebStoreElement()); |
23 | 23 |
24 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { | 24 data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { |
25 appsMiniview.appendChild(apps.createMiniviewElement(app)); | 25 appsMiniview.appendChild(apps.createMiniviewElement(app)); |
26 }); | 26 }); |
27 | 27 |
28 appsSection.classList.remove('disabled'); | 28 appsSection.classList.remove('disabled'); |
| 29 updateMiniviewClipping(appsMiniview); |
29 layoutSections(); | 30 layoutSections(); |
30 } | 31 } |
31 | 32 |
32 var apps = { | 33 var apps = { |
33 /** | 34 /** |
34 * @this {!HTMLAnchorElement} | 35 * @this {!HTMLAnchorElement} |
35 */ | 36 */ |
36 handleClick_: function() { | 37 handleClick_: function() { |
37 // TODO(arv): Handle zoom? | 38 // TODO(arv): Handle zoom? |
38 var rect = this.getBoundingClientRect(); | 39 var rect = this.getBoundingClientRect(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 }, | 131 }, |
131 | 132 |
132 createWebStoreElement: function() { | 133 createWebStoreElement: function() { |
133 return this.createElement_({ | 134 return this.createElement_({ |
134 'id': 'web-store-entry', | 135 'id': 'web-store-entry', |
135 'name': localStrings.getString('web_store_title'), | 136 'name': localStrings.getString('web_store_title'), |
136 'launch_url': localStrings.getString('web_store_url') | 137 'launch_url': localStrings.getString('web_store_url') |
137 }); | 138 }); |
138 } | 139 } |
139 }; | 140 }; |
OLD | NEW |