Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: chrome/browser/geolocation/geolocation_observer.h

Issue 6591034: Move core pieces of geolocation from chrome to content.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix Linux build Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 CHROME_BROWSER_GEOLOCATION_GEOLOCATION_OBSERVER_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_OBSERVER_H_
7 #pragma once
8
9 struct Geoposition;
10
11 // This interface is implemented by observers of GeolocationProvider as
12 // well as GeolocationProvider itself as an observer of GeolocationArbitrator.
13 class GeolocationObserver {
14 public:
15 // This will be called whenever the 'best available' location is updated,
16 // or when an error is encountered meaning no location data will be
17 // available in the forseeable future.
18 virtual void OnLocationUpdate(const Geoposition& position) = 0;
19
20 protected:
21 GeolocationObserver() {}
22 virtual ~GeolocationObserver() {}
23
24 private:
25 DISALLOW_COPY_AND_ASSIGN(GeolocationObserver);
26 };
27
28 struct GeolocationObserverOptions {
29 GeolocationObserverOptions() : use_high_accuracy(false) {}
30 explicit GeolocationObserverOptions(bool high_accuracy)
31 : use_high_accuracy(high_accuracy) {}
32
33 // Given a map<ANYTHING, GeolocationObserverOptions> this function will
34 // iterate the map and collapse all the options found to a single instance
35 // that satisfies them all.
36 template <typename MAP>
37 static GeolocationObserverOptions Collapse(const MAP& options_map) {
38 for (typename MAP::const_iterator it = options_map.begin();
39 it != options_map.end(); ++it) {
40 if (it->second.use_high_accuracy)
41 return GeolocationObserverOptions(true);
42 }
43 return GeolocationObserverOptions(false);
44 }
45
46 bool use_high_accuracy;
47 };
48
49 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698