tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GeolocationSystem.h (1934B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_GeolocationSystem_h
      8 #define mozilla_dom_GeolocationSystem_h
      9 
     10 #include "GeolocationIPCUtils.h"
     11 #include "mozilla/dom/PContentParent.h"
     12 
     13 namespace mozilla::dom {
     14 
     15 class BrowsingContext;
     16 
     17 namespace geolocation {
     18 
     19 /**
     20 * Get the behavior that Gecko should perform when the user asks for
     21 * geolocation.  The result isn't guaranteed to be accurate on all platforms
     22 * (for example, some may prompt the user for permission without Gecko's
     23 * knowledge).  It is, however, guaranteed to be sensible.  For example, this
     24 * will never return "SystemWillPromptUser" if that is not true, nor will it
     25 * return "GeckoWillPromptUser" if Gecko doesn't know how to open OS settings.
     26 */
     27 SystemGeolocationPermissionBehavior GetGeolocationPermissionBehavior();
     28 
     29 class SystemGeolocationPermissionRequest {
     30 public:
     31  NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
     32 
     33  // Stop watching for permission
     34  virtual void Stop() = 0;
     35 
     36 protected:
     37  virtual ~SystemGeolocationPermissionRequest() = default;
     38 };
     39 
     40 using ParentRequestResolver =
     41    PContentParent::RequestGeolocationPermissionFromUserResolver;
     42 
     43 /**
     44 * Opens the relevant system dialog to request permission from the user.
     45 * Resolves aResolver when permission is granted, an error occurs, or Stop has
     46 * been called on the SystemGeolocationPermissionRequest.
     47 */
     48 already_AddRefed<SystemGeolocationPermissionRequest>
     49 RequestLocationPermissionFromUser(BrowsingContext* aBrowsingContext,
     50                                  ParentRequestResolver&& aResolver);
     51 
     52 }  // namespace geolocation
     53 }  // namespace mozilla::dom
     54 
     55 #endif /* mozilla_dom_GeolocationSystem_h */