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 TilePage = ntp4.TilePage; | 8 var TilePage = ntp4.TilePage; |
9 | 9 |
10 /** | 10 /** |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 /** | 112 /** |
113 * Handles a click on the tile. | 113 * Handles a click on the tile. |
114 * @param {Event} e The click event. | 114 * @param {Event} e The click event. |
115 */ | 115 */ |
116 handleClick_: function(e) { | 116 handleClick_: function(e) { |
117 if (e.target.classList.contains('close-button')) { | 117 if (e.target.classList.contains('close-button')) { |
118 this.blacklist_(); | 118 this.blacklist_(); |
119 e.preventDefault(); | 119 e.preventDefault(); |
120 } else { | 120 } else { |
| 121 // Records an app launch from the most visited page (Chrome will decide |
| 122 // whether the url is an app). |
| 123 chrome.send('recordAppLaunchByURL', |
| 124 [encodeURIComponent(this.href), |
| 125 ntp4.APP_LAUNCH.NTP_MOST_VISITED]); |
| 126 // Records the index of this tile. |
121 chrome.send('recordInHistogram', ['NTP_MostVisited', this.index, 8]); | 127 chrome.send('recordInHistogram', ['NTP_MostVisited', this.index, 8]); |
122 } | 128 } |
123 }, | 129 }, |
124 | 130 |
125 /** | 131 /** |
126 * Allow blacklisting most visited site using the keyboard. | 132 * Allow blacklisting most visited site using the keyboard. |
127 */ | 133 */ |
128 handleKeyDown_: function(e) { | 134 handleKeyDown_: function(e) { |
129 if (!IS_MAC && e.keyCode == 46 || // Del | 135 if (!IS_MAC && e.keyCode == 46 || // Del |
130 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace | 136 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 if (tile) | 369 if (tile) |
364 tile.setStripeColor(color); | 370 tile.setStripeColor(color); |
365 }; | 371 }; |
366 | 372 |
367 return { | 373 return { |
368 MostVisitedPage: MostVisitedPage, | 374 MostVisitedPage: MostVisitedPage, |
369 refreshData: refreshData, | 375 refreshData: refreshData, |
370 setFaviconDominantColor: setFaviconDominantColor, | 376 setFaviconDominantColor: setFaviconDominantColor, |
371 }; | 377 }; |
372 }); | 378 }); |
OLD | NEW |