| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 var appImg = this.ownerDocument.createElement('img'); | 191 var appImg = this.ownerDocument.createElement('img'); |
| 192 this.appImg_ = appImg; | 192 this.appImg_ = appImg; |
| 193 this.setIcon(); | 193 this.setIcon(); |
| 194 appImgContainer.appendChild(appImg); | 194 appImgContainer.appendChild(appImg); |
| 195 | 195 |
| 196 if (this.useSmallIcon_) { | 196 if (this.useSmallIcon_) { |
| 197 var imgDiv = this.ownerDocument.createElement('div'); | 197 var imgDiv = this.ownerDocument.createElement('div'); |
| 198 imgDiv.className = 'app-icon-div'; | 198 imgDiv.className = 'app-icon-div'; |
| 199 imgDiv.appendChild(appImgContainer); | 199 imgDiv.appendChild(appImgContainer); |
| 200 imgDiv.addEventListener('click', this.onClick_.bind(this)); | 200 imgDiv.addEventListener('click', this.onClick_.bind(this)); |
| 201 imgDiv.title = this.appData_.name; |
| 201 this.imgDiv_ = imgDiv; | 202 this.imgDiv_ = imgDiv; |
| 202 appContents.appendChild(imgDiv); | 203 appContents.appendChild(imgDiv); |
| 203 this.appImgContainer_.style.position = 'absolute'; | 204 this.appImgContainer_.style.position = 'absolute'; |
| 204 this.appImgContainer_.style.bottom = '10px'; | 205 this.appImgContainer_.style.bottom = '10px'; |
| 205 this.appImgContainer_.style.left = '10px'; | 206 this.appImgContainer_.style.left = '10px'; |
| 206 var stripeDiv = this.ownerDocument.createElement('div'); | 207 var stripeDiv = this.ownerDocument.createElement('div'); |
| 207 stripeDiv.className = 'color-stripe'; | 208 stripeDiv.className = 'color-stripe'; |
| 208 imgDiv.appendChild(stripeDiv); | 209 imgDiv.appendChild(stripeDiv); |
| 209 | 210 |
| 210 chrome.send('getAppIconDominantColor', [this.id]); | 211 chrome.send('getAppIconDominantColor', [this.id]); |
| 211 } else { | 212 } else { |
| 212 appImgContainer.addEventListener('click', this.onClick_.bind(this)); | 213 appImgContainer.addEventListener('click', this.onClick_.bind(this)); |
| 214 appImgContainer.title = this.appData_.name; |
| 213 appContents.appendChild(appImgContainer); | 215 appContents.appendChild(appImgContainer); |
| 214 } | 216 } |
| 215 | 217 |
| 216 var appSpan = this.ownerDocument.createElement('span'); | 218 var appSpan = this.ownerDocument.createElement('span'); |
| 217 appSpan.textContent = this.appData_.name; | 219 appSpan.textContent = appSpan.title = this.appData_.name; |
| 218 appSpan.addEventListener('click', this.onClick_.bind(this)); | 220 appSpan.addEventListener('click', this.onClick_.bind(this)); |
| 219 appContents.appendChild(appSpan); | 221 appContents.appendChild(appSpan); |
| 220 this.appendChild(appContents); | 222 this.appendChild(appContents); |
| 221 | 223 |
| 222 var notification = this.appData_.notification; | 224 var notification = this.appData_.notification; |
| 223 var hasNotification = typeof notification != 'undefined' && | 225 var hasNotification = typeof notification != 'undefined' && |
| 224 typeof notification['title'] != 'undefined' && | 226 typeof notification['title'] != 'undefined' && |
| 225 typeof notification['body'] != 'undefined'; | 227 typeof notification['body'] != 'undefined'; |
| 226 if (hasNotification) | 228 if (hasNotification) |
| 227 this.setupNotification_(notification); | 229 this.setupNotification_(notification); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 appsPrefChangeCallback: appsPrefChangeCallback, | 716 appsPrefChangeCallback: appsPrefChangeCallback, |
| 715 launchAppAfterEnable: launchAppAfterEnable, | 717 launchAppAfterEnable: launchAppAfterEnable, |
| 716 }; | 718 }; |
| 717 }); | 719 }); |
| 718 | 720 |
| 719 // TODO(estade): update the content handlers to use ntp namespace instead of | 721 // TODO(estade): update the content handlers to use ntp namespace instead of |
| 720 // making these global. | 722 // making these global. |
| 721 var appNotificationChanged = ntp4.appNotificationChanged; | 723 var appNotificationChanged = ntp4.appNotificationChanged; |
| 722 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; | 724 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; |
| 723 var launchAppAfterEnable = ntp4.launchAppAfterEnable; | 725 var launchAppAfterEnable = ntp4.launchAppAfterEnable; |
| OLD | NEW |