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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 { | 73 { |
74 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled
, true); | 74 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled
, true); |
75 m_instrumentingAgents->setInspectorApplicationCacheAgent(this); | 75 m_instrumentingAgents->setInspectorApplicationCacheAgent(this); |
76 | 76 |
77 // We need to pass initial navigator.onOnline. | 77 // We need to pass initial navigator.onOnline. |
78 networkStateChanged(networkStateNotifier().onLine()); | 78 networkStateChanged(networkStateNotifier().onLine()); |
79 } | 79 } |
80 | 80 |
81 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) | 81 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(Frame* frame) |
82 { | 82 { |
83 DocumentLoader* documentLoader = frame->loader()->documentLoader(); | 83 DocumentLoader* documentLoader = frame->loader().documentLoader(); |
84 if (!documentLoader) | 84 if (!documentLoader) |
85 return; | 85 return; |
86 | 86 |
87 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 87 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
88 ApplicationCacheHost::Status status = host->status(); | 88 ApplicationCacheHost::Status status = host->status(); |
89 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 89 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
90 | 90 |
91 String manifestURL = info.m_manifest.string(); | 91 String manifestURL = info.m_manifest.string(); |
92 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif
estURL, static_cast<int>(status)); | 92 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif
estURL, static_cast<int>(status)); |
93 } | 93 } |
94 | 94 |
95 void InspectorApplicationCacheAgent::networkStateChanged(bool online) | 95 void InspectorApplicationCacheAgent::networkStateChanged(bool online) |
96 { | 96 { |
97 m_frontend->networkStateUpdated(online); | 97 m_frontend->networkStateUpdated(online); |
98 } | 98 } |
99 | 99 |
100 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) | 100 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr
<TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) |
101 { | 101 { |
102 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); | 102 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest
>::create(); |
103 | 103 |
104 Frame* mainFrame = m_pageAgent->mainFrame(); | 104 Frame* mainFrame = m_pageAgent->mainFrame(); |
105 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext(mai
nFrame)) { | 105 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext(mai
nFrame)) { |
106 DocumentLoader* documentLoader = frame->loader()->documentLoader(); | 106 DocumentLoader* documentLoader = frame->loader().documentLoader(); |
107 if (!documentLoader) | 107 if (!documentLoader) |
108 continue; | 108 continue; |
109 | 109 |
110 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); | 110 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); |
111 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); | 111 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); |
112 String manifestURL = info.m_manifest.string(); | 112 String manifestURL = info.m_manifest.string(); |
113 if (!manifestURL.isEmpty()) { | 113 if (!manifestURL.isEmpty()) { |
114 RefPtr<TypeBuilder::ApplicationCache::FrameWithManifest> value = Typ
eBuilder::ApplicationCache::FrameWithManifest::create() | 114 RefPtr<TypeBuilder::ApplicationCache::FrameWithManifest> value = Typ
eBuilder::ApplicationCache::FrameWithManifest::create() |
115 .setFrameId(m_pageAgent->frameId(frame)) | 115 .setFrameId(m_pageAgent->frameId(frame)) |
116 .setManifestURL(manifestURL) | 116 .setManifestURL(manifestURL) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 RefPtr<TypeBuilder::ApplicationCache::ApplicationCacheResource> value = Type
Builder::ApplicationCache::ApplicationCacheResource::create() | 198 RefPtr<TypeBuilder::ApplicationCache::ApplicationCacheResource> value = Type
Builder::ApplicationCache::ApplicationCacheResource::create() |
199 .setUrl(resourceInfo.m_resource.string()) | 199 .setUrl(resourceInfo.m_resource.string()) |
200 .setSize(static_cast<int>(resourceInfo.m_size)) | 200 .setSize(static_cast<int>(resourceInfo.m_size)) |
201 .setType(builder.toString()); | 201 .setType(builder.toString()); |
202 return value; | 202 return value; |
203 } | 203 } |
204 | 204 |
205 } // namespace WebCore | 205 } // namespace WebCore |
206 | 206 |
OLD | NEW |