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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return m_lastPosition.get(); | 145 return m_lastPosition.get(); |
146 } | 146 } |
147 | 147 |
148 void Geolocation::recordOriginTypeAccess() const | 148 void Geolocation::recordOriginTypeAccess() const |
149 { | 149 { |
150 ASSERT(frame()); | 150 ASSERT(frame()); |
151 | 151 |
152 Document* document = this->document(); | 152 Document* document = this->document(); |
153 ASSERT(document); | 153 ASSERT(document); |
154 | 154 |
155 // It is required by isPrivilegedContext() but isn't | 155 // It is required by isSecureContext() but isn't |
156 // actually used. This could be used later if a warning is shown in the | 156 // actually used. This could be used later if a warning is shown in the |
157 // developer console. | 157 // developer console. |
158 String insecureOriginMsg; | 158 String insecureOriginMsg; |
159 if (document->isPrivilegedContext(insecureOriginMsg)) { | 159 if (document->isSecureContext(insecureOriginMsg)) { |
160 UseCounter::count(document, UseCounter::GeolocationSecureOrigin); | 160 UseCounter::count(document, UseCounter::GeolocationSecureOrigin); |
161 } else { | 161 } else { |
162 UseCounter::countDeprecation(document, UseCounter::GeolocationInsecureOr
igin); | 162 UseCounter::countDeprecation(document, UseCounter::GeolocationInsecureOr
igin); |
163 OriginsUsingFeatures::countAnyWorld(*document, OriginsUsingFeatures::Fea
ture::GeolocationInsecureOrigin); | 163 OriginsUsingFeatures::countAnyWorld(*document, OriginsUsingFeatures::Fea
ture::GeolocationInsecureOrigin); |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 void Geolocation::getCurrentPosition(PositionCallback* successCallback, Position
ErrorCallback* errorCallback, const PositionOptions& options) | 167 void Geolocation::getCurrentPosition(PositionCallback* successCallback, Position
ErrorCallback* errorCallback, const PositionOptions& options) |
168 { | 168 { |
169 if (!frame()) | 169 if (!frame()) |
(...skipping 22 matching lines...) Expand all Loading... |
192 do { | 192 do { |
193 watchID = executionContext()->circularSequentialID(); | 193 watchID = executionContext()->circularSequentialID(); |
194 } while (!m_watchers.add(watchID, notifier)); | 194 } while (!m_watchers.add(watchID, notifier)); |
195 return watchID; | 195 return watchID; |
196 } | 196 } |
197 | 197 |
198 void Geolocation::startRequest(GeoNotifier *notifier) | 198 void Geolocation::startRequest(GeoNotifier *notifier) |
199 { | 199 { |
200 if (frame()->settings()->strictPowerfulFeatureRestrictions()) { | 200 if (frame()->settings()->strictPowerfulFeatureRestrictions()) { |
201 String errorMessage; | 201 String errorMessage; |
202 if (!executionContext()->isPrivilegedContext(errorMessage)) { | 202 if (!executionContext()->isSecureContext(errorMessage)) { |
203 notifier->setFatalError(PositionError::create(PositionError::POSITIO
N_UNAVAILABLE, errorMessage)); | 203 notifier->setFatalError(PositionError::create(PositionError::POSITIO
N_UNAVAILABLE, errorMessage)); |
204 return; | 204 return; |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
208 if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { | 208 if (RuntimeEnabledFeatures::restrictIFramePermissionsEnabled()) { |
209 // TODO(keenanb): kill the request if the parent is blocking the request
er | 209 // TODO(keenanb): kill the request if the parent is blocking the request
er |
210 Element* owner = document()->ownerElement(); | 210 Element* owner = document()->ownerElement(); |
211 if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { | 211 if (owner && owner->hasAttribute(HTMLNames::permissionsAttr)) { |
212 String errorMessage = "A cross-origin iframe needs its permissions a
ttribute properly set in order to use the geolocation API."; | 212 String errorMessage = "A cross-origin iframe needs its permissions a
ttribute properly set in order to use the geolocation API."; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 notifier->startTimer(); | 551 notifier->startTimer(); |
552 else | 552 else |
553 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); | 553 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
554 } else { | 554 } else { |
555 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); | 555 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); |
556 } | 556 } |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 } // namespace blink | 560 } // namespace blink |
OLD | NEW |