1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef __LegacyJumpListItem_h__
7 #define __LegacyJumpListItem_h__
11 #undef LogSeverity // SetupAPI.h #defines this as DWORD
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/LazyIdleThread.h"
15 #include "nsILegacyJumpListItem.h" // defines nsILegacyJumpListItem
16 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
20 #include "nsICryptoHash.h"
22 #include "nsCycleCollectionParticipant.h"
29 class LegacyJumpListItemBase
: public nsILegacyJumpListItem
{
31 LegacyJumpListItemBase()
32 : mItemType(nsILegacyJumpListItem::JUMPLIST_ITEM_EMPTY
) {}
34 explicit LegacyJumpListItemBase(int32_t type
) : mItemType(type
) {}
36 NS_DECL_NSILEGACYJUMPLISTITEM
38 static const char kJumpListCacheDir
[];
41 virtual ~LegacyJumpListItemBase() {}
43 short Type() { return mItemType
; }
47 class LegacyJumpListItem
: public LegacyJumpListItemBase
{
48 ~LegacyJumpListItem() {}
51 using LegacyJumpListItemBase::LegacyJumpListItemBase
;
56 class LegacyJumpListSeparator
: public LegacyJumpListItemBase
,
57 public nsILegacyJumpListSeparator
{
58 ~LegacyJumpListSeparator() {}
61 LegacyJumpListSeparator()
62 : LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_SEPARATOR
) {
66 NS_FORWARD_NSILEGACYJUMPLISTITEM(LegacyJumpListItemBase::)
68 static nsresult
GetSeparator(RefPtr
<IShellLinkW
>& aShellLink
);
71 class LegacyJumpListLink
: public LegacyJumpListItemBase
,
72 public nsILegacyJumpListLink
{
73 ~LegacyJumpListLink() {}
77 : LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_LINK
) {}
80 NS_IMETHOD
GetType(int16_t* aType
) override
{
81 return LegacyJumpListItemBase::GetType(aType
);
83 NS_IMETHOD
Equals(nsILegacyJumpListItem
* item
, bool* _retval
) override
;
84 NS_DECL_NSILEGACYJUMPLISTLINK
86 static nsresult
GetShellItem(nsCOMPtr
<nsILegacyJumpListItem
>& item
,
87 RefPtr
<IShellItem2
>& aShellItem
);
88 static nsresult
GetJumpListLink(IShellItem
* pItem
,
89 nsCOMPtr
<nsILegacyJumpListLink
>& aLink
);
93 nsCOMPtr
<nsIURI
> mURI
;
94 nsCOMPtr
<nsICryptoHash
> mCryptoHash
;
97 class LegacyJumpListShortcut
: public LegacyJumpListItemBase
,
98 public nsILegacyJumpListShortcut
{
99 ~LegacyJumpListShortcut() {}
102 LegacyJumpListShortcut()
103 : LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_SHORTCUT
) {}
105 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
106 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(LegacyJumpListShortcut
,
107 LegacyJumpListItemBase
)
108 NS_IMETHOD
GetType(int16_t* aType
) override
{
109 return LegacyJumpListItemBase::GetType(aType
);
111 NS_IMETHOD
Equals(nsILegacyJumpListItem
* item
, bool* _retval
) override
;
112 NS_DECL_NSILEGACYJUMPLISTSHORTCUT
114 static nsresult
GetShellLink(nsCOMPtr
<nsILegacyJumpListItem
>& item
,
115 RefPtr
<IShellLinkW
>& aShellLink
,
116 RefPtr
<LazyIdleThread
>& aIOThread
);
117 static nsresult
GetJumpListShortcut(
118 IShellLinkW
* pLink
, nsCOMPtr
<nsILegacyJumpListShortcut
>& aShortcut
);
119 static nsresult
GetOutputIconPath(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
120 nsCOMPtr
<nsIFile
>& aICOFile
);
124 nsCOMPtr
<nsIURI
> mFaviconPageURI
;
125 nsCOMPtr
<nsILocalHandlerApp
> mHandlerApp
;
127 bool ExecutableExists(nsCOMPtr
<nsILocalHandlerApp
>& handlerApp
);
130 } // namespace widget
131 } // namespace mozilla
133 #endif /* __LegacyJumpListItem_h__ */