Commit e4a09265 authored by vsevik@chromium.org's avatar vsevik@chromium.org

Web Inspector: ApplicationCache view should show navigator.onLine indicator.

https://bugs.webkit.org/show_bug.cgi?id=72618

Reviewed by Pavel Feldman.

* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::enable):
* inspector/front-end/ApplicationCacheItemsView.js:
(WebInspector.ApplicationCacheItemsView):
(WebInspector.ApplicationCacheItemsView.prototype.wasShown):
* inspector/front-end/ApplicationCacheModel.js:
(WebInspector.ApplicationCacheModel):
(WebInspector.ApplicationCacheModel.prototype.get onLine):
(WebInspector.ApplicationCacheModel.prototype._networkStateUpdated):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.showApplicationCache):
(WebInspector.ResourcesPanel.prototype._applicationCacheNetworkStateChanged):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 65b2f7e7
2011-11-21 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: ApplicationCache view should show navigator.onLine indicator.
https://bugs.webkit.org/show_bug.cgi?id=72618
Reviewed by Pavel Feldman.
* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::enable):
* inspector/front-end/ApplicationCacheItemsView.js:
(WebInspector.ApplicationCacheItemsView):
(WebInspector.ApplicationCacheItemsView.prototype.wasShown):
* inspector/front-end/ApplicationCacheModel.js:
(WebInspector.ApplicationCacheModel):
(WebInspector.ApplicationCacheModel.prototype.get onLine):
(WebInspector.ApplicationCacheModel.prototype._networkStateUpdated):
* inspector/front-end/ResourcesPanel.js:
(WebInspector.ResourcesPanel.prototype.showApplicationCache):
(WebInspector.ResourcesPanel.prototype._applicationCacheNetworkStateChanged):
2011-11-21 Carlos Garcia Campos <cgarcia@igalia.com> 2011-11-21 Carlos Garcia Campos <cgarcia@igalia.com>
Unreviewed. Fix make distcheck build. Unreviewed. Fix make distcheck build.
...@@ -79,6 +79,9 @@ void InspectorApplicationCacheAgent::enable(ErrorString*) ...@@ -79,6 +79,9 @@ void InspectorApplicationCacheAgent::enable(ErrorString*)
{ {
m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true); m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled, true);
m_instrumentingAgents->setInspectorApplicationCacheAgent(this); m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
// We need to pass initial navigator.onOnline.
networkStateChanged();
} }
void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* @constructor * @constructor
* @extends {WebInspector.View} * @extends {WebInspector.View}
*/ */
WebInspector.ApplicationCacheItemsView = function(model, frameId, status) WebInspector.ApplicationCacheItemsView = function(model, frameId)
{ {
WebInspector.View.call(this); WebInspector.View.call(this);
...@@ -64,15 +64,15 @@ WebInspector.ApplicationCacheItemsView = function(model, frameId, status) ...@@ -64,15 +64,15 @@ WebInspector.ApplicationCacheItemsView = function(model, frameId, status)
this._emptyView.show(this.element); this._emptyView.show(this.element);
this._markDirty(); this._markDirty();
var status = this._model.frameManifestStatus(frameId);
this.updateStatus(status); this.updateStatus(status);
this.updateNetworkState(this._model.onLine);
// FIXME: Status bar items don't work well enough yet, so they are being hidden. // FIXME: Status bar items don't work well enough yet, so they are being hidden.
// http://webkit.org/b/41637 Web Inspector: Give Semantics to "Refresh" and "Delete" Buttons in ApplicationCache DataGrid // http://webkit.org/b/41637 Web Inspector: Give Semantics to "Refresh" and "Delete" Buttons in ApplicationCache DataGrid
// http://webkit.org/b/72618 Web Inspector: ApplicationCache view should show navigator.onLine indicator.
this.deleteButton.element.style.display = "none"; this.deleteButton.element.style.display = "none";
this.connectivityIcon.style.display = "none";
this.connectivityMessage.style.display = "none";
this.divider.style.display = "none";
} }
WebInspector.ApplicationCacheItemsView.prototype = { WebInspector.ApplicationCacheItemsView.prototype = {
...@@ -87,7 +87,6 @@ WebInspector.ApplicationCacheItemsView.prototype = { ...@@ -87,7 +87,6 @@ WebInspector.ApplicationCacheItemsView.prototype = {
wasShown: function() wasShown: function()
{ {
this.updateNetworkState(navigator.onLine);
this._maybeUpdate(); this._maybeUpdate();
}, },
......
...@@ -42,6 +42,8 @@ WebInspector.ApplicationCacheModel = function() ...@@ -42,6 +42,8 @@ WebInspector.ApplicationCacheModel = function()
this._manifestURLsByFrame = {}; this._manifestURLsByFrame = {};
this._mainFrameNavigated(); this._mainFrameNavigated();
this._onLine = true;
} }
WebInspector.ApplicationCacheModel.EventTypes = { WebInspector.ApplicationCacheModel.EventTypes = {
...@@ -169,6 +171,14 @@ WebInspector.ApplicationCacheModel.prototype = { ...@@ -169,6 +171,14 @@ WebInspector.ApplicationCacheModel.prototype = {
return this._statuses[frameId] || applicationCache.UNCACHED; return this._statuses[frameId] || applicationCache.UNCACHED;
}, },
/**
* @return {number}
*/
get onLine()
{
return this._onLine;
},
/** /**
* @param {string} frameId * @param {string} frameId
* @param {string} manifestURL * @param {string} manifestURL
...@@ -204,6 +214,7 @@ WebInspector.ApplicationCacheModel.prototype = { ...@@ -204,6 +214,7 @@ WebInspector.ApplicationCacheModel.prototype = {
*/ */
_networkStateUpdated: function(isNowOnline) _networkStateUpdated: function(isNowOnline)
{ {
this._onLine = isNowOnline;
this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, isNowOnline); this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, isNowOnline);
} }
} }
......
...@@ -479,15 +479,8 @@ WebInspector.ResourcesPanel.prototype = { ...@@ -479,15 +479,8 @@ WebInspector.ResourcesPanel.prototype = {
showApplicationCache: function(frameId) showApplicationCache: function(frameId)
{ {
var status = this._applicationCacheModel.frameManifestStatus(frameId) if (!this._applicationCacheViews[frameId])
this._applicationCacheViews[frameId] = new WebInspector.ApplicationCacheItemsView(this._applicationCacheModel, frameId);
if (!this._applicationCacheViews[frameId]) {
this._applicationCacheViews[frameId] = new WebInspector.ApplicationCacheItemsView(this._applicationCacheModel, frameId, status);
// FIXME: Make sure this._cachedApplicationCacheNetworkState is always set and is always up to date.
if (typeof(this._cachedApplicationCacheNetworkState) === "number")
this._applicationCacheViews[frameId].updateNetworkState(this._cachedApplicationCacheNetworkState);
}
this._innerShowView(this._applicationCacheViews[frameId]); this._innerShowView(this._applicationCacheViews[frameId]);
}, },
...@@ -631,7 +624,6 @@ WebInspector.ResourcesPanel.prototype = { ...@@ -631,7 +624,6 @@ WebInspector.ResourcesPanel.prototype = {
{ {
var isNowOnline = event.data; var isNowOnline = event.data;
this._cachedApplicationCacheNetworkState = isNowOnline;
for (var manifestURL in this._applicationCacheViews) for (var manifestURL in this._applicationCacheViews)
this._applicationCacheViews[manifestURL].updateNetworkState(isNowOnline); this._applicationCacheViews[manifestURL].updateNetworkState(isNowOnline);
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment