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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 void GeolocationController::addObserver(Geolocation* observer, bool enableHighAc
curacy) | 55 void GeolocationController::addObserver(Geolocation* observer, bool enableHighAc
curacy) |
56 { | 56 { |
57 // This may be called multiple times with the same observer, though removeOb
server() | 57 // This may be called multiple times with the same observer, though removeOb
server() |
58 // is called only once with each. | 58 // is called only once with each. |
59 bool wasEmpty = m_observers.isEmpty(); | 59 bool wasEmpty = m_observers.isEmpty(); |
60 m_observers.add(observer); | 60 m_observers.add(observer); |
61 if (enableHighAccuracy) | 61 if (enableHighAccuracy) |
62 m_highAccuracyObservers.add(observer); | 62 m_highAccuracyObservers.add(observer); |
63 | 63 |
64 if (m_client) { | 64 if (m_client) { |
65 if (enableHighAccuracy) | 65 if (enableHighAccuracy) |
66 m_client->setEnableHighAccuracy(true); | 66 m_client->setEnableHighAccuracy(true); |
67 if (wasEmpty) | 67 if (wasEmpty) |
68 m_client->startUpdating(); | 68 m_client->startUpdating(); |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 void GeolocationController::removeObserver(Geolocation* observer) | 72 void GeolocationController::removeObserver(Geolocation* observer) |
73 { | 73 { |
74 if (!m_observers.contains(observer)) | 74 if (!m_observers.contains(observer)) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 132 |
133 const char* GeolocationController::supplementName() | 133 const char* GeolocationController::supplementName() |
134 { | 134 { |
135 return "GeolocationController"; | 135 return "GeolocationController"; |
136 } | 136 } |
137 | 137 |
138 void provideGeolocationTo(Page* page, GeolocationClient* client) | 138 void provideGeolocationTo(Page* page, GeolocationClient* client) |
139 { | 139 { |
140 Supplement<Page>::provideTo(page, GeolocationController::supplementName(), G
eolocationController::create(page, client)); | 140 Supplement<Page>::provideTo(page, GeolocationController::supplementName(), G
eolocationController::create(page, client)); |
141 } | 141 } |
142 | 142 |
143 } // namespace WebCore | 143 } // namespace WebCore |
OLD | NEW |