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__
12 #include "nsIJumpListItem.h" // defines nsIJumpListItem
13 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
15 #include "nsIMutableArray.h"
17 #include "nsAutoPtr.h"
19 #include "nsICryptoHash.h"
21 #include "nsCycleCollectionParticipant.h"
28 class JumpListItem
: public nsIJumpListItem
32 mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY
)
35 JumpListItem(int32_t type
) :
39 virtual ~JumpListItem()
43 NS_DECL_NSIJUMPLISTITEM
45 static const char kJumpListCacheDir
[];
48 short Type() { return mItemType
; }
53 class JumpListSeparator
: public JumpListItem
, public nsIJumpListSeparator
57 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR
)
60 NS_DECL_ISUPPORTS_INHERITED
61 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
62 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
) { return JumpListItem::Equals(item
, _retval
); }
64 static nsresult
GetSeparator(nsRefPtr
<IShellLinkW
>& aShellLink
);
67 class JumpListLink
: public JumpListItem
, public nsIJumpListLink
71 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_LINK
)
74 NS_DECL_ISUPPORTS_INHERITED
75 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
76 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
);
77 NS_DECL_NSIJUMPLISTLINK
79 static nsresult
GetShellItem(nsCOMPtr
<nsIJumpListItem
>& item
, nsRefPtr
<IShellItem2
>& aShellItem
);
80 static nsresult
GetJumpListLink(IShellItem
*pItem
, nsCOMPtr
<nsIJumpListLink
>& aLink
);
84 nsCOMPtr
<nsIURI
> mURI
;
85 nsCOMPtr
<nsICryptoHash
> mCryptoHash
;
88 class JumpListShortcut
: public JumpListItem
, public nsIJumpListShortcut
92 JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT
)
95 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
96 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut
, JumpListItem
)
97 NS_IMETHOD
GetType(int16_t *aType
) { return JumpListItem::GetType(aType
); }
98 NS_IMETHOD
Equals(nsIJumpListItem
*item
, bool *_retval
);
99 NS_DECL_NSIJUMPLISTSHORTCUT
101 static nsresult
GetShellLink(nsCOMPtr
<nsIJumpListItem
>& item
,
102 nsRefPtr
<IShellLinkW
>& aShellLink
,
103 nsCOMPtr
<nsIThread
> &aIOThread
);
104 static nsresult
GetJumpListShortcut(IShellLinkW
*pLink
, nsCOMPtr
<nsIJumpListShortcut
>& aShortcut
);
105 static nsresult
GetOutputIconPath(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
106 nsCOMPtr
<nsIFile
> &aICOFile
);
110 nsCOMPtr
<nsIURI
> mFaviconPageURI
;
111 nsCOMPtr
<nsILocalHandlerApp
> mHandlerApp
;
113 bool ExecutableExists(nsCOMPtr
<nsILocalHandlerApp
>& handlerApp
);
114 static nsresult
ObtainCachedIconFile(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
115 nsString
&aICOFilePath
,
116 nsCOMPtr
<nsIThread
> &aIOThread
);
117 static nsresult
CacheIconFileFromFaviconURIAsync(nsCOMPtr
<nsIURI
> aFaviconPageURI
,
118 nsCOMPtr
<nsIFile
> aICOFile
,
119 nsCOMPtr
<nsIThread
> &aIOThread
);
122 } // namespace widget
123 } // namespace mozilla
125 #endif /* __JumpListItem_h__ */