| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return m_lastPosition.get(); | 174 return m_lastPosition.get(); |
| 175 | 175 |
| 176 if (!m_client) | 176 if (!m_client) |
| 177 return 0; | 177 return 0; |
| 178 | 178 |
| 179 return m_client->lastPosition(); | 179 return m_client->lastPosition(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void GeolocationController::setClientForTest(GeolocationClient* client) | 182 void GeolocationController::setClientForTest(GeolocationClient* client) |
| 183 { | 183 { |
| 184 if (m_hasClientForTest) |
| 185 m_client->controllerForTestRemoved(this); |
| 184 m_client = client; | 186 m_client = client; |
| 185 m_hasClientForTest = true; | 187 m_hasClientForTest = true; |
| 186 | 188 |
| 187 client->controllerForTestAdded(this); | 189 client->controllerForTestAdded(this); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void GeolocationController::pageVisibilityChanged() | 192 void GeolocationController::pageVisibilityChanged() |
| 191 { | 193 { |
| 192 if (m_observers.isEmpty() || !m_client) | 194 if (m_observers.isEmpty() || !m_client) |
| 193 return; | 195 return; |
| 194 | 196 |
| 195 if (page() && page()->visibilityState() == PageVisibilityStateVisible) | 197 if (page() && page()->visibilityState() == PageVisibilityStateVisible) |
| 196 startUpdatingIfNeeded(); | 198 startUpdatingIfNeeded(); |
| 197 else | 199 else |
| 198 stopUpdatingIfNeeded(); | 200 stopUpdatingIfNeeded(); |
| 199 } | 201 } |
| 200 | 202 |
| 201 const char* GeolocationController::supplementName() | 203 const char* GeolocationController::supplementName() |
| 202 { | 204 { |
| 203 return "GeolocationController"; | 205 return "GeolocationController"; |
| 204 } | 206 } |
| 205 | 207 |
| 206 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) | 208 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) |
| 207 { | 209 { |
| 208 Supplement<LocalFrame>::provideTo(frame, GeolocationController::supplementNa
me(), GeolocationController::create(frame, client)); | 210 Supplement<LocalFrame>::provideTo(frame, GeolocationController::supplementNa
me(), GeolocationController::create(frame, client)); |
| 209 } | 211 } |
| 210 | 212 |
| 211 } // namespace WebCore | 213 } // namespace WebCore |
| OLD | NEW |