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 "nsIJumpListItem.h" // defines nsIJumpListItem
14 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
16 #include "nsIMutableArray.h"
18 #include "nsAutoPtr.h"
20 #include "nsICryptoHash.h"
22 #include "nsCycleCollectionParticipant.h"
29 class JumpListItem
: public nsIJumpListItem
33 mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY
)
36 JumpListItem(int32_t type
) :
41 NS_DECL_NSIJUMPLISTITEM
43 static const char kJumpListCacheDir
[];
46 virtual ~JumpListItem()
49 short Type() { return mItemType
; }
54 class JumpListSeparator
: public JumpListItem
, public nsIJumpListSeparator
56 ~JumpListSeparator() {}
60 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR
)
63 NS_DECL_ISUPPORTS_INHERITED
64 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
65 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
) { return JumpListItem::Equals(item
, _retval
); }
67 static nsresult
GetSeparator(nsRefPtr
<IShellLinkW
>& aShellLink
);
70 class JumpListLink
: public JumpListItem
, public nsIJumpListLink
76 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_LINK
)
79 NS_DECL_ISUPPORTS_INHERITED
80 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
81 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
);
82 NS_DECL_NSIJUMPLISTLINK
84 static nsresult
GetShellItem(nsCOMPtr
<nsIJumpListItem
>& item
, nsRefPtr
<IShellItem2
>& aShellItem
);
85 static nsresult
GetJumpListLink(IShellItem
*pItem
, nsCOMPtr
<nsIJumpListLink
>& aLink
);
89 nsCOMPtr
<nsIURI
> mURI
;
90 nsCOMPtr
<nsICryptoHash
> mCryptoHash
;
93 class JumpListShortcut
: public JumpListItem
, public nsIJumpListShortcut
95 ~JumpListShortcut() {}
99 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT
)
102 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
103 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut
, JumpListItem
)
104 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
105 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
);
106 NS_DECL_NSIJUMPLISTSHORTCUT
108 static nsresult
GetShellLink(nsCOMPtr
<nsIJumpListItem
>& item
,
109 nsRefPtr
<IShellLinkW
>& aShellLink
,
110 nsCOMPtr
<nsIThread
> &aIOThread
);
111 static nsresult
GetJumpListShortcut(IShellLinkW
*pLink
, 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
);
121 static nsresult
ObtainCachedIconFile(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
122 nsString
&aICOFilePath
,
123 nsCOMPtr
<nsIThread
> &aIOThread
);
124 static nsresult
CacheIconFileFromFaviconURIAsync(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
125 nsCOMPtr
<nsIFile
> aICOFile
,
126 nsCOMPtr
<nsIThread
> &aIOThread
);
129 } // namespace widget
130 } // namespace mozilla
132 #endif /* __JumpListItem_h__ */