summaryrefslogtreecommitdiffstats
path: root/content/port
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 17:03:58 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-09 17:03:58 +0000
commitf4a2c26de0fb821c38e6e25ceefb38c501dc5a84 (patch)
tree972da8c4aff388924c37746eb25e80f74a991f3f /content/port
parentc4bfd7670470f47f5e13ab1c7fa334ffa1445656 (diff)
downloadchromium_src-f4a2c26de0fb821c38e6e25ceefb38c501dc5a84.zip
chromium_src-f4a2c26de0fb821c38e6e25ceefb38c501dc5a84.tar.gz
chromium_src-f4a2c26de0fb821c38e6e25ceefb38c501dc5a84.tar.bz2
Move LocationProvider from content/public to content/port. This is only needed by new ports of content.
R=joi@chromium.org Review URL: https://codereview.chromium.org/18132014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210582 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/port')
-rw-r--r--content/port/browser/location_provider.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/content/port/browser/location_provider.h b/content/port/browser/location_provider.h
new file mode 100644
index 0000000..0dc61ef
--- /dev/null
+++ b/content/port/browser/location_provider.h
@@ -0,0 +1,58 @@
+// Copyright (c) 2013 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 CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_
+#define CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "content/public/common/geoposition.h"
+
+namespace content {
+
+class LocationProvider;
+
+// The interface for providing location information.
+class LocationProvider {
+ public:
+ virtual ~LocationProvider() {}
+
+ typedef base::Callback<void(const LocationProvider*, const Geoposition&)>
+ LocationProviderUpdateCallback;
+
+ // This callback will be used to notify when a new Geoposition becomes
+ // available.
+ virtual void SetUpdateCallback(
+ const LocationProviderUpdateCallback& callback) = 0;
+
+ // StartProvider maybe called multiple times, e.g. to alter the
+ // |high_accuracy| setting. Returns false if a fatal error was encountered
+ // which prevented the provider from starting.
+ virtual bool StartProvider(bool high_accuracy) = 0;
+
+ // Stops the provider from sending more requests.
+ // Important: a LocationProvider may be instantiated and StartProvider() may
+ // be called before the user has granted permission via OnPermissionGranted().
+ // This is to allow underlying providers to warm up, load their internal
+ // libraries, etc. No |LocationProviderUpdateCallback| can be run and no
+ // network requests can be done until OnPermissionGranted() has been called.
+ virtual void StopProvider() = 0;
+
+ // Gets the current best position estimate.
+ virtual void GetPosition(Geoposition* position) = 0;
+
+ // Provides a hint to the provider that new location data is needed as soon
+ // as possible.
+ virtual void RequestRefresh() = 0;
+
+ // Called everytime permission is granted to a page for using geolocation.
+ // This may either be through explicit user action (e.g. responding to the
+ // infobar prompt) or inferred from a persisted site permission.
+ // Note: See |StartProvider()| for more information.
+ virtual void OnPermissionGranted() = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PORT_BROWSER_LOCATION_PROVIDER_H_