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

Side by Side Diff: chrome/browser/resources/bluetooth_internals/sidebar.js

Issue 2568283003: bluetooth: Add notification system to internals page. (Closed)
Patch Set: Change handleInspect, danger->error, fix text color Created 4 years 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * Javascript for Sidebar, served from chrome://bluetooth-internals/. 6 * Javascript for Sidebar, served from chrome://bluetooth-internals/.
7 */ 7 */
8 8
9 cr.define('sidebar', function() { 9 cr.define('sidebar', function() {
10 /** @const {!cr.ui.pageManager.PageManager}*/ 10 /** @const {!cr.ui.pageManager.PageManager}*/
(...skipping 27 matching lines...) Expand all
38 38
39 Sidebar.prototype = { 39 Sidebar.prototype = {
40 __proto__: PageManager.Observer.prototype, 40 __proto__: PageManager.Observer.prototype,
41 41
42 /** 42 /**
43 * Closes the sidebar. Only applies to layouts with window width <= 600px. 43 * Closes the sidebar. Only applies to layouts with window width <= 600px.
44 */ 44 */
45 close: function() { 45 close: function() {
46 this.sidebarDiv_.classList.remove('open'); 46 this.sidebarDiv_.classList.remove('open');
47 document.body.style.overflow = ''; 47 document.body.style.overflow = '';
48 document.dispatchEvent(new CustomEvent('contentfocus'));
Dan Beam 2016/12/16 08:42:58 why is this not named something like 'sidebar-clos
mbrunson 2016/12/16 21:42:30 The main purpose of these 2 events (contentfocus/c
48 }, 49 },
49 50
50 /** 51 /**
51 * Opens the sidebar. Only applies to layouts with window width <= 600px. 52 * Opens the sidebar. Only applies to layouts with window width <= 600px.
52 */ 53 */
53 open: function() { 54 open: function() {
54 document.body.style.overflow = 'hidden'; 55 document.body.style.overflow = 'hidden';
55 this.sidebarDiv_.classList.add('open'); 56 this.sidebarDiv_.classList.add('open');
57 document.dispatchEvent(new CustomEvent('contentblur'));
56 }, 58 },
57 59
58 /** 60 /**
59 * Called when a page is navigated to. 61 * Called when a page is navigated to.
60 * @override 62 * @override
61 * @param {string} path The path of the page being visited. 63 * @param {string} path The path of the page being visited.
62 */ 64 */
63 updateHistory: function(path) { 65 updateHistory: function(path) {
64 this.sidebarContent_.querySelectorAll('li').forEach(function(item) { 66 this.sidebarContent_.querySelectorAll('li').forEach(function(item) {
65 item.classList.toggle('selected', item.dataset.pageName === path); 67 item.classList.toggle('selected', item.dataset.pageName === path);
66 }); 68 });
67 }, 69 },
68 70
69 /** 71 /**
70 * Switches the page based on which sidebar list button was clicked. 72 * Switches the page based on which sidebar list button was clicked.
71 * @param {!Event} event 73 * @param {!Event} event
72 * @private 74 * @private
73 */ 75 */
74 onItemClick_: function(event) { 76 onItemClick_: function(event) {
75 this.close(); 77 this.close();
76 PageManager.showPageByName(event.target.parentNode.dataset.pageName); 78 PageManager.showPageByName(event.target.parentNode.dataset.pageName);
77 }, 79 },
78 }; 80 };
79 81
80 return { 82 return {
81 Sidebar: Sidebar 83 Sidebar: Sidebar
82 }; 84 };
83 }); 85 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698