2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-02-01 09:19:35 -08:00
|
|
|
/* vim: set ts=2 sw=2 et tw=79: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifndef nsHistory_h___
|
|
|
|
#define nsHistory_h___
|
|
|
|
|
2013-08-09 23:47:59 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "mozilla/ErrorResult.h"
|
2013-09-05 23:43:16 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2013-08-09 23:47:59 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMHistory.h"
|
2013-09-05 23:43:16 -07:00
|
|
|
#include "nsPIDOMWindow.h" // for GetParentObject
|
|
|
|
#include "nsStringFwd.h"
|
|
|
|
#include "nsWrapperCache.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIDocShell;
|
2013-09-05 23:43:16 -07:00
|
|
|
class nsISHistory;
|
|
|
|
class nsIWeakReference;
|
|
|
|
class nsPIDOMWindow;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Script "History" object
|
2013-08-09 23:47:59 -07:00
|
|
|
class nsHistory MOZ_FINAL : public nsIDOMHistory, // Empty, needed for extension
|
|
|
|
// backwards compat
|
|
|
|
public nsWrapperCache
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-08-09 23:47:59 -07:00
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsHistory)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit nsHistory(nsPIDOMWindow* aInnerWindow);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-09 23:47:59 -07:00
|
|
|
nsPIDOMWindow* GetParentObject() const;
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-09 23:47:59 -07:00
|
|
|
uint32_t GetLength(mozilla::ErrorResult& aRv) const;
|
2014-06-11 13:26:52 -07:00
|
|
|
void GetState(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
|
|
|
|
mozilla::ErrorResult& aRv) const;
|
2013-08-09 23:47:59 -07:00
|
|
|
void Go(int32_t aDelta, mozilla::ErrorResult& aRv);
|
|
|
|
void Back(mozilla::ErrorResult& aRv);
|
|
|
|
void Forward(mozilla::ErrorResult& aRv);
|
|
|
|
void PushState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
|
|
const nsAString& aTitle, const nsAString& aUrl,
|
|
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
void ReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
|
|
|
const nsAString& aTitle, const nsAString& aUrl,
|
|
|
|
mozilla::ErrorResult& aRv);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-09 23:47:59 -07:00
|
|
|
protected:
|
2014-06-23 12:56:07 -07:00
|
|
|
virtual ~nsHistory();
|
|
|
|
|
2013-09-05 23:43:16 -07:00
|
|
|
nsIDocShell* GetDocShell() const;
|
2011-02-01 09:19:35 -08:00
|
|
|
|
2013-08-23 17:23:37 -07:00
|
|
|
void PushOrReplaceState(JSContext* aCx, JS::Handle<JS::Value> aData,
|
2013-08-09 23:47:59 -07:00
|
|
|
const nsAString& aTitle, const nsAString& aUrl,
|
|
|
|
mozilla::ErrorResult& aRv, bool aReplace);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-08-09 23:47:59 -07:00
|
|
|
already_AddRefed<nsISHistory> GetSessionHistory() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-01 09:19:35 -08:00
|
|
|
nsCOMPtr<nsIWeakReference> mInnerWindow;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHistory_h___ */
|