OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * Copyright (C) 2010 Google Inc. All rights reserved. | 4 * Copyright (C) 2010 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return totalSize; | 204 return totalSize; |
205 } | 205 } |
206 | 206 |
207 /** | 207 /** |
208 * @param {!Array.<!SDK.Cookie>} cookies | 208 * @param {!Array.<!SDK.Cookie>} cookies |
209 */ | 209 */ |
210 _sortCookies(cookies) { | 210 _sortCookies(cookies) { |
211 var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1; | 211 var sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1; |
212 | 212 |
213 /** | 213 /** |
| 214 * @param {!SDK.Cookie} cookie |
| 215 * @param {string} property |
| 216 * @return {string} |
| 217 */ |
| 218 function getValue(cookie, property) { |
| 219 return typeof cookie[property] === 'function' ? String(cookie[property]())
: String(cookie.name()); |
| 220 } |
| 221 |
| 222 /** |
214 * @param {string} property | 223 * @param {string} property |
215 * @param {!SDK.Cookie} cookie1 | 224 * @param {!SDK.Cookie} cookie1 |
216 * @param {!SDK.Cookie} cookie2 | 225 * @param {!SDK.Cookie} cookie2 |
217 */ | 226 */ |
218 function compareTo(property, cookie1, cookie2) { | 227 function compareTo(property, cookie1, cookie2) { |
219 return sortDirection * | 228 return sortDirection * getValue(cookie1, property).compareTo(getValue(cook
ie2, property)); |
220 (String(cookie1[property] || cookie1['name'])).compareTo(String(cookie
2[property] || cookie2['name'])); | |
221 } | 229 } |
222 | 230 |
223 /** | 231 /** |
224 * @param {!SDK.Cookie} cookie1 | 232 * @param {!SDK.Cookie} cookie1 |
225 * @param {!SDK.Cookie} cookie2 | 233 * @param {!SDK.Cookie} cookie2 |
226 */ | 234 */ |
227 function numberCompare(cookie1, cookie2) { | 235 function numberCompare(cookie1, cookie2) { |
228 return sortDirection * (cookie1.size() - cookie2.size()); | 236 return sortDirection * (cookie1.size() - cookie2.size()); |
229 } | 237 } |
230 | 238 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 this._nextSelectedCookie = neighbour.cookie; | 306 this._nextSelectedCookie = neighbour.cookie; |
299 cookie.remove(); | 307 cookie.remove(); |
300 this._refresh(); | 308 this._refresh(); |
301 } | 309 } |
302 | 310 |
303 _refresh() { | 311 _refresh() { |
304 if (this._refreshCallback) | 312 if (this._refreshCallback) |
305 this._refreshCallback(); | 313 this._refreshCallback(); |
306 } | 314 } |
307 }; | 315 }; |
OLD | NEW |