| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 , m_documentLoader(documentLoader) | 63 , m_documentLoader(documentLoader) |
| 64 , m_defersEvents(true) | 64 , m_defersEvents(true) |
| 65 { | 65 { |
| 66 ASSERT(m_documentLoader); | 66 ASSERT(m_documentLoader); |
| 67 } | 67 } |
| 68 | 68 |
| 69 ApplicationCacheHost::~ApplicationCacheHost() | 69 ApplicationCacheHost::~ApplicationCacheHost() |
| 70 { | 70 { |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ApplicationCacheHost::maybeLoadMainResource(ResourceRequest& request, Subst
ituteData&) | 73 void ApplicationCacheHost::willStartLoadingMainResource(ResourceRequest& request
) |
| 74 { | 74 { |
| 75 // We defer creating the outer host object to avoid spurious creation/destru
ction | 75 // We defer creating the outer host object to avoid spurious creation/destru
ction |
| 76 // around creating empty documents. At this point, we're initiating a main r
esource | 76 // around creating empty documents. At this point, we're initiating a main r
esource |
| 77 // load for the document, so its for real. | 77 // load for the document, so its for real. |
| 78 | 78 |
| 79 if (!isApplicationCacheEnabled()) | 79 if (!isApplicationCacheEnabled()) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 m_internal = adoptPtr(new ApplicationCacheHostInternal(this)); | 82 m_internal = adoptPtr(new ApplicationCacheHostInternal(this)); |
| 83 if (m_internal->m_outerHost) { | 83 if (m_internal->m_outerHost) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 107 // same resource being loaded, because "foreign" entries are never p
icked | 107 // same resource being loaded, because "foreign" entries are never p
icked |
| 108 // during navigation. | 108 // during navigation. |
| 109 // see WebCore::ApplicationCacheGroup::selectCache() | 109 // see WebCore::ApplicationCacheGroup::selectCache() |
| 110 Frame* frame = m_documentLoader->frame(); | 110 Frame* frame = m_documentLoader->frame(); |
| 111 frame->navigationScheduler()->scheduleLocationChange(frame->document
()->securityOrigin(), | 111 frame->navigationScheduler()->scheduleLocationChange(frame->document
()->securityOrigin(), |
| 112 frame->document()->url(), frame->loader()->referrer()); | 112 frame->document()->url(), frame->loader()->referrer()); |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ApplicationCacheHost::maybeLoadMainResourceForRedirect(ResourceRequest&, Su
bstituteData&) | 117 void ApplicationCacheHost::didReceiveResponseForMainResource(const ResourceRespo
nse& response) |
| 118 { | |
| 119 // N/A to the chromium port | |
| 120 } | |
| 121 | |
| 122 void ApplicationCacheHost::maybeLoadFallbackForMainResponse(const ResourceReques
t&, const ResourceResponse& response) | |
| 123 { | 118 { |
| 124 if (m_internal) { | 119 if (m_internal) { |
| 125 WrappedResourceResponse wrapped(response); | 120 WrappedResourceResponse wrapped(response); |
| 126 m_internal->m_outerHost->didReceiveResponseForMainResource(wrapped); | 121 m_internal->m_outerHost->didReceiveResponseForMainResource(wrapped); |
| 127 } | 122 } |
| 128 } | 123 } |
| 129 | 124 |
| 130 bool ApplicationCacheHost::maybeLoadFallbackForMainError(const ResourceRequest&,
const ResourceError& error) | 125 void ApplicationCacheHost::mainResourceDataReceived(const char* data, int length
) |
| 131 { | |
| 132 // N/A to the chromium port | |
| 133 return false; | |
| 134 } | |
| 135 | |
| 136 void ApplicationCacheHost::mainResourceDataReceived(const char* data, int length
, long long, bool) | |
| 137 { | 126 { |
| 138 if (m_internal) | 127 if (m_internal) |
| 139 m_internal->m_outerHost->didReceiveDataForMainResource(data, length); | 128 m_internal->m_outerHost->didReceiveDataForMainResource(data, length); |
| 140 } | 129 } |
| 141 | 130 |
| 142 void ApplicationCacheHost::failedLoadingMainResource() | 131 void ApplicationCacheHost::failedLoadingMainResource() |
| 143 { | 132 { |
| 144 if (m_internal) | 133 if (m_internal) |
| 145 m_internal->m_outerHost->didFinishLoadingMainResource(false); | 134 m_internal->m_outerHost->didFinishLoadingMainResource(false); |
| 146 } | 135 } |
| 147 | 136 |
| 148 void ApplicationCacheHost::finishedLoadingMainResource() | 137 void ApplicationCacheHost::finishedLoadingMainResource() |
| 149 { | 138 { |
| 150 if (m_internal) | 139 if (m_internal) |
| 151 m_internal->m_outerHost->didFinishLoadingMainResource(true); | 140 m_internal->m_outerHost->didFinishLoadingMainResource(true); |
| 152 } | 141 } |
| 153 | 142 |
| 154 bool ApplicationCacheHost::maybeLoadResource(ResourceLoader*, ResourceRequest& r
equest, const KURL&) | 143 void ApplicationCacheHost::willStartLoadingResource(ResourceRequest& request) |
| 155 { | 144 { |
| 156 // FIXME: look into the purpose of the unused KURL& originalURL parameter | 145 // FIXME: look into the purpose of the unused KURL& originalURL parameter |
| 157 if (m_internal) { | 146 if (m_internal) { |
| 158 WrappedResourceRequest wrapped(request); | 147 WrappedResourceRequest wrapped(request); |
| 159 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); | 148 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); |
| 160 } | 149 } |
| 161 return false; | |
| 162 } | 150 } |
| 163 | 151 |
| 164 bool ApplicationCacheHost::maybeLoadFallbackForRedirect(ResourceLoader*, Resourc
eRequest&, const ResourceResponse&) | 152 void ApplicationCacheHost::willStartLoadingSynchronously(ResourceRequest& reques
t) |
| 165 { | |
| 166 // N/A to the chromium port | |
| 167 return false; | |
| 168 } | |
| 169 | |
| 170 bool ApplicationCacheHost::maybeLoadFallbackForResponse(ResourceLoader*, const R
esourceResponse&) | |
| 171 { | |
| 172 // N/A to the chromium port | |
| 173 return false; | |
| 174 } | |
| 175 | |
| 176 bool ApplicationCacheHost::maybeLoadFallbackForError(ResourceLoader*, const Reso
urceError&) | |
| 177 { | |
| 178 // N/A to the chromium port | |
| 179 return false; | |
| 180 } | |
| 181 | |
| 182 bool ApplicationCacheHost::maybeLoadSynchronously(ResourceRequest& request, Reso
urceError&, ResourceResponse&, Vector<char>&) | |
| 183 { | 153 { |
| 184 if (m_internal) { | 154 if (m_internal) { |
| 185 WrappedResourceRequest wrapped(request); | 155 WrappedResourceRequest wrapped(request); |
| 186 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); | 156 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); |
| 187 } | 157 } |
| 188 return false; | |
| 189 } | |
| 190 | |
| 191 void ApplicationCacheHost::maybeLoadFallbackSynchronously(const ResourceRequest&
, ResourceError&, ResourceResponse&, Vector<char>&) | |
| 192 { | |
| 193 // N/A to the chromium port | |
| 194 } | 158 } |
| 195 | 159 |
| 196 void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
ationCache) | 160 void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
ationCache) |
| 197 { | 161 { |
| 198 ASSERT(!m_domApplicationCache || !domApplicationCache); | 162 ASSERT(!m_domApplicationCache || !domApplicationCache); |
| 199 m_domApplicationCache = domApplicationCache; | 163 m_domApplicationCache = domApplicationCache; |
| 200 } | 164 } |
| 201 | 165 |
| 202 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int
done) | 166 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int
done) |
| 203 { | 167 { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 { | 204 { |
| 241 RefPtr<DocumentLoader> protect(documentLoader()); | 205 RefPtr<DocumentLoader> protect(documentLoader()); |
| 242 for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { | 206 for (unsigned i = 0; i < m_deferredEvents.size(); ++i) { |
| 243 const DeferredEvent& deferred = m_deferredEvents[i]; | 207 const DeferredEvent& deferred = m_deferredEvents[i]; |
| 244 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.prog
ressDone); | 208 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.prog
ressDone); |
| 245 } | 209 } |
| 246 m_deferredEvents.clear(); | 210 m_deferredEvents.clear(); |
| 247 m_defersEvents = false; | 211 m_defersEvents = false; |
| 248 } | 212 } |
| 249 | 213 |
| 250 void ApplicationCacheHost::stopLoadingInFrame(Frame* frame) | |
| 251 { | |
| 252 // N/A to the chromium port | |
| 253 } | |
| 254 | |
| 255 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) | 214 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) |
| 256 { | 215 { |
| 257 if (m_domApplicationCache) { | 216 if (m_domApplicationCache) { |
| 258 const AtomicString& eventType = DOMApplicationCache::toEventType(id); | 217 const AtomicString& eventType = DOMApplicationCache::toEventType(id); |
| 259 ExceptionCode ec = 0; | 218 ExceptionCode ec = 0; |
| 260 RefPtr<Event> event; | 219 RefPtr<Event> event; |
| 261 if (id == PROGRESS_EVENT) | 220 if (id == PROGRESS_EVENT) |
| 262 event = ProgressEvent::create(eventType, true, done, total); | 221 event = ProgressEvent::create(eventType, true, done, total); |
| 263 else | 222 else |
| 264 event = Event::create(eventType, false, false); | 223 event = Event::create(eventType, false, false); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 292 } | 251 } |
| 293 | 252 |
| 294 bool ApplicationCacheHost::isApplicationCacheEnabled() | 253 bool ApplicationCacheHost::isApplicationCacheEnabled() |
| 295 { | 254 { |
| 296 ASSERT(m_documentLoader->frame()); | 255 ASSERT(m_documentLoader->frame()); |
| 297 return m_documentLoader->frame()->settings() | 256 return m_documentLoader->frame()->settings() |
| 298 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheE
nabled(); | 257 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheE
nabled(); |
| 299 } | 258 } |
| 300 | 259 |
| 301 } // namespace WebCore | 260 } // namespace WebCore |
| OLD | NEW |