| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 17 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/inspector/InspectorApplicationCacheAgent.h" | 27 #include "core/inspector/InspectorApplicationCacheAgent.h" |
| 28 | 28 |
| 29 #include "core/frame/LocalFrame.h" | 29 #include "core/frame/LocalFrame.h" |
| 30 #include "core/inspector/InspectorIdentifiers.h" |
| 30 #include "core/inspector/InspectorPageAgent.h" | 31 #include "core/inspector/InspectorPageAgent.h" |
| 31 #include "core/inspector/InspectorState.h" | 32 #include "core/inspector/InspectorState.h" |
| 32 #include "core/inspector/InstrumentingAgents.h" | 33 #include "core/inspector/InstrumentingAgents.h" |
| 33 #include "core/loader/DocumentLoader.h" | 34 #include "core/loader/DocumentLoader.h" |
| 34 #include "core/loader/FrameLoader.h" | 35 #include "core/loader/FrameLoader.h" |
| 35 #include "core/page/NetworkStateNotifier.h" | 36 #include "core/page/NetworkStateNotifier.h" |
| 36 #include "wtf/text/StringBuilder.h" | 37 #include "wtf/text/StringBuilder.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 { | 73 { |
| 73 DocumentLoader* documentLoader = frame->loader().documentLoader(); | 74 DocumentLoader* documentLoader = frame->loader().documentLoader(); |
| 74 if (!documentLoader) | 75 if (!documentLoader) |
| 75 return; | 76 return; |
| 76 | 77 |
| 77 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 78 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
| 78 ApplicationCacheHost::Status status = host->status(); | 79 ApplicationCacheHost::Status status = host->status(); |
| 79 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 80 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
| 80 | 81 |
| 81 String manifestURL = info.m_manifest.string(); | 82 String manifestURL = info.m_manifest.string(); |
| 82 frontend()->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif
estURL, static_cast<int>(status)); | 83 String frameId = InspectorIdentifiers<LocalFrame>::identifier(frame); |
| 84 frontend()->applicationCacheStatusUpdated(frameId, manifestURL, static_cast<
int>(status)); |
| 83 } | 85 } |
| 84 | 86 |
| 85 void InspectorApplicationCacheAgent::networkStateChanged(LocalFrame* frame, bool
online) | 87 void InspectorApplicationCacheAgent::networkStateChanged(LocalFrame* frame, bool
online) |
| 86 { | 88 { |
| 87 if (frame == m_pageAgent->inspectedFrame()) | 89 if (frame == m_pageAgent->inspectedFrame()) |
| 88 frontend()->networkStateUpdated(online); | 90 frontend()->networkStateUpdated(online); |
| 89 } | 91 } |
| 90 | 92 |
| 91 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) | 93 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) |
| 92 { | 94 { |
| 93 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); | 95 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); |
| 94 | 96 |
| 95 LocalFrame* inspectedFrame = m_pageAgent->inspectedFrame(); | 97 LocalFrame* inspectedFrame = m_pageAgent->inspectedFrame(); |
| 96 for (Frame* frame = inspectedFrame; frame; frame = frame->tree().traverseNex
t(inspectedFrame)) { | 98 for (Frame* frame = inspectedFrame; frame; frame = frame->tree().traverseNex
t(inspectedFrame)) { |
| 97 if (!frame->isLocalFrame()) | 99 if (!frame->isLocalFrame()) |
| 98 continue; | 100 continue; |
| 99 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL
oader(); | 101 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL
oader(); |
| 100 if (!documentLoader) | 102 if (!documentLoader) |
| 101 continue; | 103 continue; |
| 102 | 104 |
| 103 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 105 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
| 104 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 106 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
| 105 String manifestURL = info.m_manifest.string(); | 107 String manifestURL = info.m_manifest.string(); |
| 106 if (!manifestURL.isEmpty()) { | 108 if (!manifestURL.isEmpty()) { |
| 107 RefPtr<TypeBuilder::ApplicationCache::FrameWithManifest> value = Typ
eBuilder::ApplicationCache::FrameWithManifest::create() | 109 RefPtr<TypeBuilder::ApplicationCache::FrameWithManifest> value = Typ
eBuilder::ApplicationCache::FrameWithManifest::create() |
| 108 .setFrameId(m_pageAgent->frameId(toLocalFrame(frame))) | 110 .setFrameId(InspectorIdentifiers<LocalFrame>::identifier(toLocal
Frame(frame))) |
| 109 .setManifestURL(manifestURL) | 111 .setManifestURL(manifestURL) |
| 110 .setStatus(static_cast<int>(host->status())); | 112 .setStatus(static_cast<int>(host->status())); |
| 111 result->addItem(value); | 113 result->addItem(value); |
| 112 } | 114 } |
| 113 } | 115 } |
| 114 } | 116 } |
| 115 | 117 |
| 116 DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(Er
rorString* errorString, String frameId) | 118 DocumentLoader* InspectorApplicationCacheAgent::assertFrameWithDocumentLoader(Er
rorString* errorString, String frameId) |
| 117 { | 119 { |
| 118 LocalFrame* frame = m_pageAgent->assertFrame(errorString, frameId); | 120 LocalFrame* frame = m_pageAgent->assertFrame(errorString, frameId); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 198 } |
| 197 | 199 |
| 198 DEFINE_TRACE(InspectorApplicationCacheAgent) | 200 DEFINE_TRACE(InspectorApplicationCacheAgent) |
| 199 { | 201 { |
| 200 visitor->trace(m_pageAgent); | 202 visitor->trace(m_pageAgent); |
| 201 InspectorBaseAgent::trace(visitor); | 203 InspectorBaseAgent::trace(visitor); |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace blink | 206 } // namespace blink |
| 205 | 207 |
| OLD | NEW |