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 29 matching lines...) Expand all Loading... |
40 class GeolocationClient; | 40 class GeolocationClient; |
41 class GeolocationError; | 41 class GeolocationError; |
42 class GeolocationPosition; | 42 class GeolocationPosition; |
43 class Page; | 43 class Page; |
44 | 44 |
45 class GeolocationController FINAL : public Supplement<Page>, public PageLifecycl
eObserver { | 45 class GeolocationController FINAL : public Supplement<Page>, public PageLifecycl
eObserver { |
46 WTF_MAKE_NONCOPYABLE(GeolocationController); | 46 WTF_MAKE_NONCOPYABLE(GeolocationController); |
47 public: | 47 public: |
48 virtual ~GeolocationController(); | 48 virtual ~GeolocationController(); |
49 | 49 |
50 static PassOwnPtr<GeolocationController> create(Page*, GeolocationClient*); | 50 static PassOwnPtr<GeolocationController> create(Page&, GeolocationClient*); |
51 | 51 |
52 void addObserver(Geolocation*, bool enableHighAccuracy); | 52 void addObserver(Geolocation*, bool enableHighAccuracy); |
53 void removeObserver(Geolocation*); | 53 void removeObserver(Geolocation*); |
54 | 54 |
55 void requestPermission(Geolocation*); | 55 void requestPermission(Geolocation*); |
56 void cancelPermissionRequest(Geolocation*); | 56 void cancelPermissionRequest(Geolocation*); |
57 | 57 |
58 void positionChanged(GeolocationPosition*); | 58 void positionChanged(GeolocationPosition*); |
59 void errorOccurred(GeolocationError*); | 59 void errorOccurred(GeolocationError*); |
60 | 60 |
61 GeolocationPosition* lastPosition(); | 61 GeolocationPosition* lastPosition(); |
62 | 62 |
63 void setClientForTest(GeolocationClient*); | 63 void setClientForTest(GeolocationClient*); |
64 bool hasClientForTest() { return m_hasClientForTest; } | 64 bool hasClientForTest() { return m_hasClientForTest; } |
65 GeolocationClient* client() { return m_client; } | 65 GeolocationClient* client() { return m_client; } |
66 | 66 |
67 // Inherited from PageLifecycleObserver. | 67 // Inherited from PageLifecycleObserver. |
68 virtual void pageVisibilityChanged() OVERRIDE; | 68 virtual void pageVisibilityChanged() OVERRIDE; |
69 | 69 |
70 static const char* supplementName(); | 70 static const char* supplementName(); |
71 static GeolocationController* from(Page* page) { return static_cast<Geolocat
ionController*>(Supplement<Page>::from(page, supplementName())); } | 71 static GeolocationController* from(Page* page) { return static_cast<Geolocat
ionController*>(Supplement<Page>::from(page, supplementName())); } |
72 | 72 |
73 private: | 73 private: |
74 GeolocationController(Page*, GeolocationClient*); | 74 GeolocationController(Page&, GeolocationClient*); |
75 | 75 |
76 void startUpdatingIfNeeded(); | 76 void startUpdatingIfNeeded(); |
77 void stopUpdatingIfNeeded(); | 77 void stopUpdatingIfNeeded(); |
78 | 78 |
79 GeolocationClient* m_client; | 79 GeolocationClient* m_client; |
80 bool m_hasClientForTest; | 80 bool m_hasClientForTest; |
81 | 81 |
82 RefPtr<GeolocationPosition> m_lastPosition; | 82 RefPtr<GeolocationPosition> m_lastPosition; |
83 typedef WillBePersistentHeapHashSet<RefPtrWillBeMember<Geolocation> > Observ
ersSet; | 83 typedef WillBePersistentHeapHashSet<RefPtrWillBeMember<Geolocation> > Observ
ersSet; |
84 // All observers; both those requesting high accuracy and those not. | 84 // All observers; both those requesting high accuracy and those not. |
85 ObserversSet m_observers; | 85 ObserversSet m_observers; |
86 ObserversSet m_highAccuracyObservers; | 86 ObserversSet m_highAccuracyObservers; |
87 bool m_isClientUpdating; | 87 bool m_isClientUpdating; |
88 GeolocationInspectorAgent* m_inspectorAgent; | 88 GeolocationInspectorAgent* m_inspectorAgent; |
89 }; | 89 }; |
90 | 90 |
91 } // namespace WebCore | 91 } // namespace WebCore |
92 | 92 |
93 #endif // GeolocationController_h | 93 #endif // GeolocationController_h |
OLD | NEW |