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

Side by Side Diff: chrome/browser/resources/ntp4/other_sessions.js

Issue 10141005: switch ntp to jstemplate v2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test once and for all Created 8 years, 8 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 /** 5 /**
6 * @fileoverview The menu that shows tabs from sessions on other devices. 6 * @fileoverview The menu that shows tabs from sessions on other devices.
7 */ 7 */
8 8
9 cr.define('ntp', function() { 9 cr.define('ntp', function() {
10 'use strict'; 10 'use strict';
11 11
12 var localStrings = new LocalStrings();
13 var Menu = cr.ui.Menu; 12 var Menu = cr.ui.Menu;
14 var MenuItem = cr.ui.MenuItem; 13 var MenuItem = cr.ui.MenuItem;
15 var MenuButton = cr.ui.MenuButton; 14 var MenuButton = cr.ui.MenuButton;
16 var OtherSessionsMenuButton = cr.ui.define('button'); 15 var OtherSessionsMenuButton = cr.ui.define('button');
17 16
18 // Histogram buckets for UMA tracking of menu usage. 17 // Histogram buckets for UMA tracking of menu usage.
19 var HISTOGRAM_EVENT = { 18 var HISTOGRAM_EVENT = {
20 INITIALIZED: 0, 19 INITIALIZED: 0,
21 SHOW_MENU: 1, 20 SHOW_MENU: 1,
22 LINK_CLICKED: 2, 21 LINK_CLICKED: 2,
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 247
249 /** 248 /**
250 * Appends a menu item to |this.menu|. 249 * Appends a menu item to |this.menu|.
251 * @param {String} textId The ID for the localized string that acts as 250 * @param {String} textId The ID for the localized string that acts as
252 * the item's label. 251 * the item's label.
253 */ 252 */
254 appendMenuItem_: function(textId) { 253 appendMenuItem_: function(textId) {
255 var button = cr.doc.createElement('button'); 254 var button = cr.doc.createElement('button');
256 this.menu.appendChild(button); 255 this.menu.appendChild(button);
257 cr.ui.decorate(button, cr.ui.MenuItem); 256 cr.ui.decorate(button, cr.ui.MenuItem);
258 button.textContent = localStrings.getString(textId); 257 button.textContent = loadTimeData.getString(textId);
259 return button; 258 return button;
260 }, 259 },
261 260
262 /** 261 /**
263 * Handler for the 'hide' menu item. 262 * Handler for the 'hide' menu item.
264 * @param {Event} e The activation event. 263 * @param {Event} e The activation event.
265 * @private 264 * @private
266 */ 265 */
267 onHide_: function(e) { 266 onHide_: function(e) {
268 chrome.send('deleteForeignSession', [this.sessionTag_]); 267 chrome.send('deleteForeignSession', [this.sessionTag_]);
269 chrome.send('getForeignSessions'); // Refresh the list. 268 chrome.send('getForeignSessions'); // Refresh the list.
270 }, 269 },
271 270
272 /** 271 /**
273 * Set the session tag which identifies the session that the context menu 272 * Set the session tag which identifies the session that the context menu
274 * was invoked on. 273 * was invoked on.
275 * @param {String} tag The session tag. 274 * @param {String} tag The session tag.
276 */ 275 */
277 setSessionTag: function(tag) { 276 setSessionTag: function(tag) {
278 this.sessionTag_ = tag; 277 this.sessionTag_ = tag;
279 } 278 }
280 }; 279 };
281 280
282 return { 281 return {
283 OtherSessionsMenuButton: OtherSessionsMenuButton, 282 OtherSessionsMenuButton: OtherSessionsMenuButton,
284 }; 283 };
285 }); 284 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.js ('k') | chrome/browser/resources/ntp4/page_list_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698