| 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 25 matching lines...) Expand all Loading... |
| 36 #include "public/platform/WebURLResponse.h" | 36 #include "public/platform/WebURLResponse.h" |
| 37 #include "public/platform/WebVector.h" | 37 #include "public/platform/WebVector.h" |
| 38 #include "ApplicationCacheHostInternal.h" | 38 #include "ApplicationCacheHostInternal.h" |
| 39 #include "WebFrameImpl.h" | 39 #include "WebFrameImpl.h" |
| 40 #include "bindings/v8/ExceptionStatePlaceholder.h" | 40 #include "bindings/v8/ExceptionStatePlaceholder.h" |
| 41 #include "core/dom/ProgressEvent.h" | 41 #include "core/dom/ProgressEvent.h" |
| 42 #include "core/inspector/InspectorApplicationCacheAgent.h" | 42 #include "core/inspector/InspectorApplicationCacheAgent.h" |
| 43 #include "core/inspector/InspectorInstrumentation.h" | 43 #include "core/inspector/InspectorInstrumentation.h" |
| 44 #include "core/loader/DocumentLoader.h" | 44 #include "core/loader/DocumentLoader.h" |
| 45 #include "core/loader/FrameLoader.h" | 45 #include "core/loader/FrameLoader.h" |
| 46 #include "core/loader/appcache/DOMApplicationCache.h" | 46 #include "core/loader/appcache/ApplicationCache.h" |
| 47 #include "core/page/Frame.h" | 47 #include "core/page/Frame.h" |
| 48 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
| 49 #include "core/page/Settings.h" | 49 #include "core/page/Settings.h" |
| 50 #include "core/platform/chromium/support/WrappedResourceRequest.h" | 50 #include "core/platform/chromium/support/WrappedResourceRequest.h" |
| 51 #include "core/platform/chromium/support/WrappedResourceResponse.h" | 51 #include "core/platform/chromium/support/WrappedResourceResponse.h" |
| 52 #include "weborigin/SecurityOrigin.h" | 52 #include "weborigin/SecurityOrigin.h" |
| 53 | 53 |
| 54 using namespace WebKit; | 54 using namespace WebKit; |
| 55 | 55 |
| 56 namespace WebCore { | 56 namespace WebCore { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 void ApplicationCacheHost::willStartLoadingSynchronously(ResourceRequest& reques
t) | 153 void ApplicationCacheHost::willStartLoadingSynchronously(ResourceRequest& reques
t) |
| 154 { | 154 { |
| 155 if (m_internal) { | 155 if (m_internal) { |
| 156 WrappedResourceRequest wrapped(request); | 156 WrappedResourceRequest wrapped(request); |
| 157 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); | 157 m_internal->m_outerHost->willStartSubResourceRequest(wrapped); |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplic
ationCache) | 161 void ApplicationCacheHost::setApplicationCache(ApplicationCache* domApplicationC
ache) |
| 162 { | 162 { |
| 163 ASSERT(!m_domApplicationCache || !domApplicationCache); | 163 ASSERT(!m_domApplicationCache || !domApplicationCache); |
| 164 m_domApplicationCache = domApplicationCache; | 164 m_domApplicationCache = domApplicationCache; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id, int total, int
done) | 167 void ApplicationCacheHost::notifyApplicationCache(EventID id, int total, int don
e) |
| 168 { | 168 { |
| 169 if (id != PROGRESS_EVENT) | 169 if (id != PROGRESS_EVENT) |
| 170 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader-
>frame()); | 170 InspectorInstrumentation::updateApplicationCacheStatus(m_documentLoader-
>frame()); |
| 171 | 171 |
| 172 if (m_defersEvents) { | 172 if (m_defersEvents) { |
| 173 // Event dispatching is deferred until document.onload has fired. | 173 // Event dispatching is deferred until document.onload has fired. |
| 174 m_deferredEvents.append(DeferredEvent(id, total, done)); | 174 m_deferredEvents.append(DeferredEvent(id, total, done)); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 dispatchDOMEvent(id, total, done); | 177 dispatchDOMEvent(id, total, done); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 208 const DeferredEvent& deferred = m_deferredEvents[i]; | 208 const DeferredEvent& deferred = m_deferredEvents[i]; |
| 209 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.prog
ressDone); | 209 dispatchDOMEvent(deferred.eventID, deferred.progressTotal, deferred.prog
ressDone); |
| 210 } | 210 } |
| 211 m_deferredEvents.clear(); | 211 m_deferredEvents.clear(); |
| 212 m_defersEvents = false; | 212 m_defersEvents = false; |
| 213 } | 213 } |
| 214 | 214 |
| 215 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) | 215 void ApplicationCacheHost::dispatchDOMEvent(EventID id, int total, int done) |
| 216 { | 216 { |
| 217 if (m_domApplicationCache) { | 217 if (m_domApplicationCache) { |
| 218 const AtomicString& eventType = DOMApplicationCache::toEventType(id); | 218 const AtomicString& eventType = ApplicationCache::toEventType(id); |
| 219 RefPtr<Event> event; | 219 RefPtr<Event> event; |
| 220 if (id == PROGRESS_EVENT) | 220 if (id == PROGRESS_EVENT) |
| 221 event = ProgressEvent::create(eventType, true, done, total); | 221 event = ProgressEvent::create(eventType, true, done, total); |
| 222 else | 222 else |
| 223 event = Event::create(eventType, false, false); | 223 event = Event::create(eventType, false, false); |
| 224 m_domApplicationCache->dispatchEvent(event, ASSERT_NO_EXCEPTION); | 224 m_domApplicationCache->dispatchEvent(event, ASSERT_NO_EXCEPTION); |
| 225 } | 225 } |
| 226 } | 226 } |
| 227 | 227 |
| 228 ApplicationCacheHost::Status ApplicationCacheHost::status() const | 228 ApplicationCacheHost::Status ApplicationCacheHost::status() const |
| (...skipping 21 matching lines...) Expand all Loading... |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool ApplicationCacheHost::isApplicationCacheEnabled() | 252 bool ApplicationCacheHost::isApplicationCacheEnabled() |
| 253 { | 253 { |
| 254 ASSERT(m_documentLoader->frame()); | 254 ASSERT(m_documentLoader->frame()); |
| 255 return m_documentLoader->frame()->settings() | 255 return m_documentLoader->frame()->settings() |
| 256 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheE
nabled(); | 256 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheE
nabled(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace WebCore | 259 } // namespace WebCore |
| OLD | NEW |