chromium/services/device/public/mojom/geolocation_context.mojom

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module device.mojom;

import "services/device/public/mojom/geolocation.mojom";
import "services/device/public/mojom/geolocation_client_id.mojom";
import "services/device/public/mojom/geoposition.mojom";
import "url/mojom/url.mojom";
import "url/mojom/origin.mojom";

// GeolocationContext provides methods to bind Geolocation instance and to
// set/clear overrides of geoposition that will apply to all Geolocation
// instances created by this context.
interface GeolocationContext {
  // Creates a Geolocation instance bound to `receiver`.
  // `requesting_url` is the URL of the top-level frame that made the request.
  BindGeolocation(pending_receiver<Geolocation> receiver,
                  url.mojom.Url requesting_url,
                  GeolocationClientId client_id);

  // Called when an origin has lost permission to access geolocation.
  // Unbinds all Geolocation instances that were bound from the origin.
  OnPermissionRevoked(url.mojom.Origin origin);

  // Enables geolocation override. This method can be used to trigger possible
  // location-specific behavior in GeolocationImpl created by this
  // GeolocationContext.
  SetOverride(GeopositionResult result);

  // Disables geolocation override.
  ClearOverride();
};