docshell/shistory/ParentSHistory.h
author Tom Ritter <tom@mozilla.com>
Tue, 27 Nov 2018 14:44:34 -0600
changeset 451257 585f7d2135eeaddf35d239c909ef43ffa37fa860
parent 448947 6f3709b3878117466168c40affa7bca0b60cf75b
child 470936 47813ecb1f4e0244ded2f7b938430bf52c927751
permissions -rw-r--r--
Bug 1512921 - Bump clang to trunk 348970 for Windows builds. r=dmajor This removes several patches that have been upstreamed.

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/**
 * ParentSHistory is the ultimate source of truth for a browsing session's
 * history. It lives in the parent process and stores the complete view of
 * session history.
 *
 * NOTE: Currently session history is in transition, meaning that we're still
 * using the legacy nsSHistory class internally. This means that currently the
 * session history state lives in the content process, rather than in this
 * class.
 */

#ifndef mozilla_dom_ParentSHistory_h
#define mozilla_dom_ParentSHistory_h

#include "nsCOMPtr.h"
#include "mozilla/RefPtr.h"
#include "nsISHistory.h"
#include "mozilla/ErrorResult.h"
#include "nsWrapperCache.h"

class nsDocShell;

namespace mozilla {
namespace dom {

class TabParent;
class ChildSHistory;

class ParentSHistory : public nsISupports, public nsWrapperCache {
 public:
  friend class ChildSHistory;

  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ParentSHistory)
  nsISupports* GetParentObject() const;
  JSObject* WrapObject(JSContext* cx,
                       JS::Handle<JSObject*> aGivenProto) override;

  explicit ParentSHistory(nsFrameLoader* aFrameLoader);

  // XXX(nika): Implement
  int32_t Count() { return 0; }
  int32_t Index() { return 0; }

 private:
  nsDocShell* GetDocShell();
  TabParent* GetTabParent();

  already_AddRefed<ChildSHistory> GetChildIfSameProcess();

  virtual ~ParentSHistory();

  RefPtr<nsFrameLoader> mFrameLoader;
};

}  // namespace dom
}  // namespace mozilla

#endif /* mozilla_dom_ParentSHistory_h */