michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __JumpListItem_h__ michael@0: #define __JumpListItem_h__ michael@0: michael@0: #include michael@0: #include michael@0: #undef LogSeverity // SetupAPI.h #defines this as DWORD michael@0: michael@0: #include "nsIJumpListItem.h" // defines nsIJumpListItem michael@0: #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp michael@0: #include "nsTArray.h" michael@0: #include "nsIMutableArray.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsIURI.h" michael@0: #include "nsICryptoHash.h" michael@0: #include "nsString.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: class nsIThread; michael@0: michael@0: namespace mozilla { michael@0: namespace widget { michael@0: michael@0: class JumpListItem : public nsIJumpListItem michael@0: { michael@0: public: michael@0: JumpListItem() : michael@0: mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY) michael@0: {} michael@0: michael@0: JumpListItem(int32_t type) : michael@0: mItemType(type) michael@0: {} michael@0: michael@0: virtual ~JumpListItem() michael@0: {} michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIJUMPLISTITEM michael@0: michael@0: static const char kJumpListCacheDir[]; michael@0: michael@0: protected: michael@0: short Type() { return mItemType; } michael@0: short mItemType; michael@0: michael@0: }; michael@0: michael@0: class JumpListSeparator : public JumpListItem, public nsIJumpListSeparator michael@0: { michael@0: public: michael@0: JumpListSeparator() : michael@0: JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR) michael@0: {} michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_IMETHOD GetType(int16_t *aType) { return JumpListItem::GetType(aType); } michael@0: NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) { return JumpListItem::Equals(item, _retval); } michael@0: michael@0: static nsresult GetSeparator(nsRefPtr& aShellLink); michael@0: }; michael@0: michael@0: class JumpListLink : public JumpListItem, public nsIJumpListLink michael@0: { michael@0: public: michael@0: JumpListLink() : michael@0: JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_LINK) michael@0: {} michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_IMETHOD GetType(int16_t *aType) { return JumpListItem::GetType(aType); } michael@0: NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval); michael@0: NS_DECL_NSIJUMPLISTLINK michael@0: michael@0: static nsresult GetShellItem(nsCOMPtr& item, nsRefPtr& aShellItem); michael@0: static nsresult GetJumpListLink(IShellItem *pItem, nsCOMPtr& aLink); michael@0: michael@0: protected: michael@0: nsString mUriTitle; michael@0: nsCOMPtr mURI; michael@0: nsCOMPtr mCryptoHash; michael@0: }; michael@0: michael@0: class JumpListShortcut : public JumpListItem, public nsIJumpListShortcut michael@0: { michael@0: public: michael@0: JumpListShortcut() : michael@0: JumpListItem(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT) michael@0: {} michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItem) michael@0: NS_IMETHOD GetType(int16_t *aType) { return JumpListItem::GetType(aType); } michael@0: NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval); michael@0: NS_DECL_NSIJUMPLISTSHORTCUT michael@0: michael@0: static nsresult GetShellLink(nsCOMPtr& item, michael@0: nsRefPtr& aShellLink, michael@0: nsCOMPtr &aIOThread); michael@0: static nsresult GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr& aShortcut); michael@0: static nsresult GetOutputIconPath(nsCOMPtr aFaviconPageURI, michael@0: nsCOMPtr &aICOFile); michael@0: michael@0: protected: michael@0: int32_t mIconIndex; michael@0: nsCOMPtr mFaviconPageURI; michael@0: nsCOMPtr mHandlerApp; michael@0: michael@0: bool ExecutableExists(nsCOMPtr& handlerApp); michael@0: static nsresult ObtainCachedIconFile(nsCOMPtr aFaviconPageURI, michael@0: nsString &aICOFilePath, michael@0: nsCOMPtr &aIOThread); michael@0: static nsresult CacheIconFileFromFaviconURIAsync(nsCOMPtr aFaviconPageURI, michael@0: nsCOMPtr aICOFile, michael@0: nsCOMPtr &aIOThread); michael@0: }; michael@0: michael@0: } // namespace widget michael@0: } // namespace mozilla michael@0: michael@0: #endif /* __JumpListItem_h__ */