/src/mozilla-central/docshell/shistory/ParentSHistory.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #include "mozilla/dom/ParentSHistory.h" |
8 | | #include "mozilla/dom/ParentSHistoryBinding.h" |
9 | | #include "mozilla/dom/TabParent.h" |
10 | | #include "nsDocShell.h" |
11 | | #include "nsFrameLoader.h" |
12 | | #include "nsXULAppAPI.h" |
13 | | |
14 | | namespace mozilla { |
15 | | namespace dom { |
16 | | |
17 | | ParentSHistory::ParentSHistory(nsFrameLoader* aFrameLoader) |
18 | | : mFrameLoader(aFrameLoader) |
19 | 0 | { |
20 | 0 | MOZ_ASSERT(XRE_IsParentProcess()); |
21 | 0 | } |
22 | | |
23 | | ParentSHistory::~ParentSHistory() |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | nsDocShell* |
28 | | ParentSHistory::GetDocShell() |
29 | 0 | { |
30 | 0 | return nsDocShell::Cast(mFrameLoader->GetExistingDocShell()); |
31 | 0 | } |
32 | | |
33 | | TabParent* |
34 | | ParentSHistory::GetTabParent() |
35 | 0 | { |
36 | 0 | return static_cast<TabParent*>(mFrameLoader->GetRemoteBrowser()); |
37 | 0 | } |
38 | | |
39 | | already_AddRefed<ChildSHistory> |
40 | | ParentSHistory::GetChildIfSameProcess() |
41 | 0 | { |
42 | 0 | if (GetDocShell()) { |
43 | 0 | return GetDocShell()->GetSessionHistory(); |
44 | 0 | } |
45 | 0 | |
46 | 0 | return nullptr; |
47 | 0 | } |
48 | | |
49 | 0 | NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ParentSHistory) |
50 | 0 | NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY |
51 | 0 | NS_INTERFACE_MAP_ENTRY(nsISupports) |
52 | 0 | NS_INTERFACE_MAP_END |
53 | | |
54 | | NS_IMPL_CYCLE_COLLECTING_ADDREF(ParentSHistory) |
55 | | NS_IMPL_CYCLE_COLLECTING_RELEASE(ParentSHistory) |
56 | | |
57 | | NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ParentSHistory, |
58 | | mFrameLoader) |
59 | | |
60 | | JSObject* |
61 | | ParentSHistory::WrapObject(JSContext* cx, JS::Handle<JSObject*> aGivenProto) |
62 | 0 | { |
63 | 0 | return ParentSHistory_Binding::Wrap(cx, this, aGivenProto); |
64 | 0 | } |
65 | | |
66 | | nsISupports* |
67 | | ParentSHistory::GetParentObject() const |
68 | 0 | { |
69 | 0 | return mFrameLoader; |
70 | 0 | } |
71 | | |
72 | | } // namespace dom |
73 | | } // namespace mozilla |