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

Side by Side Diff: chrome/browser/resources/local_ntp/most_visited_single.js

Issue 2091323002: Kill NewTabPage.NumberOfMouseOvers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add additional file to sync. Created 4 years, 5 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 | « no previous file | chrome/browser/resources/local_ntp/most_visited_util.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright 2015 The Chromium Authors. All rights reserved. 1 /* Copyright 2015 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 // Single iframe for NTP tiles. 5 // Single iframe for NTP tiles.
6 (function() { 6 (function() {
7 'use strict'; 7 'use strict';
8 8
9 9
10 /** 10 /**
11 * The different types of events that are logged from the NTP. This enum is 11 * The different types of events that are logged from the NTP. This enum is
12 * used to transfer information from the NTP JavaScript to the renderer and is 12 * used to transfer information from the NTP JavaScript to the renderer and is
13 * not used as a UMA enum histogram's logged value. 13 * not used as a UMA enum histogram's logged value.
14 * Note: Keep in sync with common/ntp_logging_events.h 14 * Note: Keep in sync with common/ntp_logging_events.h
15 * @enum {number} 15 * @enum {number}
16 * @const 16 * @const
17 */ 17 */
18 var LOG_TYPE = { 18 var LOG_TYPE = {
19 // The suggestion is coming from the server. 19 // The suggestion is coming from the server.
20 NTP_SERVER_SIDE_SUGGESTION: 0, 20 NTP_SERVER_SIDE_SUGGESTION: 0,
21 // The suggestion is coming from the client. 21 // The suggestion is coming from the client.
22 NTP_CLIENT_SIDE_SUGGESTION: 1, 22 NTP_CLIENT_SIDE_SUGGESTION: 1,
23 // Indicates a tile was rendered, no matter if it's a thumbnail, a gray tile 23 // Indicates a tile was rendered, no matter if it's a thumbnail, a gray tile
24 // or an external tile. 24 // or an external tile.
25 NTP_TILE: 2, 25 NTP_TILE: 2,
26 // The tile uses a local thumbnail image. 26 // The tile uses a local thumbnail image.
27 NTP_THUMBNAIL_TILE: 3, 27 NTP_THUMBNAIL_TILE: 3,
28 // Used when no thumbnail is specified and a gray tile with the domain is used
29 // as the main tile. Unused here.
30 NTP_GRAY_TILE: 4,
31 // The visuals of that tile are handled externally by the page itself.
32 // Unused here.
33 NTP_EXTERNAL_TILE: 5,
34 // There was an error in loading both the thumbnail image and the fallback 28 // There was an error in loading both the thumbnail image and the fallback
35 // (if it was provided), resulting in a gray tile. 29 // (if it was provided), resulting in a gray tile.
36 NTP_THUMBNAIL_ERROR: 6, 30 NTP_THUMBNAIL_ERROR: 6,
37 // Used a gray tile with the domain as the fallback for a failed thumbnail.
38 // Unused here.
39 NTP_GRAY_TILE_FALLBACK: 7,
40 // The visuals of that tile's fallback are handled externally. Unused here.
41 NTP_EXTERNAL_TILE_FALLBACK: 8,
42 // The user moused over an NTP tile.
43 NTP_MOUSEOVER: 9,
44 // A NTP Tile has finished loading (successfully or failing). 31 // A NTP Tile has finished loading (successfully or failing).
45 NTP_TILE_LOADED: 10, 32 NTP_TILE_LOADED: 10,
46 }; 33 };
47 34
48 35
49 /** 36 /**
50 * The different sources that an NTP tile can have. 37 * The different sources that an NTP tile can have.
51 * Note: Keep in sync with common/ntp_logging_events.h 38 * Note: Keep in sync with common/ntp_logging_events.h
52 * @enum {number} 39 * @enum {number}
53 * @const 40 * @const
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 if (inArrowDirection(this, nonEmptyTiles[i]) && 439 if (inArrowDirection(this, nonEmptyTiles[i]) &&
453 (!nextTile || inArrowDirection(nonEmptyTiles[i], nextTile))) { 440 (!nextTile || inArrowDirection(nonEmptyTiles[i], nextTile))) {
454 nextTile = nonEmptyTiles[i]; 441 nextTile = nonEmptyTiles[i];
455 } 442 }
456 } 443 }
457 if (nextTile) { 444 if (nextTile) {
458 nextTile.focus(); 445 nextTile.focus();
459 } 446 }
460 } 447 }
461 }); 448 });
462 // TODO(fserb): remove this or at least change to mouseenter.
463 tile.addEventListener('mouseover', function() {
464 logEvent(LOG_TYPE.NTP_MOUSEOVER);
465 });
466 449
467 var title = tile.querySelector('.mv-title'); 450 var title = tile.querySelector('.mv-title');
468 title.innerText = data.title; 451 title.innerText = data.title;
469 title.style.direction = data.direction || 'ltr'; 452 title.style.direction = data.direction || 'ltr';
470 if (NUM_TITLE_LINES > 1) { 453 if (NUM_TITLE_LINES > 1) {
471 title.classList.add('multiline'); 454 title.classList.add('multiline');
472 } 455 }
473 456
474 if (USE_ICONS) { 457 if (USE_ICONS) {
475 var thumb = tile.querySelector('.mv-thumb'); 458 var thumb = tile.querySelector('.mv-thumb');
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 var html = document.querySelector('html'); 620 var html = document.querySelector('html');
638 html.dir = 'rtl'; 621 html.dir = 'rtl';
639 } 622 }
640 623
641 window.addEventListener('message', handlePostMessage); 624 window.addEventListener('message', handlePostMessage);
642 }; 625 };
643 626
644 627
645 window.addEventListener('DOMContentLoaded', init); 628 window.addEventListener('DOMContentLoaded', init);
646 })(); 629 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/local_ntp/most_visited_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698