| 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..b93c0f9e8bdf51288f161f6accf9cc2889eb8a3b
|
| --- /dev/null
|
| +++ b/chrome/browser/policy/device_status_location_helper.h
|
| @@ -0,0 +1,68 @@
|
| +// 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/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/timer.h"
|
| +#include "content/browser/geolocation/geolocation_observer.h"
|
| +#include "content/common/geoposition.h"
|
| +
|
| +class GeolocationProvider;
|
| +class PrefService;
|
| +
|
| +namespace base {
|
| +template<typename Type> class DeleteHelper;
|
| +}
|
| +
|
| +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 = 30 * 60;
|
| +
|
| + private:
|
| + friend class base::DeleteHelper<DeviceStatusLocationHelper>;
|
| + 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_
|
|
|