| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 void GeolocationClientMock::setEnableHighAccuracy(bool) | 142 void GeolocationClientMock::setEnableHighAccuracy(bool) |
| 143 { | 143 { |
| 144 // FIXME: We need to add some tests regarding "high accuracy" mode. | 144 // FIXME: We need to add some tests regarding "high accuracy" mode. |
| 145 // See https://bugs.webkit.org/show_bug.cgi?id=49438 | 145 // See https://bugs.webkit.org/show_bug.cgi?id=49438 |
| 146 } | 146 } |
| 147 | 147 |
| 148 GeolocationPosition* GeolocationClientMock::lastPosition() | 148 GeolocationPosition* GeolocationClientMock::lastPosition() |
| 149 { | 149 { |
| 150 return m_lastPosition.get(); | 150 return m_lastPosition; |
| 151 } | 151 } |
| 152 | 152 |
| 153 void GeolocationClientMock::asyncUpdateController() | 153 void GeolocationClientMock::asyncUpdateController() |
| 154 { | 154 { |
| 155 if (m_isActive && !m_controllerTimer.isActive()) | 155 if (m_isActive && !m_controllerTimer.isActive()) |
| 156 m_controllerTimer.startOneShot(0, BLINK_FROM_HERE); | 156 m_controllerTimer.startOneShot(0, BLINK_FROM_HERE); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void GeolocationClientMock::controllerTimerFired(Timer<GeolocationClientMock>* t
imer) | 159 void GeolocationClientMock::controllerTimerFired(Timer<GeolocationClientMock>* t
imer) |
| 160 { | 160 { |
| 161 ASSERT_UNUSED(timer, timer == &m_controllerTimer); | 161 ASSERT_UNUSED(timer, timer == &m_controllerTimer); |
| 162 | 162 |
| 163 // Make a copy of the set of controllers since it might be modified while it
erating. | 163 // Make a copy of the set of controllers since it might be modified while it
erating. |
| 164 GeolocationControllers controllers = m_controllers; | 164 GeolocationControllers controllers = m_controllers; |
| 165 if (m_lastPosition.get()) { | 165 if (m_lastPosition) { |
| 166 ASSERT(!m_hasError); | 166 ASSERT(!m_hasError); |
| 167 for (GeolocationControllers::iterator it = controllers.begin(); it != co
ntrollers.end(); ++it) | 167 for (GeolocationControllers::iterator it = controllers.begin(); it != co
ntrollers.end(); ++it) |
| 168 (*it)->positionChanged(m_lastPosition.get()); | 168 (*it)->positionChanged(m_lastPosition); |
| 169 } else if (m_hasError) { | 169 } else if (m_hasError) { |
| 170 for (GeolocationControllers::iterator it = controllers.begin(); it != co
ntrollers.end(); ++it) | 170 for (GeolocationControllers::iterator it = controllers.begin(); it != co
ntrollers.end(); ++it) |
| 171 (*it)->errorOccurred(GeolocationError::create(GeolocationError::Posi
tionUnavailable, m_errorMessage)); | 171 (*it)->errorOccurred(GeolocationError::create(GeolocationError::Posi
tionUnavailable, m_errorMessage)); |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 void GeolocationClientMock::clearError() | 175 void GeolocationClientMock::clearError() |
| 176 { | 176 { |
| 177 m_hasError = false; | 177 m_hasError = false; |
| 178 m_errorMessage = String(); | 178 m_errorMessage = String(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 DEFINE_TRACE(GeolocationClientMock) | 181 DEFINE_TRACE(GeolocationClientMock) |
| 182 { | 182 { |
| 183 visitor->trace(m_controllers); | 183 visitor->trace(m_controllers); |
| 184 visitor->trace(m_lastPosition); | 184 visitor->trace(m_lastPosition); |
| 185 visitor->trace(m_pendingPermissions); | 185 visitor->trace(m_pendingPermissions); |
| 186 GeolocationClient::trace(visitor); | 186 GeolocationClient::trace(visitor); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace blink | 189 } // namespace blink |
| OLD | NEW |