| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 this._clearButton = new WebInspector.ToolbarButton(WebInspector.UIString("Cl
ear"), "clear-toolbar-item"); | 44 this._clearButton = new WebInspector.ToolbarButton(WebInspector.UIString("Cl
ear"), "clear-toolbar-item"); |
| 45 this._clearButton.setVisible(false); | 45 this._clearButton.setVisible(false); |
| 46 this._clearButton.addEventListener("click", this._clearButtonClicked, this); | 46 this._clearButton.addEventListener("click", this._clearButtonClicked, this); |
| 47 | 47 |
| 48 this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Refresh"), "refresh-toolbar-item"); | 48 this._refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Refresh"), "refresh-toolbar-item"); |
| 49 this._refreshButton.addEventListener("click", this._refreshButtonClicked, th
is); | 49 this._refreshButton.addEventListener("click", this._refreshButtonClicked, th
is); |
| 50 | 50 |
| 51 this._treeElement = treeElement; | 51 this._treeElement = treeElement; |
| 52 this._cookieDomain = cookieDomain; | 52 this._cookieDomain = cookieDomain; |
| 53 | 53 |
| 54 this._emptyView = new WebInspector.EmptyView(cookieDomain ? WebInspector.UIS
tring("This site has no cookies.") : WebInspector.UIString("By default cookies a
re disabled for local files.\nYou could override this by starting the browser wi
th --enable-file-cookies command line flag.")); | 54 this._emptyWidget = new WebInspector.EmptyWidget(cookieDomain ? WebInspector
.UIString("This site has no cookies.") : WebInspector.UIString("By default cooki
es are disabled for local files.\nYou could override this by starting the browse
r with --enable-file-cookies command line flag.")); |
| 55 this._emptyView.show(this.element); | 55 this._emptyWidget.show(this.element); |
| 56 | 56 |
| 57 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), t
rue); | 57 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), t
rue); |
| 58 } | 58 } |
| 59 | 59 |
| 60 WebInspector.CookieItemsView.prototype = { | 60 WebInspector.CookieItemsView.prototype = { |
| 61 /** | 61 /** |
| 62 * @return {!Array.<!WebInspector.ToolbarItem>} | 62 * @return {!Array.<!WebInspector.ToolbarItem>} |
| 63 */ | 63 */ |
| 64 toolbarItems: function() | 64 toolbarItems: function() |
| 65 { | 65 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * @param {!Array.<!WebInspector.Cookie>} allCookies | 85 * @param {!Array.<!WebInspector.Cookie>} allCookies |
| 86 */ | 86 */ |
| 87 _updateWithCookies: function(allCookies) | 87 _updateWithCookies: function(allCookies) |
| 88 { | 88 { |
| 89 this._cookies = this._filterCookiesForDomain(allCookies); | 89 this._cookies = this._filterCookiesForDomain(allCookies); |
| 90 | 90 |
| 91 if (!this._cookies.length) { | 91 if (!this._cookies.length) { |
| 92 // Nothing to show. | 92 // Nothing to show. |
| 93 this._emptyView.show(this.element); | 93 this._emptyWidget.show(this.element); |
| 94 this._clearButton.setVisible(false); | 94 this._clearButton.setVisible(false); |
| 95 this._deleteButton.setVisible(false); | 95 this._deleteButton.setVisible(false); |
| 96 if (this._cookiesTable) | 96 if (this._cookiesTable) |
| 97 this._cookiesTable.detach(); | 97 this._cookiesTable.detach(); |
| 98 return; | 98 return; |
| 99 } | 99 } |
| 100 | 100 |
| 101 if (!this._cookiesTable) | 101 if (!this._cookiesTable) |
| 102 this._cookiesTable = new WebInspector.CookiesTable(false, this._upda
te.bind(this), this._showDeleteButton.bind(this)); | 102 this._cookiesTable = new WebInspector.CookiesTable(false, this._upda
te.bind(this), this._showDeleteButton.bind(this)); |
| 103 | 103 |
| 104 this._cookiesTable.setCookies(this._cookies); | 104 this._cookiesTable.setCookies(this._cookies); |
| 105 this._emptyView.detach(); | 105 this._emptyWidget.detach(); |
| 106 this._cookiesTable.show(this.element); | 106 this._cookiesTable.show(this.element); |
| 107 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d co
okies (%s)"), this._cookies.length, | 107 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d co
okies (%s)"), this._cookies.length, |
| 108 Number.bytesToString(this._totalSize)); | 108 Number.bytesToString(this._totalSize)); |
| 109 this._clearButton.setVisible(true); | 109 this._clearButton.setVisible(true); |
| 110 this._deleteButton.setVisible(!!this._cookiesTable.selectedCookie()); | 110 this._deleteButton.setVisible(!!this._cookiesTable.selectedCookie()); |
| 111 }, | 111 }, |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * @param {!Array.<!WebInspector.Cookie>} allCookies | 114 * @param {!Array.<!WebInspector.Cookie>} allCookies |
| 115 */ | 115 */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 { | 181 { |
| 182 if (!this._cookies.length) { | 182 if (!this._cookies.length) { |
| 183 var contextMenu = new WebInspector.ContextMenu(event); | 183 var contextMenu = new WebInspector.ContextMenu(event); |
| 184 contextMenu.appendItem(WebInspector.UIString("Refresh"), this._updat
e.bind(this)); | 184 contextMenu.appendItem(WebInspector.UIString("Refresh"), this._updat
e.bind(this)); |
| 185 contextMenu.show(); | 185 contextMenu.show(); |
| 186 } | 186 } |
| 187 }, | 187 }, |
| 188 | 188 |
| 189 __proto__: WebInspector.VBox.prototype | 189 __proto__: WebInspector.VBox.prototype |
| 190 } | 190 } |
| OLD | NEW |