tor-browser

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

WindowsLocationParent.h (1703B)


      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_WindowsLocationParent_h__
      8 #define mozilla_dom_WindowsLocationParent_h__
      9 
     10 #include "mozilla/dom/PWindowsLocationParent.h"
     11 #include "nsCOMPtr.h"
     12 
     13 class nsGeoPosition;
     14 class nsIGeolocationUpdate;
     15 
     16 namespace mozilla::dom {
     17 
     18 class WindowsLocationProvider;
     19 
     20 // Geolocation actor in main process.
     21 // This may receive messages asynchronously, even after it sends Unregister
     22 // to the child.
     23 class WindowsLocationParent final : public PWindowsLocationParent {
     24  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WindowsLocationParent, override);
     25 
     26  using IPCResult = ::mozilla::ipc::IPCResult;
     27 
     28  explicit WindowsLocationParent(WindowsLocationProvider* aProvider)
     29      : mProvider(aProvider) {}
     30 
     31  // Update geolocation with new position information.
     32  IPCResult RecvUpdate(RefPtr<nsIDOMGeoPosition> aGeoPosition);
     33 
     34  // A failure occurred.  This may be translated into a
     35  // nsIGeolocationUpdate::NotifyError or may be ignored if the MLS fallback
     36  // is available.
     37  IPCResult RecvFailed(uint16_t err);
     38 
     39  void ActorDestroy(ActorDestroyReason aReason) override;
     40 
     41  // After this, the actor will simply ignore any incoming messages.
     42  void DetachFromLocationProvider() { mProvider = nullptr; }
     43 
     44 private:
     45  ~WindowsLocationParent() override = default;
     46 
     47  WindowsLocationProvider* mProvider;
     48 };
     49 
     50 }  // namespace mozilla::dom
     51 
     52 #endif  // mozilla_dom_WindowsLocationParent_h__