Home | History | Annotate | Download | only in geolocation
      1 // Copyright 2014 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef GeolocationWatchers_h
      6 #define GeolocationWatchers_h
      7 
      8 #include "platform/heap/Handle.h"
      9 
     10 namespace blink {
     11 
     12 class GeoNotifier;
     13 
     14 class GeolocationWatchers {
     15     DISALLOW_ALLOCATION();
     16 
     17 public:
     18     GeolocationWatchers() { }
     19     void trace(Visitor*);
     20 
     21     bool add(int id, GeoNotifier*);
     22     GeoNotifier* find(int id);
     23     void remove(int id);
     24     void remove(GeoNotifier*);
     25     bool contains(GeoNotifier*) const;
     26     void clear();
     27     bool isEmpty() const;
     28 
     29     void getNotifiersVector(HeapVector<Member<GeoNotifier> >&) const;
     30 
     31 private:
     32     typedef HeapHashMap<int, Member<GeoNotifier> > IdToNotifierMap;
     33     typedef HeapHashMap<Member<GeoNotifier>, int> NotifierToIdMap;
     34 
     35     IdToNotifierMap m_idToNotifierMap;
     36     NotifierToIdMap m_notifierToIdMap;
     37 };
     38 
     39 } // namespace blink
     40 
     41 #endif // GeolocationWatchers_h
     42