| 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 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (m_state->getBoolean(ApplicationCacheAgentState::applicationCacheAgentEna
bled)) { | 64 if (m_state->getBoolean(ApplicationCacheAgentState::applicationCacheAgentEna
bled)) { |
| 65 ErrorString error; | 65 ErrorString error; |
| 66 enable(&error); | 66 enable(&error); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void InspectorApplicationCacheAgent::enable(ErrorString*) | 70 void InspectorApplicationCacheAgent::enable(ErrorString*) |
| 71 { | 71 { |
| 72 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled
, true); | 72 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled
, true); |
| 73 m_instrumentingAgents->setInspectorApplicationCacheAgent(this); | 73 m_instrumentingAgents->setInspectorApplicationCacheAgent(this); |
| 74 | 74 m_frontend->networkStateUpdated(networkStateNotifier().onLine()); |
| 75 // We need to pass initial navigator.onOnline. | |
| 76 networkStateChanged(networkStateNotifier().onLine()); | |
| 77 } | 75 } |
| 78 | 76 |
| 79 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(LocalFrame* fr
ame) | 77 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(LocalFrame* fr
ame) |
| 80 { | 78 { |
| 81 DocumentLoader* documentLoader = frame->loader().documentLoader(); | 79 DocumentLoader* documentLoader = frame->loader().documentLoader(); |
| 82 if (!documentLoader) | 80 if (!documentLoader) |
| 83 return; | 81 return; |
| 84 | 82 |
| 85 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 83 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
| 86 ApplicationCacheHost::Status status = host->status(); | 84 ApplicationCacheHost::Status status = host->status(); |
| 87 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 85 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
| 88 | 86 |
| 89 String manifestURL = info.m_manifest.string(); | 87 String manifestURL = info.m_manifest.string(); |
| 90 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif
estURL, static_cast<int>(status)); | 88 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif
estURL, static_cast<int>(status)); |
| 91 } | 89 } |
| 92 | 90 |
| 93 void InspectorApplicationCacheAgent::networkStateChanged(bool online) | 91 void InspectorApplicationCacheAgent::networkStateChanged(LocalFrame* frame, bool
online) |
| 94 { | 92 { |
| 95 m_frontend->networkStateUpdated(online); | 93 if (frame == m_pageAgent->inspectedFrame()) |
| 94 m_frontend->networkStateUpdated(online); |
| 96 } | 95 } |
| 97 | 96 |
| 98 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) | 97 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) |
| 99 { | 98 { |
| 100 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); | 99 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); |
| 101 | 100 |
| 102 LocalFrame* mainFrame = m_pageAgent->mainFrame(); | 101 LocalFrame* inspectedFrame = m_pageAgent->inspectedFrame(); |
| 103 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext(mai
nFrame)) { | 102 for (Frame* frame = inspectedFrame; frame; frame = frame->tree().traverseNex
t(inspectedFrame)) { |
| 104 if (!frame->isLocalFrame()) | 103 if (!frame->isLocalFrame()) |
| 105 continue; | 104 continue; |
| 106 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL
oader(); | 105 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL
oader(); |
| 107 if (!documentLoader) | 106 if (!documentLoader) |
| 108 continue; | 107 continue; |
| 109 | 108 |
| 110 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 109 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
| 111 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 110 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
| 112 String manifestURL = info.m_manifest.string(); | 111 String manifestURL = info.m_manifest.string(); |
| 113 if (!manifestURL.isEmpty()) { | 112 if (!manifestURL.isEmpty()) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 202 } |
| 204 | 203 |
| 205 void InspectorApplicationCacheAgent::trace(Visitor* visitor) | 204 void InspectorApplicationCacheAgent::trace(Visitor* visitor) |
| 206 { | 205 { |
| 207 visitor->trace(m_pageAgent); | 206 visitor->trace(m_pageAgent); |
| 208 InspectorBaseAgent::trace(visitor); | 207 InspectorBaseAgent::trace(visitor); |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace blink | 210 } // namespace blink |
| 212 | 211 |
| OLD | NEW |