docshell/shistory/ParentSHistory.h
author Dan Glastonbury <dan.glastonbury@gmail.com>
Thu, 21 Jun 2018 17:40:12 +1000
changeset 809474 454fa24f3a805a3db32218ec2689e2078b10374d
parent 780299 47c477fefd3b83f5888a558b546a92d525d1cbd1
permissions -rw-r--r--
Bug 1467621 - P3: Add test for shadow-like color transitions on top of color transitions. r?xidorn MozReview-Commit-ID: H6fxubFjNg6

/* -*- 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 */