Title: [92674] trunk/Source/WebCore
Revision
92674
Author
vse...@chromium.org
Date
2011-08-09 03:39:27 -0700 (Tue, 09 Aug 2011)

Log Message

Web Inspector: Add "Refresh" to context menu of resources panel cookies view.
https://bugs.webkit.org/show_bug.cgi?id=65854

Reviewed by Pavel Feldman.

* inspector/front-end/CookieItemsView.js:
(WebInspector.CookieItemsView):
(WebInspector.CookieItemsView.prototype._updateWithCookies):
(WebInspector.CookieItemsView.prototype._refreshButtonClicked):
(WebInspector.CookieItemsView.prototype._contextMenu):
* inspector/front-end/CookiesTable.js:
(WebInspector.CookiesTable):
* inspector/front-end/DataGrid.js:
(WebInspector.DataGrid.prototype.get refreshCallback):
(WebInspector.DataGrid.prototype.set refreshCallback):
(WebInspector.DataGrid.prototype._contextMenuInDataTable):
* inspector/front-end/ResourceCookiesView.js:
(WebInspector.ResourceCookiesView.prototype._buildCookiesTable):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92673 => 92674)


--- trunk/Source/WebCore/ChangeLog	2011-08-09 10:34:54 UTC (rev 92673)
+++ trunk/Source/WebCore/ChangeLog	2011-08-09 10:39:27 UTC (rev 92674)
@@ -1,5 +1,26 @@
 2011-08-09  Vsevolod Vlasov  <vse...@chromium.org>
 
+        Web Inspector: Add "Refresh" to context menu of resources panel cookies view.
+        https://bugs.webkit.org/show_bug.cgi?id=65854
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/CookieItemsView.js:
+        (WebInspector.CookieItemsView):
+        (WebInspector.CookieItemsView.prototype._updateWithCookies):
+        (WebInspector.CookieItemsView.prototype._refreshButtonClicked):
+        (WebInspector.CookieItemsView.prototype._contextMenu):
+        * inspector/front-end/CookiesTable.js:
+        (WebInspector.CookiesTable):
+        * inspector/front-end/DataGrid.js:
+        (WebInspector.DataGrid.prototype.get refreshCallback):
+        (WebInspector.DataGrid.prototype.set refreshCallback):
+        (WebInspector.DataGrid.prototype._contextMenuInDataTable):
+        * inspector/front-end/ResourceCookiesView.js:
+        (WebInspector.ResourceCookiesView.prototype._buildCookiesTable):
+
+2011-08-09  Vsevolod Vlasov  <vse...@chromium.org>
+
         Web Inspector: Resources panel does not show main resource cookies.
         https://bugs.webkit.org/show_bug.cgi?id=65770
 

Modified: trunk/Source/WebCore/inspector/front-end/CookieItemsView.js (92673 => 92674)


--- trunk/Source/WebCore/inspector/front-end/CookieItemsView.js	2011-08-09 10:34:54 UTC (rev 92673)
+++ trunk/Source/WebCore/inspector/front-end/CookieItemsView.js	2011-08-09 10:39:27 UTC (rev 92674)
@@ -45,6 +45,8 @@
 
     this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("This site has no cookies."));
     this._emptyView.show(this.element);
+    
+    this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
 }
 
 WebInspector.CookieItemsView.prototype = {
@@ -90,7 +92,7 @@
         }
 
         if (!this._cookiesTable) {
-            this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this)) : new WebInspector.SimpleCookiesTable();
+            this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this), this._update.bind(this)) : new WebInspector.SimpleCookiesTable();
             this.element.appendChild(this._cookiesTable.element);
         }
 
@@ -151,6 +153,15 @@
     _refreshButtonClicked: function(event)
     {
         this._update();
+    },
+    
+    _contextMenu: function()
+    {
+        if (!this._cookies.length) {
+            var contextMenu = new WebInspector.ContextMenu();
+            contextMenu.appendItem(WebInspector.UIString("Refresh"), this._update.bind(this));
+            contextMenu.show(event);
+        }
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/CookiesTable.js (92673 => 92674)


--- trunk/Source/WebCore/inspector/front-end/CookiesTable.js	2011-08-09 10:34:54 UTC (rev 92673)
+++ trunk/Source/WebCore/inspector/front-end/CookiesTable.js	2011-08-09 10:39:27 UTC (rev 92674)
@@ -28,7 +28,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback)
+WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback, refreshCallback)
 {
     this._cookieDomain = cookieDomain;
 
@@ -64,6 +64,7 @@
 
     this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback ? this._onDeleteFromGrid.bind(this) : null);
     this._dataGrid.addEventListener("sorting changed", this._rebuildTable, this);
+    this._dataGrid.refreshCallback = refreshCallback;
 
     this.element = this._dataGrid.element;
     this._data = [];

Modified: trunk/Source/WebCore/inspector/front-end/DataGrid.js (92673 => 92674)


--- trunk/Source/WebCore/inspector/front-end/DataGrid.js	2011-08-09 10:34:54 UTC (rev 92673)
+++ trunk/Source/WebCore/inspector/front-end/DataGrid.js	2011-08-09 10:39:27 UTC (rev 92674)
@@ -155,6 +155,16 @@
 }
 
 WebInspector.DataGrid.prototype = {
+    get refreshCallback()
+    {
+        return this._refreshCallback;
+    },
+        
+    set refreshCallback(refreshCallback)
+    {
+        this._refreshCallback = refreshCallback;
+    },
+    
     _ondblclick: function(event)
     {
         if (this._editing || this._editingNode)
@@ -878,24 +888,23 @@
     
     _contextMenuInDataTable: function(event)
     {
+        var contextMenu = new WebInspector.ContextMenu();
+
         var gridNode = this.dataGridNodeFromNode(event.target);
-        if (!gridNode || !gridNode.selectable)
-            return;
-        
-        if (gridNode.isEventWithinDisclosureTriangle(event))
-            return;
-      
-        var contextMenu = new WebInspector.ContextMenu();
-        
-        // FIXME: Use the column names for Editing, instead of just "Edit".
-        if (this.dataGrid._editCallback) {
-            if (gridNode === this.creationNode)
-                contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
-            else
-                contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
+        if (this.dataGrid._refreshCallback && (!gridNode || gridNode !== this.creationNode))
+            contextMenu.appendItem(WebInspector.UIString("Refresh"), this._refreshCallback.bind(this));
+
+        if (gridNode && gridNode.selectable && !gridNode.isEventWithinDisclosureTriangle(event)) {
+            // FIXME: Use the column names for Editing, instead of just "Edit".
+            if (this.dataGrid._editCallback) {
+                if (gridNode === this.creationNode)
+                    contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
+                else
+                    contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
+            }
+            if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
+                contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
         }
-        if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
-            contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
         
         contextMenu.show(event);
     },

Modified: trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js (92673 => 92674)


--- trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js	2011-08-09 10:34:54 UTC (rev 92673)
+++ trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js	2011-08-09 10:39:27 UTC (rev 92674)
@@ -72,7 +72,7 @@
     {
         this.element.removeChildren();
 
-        this._cookiesTable = new WebInspector.CookiesTable(null, true, true);
+        this._cookiesTable = new WebInspector.CookiesTable(null, true);
         this._cookiesTable.addCookiesFolder(WebInspector.UIString("Request Cookies"), this._resource.requestCookies);
         this._cookiesTable.addCookiesFolder(WebInspector.UIString("Response Cookies"), this._resource.responseCookies);
         this.element.appendChild(this._cookiesTable.element);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to