Chromium Code Reviews| 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 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 super(Common.UIString('Cookies'), 'cookiesPanel'); | 36 super(Common.UIString('Cookies'), 'cookiesPanel'); |
| 37 | 37 |
| 38 this.element.classList.add('storage-view'); | 38 this.element.classList.add('storage-view'); |
| 39 | 39 |
| 40 this._model = model; | 40 this._model = model; |
| 41 this._cookieDomain = cookieDomain; | 41 this._cookieDomain = cookieDomain; |
| 42 | 42 |
| 43 this._totalSize = 0; | 43 this._totalSize = 0; |
| 44 /** @type {?CookieTable.CookiesTable} */ | 44 /** @type {?CookieTable.CookiesTable} */ |
| 45 this._cookiesTable = null; | 45 this._cookiesTable = null; |
| 46 this._refreshThrottler = new Common.Throttler(300); | |
| 47 /** @type {!Array<!Common.EventTarget.EventDescriptor>} */ | |
| 48 this._eventDescriptors = []; | |
| 46 this.setCookiesDomain(model, cookieDomain); | 49 this.setCookiesDomain(model, cookieDomain); |
| 47 } | 50 } |
| 48 | 51 |
| 49 /** | 52 /** |
| 50 * @param {!SDK.CookieModel} model | 53 * @param {!SDK.CookieModel} model |
| 51 * @param {string} domain | 54 * @param {string} domain |
| 52 */ | 55 */ |
| 53 setCookiesDomain(model, domain) { | 56 setCookiesDomain(model, domain) { |
| 54 this._model = model; | 57 this._model = model; |
| 55 this._cookieDomain = domain; | 58 this._cookieDomain = domain; |
| 56 this.refreshItems(); | 59 this.refreshItems(); |
| 60 Common.EventTarget.removeEventListeners(this._eventDescriptors); | |
| 61 var networkManager = model.target().model(SDK.NetworkManager); | |
| 62 this._eventDescriptors = | |
| 63 [networkManager.addEventListener(SDK.NetworkManager.Events.ResponseRecei ved, () => this._onResponseRecieved())]; | |
|
dgozman
2017/05/11 23:08:41
Ain't this an unrelated change?
eostroukhov
2017/05/12 19:36:36
It just becomes immediately obvious if we are rest
| |
| 57 } | 64 } |
| 58 | 65 |
| 59 /** | 66 /** |
| 60 * @param {!SDK.Cookie} newCookie | 67 * @param {!SDK.Cookie} newCookie |
| 61 * @param {?SDK.Cookie} oldCookie | 68 * @param {?SDK.Cookie} oldCookie |
| 62 * @param {function(?string)} callback | 69 * @param {function(?string)} callback |
| 63 */ | 70 */ |
| 64 _saveCookie(newCookie, oldCookie, callback) { | 71 _saveCookie(newCookie, oldCookie, callback) { |
| 65 if (!this._model) { | 72 if (!this._model) { |
| 66 callback(Common.UIString('Unable to save the cookie')); | 73 callback(Common.UIString('Unable to save the cookie')); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 if (selectedCookie) | 127 if (selectedCookie) |
| 121 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); | 128 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); |
| 122 } | 129 } |
| 123 | 130 |
| 124 /** | 131 /** |
| 125 * @override | 132 * @override |
| 126 */ | 133 */ |
| 127 refreshItems() { | 134 refreshItems() { |
| 128 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies)); | 135 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW ithCookies(cookies)); |
| 129 } | 136 } |
| 137 | |
| 138 _onResponseRecieved() { | |
| 139 this._refreshThrottler.schedule(() => Promise.resolve(this.refreshItems())); | |
| 140 } | |
| 130 }; | 141 }; |
| OLD | NEW |