1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef GECKOVIEWHISTORY_H 6 #define GECKOVIEWHISTORY_H 7 8 #include "mozilla/BaseHistory.h" 9 #include "nsTObserverArray.h" 10 #include "nsURIHashKey.h" 11 #include "nsINamed.h" 12 #include "nsITimer.h" 13 #include "nsIURI.h" 14 15 #include "mozilla/StaticPtr.h" 16 17 class nsIWidget; 18 19 namespace mozilla { 20 namespace dom { 21 class Document; 22 } 23 } // namespace mozilla 24 25 struct VisitedURI { 26 nsCOMPtr<nsIURI> mURI; 27 bool mVisited = false; 28 }; 29 30 class GeckoViewHistory final : public mozilla::BaseHistory { 31 public: 32 NS_DECL_ISUPPORTS 33 34 // IHistory 35 NS_IMETHOD VisitURI(nsIWidget*, nsIURI*, nsIURI* aLastVisitedURI, 36 uint32_t aFlags) final; 37 NS_IMETHOD SetURITitle(nsIURI*, const nsAString&) final; 38 39 static already_AddRefed<GeckoViewHistory> GetSingleton(); 40 41 void StartPendingVisitedQueries(PendingVisitedQueries&&) final; 42 43 GeckoViewHistory(); 44 45 void QueryVisitedState(nsIWidget* aWidget, 46 mozilla::dom::ContentParent* aInterestedProcess, 47 nsTArray<RefPtr<nsIURI>>&& aURIs); 48 void HandleVisitedState(const nsTArray<VisitedURI>& aVisitedURIs, 49 ContentParentSet* aInterestedProcesses); 50 51 private: 52 virtual ~GeckoViewHistory(); 53 54 void QueryVisitedStateInContentProcess(const PendingVisitedQueries&); 55 void QueryVisitedStateInParentProcess(const PendingVisitedQueries&); 56 57 static mozilla::StaticRefPtr<GeckoViewHistory> sHistory; 58 }; 59 60 #endif 61