| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 { | 103 { |
| 104 // If a fatal error has already been set, stick with it. This makes sure tha
t | 104 // If a fatal error has already been set, stick with it. This makes sure tha
t |
| 105 // when permission is denied, this is the error reported, as required by the | 105 // when permission is denied, this is the error reported, as required by the |
| 106 // spec. | 106 // spec. |
| 107 if (m_fatalError) | 107 if (m_fatalError) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 m_fatalError = error; | 110 m_fatalError = error; |
| 111 // An existing timer may not have a zero timeout. | 111 // An existing timer may not have a zero timeout. |
| 112 m_timer.stop(); | 112 m_timer.stop(); |
| 113 m_timer.startOneShot(0); | 113 m_timer.startOneShot(0, FROM_HERE); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void Geolocation::GeoNotifier::setUseCachedPosition() | 116 void Geolocation::GeoNotifier::setUseCachedPosition() |
| 117 { | 117 { |
| 118 m_useCachedPosition = true; | 118 m_useCachedPosition = true; |
| 119 m_timer.startOneShot(0); | 119 m_timer.startOneShot(0, FROM_HERE); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool Geolocation::GeoNotifier::hasZeroTimeout() const | 122 bool Geolocation::GeoNotifier::hasZeroTimeout() const |
| 123 { | 123 { |
| 124 return m_options->hasTimeout() && m_options->timeout() == 0; | 124 return m_options->hasTimeout() && m_options->timeout() == 0; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void Geolocation::GeoNotifier::runSuccessCallback(Geoposition* position) | 127 void Geolocation::GeoNotifier::runSuccessCallback(Geoposition* position) |
| 128 { | 128 { |
| 129 // If we are here and the Geolocation permission is not approved, something
has | 129 // If we are here and the Geolocation permission is not approved, something
has |
| 130 // gone horribly wrong. | 130 // gone horribly wrong. |
| 131 if (!m_geolocation->isAllowed()) | 131 if (!m_geolocation->isAllowed()) |
| 132 CRASH(); | 132 CRASH(); |
| 133 | 133 |
| 134 m_successCallback->handleEvent(position); | 134 m_successCallback->handleEvent(position); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void Geolocation::GeoNotifier::runErrorCallback(PositionError* error) | 137 void Geolocation::GeoNotifier::runErrorCallback(PositionError* error) |
| 138 { | 138 { |
| 139 if (m_errorCallback) | 139 if (m_errorCallback) |
| 140 m_errorCallback->handleEvent(error); | 140 m_errorCallback->handleEvent(error); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void Geolocation::GeoNotifier::startTimerIfNeeded() | 143 void Geolocation::GeoNotifier::startTimerIfNeeded() |
| 144 { | 144 { |
| 145 if (m_options->hasTimeout()) | 145 if (m_options->hasTimeout()) |
| 146 m_timer.startOneShot(m_options->timeout() / 1000.0); | 146 m_timer.startOneShot(m_options->timeout() / 1000.0, FROM_HERE); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void Geolocation::GeoNotifier::stopTimer() | 149 void Geolocation::GeoNotifier::stopTimer() |
| 150 { | 150 { |
| 151 m_timer.stop(); | 151 m_timer.stop(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) | 154 void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) |
| 155 { | 155 { |
| 156 m_timer.stop(); | 156 m_timer.stop(); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 notifier->startTimerIfNeeded(); | 701 notifier->startTimerIfNeeded(); |
| 702 else | 702 else |
| 703 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); | 703 notifier->setFatalError(PositionError::create(PositionError::POS
ITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
| 704 } else { | 704 } else { |
| 705 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); | 705 notifier->setFatalError(PositionError::create(PositionError::PERMISS
ION_DENIED, permissionDeniedErrorMessage)); |
| 706 } | 706 } |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // namespace WebCore | 710 } // namespace WebCore |
| OLD | NEW |