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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 watchID = executionContext()->circularSequentialID(); | 190 watchID = executionContext()->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() && !executionC
ontext()->isSecureContext(errorMessage)) { |
200 notifier->setFatalError(PositionError::create(PositionError::POSITION_UN
AVAILABLE, 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::POSITIO
N_UNAVAILABLE, errorMessage)); | 209 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, errorMessage)); |
210 return; | 210 return; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 // Check whether permissions have already been denied. Note that if this is
the case, | 214 // Check whether permissions have already been denied. Note that if this is
the case, |
215 // the permission state can not change again in the lifetime of this page. | 215 // the permission state can not change again in the lifetime of this page. |
216 if (isDenied()) | 216 if (isDenied()) |
217 notifier->setFatalError(PositionError::create(PositionError::PERMISSION_
DENIED, permissionDeniedErrorMessage)); | 217 notifier->setFatalError(PositionError::create(PositionError::PERMISSION_
DENIED, permissionDeniedErrorMessage)); |
218 else if (haveSuitableCachedPosition(notifier->options())) | 218 else if (haveSuitableCachedPosition(notifier->options())) |
219 notifier->setUseCachedPosition(); | 219 notifier->setUseCachedPosition(); |
(...skipping 327 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 |