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 __JumpListItem_h__
7 #define __JumpListItem_h__
11 #undef LogSeverity // SetupAPI.h #defines this as DWORD
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/LazyIdleThread.h"
15 #include "nsIJumpListItem.h" // defines nsIJumpListItem
16 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
20 #include "nsICryptoHash.h"
22 #include "nsCycleCollectionParticipant.h"
29 class JumpListItemBase
: public nsIJumpListItem
{
31 JumpListItemBase() : mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY
) {}
33 explicit JumpListItemBase(int32_t type
) : mItemType(type
) {}
35 NS_DECL_NSIJUMPLISTITEM
37 static const char kJumpListCacheDir
[];
40 virtual ~JumpListItemBase() {}
42 short Type() { return mItemType
; }
46 class JumpListItem
: public JumpListItemBase
{
50 using JumpListItemBase::JumpListItemBase
;
55 class JumpListSeparator
: public JumpListItemBase
, public nsIJumpListSeparator
{
56 ~JumpListSeparator() {}
60 : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR
) {}
63 NS_FORWARD_NSIJUMPLISTITEM(JumpListItemBase::)
65 static nsresult
GetSeparator(RefPtr
<IShellLinkW
>& aShellLink
);
68 class JumpListLink
: public JumpListItemBase
, public nsIJumpListLink
{
72 JumpListLink() : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_LINK
) {}
75 NS_IMETHOD
GetType(int16_t* aType
) override
{
76 return JumpListItemBase::GetType(aType
);
78 NS_IMETHOD
Equals(nsIJumpListItem
* item
, bool* _retval
) override
;
79 NS_DECL_NSIJUMPLISTLINK
81 static nsresult
GetShellItem(nsCOMPtr
<nsIJumpListItem
>& item
,
82 RefPtr
<IShellItem2
>& aShellItem
);
83 static nsresult
GetJumpListLink(IShellItem
* pItem
,
84 nsCOMPtr
<nsIJumpListLink
>& aLink
);
88 nsCOMPtr
<nsIURI
> mURI
;
89 nsCOMPtr
<nsICryptoHash
> mCryptoHash
;
92 class JumpListShortcut
: public JumpListItemBase
, public nsIJumpListShortcut
{
93 ~JumpListShortcut() {}
97 : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT
) {}
99 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
100 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut
, JumpListItemBase
)
101 NS_IMETHOD
GetType(int16_t* aType
) override
{
102 return JumpListItemBase::GetType(aType
);
104 NS_IMETHOD
Equals(nsIJumpListItem
* item
, bool* _retval
) override
;
105 NS_DECL_NSIJUMPLISTSHORTCUT
107 static nsresult
GetShellLink(nsCOMPtr
<nsIJumpListItem
>& item
,
108 RefPtr
<IShellLinkW
>& aShellLink
,
109 RefPtr
<LazyIdleThread
>& aIOThread
);
110 static nsresult
GetJumpListShortcut(IShellLinkW
* pLink
,
111 nsCOMPtr
<nsIJumpListShortcut
>& aShortcut
);
112 static nsresult
GetOutputIconPath(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
113 nsCOMPtr
<nsIFile
>& aICOFile
);
117 nsCOMPtr
<nsIURI
> mFaviconPageURI
;
118 nsCOMPtr
<nsILocalHandlerApp
> mHandlerApp
;
120 bool ExecutableExists(nsCOMPtr
<nsILocalHandlerApp
>& handlerApp
);
123 } // namespace widget
124 } // namespace mozilla
126 #endif /* __JumpListItem_h__ */