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

Side by Side Diff: chrome/browser/resources/ntp_search/nav_dot.js

Issue 12207138: Remove unused ntp_search. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Nav dot
7 * This is the class for the navigation controls that appear along the bottom
8 * of the NTP.
9 */
10
11 cr.define('ntp', function() {
12 'use strict';
13
14 /**
15 * Creates a new navigation dot.
16 * @param {TilePage} page The associated TilePage.
17 * @param {string} title The title of the navigation dot.
18 * @constructor
19 * @extends {HTMLLIElement}
20 */
21 function NavDot(page, title) {
22 var dot = cr.doc.createElement('li');
23 dot.__proto__ = NavDot.prototype;
24 dot.initialize(page, title);
25
26 return dot;
27 }
28
29 NavDot.prototype = {
30 __proto__: HTMLLIElement.prototype,
31
32 initialize: function(page, title) {
33 this.className = 'dot';
34 this.page_ = page;
35 this.textContent = title;
36
37 this.addEventListener('keydown', this.onKeyDown_);
38 this.addEventListener('click', this.onClick_);
39 },
40
41 /**
42 * @return {TilePage} The associated TilePage.
43 */
44 get page() {
45 return this.page_;
46 },
47
48 /**
49 * Removes the dot from the page.
50 */
51 remove: function() {
52 this.parentNode.removeChild(this);
53 },
54
55 /**
56 * Navigates the card slider to the page for this dot.
57 */
58 switchToPage: function() {
59 ntp.getCardSlider().selectCardByValue(this.page_, true);
60 },
61
62 /**
63 * Handler for keydown event on the dot.
64 * @param {Event} e The KeyboardEvent.
65 */
66 onKeyDown_: function(e) {
67 if (e.keyIdentifier == 'Enter') {
68 this.onClick_(e);
69 e.stopPropagation();
70 }
71 },
72
73 /**
74 * Clicking causes the associated page to show.
75 * @param {Event} e The click event.
76 * @private
77 */
78 onClick_: function(e) {
79 this.switchToPage();
80 e.stopPropagation();
81 },
82
83 };
84
85 return {
86 NavDot: NavDot,
87 };
88 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp_search/nav_dot.css ('k') | chrome/browser/resources/ntp_search/new_tab.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698