Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 #include "wtf/Noncopyable.h" | 34 #include "wtf/Noncopyable.h" |
| 35 #include "wtf/RefPtr.h" | 35 #include "wtf/RefPtr.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 class GeolocationInspectorAgent; | 39 class GeolocationInspectorAgent; |
| 40 class GeolocationClient; | 40 class GeolocationClient; |
| 41 class GeolocationError; | 41 class GeolocationError; |
| 42 class GeolocationPosition; | 42 class GeolocationPosition; |
| 43 | 43 |
| 44 class GeolocationController FINAL : public NoBaseWillBeGarbageCollectedFinalized <GeolocationController>, public WillBeHeapSupplement<LocalFrame>, public PageLif ecycleObserver { | 44 class GeolocationController FINAL : public Supplement<LocalFrame>, public PageLi fecycleObserver { |
| 45 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(GeolocationController); | |
| 46 WTF_MAKE_NONCOPYABLE(GeolocationController); | 45 WTF_MAKE_NONCOPYABLE(GeolocationController); |
| 47 public: | 46 public: |
| 48 virtual ~GeolocationController(); | 47 virtual ~GeolocationController(); |
| 49 | 48 |
| 50 static PassOwnPtr<GeolocationController> create(LocalFrame&, GeolocationClie nt*); | 49 static PassOwnPtr<GeolocationController> create(LocalFrame&, GeolocationClie nt*); |
| 51 | 50 |
| 52 void addObserver(Geolocation*, bool enableHighAccuracy); | 51 void addObserver(Geolocation*, bool enableHighAccuracy); |
| 53 void removeObserver(Geolocation*); | 52 void removeObserver(Geolocation*); |
|
haraken
2014/06/04 01:03:19
jam@, michael@: I found that no one is calling rem
| |
| 54 | 53 |
| 55 void requestPermission(Geolocation*); | 54 void requestPermission(Geolocation*); |
| 56 void cancelPermissionRequest(Geolocation*); | 55 void cancelPermissionRequest(Geolocation*); |
| 57 | 56 |
| 58 void positionChanged(GeolocationPosition*); | 57 void positionChanged(GeolocationPosition*); |
| 59 void errorOccurred(GeolocationError*); | 58 void errorOccurred(GeolocationError*); |
| 60 | 59 |
| 61 GeolocationPosition* lastPosition(); | 60 GeolocationPosition* lastPosition(); |
| 62 | 61 |
| 63 void setClientForTest(GeolocationClient*); | 62 void setClientForTest(GeolocationClient*); |
| 64 bool hasClientForTest() { return m_hasClientForTest; } | 63 bool hasClientForTest() { return m_hasClientForTest; } |
| 65 GeolocationClient* client() { return m_client; } | 64 GeolocationClient* client() { return m_client; } |
| 66 | 65 |
| 67 // Inherited from PageLifecycleObserver. | 66 // Inherited from PageLifecycleObserver. |
| 68 virtual void pageVisibilityChanged() OVERRIDE; | 67 virtual void pageVisibilityChanged() OVERRIDE; |
| 69 | 68 |
| 70 static const char* supplementName(); | 69 static const char* supplementName(); |
| 71 static GeolocationController* from(LocalFrame* frame) { return static_cast<G eolocationController*>(WillBeHeapSupplement<LocalFrame>::from(frame, supplementN ame())); } | 70 static GeolocationController* from(LocalFrame* frame) { return static_cast<G eolocationController*>(Supplement<LocalFrame>::from(frame, supplementName())); } |
| 72 | |
| 73 virtual void trace(Visitor*) OVERRIDE; | |
| 74 | 71 |
| 75 virtual void willBeDestroyed() OVERRIDE; | 72 virtual void willBeDestroyed() OVERRIDE; |
| 76 | 73 |
| 77 private: | 74 private: |
| 78 GeolocationController(LocalFrame&, GeolocationClient*); | 75 GeolocationController(LocalFrame&, GeolocationClient*); |
| 79 | 76 |
| 80 void startUpdatingIfNeeded(); | 77 void startUpdatingIfNeeded(); |
| 81 void stopUpdatingIfNeeded(); | 78 void stopUpdatingIfNeeded(); |
| 82 | 79 |
| 83 GeolocationClient* m_client; | 80 GeolocationClient* m_client; |
| 84 bool m_hasClientForTest; | 81 bool m_hasClientForTest; |
| 85 | 82 |
| 86 RefPtrWillBeMember<GeolocationPosition> m_lastPosition; | 83 RefPtrWillBePersistent<GeolocationPosition> m_lastPosition; |
| 87 typedef WillBeHeapHashSet<RefPtrWillBeMember<Geolocation> > ObserversSet; | 84 typedef WillBePersistentHeapHashSet<RefPtrWillBeMember<Geolocation> > Observ ersSet; |
| 88 // All observers; both those requesting high accuracy and those not. | 85 // All observers; both those requesting high accuracy and those not. |
| 89 ObserversSet m_observers; | 86 ObserversSet m_observers; |
| 90 ObserversSet m_highAccuracyObservers; | 87 ObserversSet m_highAccuracyObservers; |
| 91 bool m_isClientUpdating; | 88 bool m_isClientUpdating; |
| 92 GeolocationInspectorAgent* m_inspectorAgent; | 89 GeolocationInspectorAgent* m_inspectorAgent; |
| 93 }; | 90 }; |
| 94 | 91 |
| 95 } // namespace WebCore | 92 } // namespace WebCore |
| 96 | 93 |
| 97 #endif // GeolocationController_h | 94 #endif // GeolocationController_h |
| OLD | NEW |