tor-browser

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

GeolocationIPCUtils.h (2508B)


      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_GeolocationIPCUtils_h
      8 #define mozilla_dom_GeolocationIPCUtils_h
      9 
     10 #include "ipc/EnumSerializer.h"
     11 
     12 namespace mozilla::dom::geolocation {
     13 
     14 enum class SystemGeolocationPermissionBehavior {
     15  // OS geolocation permission may be granted or not, but Gecko should not ask
     16  // the user for it.  Gecko may not even know if it already has geolocation
     17  // permission.  This value is used when Gecko is done asking the user for
     18  // permission, when Gecko doesn't have to ask the user because permission is
     19  // already granted, and when Gecko is running on a platform where it cannot
     20  // perform the system UX operations required to get permission (such as
     21  // opening system preferences).
     22  NoPrompt,
     23  // Gecko does not have OS geolocation permission.  The OS will ask the user
     24  // for location permission before responding to requests.
     25  SystemWillPromptUser,
     26  // Gecko does not have OS geolocation permission.  Gecko will open OS
     27  // preferences and ask the user to either grant location permission or to
     28  // cancel the request.  It will wait for an answer before responding to the
     29  // geolocation request.
     30  GeckoWillPromptUser,
     31  Last = GeckoWillPromptUser,
     32 };
     33 
     34 enum class GeolocationPermissionStatus {
     35  Canceled,
     36  Granted,
     37  Error,
     38  Last = Error
     39 };
     40 
     41 }  // namespace mozilla::dom::geolocation
     42 
     43 namespace IPC {
     44 
     45 template <>
     46 struct ParamTraits<
     47    mozilla::dom::geolocation::SystemGeolocationPermissionBehavior>
     48    : public ContiguousEnumSerializerInclusive<
     49          mozilla::dom::geolocation::SystemGeolocationPermissionBehavior,
     50          mozilla::dom::geolocation::SystemGeolocationPermissionBehavior::
     51              NoPrompt,
     52          mozilla::dom::geolocation::SystemGeolocationPermissionBehavior::
     53              Last> {};
     54 
     55 template <>
     56 struct ParamTraits<mozilla::dom::geolocation::GeolocationPermissionStatus>
     57    : public ContiguousEnumSerializerInclusive<
     58          mozilla::dom::geolocation::GeolocationPermissionStatus,
     59          mozilla::dom::geolocation::GeolocationPermissionStatus::Canceled,
     60          mozilla::dom::geolocation::GeolocationPermissionStatus::Last> {};
     61 
     62 }  // namespace IPC
     63 
     64 #endif /* mozilla_dom_GeolocationIPCUtils_h */