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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 , m_isActive(false) | 45 , m_isActive(false) |
46 , m_permissionState(PermissionStateUnset) | 46 , m_permissionState(PermissionStateUnset) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 GeolocationClientMock::~GeolocationClientMock() | 50 GeolocationClientMock::~GeolocationClientMock() |
51 { | 51 { |
52 ASSERT(!m_isActive); | 52 ASSERT(!m_isActive); |
53 } | 53 } |
54 | 54 |
55 void GeolocationClientMock::setPosition(PassRefPtrWillBeRawPtr<GeolocationPositi
on> position) | 55 void GeolocationClientMock::setPosition(GeolocationPosition* position) |
56 { | 56 { |
57 m_lastPosition = position; | 57 m_lastPosition = position; |
58 clearError(); | 58 clearError(); |
59 asyncUpdateController(); | 59 asyncUpdateController(); |
60 } | 60 } |
61 | 61 |
62 void GeolocationClientMock::setPositionUnavailableError(const String& errorMessa
ge) | 62 void GeolocationClientMock::setPositionUnavailableError(const String& errorMessa
ge) |
63 { | 63 { |
64 m_hasError = true; | 64 m_hasError = true; |
65 m_errorMessage = errorMessage; | 65 m_errorMessage = errorMessage; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 ASSERT_UNUSED(timer, timer == &m_controllerTimer); | 167 ASSERT_UNUSED(timer, timer == &m_controllerTimer); |
168 | 168 |
169 // Make a copy of the set of controllers since it might be modified while it
erating. | 169 // Make a copy of the set of controllers since it might be modified while it
erating. |
170 HashSet<GeolocationController*> controllers = m_controllers; | 170 HashSet<GeolocationController*> controllers = m_controllers; |
171 if (m_lastPosition.get()) { | 171 if (m_lastPosition.get()) { |
172 ASSERT(!m_hasError); | 172 ASSERT(!m_hasError); |
173 for (HashSet<GeolocationController*>::iterator it = controllers.begin();
it != controllers.end(); ++it) | 173 for (HashSet<GeolocationController*>::iterator it = controllers.begin();
it != controllers.end(); ++it) |
174 (*it)->positionChanged(m_lastPosition.get()); | 174 (*it)->positionChanged(m_lastPosition.get()); |
175 } else if (m_hasError) { | 175 } else if (m_hasError) { |
176 for (HashSet<GeolocationController*>::iterator it = controllers.begin();
it != controllers.end(); ++it) | 176 for (HashSet<GeolocationController*>::iterator it = controllers.begin();
it != controllers.end(); ++it) |
177 (*it)->errorOccurred(GeolocationError::create(GeolocationError::Posi
tionUnavailable, m_errorMessage).get()); | 177 (*it)->errorOccurred(GeolocationError::create(GeolocationError::Posi
tionUnavailable, m_errorMessage)); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 void GeolocationClientMock::clearError() | 181 void GeolocationClientMock::clearError() |
182 { | 182 { |
183 m_hasError = false; | 183 m_hasError = false; |
184 m_errorMessage = String(); | 184 m_errorMessage = String(); |
185 } | 185 } |
186 | 186 |
187 } // WebCore | 187 } // WebCore |
OLD | NEW |