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