| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 void ApplicationCache::frameDestroyed() | 55 void ApplicationCache::frameDestroyed() |
| 56 { | 56 { |
| 57 if (ApplicationCacheHost* cacheHost = applicationCacheHost()) | 57 if (ApplicationCacheHost* cacheHost = applicationCacheHost()) |
| 58 cacheHost->setApplicationCache(0); | 58 cacheHost->setApplicationCache(0); |
| 59 DOMWindowProperty::frameDestroyed(); | 59 DOMWindowProperty::frameDestroyed(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 ApplicationCacheHost* ApplicationCache::applicationCacheHost() const | 62 ApplicationCacheHost* ApplicationCache::applicationCacheHost() const |
| 63 { | 63 { |
| 64 if (!m_frame || !m_frame->loader().documentLoader()) | 64 if (!frame() || !frame()->loader().documentLoader()) |
| 65 return 0; | 65 return 0; |
| 66 return m_frame->loader().documentLoader()->applicationCacheHost(); | 66 return frame()->loader().documentLoader()->applicationCacheHost(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 unsigned short ApplicationCache::status() const | 69 unsigned short ApplicationCache::status() const |
| 70 { | 70 { |
| 71 recordAPIUseType(); | 71 recordAPIUseType(); |
| 72 ApplicationCacheHost* cacheHost = applicationCacheHost(); | 72 ApplicationCacheHost* cacheHost = applicationCacheHost(); |
| 73 if (!cacheHost) | 73 if (!cacheHost) |
| 74 return ApplicationCacheHost::kUncached; | 74 return ApplicationCacheHost::kUncached; |
| 75 return cacheHost->getStatus(); | 75 return cacheHost->getStatus(); |
| 76 } | 76 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 cacheHost->abort(); | 98 cacheHost->abort(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 const AtomicString& ApplicationCache::interfaceName() const | 101 const AtomicString& ApplicationCache::interfaceName() const |
| 102 { | 102 { |
| 103 return EventTargetNames::ApplicationCache; | 103 return EventTargetNames::ApplicationCache; |
| 104 } | 104 } |
| 105 | 105 |
| 106 ExecutionContext* ApplicationCache::getExecutionContext() const | 106 ExecutionContext* ApplicationCache::getExecutionContext() const |
| 107 { | 107 { |
| 108 if (m_frame) | 108 if (frame()) |
| 109 return m_frame->document(); | 109 return frame()->document(); |
| 110 return 0; | 110 return 0; |
| 111 } | 111 } |
| 112 | 112 |
| 113 const AtomicString& ApplicationCache::toEventType(ApplicationCacheHost::EventID
id) | 113 const AtomicString& ApplicationCache::toEventType(ApplicationCacheHost::EventID
id) |
| 114 { | 114 { |
| 115 switch (id) { | 115 switch (id) { |
| 116 case ApplicationCacheHost::kCheckingEvent: | 116 case ApplicationCacheHost::kCheckingEvent: |
| 117 return EventTypeNames::checking; | 117 return EventTypeNames::checking; |
| 118 case ApplicationCacheHost::kErrorEvent: | 118 case ApplicationCacheHost::kErrorEvent: |
| 119 return EventTypeNames::error; | 119 return EventTypeNames::error; |
| 120 case ApplicationCacheHost::kNoupdateEvent: | 120 case ApplicationCacheHost::kNoupdateEvent: |
| 121 return EventTypeNames::noupdate; | 121 return EventTypeNames::noupdate; |
| 122 case ApplicationCacheHost::kDownloadingEvent: | 122 case ApplicationCacheHost::kDownloadingEvent: |
| 123 return EventTypeNames::downloading; | 123 return EventTypeNames::downloading; |
| 124 case ApplicationCacheHost::kProgressEvent: | 124 case ApplicationCacheHost::kProgressEvent: |
| 125 return EventTypeNames::progress; | 125 return EventTypeNames::progress; |
| 126 case ApplicationCacheHost::kUpdatereadyEvent: | 126 case ApplicationCacheHost::kUpdatereadyEvent: |
| 127 return EventTypeNames::updateready; | 127 return EventTypeNames::updateready; |
| 128 case ApplicationCacheHost::kCachedEvent: | 128 case ApplicationCacheHost::kCachedEvent: |
| 129 return EventTypeNames::cached; | 129 return EventTypeNames::cached; |
| 130 case ApplicationCacheHost::kObsoleteEvent: | 130 case ApplicationCacheHost::kObsoleteEvent: |
| 131 return EventTypeNames::obsolete; | 131 return EventTypeNames::obsolete; |
| 132 } | 132 } |
| 133 NOTREACHED(); | 133 NOTREACHED(); |
| 134 return EventTypeNames::error; | 134 return EventTypeNames::error; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ApplicationCache::recordAPIUseType() const | 137 void ApplicationCache::recordAPIUseType() const |
| 138 { | 138 { |
| 139 if (!m_frame) | 139 if (!frame()) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 Document* document = m_frame->document(); | 142 Document* document = frame()->document(); |
| 143 | 143 |
| 144 if (!document) | 144 if (!document) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 if (document->isSecureContext()) { | 147 if (document->isSecureContext()) { |
| 148 UseCounter::count(document, UseCounter::ApplicationCacheAPISecureOrigin)
; | 148 UseCounter::count(document, UseCounter::ApplicationCacheAPISecureOrigin)
; |
| 149 } else { | 149 } else { |
| 150 Deprecation::countDeprecation(document, UseCounter::ApplicationCacheAPII
nsecureOrigin); | 150 Deprecation::countDeprecation(document, UseCounter::ApplicationCacheAPII
nsecureOrigin); |
| 151 HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature
::ApplicationCacheAPIInsecureHost); | 151 HostsUsingFeatures::countAnyWorld(*document, HostsUsingFeatures::Feature
::ApplicationCacheAPIInsecureHost); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace blink | 155 } // namespace blink |
| OLD | NEW |