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 localStrings = new LocalStrings(); | 5 localStrings = new LocalStrings(); |
6 | 6 |
7 // UTF8 sequence for an arrow triangle pointing down. | 7 // UTF8 sequence for an arrow triangle pointing down. |
8 kExpandedArrow = "\u25BE"; | 8 kExpandedArrow = "\u25BE"; |
9 // UTF8 sequence for an arrow triangle pointing right. | 9 // UTF8 sequence for an arrow triangle pointing right. |
10 kCollapsedArrow = "\u25B8"; | 10 kCollapsedArrow = "\u25B8"; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 windowDiv.appendChild(createTitleDiv('window-title', 'Window')); | 75 windowDiv.appendChild(createTitleDiv('window-title', 'Window')); |
76 addItems(windowDiv, window.tabs, transformTab); | 76 addItems(windowDiv, window.tabs, transformTab); |
77 return windowDiv; | 77 return windowDiv; |
78 } | 78 } |
79 | 79 |
80 /** | 80 /** |
81 * Transforms a session into an HTML element. | 81 * Transforms a session into an HTML element. |
82 */ | 82 */ |
83 function transformSession(session) { | 83 function transformSession(session) { |
84 var sessionDiv = document.createElement('div'); | 84 var sessionDiv = document.createElement('div'); |
| 85 var sessionName = session.name.length == 0 ? 'Session' : session.name; |
85 sessionDiv.className = "session"; | 86 sessionDiv.className = "session"; |
86 sessionDiv.appendChild(createTitleDiv('session-title', 'Session')); | 87 sessionDiv.appendChild(createTitleDiv('session-title', sessionName)); |
87 addItems(sessionDiv, session.windows, transformWindow); | 88 addItems(sessionDiv, session.windows, transformWindow); |
88 return sessionDiv; | 89 return sessionDiv; |
89 } | 90 } |
90 | 91 |
91 /** | 92 /** |
92 * Creates the UI for the sessions tree. | 93 * Creates the UI for the sessions tree. |
93 */ | 94 */ |
94 function createSessionTreeUI(sessionList) { | 95 function createSessionTreeUI(sessionList) { |
95 $('sessions-summary-text').textContent = | 96 $('sessions-summary-text').textContent = |
96 localStrings.getStringF('sessionsCountFormat', sessionList.length); | 97 localStrings.getStringF('sessionsCountFormat', sessionList.length); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * Callback from backend with the list of sessions. Builds the UI. | 131 * Callback from backend with the list of sessions. Builds the UI. |
131 * @param {array} sessionList The list of sessions. | 132 * @param {array} sessionList The list of sessions. |
132 * @param {array} magicList List of "interesting" tabs. | 133 * @param {array} magicList List of "interesting" tabs. |
133 */ | 134 */ |
134 function updateSessionList(sessionList, magicList) { | 135 function updateSessionList(sessionList, magicList) { |
135 createSessionTreeUI(sessionList); | 136 createSessionTreeUI(sessionList); |
136 createMagicListUI(magicList); | 137 createMagicListUI(magicList); |
137 } | 138 } |
138 | 139 |
139 document.addEventListener('DOMContentLoaded', requestSessions); | 140 document.addEventListener('DOMContentLoaded', requestSessions); |
OLD | NEW |