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

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. 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/timer.h"
10 #include "content/browser/geolocation/geolocation_provider.h"
11
12 class PrefService;
13
14 namespace policy {
15
16 // Helper class for retrieving the device's geographic location.
17 class DeviceStatusLocationHelper : public GeolocationObserver {
18 public:
19 explicit DeviceStatusLocationHelper(PrefService* local_state);
20 void Destruct();
21
22 const Geoposition& GetPosition() const;
23
24 static void RegisterPrefs(PrefService* local_state);
25
26 virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE;
27
28 void SetGeolocationProviderForTest(GeolocationProvider* provider);
29
30 static const unsigned int kPollIntervalSeconds = 1800;
joth 2012/04/23 10:05:14 nit: could write this as = 30 * kSecondsPerMinute
bartfab (slow) 2012/04/23 12:21:28 How about = 30 * 60 instead? time.h has various co
31
32 private:
33 friend class base::DeleteHelper<DeviceStatusLocationHelper>;
Joao da Silva 2012/04/20 14:21:09 #include "base/sequenced_task_runner_helpers.h" fo
bartfab (slow) 2012/04/23 09:48:54 A forward declaration should actually be sufficien
34 virtual ~DeviceStatusLocationHelper();
35
36 void Init(const Geoposition& position);
37 void DestructInternal();
38
39 void ScheduleUpdate(const Geoposition& position);
40
41 void StartObserving();
42 void StopObserving();
43
44 void ReceiveUpdate(const Geoposition& position);
45
46 // Used by UI thread only
47 PrefService* local_state_;
48 Geoposition position_;
49
50 // Used by IO thread only
51 base::OneShotTimer<DeviceStatusLocationHelper>* timer_;
52 GeolocationProvider* provider_;
53 bool observing_;
54
55 DISALLOW_COPY_AND_ASSIGN(DeviceStatusLocationHelper);
56 };
57
58 } // namespace policy
59
60 #endif // CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698