OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('ntp4', function() { | 5 cr.define('ntp4', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var localStrings = new LocalStrings; | 8 var localStrings = new LocalStrings; |
9 | 9 |
10 var APP_LAUNCH = { | 10 var APP_LAUNCH = { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 return self.contextMenu; | 223 return self.contextMenu; |
224 }); | 224 }); |
225 appContents.addEventListener('contextmenu', cr.ui.contextMenuHandler); | 225 appContents.addEventListener('contextmenu', cr.ui.contextMenuHandler); |
226 | 226 |
227 this.isStore_ = this.appData_.is_webstore; | 227 this.isStore_ = this.appData_.is_webstore; |
228 if (this.isStore_) | 228 if (this.isStore_) |
229 this.createAppsPromoExtras_(); | 229 this.createAppsPromoExtras_(); |
230 }, | 230 }, |
231 | 231 |
232 /** | 232 /** |
| 233 * Removes the app tile from the page. Should be called after the app has |
| 234 * been uninstalled. |
| 235 */ |
| 236 remove: function() { |
| 237 // Unset the ID immediately, because the app is already gone. But leave |
| 238 // the tile on the page as it animates out. |
| 239 this.id = ''; |
| 240 var tile = findAncestorByClass(this, 'tile'); |
| 241 tile.doRemove(); |
| 242 }, |
| 243 |
| 244 /** |
233 * Creates the apps-promo section of the app (should only be called for the | 245 * Creates the apps-promo section of the app (should only be called for the |
234 * webstore app). | 246 * webstore app). |
235 * @private | 247 * @private |
236 */ | 248 */ |
237 createAppsPromoExtras_: function() { | 249 createAppsPromoExtras_: function() { |
238 this.classList.add('webstore'); | 250 this.classList.add('webstore'); |
239 | 251 |
240 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true); | 252 this.appsPromoExtras_ = $('apps-promo-extras-template').cloneNode(true); |
241 this.appsPromoExtras_.id = ''; | 253 this.appsPromoExtras_.id = ''; |
242 this.appsPromoHeading_ = | 254 this.appsPromoHeading_ = |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 var store = document.querySelector('.webstore'); | 544 var store = document.querySelector('.webstore'); |
533 if (store) | 545 if (store) |
534 store.setAppsPromoData(data); | 546 store.setAppsPromoData(data); |
535 }; | 547 }; |
536 | 548 |
537 return { | 549 return { |
538 APP_LAUNCH: APP_LAUNCH, | 550 APP_LAUNCH: APP_LAUNCH, |
539 AppsPage: AppsPage, | 551 AppsPage: AppsPage, |
540 }; | 552 }; |
541 }); | 553 }); |
OLD | NEW |