| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All Rights Reserved. |
| 3 * Copyright 2010, The Android Open Source Project | 3 * Copyright 2010, The Android Open Source Project |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 static Geolocation* create(ExecutionContext*); | 56 static Geolocation* create(ExecutionContext*); |
| 57 virtual ~Geolocation(); | 57 virtual ~Geolocation(); |
| 58 void trace(Visitor*); | 58 void trace(Visitor*); |
| 59 | 59 |
| 60 virtual void stop() override; | 60 virtual void stop() override; |
| 61 Document* document() const; | 61 Document* document() const; |
| 62 LocalFrame* frame() const; | 62 LocalFrame* frame() const; |
| 63 | 63 |
| 64 // Creates a oneshot and attempts to obtain a position that meets the | 64 // Creates a oneshot and attempts to obtain a position that meets the |
| 65 // constraints of the options. | 65 // constraints of the options. |
| 66 void getCurrentPosition(PositionCallback*, PositionErrorCallback*, const Dic
tionary&); | 66 void getCurrentPosition(PositionCallback*, PositionErrorCallback*, const Pos
itionOptions&); |
| 67 | 67 |
| 68 // Creates a watcher that will be notified whenever a new position is | 68 // Creates a watcher that will be notified whenever a new position is |
| 69 // available that meets the constraints of the options. | 69 // available that meets the constraints of the options. |
| 70 int watchPosition(PositionCallback*, PositionErrorCallback*, const Dictionar
y&); | 70 int watchPosition(PositionCallback*, PositionErrorCallback*, const PositionO
ptions&); |
| 71 | 71 |
| 72 // Removes all references to the watcher, it will not be updated again. | 72 // Removes all references to the watcher, it will not be updated again. |
| 73 void clearWatch(int watchID); | 73 void clearWatch(int watchID); |
| 74 | 74 |
| 75 void setIsAllowed(bool); | 75 void setIsAllowed(bool); |
| 76 | 76 |
| 77 bool isAllowed() const { return m_geolocationPermission == PermissionAllowed
; } | 77 bool isAllowed() const { return m_geolocationPermission == PermissionAllowed
; } |
| 78 | 78 |
| 79 // Notifies this that a new position is available. Must never be called | 79 // Notifies this that a new position is available. Must never be called |
| 80 // before permission is granted by the user. | 80 // before permission is granted by the user. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Processes the notifiers that were waiting for a permission decision. If | 149 // Processes the notifiers that were waiting for a permission decision. If |
| 150 // granted and this can be registered with the controller then the | 150 // granted and this can be registered with the controller then the |
| 151 // notifier's timers are started. Otherwise, a fatal error is set on them. | 151 // notifier's timers are started. Otherwise, a fatal error is set on them. |
| 152 void handlePendingPermissionNotifiers(); | 152 void handlePendingPermissionNotifiers(); |
| 153 | 153 |
| 154 // Attempts to obtain a position for the given notifier, either by using | 154 // Attempts to obtain a position for the given notifier, either by using |
| 155 // the cached position or by requesting one from the controller. Sets a | 155 // the cached position or by requesting one from the controller. Sets a |
| 156 // fatal error if permission is denied or no position can be obtained. | 156 // fatal error if permission is denied or no position can be obtained. |
| 157 void startRequest(GeoNotifier*); | 157 void startRequest(GeoNotifier*); |
| 158 | 158 |
| 159 bool haveSuitableCachedPosition(PositionOptions*); | 159 bool haveSuitableCachedPosition(const PositionOptions&); |
| 160 | 160 |
| 161 // Runs the success callbacks for the set of notifiers awaiting a cached | 161 // Runs the success callbacks for the set of notifiers awaiting a cached |
| 162 // position, the set is then cleared. The oneshots are removed everywhere. | 162 // position, the set is then cleared. The oneshots are removed everywhere. |
| 163 void makeCachedPositionCallbacks(); | 163 void makeCachedPositionCallbacks(); |
| 164 | 164 |
| 165 // Record whether the origin trying to access Geolocation would be allowed | 165 // Record whether the origin trying to access Geolocation would be allowed |
| 166 // to access a feature that can only be accessed by secure origins. | 166 // to access a feature that can only be accessed by secure origins. |
| 167 // See http://goo.gl/lq4gCo | 167 // See http://goo.gl/lq4gCo |
| 168 void recordOriginTypeAccess() const; | 168 void recordOriginTypeAccess() const; |
| 169 | 169 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 Permission m_geolocationPermission; | 185 Permission m_geolocationPermission; |
| 186 | 186 |
| 187 GeoNotifierSet m_requestsAwaitingCachedPosition; | 187 GeoNotifierSet m_requestsAwaitingCachedPosition; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace blink | 190 } // namespace blink |
| 191 | 191 |
| 192 #endif // Geolocation_h | 192 #endif // Geolocation_h |
| OLD | NEW |