mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
105
dom/base/GroupedSHistory.h
Normal file
105
dom/base/GroupedSHistory.h
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#ifndef GroupedSHistory_h
|
||||
#define GroupedSHistory_h
|
||||
|
||||
#include "nsIFrameLoader.h"
|
||||
#include "nsIGroupedSHistory.h"
|
||||
#include "nsIPartialSHistory.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
||||
/**
|
||||
* GroupedSHistory connects session histories across multiple frameloaders.
|
||||
* Each frameloader has a PartialSHistory, and GroupedSHistory has an array
|
||||
* refering to all participating PartialSHistory(s).
|
||||
*
|
||||
* The following figure illustrates the idea. In this case, the GroupedSHistory
|
||||
* is composed of 3 frameloaders, and the active one is frameloader 1.
|
||||
* GroupedSHistory is always attached to the active frameloader.
|
||||
*
|
||||
* +----------------------------------------------------+
|
||||
* | |
|
||||
* | v
|
||||
* +------------------+ +-------------------+ +-----------------+
|
||||
* | FrameLoader 1 | | PartialSHistory 1 | | GroupedSHistory |
|
||||
* | (active) |----->| (active) |<--+---| |
|
||||
* +------------------+ +-------------------+ | +-----------------+
|
||||
* |
|
||||
* +------------------+ +-------------------+ |
|
||||
* | FrameLoader 2 | | PartialSHistory 2 | |
|
||||
* | (inactive) |----->| (inactive) |<--+
|
||||
* +------------------+ +-------------------+ |
|
||||
* |
|
||||
* +------------------+ +-------------------+ |
|
||||
* | FrameLoader 3 | | PartialSHistory 3 | |
|
||||
* | (inactive) |----->| (inactive) |<--+
|
||||
* +------------------+ +-------------------+
|
||||
*
|
||||
* If a history navigation leads to frameloader 3, it becomes the active one,
|
||||
* and GroupedSHistory is re-attached to frameloader 3.
|
||||
*
|
||||
* +------------------+ +-------------------+
|
||||
* | FrameLoader 1 | | PartialSHistory 1 |
|
||||
* | (inactive) |----->| (inactive) |<--+
|
||||
* +------------------+ +-------------------+ |
|
||||
* |
|
||||
* +------------------+ +-------------------+ |
|
||||
* | FrameLoader 2 | | PartialSHistory 2 | |
|
||||
* | (inactive) |----->| (inactive) |<--+
|
||||
* +------------------+ +-------------------+ |
|
||||
* |
|
||||
* +------------------+ +-------------------+ | +-----------------+
|
||||
* | FrameLoader 3 | | PartialSHistory 3 | | | GroupedSHistory |
|
||||
* | (active) |----->| (active) |<--+---| |
|
||||
* +------------------+ +-------------------+ +-----------------+
|
||||
* | ^
|
||||
* | |
|
||||
* +----------------------------------------------------+
|
||||
*/
|
||||
class GroupedSHistory final : public nsIGroupedSHistory
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(GroupedSHistory)
|
||||
NS_DECL_NSIGROUPEDSHISTORY
|
||||
GroupedSHistory();
|
||||
|
||||
/**
|
||||
* Get the value of preference "browser.groupedhistory.enabled" to determine
|
||||
* if grouped session history should be enabled.
|
||||
*/
|
||||
static bool GroupedHistoryEnabled();
|
||||
|
||||
private:
|
||||
~GroupedSHistory() {}
|
||||
|
||||
/**
|
||||
* Remove all partial histories and close tabs after the given index (of
|
||||
* mPartialHistories, not the index of session history entries).
|
||||
*/
|
||||
void PurgePartialHistories(uint32_t aLastPartialIndexToKeep);
|
||||
|
||||
// The total number of entries in all partial histories.
|
||||
uint32_t mCount;
|
||||
|
||||
// The index of currently active partial history in mPartialHistories.
|
||||
// Use int32_t as we have invalid index and nsCOMArray also uses int32_t.
|
||||
int32_t mIndexOfActivePartialHistory;
|
||||
|
||||
// All participating nsIPartialSHistory objects.
|
||||
nsCOMArray<nsIPartialSHistory> mPartialHistories;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* GroupedSHistory_h */
|
||||
Loading…
Add table
Add a link
Reference in a new issue