OLD | NEW |
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 * The global object. | 6 * The global object. |
7 * @type {!Object} | 7 * @type {!Object} |
8 * @const | 8 * @const |
9 */ | 9 */ |
10 var global = this; | 10 var global = this; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 if (url.indexOf('?') == -1) | 225 if (url.indexOf('?') == -1) |
226 return url + '?' + param; | 226 return url + '?' + param; |
227 return url + '&' + param; | 227 return url + '&' + param; |
228 } | 228 } |
229 | 229 |
230 /** | 230 /** |
231 * Creates a new URL for a favicon request. | 231 * Creates a new URL for a favicon request. |
232 * @param {string} url The url for the favicon. | 232 * @param {string} url The url for the favicon. |
233 * @param {number=} opt_size Optional preferred size of the favicon. | 233 * @param {number=} opt_size Optional preferred size of the favicon. |
| 234 * @param {boolean=} opt_sessionFavicon Optional flag to indicate if |
| 235 * requesting a session favicon. |
234 * @return {string} Updated URL for the favicon. | 236 * @return {string} Updated URL for the favicon. |
235 */ | 237 */ |
236 function getFaviconUrl(url, opt_size) { | 238 function getFaviconUrl(url, opt_size, opt_sessionFavicon) { |
237 var size = opt_size || 16; | 239 var size = opt_size || 16; |
238 return 'chrome://favicon/size/' + size + '@' + | 240 var type = opt_sessionFavicon ? 'session-favicon' : 'favicon'; |
| 241 return 'chrome://' + type + '/size/' + size + '@' + |
239 window.devicePixelRatio + 'x/' + url; | 242 window.devicePixelRatio + 'x/' + url; |
240 } | 243 } |
241 | 244 |
242 /** | 245 /** |
243 * Creates an element of a specified type with a specified class name. | 246 * Creates an element of a specified type with a specified class name. |
244 * @param {string} type The node type. | 247 * @param {string} type The node type. |
245 * @param {string} className The class name to use. | 248 * @param {string} className The class name to use. |
246 * @return {Element} The created element. | 249 * @return {Element} The created element. |
247 */ | 250 */ |
248 function createElementWithClassName(type, className) { | 251 function createElementWithClassName(type, className) { |
249 var elm = document.createElement(type); | 252 var elm = document.createElement(type); |
250 elm.className = className; | 253 elm.className = className; |
251 return elm; | 254 return elm; |
252 } | 255 } |
OLD | NEW |