Changeset 92674 in webkit


Ignore:
Timestamp:
Aug 9, 2011 3:39:27 AM (13 years ago)
Author:
vsevik@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92672 r92674  
     12011-08-09  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: Add "Refresh" to context menu of resources panel cookies view.
     4        https://bugs.webkit.org/show_bug.cgi?id=65854
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/CookieItemsView.js:
     9        (WebInspector.CookieItemsView):
     10        (WebInspector.CookieItemsView.prototype._updateWithCookies):
     11        (WebInspector.CookieItemsView.prototype._refreshButtonClicked):
     12        (WebInspector.CookieItemsView.prototype._contextMenu):
     13        * inspector/front-end/CookiesTable.js:
     14        (WebInspector.CookiesTable):
     15        * inspector/front-end/DataGrid.js:
     16        (WebInspector.DataGrid.prototype.get refreshCallback):
     17        (WebInspector.DataGrid.prototype.set refreshCallback):
     18        (WebInspector.DataGrid.prototype._contextMenuInDataTable):
     19        * inspector/front-end/ResourceCookiesView.js:
     20        (WebInspector.ResourceCookiesView.prototype._buildCookiesTable):
     21
    1222011-08-09  Vsevolod Vlasov  <vsevik@chromium.org>
    223
  • trunk/Source/WebCore/inspector/front-end/CookieItemsView.js

    r89577 r92674  
    4646    this._emptyView = new WebInspector.EmptyView(WebInspector.UIString("This site has no cookies."));
    4747    this._emptyView.show(this.element);
     48   
     49    this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
    4850}
    4951
     
    9193
    9294        if (!this._cookiesTable) {
    93             this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this)) : new WebInspector.SimpleCookiesTable();
     95            this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this), this._update.bind(this)) : new WebInspector.SimpleCookiesTable();
    9496            this.element.appendChild(this._cookiesTable.element);
    9597        }
     
    152154    {
    153155        this._update();
     156    },
     157   
     158    _contextMenu: function()
     159    {
     160        if (!this._cookies.length) {
     161            var contextMenu = new WebInspector.ContextMenu();
     162            contextMenu.appendItem(WebInspector.UIString("Refresh"), this._update.bind(this));
     163            contextMenu.show(event);
     164        }
    154165    }
    155166}
  • trunk/Source/WebCore/inspector/front-end/CookiesTable.js

    r72655 r92674  
    2929 */
    3030
    31 WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback)
     31WebInspector.CookiesTable = function(cookieDomain, expandable, deleteCallback, refreshCallback)
    3232{
    3333    this._cookieDomain = cookieDomain;
     
    6565    this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback ? this._onDeleteFromGrid.bind(this) : null);
    6666    this._dataGrid.addEventListener("sorting changed", this._rebuildTable, this);
     67    this._dataGrid.refreshCallback = refreshCallback;
    6768
    6869    this.element = this._dataGrid.element;
  • trunk/Source/WebCore/inspector/front-end/DataGrid.js

    r86855 r92674  
    156156
    157157WebInspector.DataGrid.prototype = {
     158    get refreshCallback()
     159    {
     160        return this._refreshCallback;
     161    },
     162       
     163    set refreshCallback(refreshCallback)
     164    {
     165        this._refreshCallback = refreshCallback;
     166    },
     167   
    158168    _ondblclick: function(event)
    159169    {
     
    879889    _contextMenuInDataTable: function(event)
    880890    {
     891        var contextMenu = new WebInspector.ContextMenu();
     892
    881893        var gridNode = this.dataGridNodeFromNode(event.target);
    882         if (!gridNode || !gridNode.selectable)
    883             return;
    884        
    885         if (gridNode.isEventWithinDisclosureTriangle(event))
    886             return;
    887      
    888         var contextMenu = new WebInspector.ContextMenu();
    889        
    890         // FIXME: Use the column names for Editing, instead of just "Edit".
    891         if (this.dataGrid._editCallback) {
    892             if (gridNode === this.creationNode)
    893                 contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
    894             else
    895                 contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
    896         }
    897         if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
    898             contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
     894        if (this.dataGrid._refreshCallback && (!gridNode || gridNode !== this.creationNode))
     895            contextMenu.appendItem(WebInspector.UIString("Refresh"), this._refreshCallback.bind(this));
     896
     897        if (gridNode && gridNode.selectable && !gridNode.isEventWithinDisclosureTriangle(event)) {
     898            // FIXME: Use the column names for Editing, instead of just "Edit".
     899            if (this.dataGrid._editCallback) {
     900                if (gridNode === this.creationNode)
     901                    contextMenu.appendItem(WebInspector.UIString("Add New"), this._startEditing.bind(this, event.target));
     902                else
     903                    contextMenu.appendItem(WebInspector.UIString("Edit"), this._startEditing.bind(this, event.target));
     904            }
     905            if (this.dataGrid._deleteCallback && gridNode !== this.creationNode)
     906                contextMenu.appendItem(WebInspector.UIString("Delete"), this._deleteCallback.bind(this, gridNode));
     907        }
    899908       
    900909        contextMenu.show(event);
  • trunk/Source/WebCore/inspector/front-end/ResourceCookiesView.js

    r89577 r92674  
    7373        this.element.removeChildren();
    7474
    75         this._cookiesTable = new WebInspector.CookiesTable(null, true, true);
     75        this._cookiesTable = new WebInspector.CookiesTable(null, true);
    7676        this._cookiesTable.addCookiesFolder(WebInspector.UIString("Request Cookies"), this._resource.requestCookies);
    7777        this._cookiesTable.addCookiesFolder(WebInspector.UIString("Response Cookies"), this._resource.responseCookies);
Note: See TracChangeset for help on using the changeset viewer.