| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * Copyright 2010, The Android Open Source Project | 4 * Copyright 2010, The Android Open Source Project |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 visitor->trace(m_oneShots); | 105 visitor->trace(m_oneShots); |
| 106 visitor->trace(m_watchers); | 106 visitor->trace(m_watchers); |
| 107 visitor->trace(m_pendingForPermissionNotifiers); | 107 visitor->trace(m_pendingForPermissionNotifiers); |
| 108 visitor->trace(m_lastPosition); | 108 visitor->trace(m_lastPosition); |
| 109 visitor->trace(m_requestsAwaitingCachedPosition); | 109 visitor->trace(m_requestsAwaitingCachedPosition); |
| 110 ActiveDOMObject::trace(visitor); | 110 ActiveDOMObject::trace(visitor); |
| 111 } | 111 } |
| 112 | 112 |
| 113 Document* Geolocation::document() const | 113 Document* Geolocation::document() const |
| 114 { | 114 { |
| 115 return toDocument(executionContext()); | 115 return toDocument(getExecutionContext()); |
| 116 } | 116 } |
| 117 | 117 |
| 118 LocalFrame* Geolocation::frame() const | 118 LocalFrame* Geolocation::frame() const |
| 119 { | 119 { |
| 120 return document() ? document()->frame() : 0; | 120 return document() ? document()->frame() : 0; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void Geolocation::stop() | 123 void Geolocation::stop() |
| 124 { | 124 { |
| 125 LocalFrame* frame = this->frame(); | 125 LocalFrame* frame = this->frame(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 { | 180 { |
| 181 if (!frame()) | 181 if (!frame()) |
| 182 return 0; | 182 return 0; |
| 183 | 183 |
| 184 GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCall
back, options); | 184 GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCall
back, options); |
| 185 startRequest(notifier); | 185 startRequest(notifier); |
| 186 | 186 |
| 187 int watchID; | 187 int watchID; |
| 188 // Keep asking for the next id until we're given one that we don't already h
ave. | 188 // Keep asking for the next id until we're given one that we don't already h
ave. |
| 189 do { | 189 do { |
| 190 watchID = executionContext()->circularSequentialID(); | 190 watchID = getExecutionContext()->circularSequentialID(); |
| 191 } while (!m_watchers.add(watchID, notifier)); | 191 } while (!m_watchers.add(watchID, notifier)); |
| 192 return watchID; | 192 return watchID; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void Geolocation::startRequest(GeoNotifier *notifier) | 195 void Geolocation::startRequest(GeoNotifier *notifier) |
| 196 { | 196 { |
| 197 recordOriginTypeAccess(); | 197 recordOriginTypeAccess(); |
| 198 String errorMessage; | 198 String errorMessage; |
| 199 if (!frame()->settings()->allowGeolocationOnInsecureOrigins() && !executionC
ontext()->isSecureContext(errorMessage)) { | 199 if (!frame()->settings()->allowGeolocationOnInsecureOrigins() && !getExecuti
onContext()->isSecureContext(errorMessage)) { |
| 200 notifier->setFatalError(PositionError::create(PositionError::PERMISSION_
DENIED, errorMessage)); | 200 notifier->setFatalError(PositionError::create(PositionError::PERMISSION_
DENIED, errorMessage)); |
| 201 return; | 201 return; |
| 202 } | 202 } |
| 203 | 203 |
| 204 if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { | 204 if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { |
| 205 // TODO(keenanb): kill the request if the parent is blocking the request
er | 205 // TODO(keenanb): kill the request if the parent is blocking the request
er |
| 206 Element* owner = document()->ownerElement(); | 206 Element* owner = document()->ownerElement(); |
| 207 if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { | 207 if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { |
| 208 String errorMessage = "A cross-origin iframe needs its permissions a
ttribute properly set in order to use the geolocation API."; | 208 String errorMessage = "A cross-origin iframe needs its permissions a
ttribute properly set in order to use the geolocation API."; |
| 209 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, errorMessage)); | 209 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, errorMessage)); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 notifier->startTimer(); | 547 notifier->startTimer(); |
| 548 else | 548 else |
| 549 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); | 549 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
| 550 } else { | 550 } else { |
| 551 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); | 551 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); |
| 552 } | 552 } |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace blink | 556 } // namespace blink |
| OLD | NEW |