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

Side by Side Diff: chrome/browser/policy/device_status_location_helper.h

Issue 10103029: Add device location reporting (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments addressed. Also added lots of includes to IWYU. Created 8 years, 8 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_POLICY_DEVICE_LOCATION_HELPER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/timer.h"
12 #include "content/browser/geolocation/geolocation_observer.h"
13 #include "content/common/geoposition.h"
14
15 class GeolocationProvider;
16 class PrefService;
17
18 namespace base {
19 template<typename Type> class DeleteHelper;
20 }
21
22 namespace policy {
23
24 // Helper class for retrieving the device's geographic location.
25 class DeviceStatusLocationHelper : public GeolocationObserver {
26 public:
27 explicit DeviceStatusLocationHelper(PrefService* local_state);
28 void Destruct();
29
30 const Geoposition& GetPosition() const;
31
32 static void RegisterPrefs(PrefService* local_state);
33
34 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE;
35
36 void SetGeolocationProviderForTest(GeolocationProvider* provider);
37
38 static const unsigned int kPollIntervalSeconds = 1800;
39
40 private:
41 friend class base::DeleteHelper<DeviceStatusLocationHelper>;
42 virtual ~DeviceStatusLocationHelper();
43
44 void Init(const Geoposition& position);
45 void DestructInternal();
46
47 void ScheduleUpdate(const Geoposition& position);
48
49 void StartObserving();
50 void StopObserving();
51
52 void ReceiveUpdate(const Geoposition& position);
53
54 // Used by UI thread only
55 PrefService* local_state_;
56 Geoposition position_;
57
58 // Used by IO thread only
59 base::OneShotTimer<DeviceStatusLocationHelper>* timer_;
60 GeolocationProvider* provider_;
61 bool observing_;
62
63 DISALLOW_COPY_AND_ASSIGN(DeviceStatusLocationHelper);
64 };
65
66 } // namespace policy
67
68 #endif // CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698