| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 class ApplicationCacheHostInternal : public WebApplicationCacheHostClient { | 56 class ApplicationCacheHostInternal : public WebApplicationCacheHostClient { |
| 57 public: | 57 public: |
| 58 ApplicationCacheHostInternal(ApplicationCacheHost* host) | 58 ApplicationCacheHostInternal(ApplicationCacheHost* host) |
| 59 : m_innerHost(host) | 59 : m_innerHost(host) |
| 60 { | 60 { |
| 61 m_outerHost.set(WebKit::webKitClient()->createApplicationCacheHost(this)); | 61 m_outerHost.set(WebKit::webKitClient()->createApplicationCacheHost(this)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void notifyEventListener(WebApplicationCacheHost::EventID eventID) | 64 virtual void notifyEventListener(WebApplicationCacheHost::EventID eventID) |
| 65 { | 65 { |
| 66 m_innerHost->notifyEventListener(static_cast<ApplicationCacheHost::EventID>(eventID)); | 66 m_innerHost->notifyDOMApplicationCache( |
| 67 static_cast<ApplicationCacheHost::EventID>(eventID)); |
| 67 } | 68 } |
| 68 | 69 |
| 69 ApplicationCacheHost* m_innerHost; | 70 ApplicationCacheHost* m_innerHost; |
| 70 OwnPtr<WebApplicationCacheHost> m_outerHost; | 71 OwnPtr<WebApplicationCacheHost> m_outerHost; |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 // ApplicationCacheHost ------------------------------------------------------- | 74 // ApplicationCacheHost ------------------------------------------------------- |
| 74 // We provide a custom implementation of this class that calls out to the | 75 // We provide a custom implementation of this class that calls out to the |
| 75 // embedding application instead of using WebCore's built in appcache system. | 76 // embedding application instead of using WebCore's built in appcache system. |
| 76 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. | 77 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // N/A to the chromium port which doesn't use the page cache. | 211 // N/A to the chromium port which doesn't use the page cache. |
| 211 return false; | 212 return false; |
| 212 } | 213 } |
| 213 | 214 |
| 214 void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplicationCache) | 215 void ApplicationCacheHost::setDOMApplicationCache(DOMApplicationCache* domApplicationCache) |
| 215 { | 216 { |
| 216 ASSERT(!m_domApplicationCache || !domApplicationCache); | 217 ASSERT(!m_domApplicationCache || !domApplicationCache); |
| 217 m_domApplicationCache = domApplicationCache; | 218 m_domApplicationCache = domApplicationCache; |
| 218 } | 219 } |
| 219 | 220 |
| 220 void ApplicationCacheHost::notifyEventListener(EventID id) | 221 void ApplicationCacheHost::notifyDOMApplicationCache(EventID id) |
| 221 { | 222 { |
| 222 if (m_domApplicationCache) | 223 if (m_domApplicationCache) { |
| 223 m_domApplicationCache->callEventListener(id); | 224 ExceptionCode ec = 0; |
| 225 m_domApplicationCache->dispatchEvent( |
| 226 Event::create(DOMApplicationCache::toEventType(id), false, false), |
| 227 ec); |
| 228 ASSERT(!ec); |
| 229 } |
| 224 } | 230 } |
| 225 | 231 |
| 226 ApplicationCacheHost::Status ApplicationCacheHost::status() const | 232 ApplicationCacheHost::Status ApplicationCacheHost::status() const |
| 227 { | 233 { |
| 228 return m_internal ? static_cast<Status>(m_internal->m_outerHost->status()) : UNCACHED; | 234 return m_internal ? static_cast<Status>(m_internal->m_outerHost->status()) : UNCACHED; |
| 229 } | 235 } |
| 230 | 236 |
| 231 bool ApplicationCacheHost::update() | 237 bool ApplicationCacheHost::update() |
| 232 { | 238 { |
| 233 return m_internal ? m_internal->m_outerHost->startUpdate() : false; | 239 return m_internal ? m_internal->m_outerHost->startUpdate() : false; |
| 234 } | 240 } |
| 235 | 241 |
| 236 bool ApplicationCacheHost::swapCache() | 242 bool ApplicationCacheHost::swapCache() |
| 237 { | 243 { |
| 238 return m_internal ? m_internal->m_outerHost->swapCache() : false; | 244 return m_internal ? m_internal->m_outerHost->swapCache() : false; |
| 239 } | 245 } |
| 240 | 246 |
| 241 bool ApplicationCacheHost::isApplicationCacheEnabled() | 247 bool ApplicationCacheHost::isApplicationCacheEnabled() |
| 242 { | 248 { |
| 243 ASSERT(m_documentLoader->frame()); | 249 ASSERT(m_documentLoader->frame()); |
| 244 return m_documentLoader->frame()->settings() | 250 return m_documentLoader->frame()->settings() |
| 245 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheEnabled(); | 251 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheEnabled(); |
| 246 } | 252 } |
| 247 | 253 |
| 248 } // namespace WebCore | 254 } // namespace WebCore |
| 249 | 255 |
| 250 #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) | 256 #endif // ENABLE(OFFLINE_WEB_APPLICATIONS) |
| OLD | NEW |