| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // This may be called multiple times with the same observer, though removeOb
server() | 83 // This may be called multiple times with the same observer, though removeOb
server() |
| 84 // is called only once with each. | 84 // is called only once with each. |
| 85 bool wasEmpty = m_observers.isEmpty(); | 85 bool wasEmpty = m_observers.isEmpty(); |
| 86 m_observers.add(observer); | 86 m_observers.add(observer); |
| 87 if (enableHighAccuracy) | 87 if (enableHighAccuracy) |
| 88 m_highAccuracyObservers.add(observer); | 88 m_highAccuracyObservers.add(observer); |
| 89 | 89 |
| 90 if (m_client) { | 90 if (m_client) { |
| 91 if (enableHighAccuracy) | 91 if (enableHighAccuracy) |
| 92 m_client->setEnableHighAccuracy(true); | 92 m_client->setEnableHighAccuracy(true); |
| 93 if (wasEmpty && page() && page()->visibilityState() == PageVisibilitySta
teVisible) | 93 if (wasEmpty && page() && page()->isPageVisible()) |
| 94 startUpdatingIfNeeded(); | 94 startUpdatingIfNeeded(); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 void GeolocationController::removeObserver(Geolocation* observer) | 98 void GeolocationController::removeObserver(Geolocation* observer) |
| 99 { | 99 { |
| 100 if (!m_observers.contains(observer)) | 100 if (!m_observers.contains(observer)) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 m_observers.remove(observer); | 103 m_observers.remove(observer); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 m_hasClientForTest = true; | 163 m_hasClientForTest = true; |
| 164 | 164 |
| 165 client->controllerForTestAdded(this); | 165 client->controllerForTestAdded(this); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void GeolocationController::pageVisibilityChanged() | 168 void GeolocationController::pageVisibilityChanged() |
| 169 { | 169 { |
| 170 if (m_observers.isEmpty() || !m_client) | 170 if (m_observers.isEmpty() || !m_client) |
| 171 return; | 171 return; |
| 172 | 172 |
| 173 if (page() && page()->visibilityState() == PageVisibilityStateVisible) | 173 if (page() && page()->isPageVisible()) |
| 174 startUpdatingIfNeeded(); | 174 startUpdatingIfNeeded(); |
| 175 else | 175 else |
| 176 stopUpdatingIfNeeded(); | 176 stopUpdatingIfNeeded(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 const char* GeolocationController::supplementName() | 179 const char* GeolocationController::supplementName() |
| 180 { | 180 { |
| 181 return "GeolocationController"; | 181 return "GeolocationController"; |
| 182 } | 182 } |
| 183 | 183 |
| 184 DEFINE_TRACE(GeolocationController) | 184 DEFINE_TRACE(GeolocationController) |
| 185 { | 185 { |
| 186 visitor->trace(m_client); | 186 visitor->trace(m_client); |
| 187 visitor->trace(m_lastPosition); | 187 visitor->trace(m_lastPosition); |
| 188 visitor->trace(m_observers); | 188 visitor->trace(m_observers); |
| 189 visitor->trace(m_highAccuracyObservers); | 189 visitor->trace(m_highAccuracyObservers); |
| 190 WillBeHeapSupplement<LocalFrame>::trace(visitor); | 190 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
| 191 PageLifecycleObserver::trace(visitor); | 191 PageLifecycleObserver::trace(visitor); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) | 194 void provideGeolocationTo(LocalFrame& frame, GeolocationClient* client) |
| 195 { | 195 { |
| 196 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su
pplementName(), GeolocationController::create(frame, client)); | 196 WillBeHeapSupplement<LocalFrame>::provideTo(frame, GeolocationController::su
pplementName(), GeolocationController::create(frame, client)); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |