| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (!m_frame || !m_frame->loader().documentLoader()) | 64 if (!m_frame || !m_frame->loader().documentLoader()) |
| 65 return 0; | 65 return 0; |
| 66 return m_frame->loader().documentLoader()->applicationCacheHost(); | 66 return m_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::UNCACHED; | 74 return ApplicationCacheHost::kUncached; |
| 75 return cacheHost->getStatus(); | 75 return cacheHost->getStatus(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void ApplicationCache::update(ExceptionState& exceptionState) | 78 void ApplicationCache::update(ExceptionState& exceptionState) |
| 79 { | 79 { |
| 80 recordAPIUseType(); | 80 recordAPIUseType(); |
| 81 ApplicationCacheHost* cacheHost = applicationCacheHost(); | 81 ApplicationCacheHost* cacheHost = applicationCacheHost(); |
| 82 if (!cacheHost || !cacheHost->update()) | 82 if (!cacheHost || !cacheHost->update()) |
| 83 exceptionState.throwDOMException(InvalidStateError, "there is no applica
tion cache to update."); | 83 exceptionState.throwDOMException(InvalidStateError, "there is no applica
tion cache to update."); |
| 84 } | 84 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 106 ExecutionContext* ApplicationCache::getExecutionContext() const | 106 ExecutionContext* ApplicationCache::getExecutionContext() const |
| 107 { | 107 { |
| 108 if (m_frame) | 108 if (m_frame) |
| 109 return m_frame->document(); | 109 return m_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::CHECKING_EVENT: | 116 case ApplicationCacheHost::kCheckingEvent: |
| 117 return EventTypeNames::checking; | 117 return EventTypeNames::checking; |
| 118 case ApplicationCacheHost::ERROR_EVENT: | 118 case ApplicationCacheHost::kErrorEvent: |
| 119 return EventTypeNames::error; | 119 return EventTypeNames::error; |
| 120 case ApplicationCacheHost::NOUPDATE_EVENT: | 120 case ApplicationCacheHost::kNoupdateEvent: |
| 121 return EventTypeNames::noupdate; | 121 return EventTypeNames::noupdate; |
| 122 case ApplicationCacheHost::DOWNLOADING_EVENT: | 122 case ApplicationCacheHost::kDownloadingEvent: |
| 123 return EventTypeNames::downloading; | 123 return EventTypeNames::downloading; |
| 124 case ApplicationCacheHost::PROGRESS_EVENT: | 124 case ApplicationCacheHost::kProgressEvent: |
| 125 return EventTypeNames::progress; | 125 return EventTypeNames::progress; |
| 126 case ApplicationCacheHost::UPDATEREADY_EVENT: | 126 case ApplicationCacheHost::kUpdatereadyEvent: |
| 127 return EventTypeNames::updateready; | 127 return EventTypeNames::updateready; |
| 128 case ApplicationCacheHost::CACHED_EVENT: | 128 case ApplicationCacheHost::kCachedEvent: |
| 129 return EventTypeNames::cached; | 129 return EventTypeNames::cached; |
| 130 case ApplicationCacheHost::OBSOLETE_EVENT: | 130 case ApplicationCacheHost::kObsoleteEvent: |
| 131 return EventTypeNames::obsolete; | 131 return EventTypeNames::obsolete; |
| 132 } | 132 } |
| 133 ASSERT_NOT_REACHED(); | 133 ASSERT_NOT_REACHED(); |
| 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 (!m_frame) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 Document* document = m_frame->document(); | 142 Document* document = m_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 |