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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 this._model.deleteCookie(cookie, callback); | 81 this._model.deleteCookie(cookie, callback); |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * @param {!Array.<!SDK.Cookie>} allCookies | 85 * @param {!Array.<!SDK.Cookie>} allCookies |
86 */ | 86 */ |
87 _updateWithCookies(allCookies) { | 87 _updateWithCookies(allCookies) { |
88 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(),
0); | 88 this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(),
0); |
89 | 89 |
90 if (!this._cookiesTable) { | 90 if (!this._cookiesTable) { |
91 const parsedURL = this._cookieDomain.asParsedURL(); | |
92 const domain = parsedURL ? parsedURL.host : ''; | |
93 this._cookiesTable = new CookieTable.CookiesTable( | 91 this._cookiesTable = new CookieTable.CookiesTable( |
94 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this.
setCanDeleteSelected(true), | 92 this._saveCookie.bind(this), this.refreshItems.bind(this), () => this.
setCanDeleteSelected(true), |
95 this._deleteCookie.bind(this), domain); | 93 this._deleteCookie.bind(this)); |
96 } | 94 } |
97 | 95 |
| 96 const parsedURL = this._cookieDomain.asParsedURL(); |
| 97 const host = parsedURL ? parsedURL.host : ''; |
| 98 this._cookiesTable.setCookieDomain(host); |
| 99 |
98 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo
kie.value()} ${cookie.domain()}`); | 100 var shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${coo
kie.value()} ${cookie.domain()}`); |
99 this._cookiesTable.setCookies(shownCookies); | 101 this._cookiesTable.setCookies(shownCookies); |
100 this._cookiesTable.show(this.element); | 102 this._cookiesTable.show(this.element); |
101 this.setCanFilter(true); | 103 this.setCanFilter(true); |
102 this.setCanDeleteAll(true); | 104 this.setCanDeleteAll(true); |
103 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie()); | 105 this.setCanDeleteSelected(!!this._cookiesTable.selectedCookie()); |
104 } | 106 } |
105 | 107 |
106 /** | 108 /** |
107 * @override | 109 * @override |
(...skipping 11 matching lines...) Expand all Loading... |
119 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); | 121 this._model.deleteCookie(selectedCookie, () => this.refreshItems()); |
120 } | 122 } |
121 | 123 |
122 /** | 124 /** |
123 * @override | 125 * @override |
124 */ | 126 */ |
125 refreshItems() { | 127 refreshItems() { |
126 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW
ithCookies(cookies)); | 128 this._model.getCookiesForDomain(this._cookieDomain, cookies => this._updateW
ithCookies(cookies)); |
127 } | 129 } |
128 }; | 130 }; |
OLD | NEW |