Index: chrome/browser/policy/device_status_location_helper.h |
diff --git a/chrome/browser/policy/device_status_location_helper.h b/chrome/browser/policy/device_status_location_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..81af0b2ca71c48b795a2c93f03f4324fa91a44c7 |
--- /dev/null |
+++ b/chrome/browser/policy/device_status_location_helper.h |
@@ -0,0 +1,60 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_ |
+#define CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_ |
+#pragma once |
+ |
+#include "base/timer.h" |
+#include "content/browser/geolocation/geolocation_provider.h" |
+ |
+class PrefService; |
+ |
+namespace policy { |
+ |
+// Helper class for retrieving the device's geographic location. |
+class DeviceStatusLocationHelper : public GeolocationObserver { |
+ public: |
+ explicit DeviceStatusLocationHelper(PrefService* local_state); |
+ void Destruct(); |
+ |
+ const Geoposition& GetPosition() const; |
+ |
+ static void RegisterPrefs(PrefService* local_state); |
+ |
+ virtual void OnLocationUpdate(const Geoposition& position) OVERRIDE; |
+ |
+ void SetGeolocationProviderForTest(GeolocationProvider* provider); |
+ |
+ 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
|
+ |
+ private: |
+ 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
|
+ virtual ~DeviceStatusLocationHelper(); |
+ |
+ void Init(const Geoposition& position); |
+ void DestructInternal(); |
+ |
+ void ScheduleUpdate(const Geoposition& position); |
+ |
+ void StartObserving(); |
+ void StopObserving(); |
+ |
+ void ReceiveUpdate(const Geoposition& position); |
+ |
+ // Used by UI thread only |
+ PrefService* local_state_; |
+ Geoposition position_; |
+ |
+ // Used by IO thread only |
+ base::OneShotTimer<DeviceStatusLocationHelper>* timer_; |
+ GeolocationProvider* provider_; |
+ bool observing_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DeviceStatusLocationHelper); |
+}; |
+ |
+} // namespace policy |
+ |
+#endif // CHROME_BROWSER_POLICY_DEVICE_LOCATION_HELPER_H_ |