Bumping manifests a=b2g-bump
[gecko.git] / widget / windows / JumpListItem.h
blobfc033c2a546e7999957446668fc65780d32dcb4d
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__
9 #include <windows.h>
10 #include <shobjidl.h>
11 #undef LogSeverity // SetupAPI.h #defines this as DWORD
13 #include "nsIJumpListItem.h" // defines nsIJumpListItem
14 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
15 #include "nsTArray.h"
16 #include "nsIMutableArray.h"
17 #include "nsCOMPtr.h"
18 #include "nsAutoPtr.h"
19 #include "nsIURI.h"
20 #include "nsICryptoHash.h"
21 #include "nsString.h"
22 #include "nsCycleCollectionParticipant.h"
24 class nsIThread;
26 namespace mozilla {
27 namespace widget {
29 class JumpListItem : public nsIJumpListItem
31 public:
32 JumpListItem() :
33 mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY)
36 JumpListItem(int32_t type) :
37 mItemType(type)
40 NS_DECL_ISUPPORTS
41 NS_DECL_NSIJUMPLISTITEM
43 static const char kJumpListCacheDir[];
45 protected:
46 virtual ~JumpListItem()
49 short Type() { return mItemType; }
50 short mItemType;
54 class JumpListSeparator : public JumpListItem, public nsIJumpListSeparator
56 ~JumpListSeparator() {}
58 public:
59 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
72 ~JumpListLink() {}
74 public:
75 JumpListLink() :
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);
87 protected:
88 nsString mUriTitle;
89 nsCOMPtr<nsIURI> mURI;
90 nsCOMPtr<nsICryptoHash> mCryptoHash;
93 class JumpListShortcut : public JumpListItem, public nsIJumpListShortcut
95 ~JumpListShortcut() {}
97 public:
98 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);
115 protected:
116 int32_t mIconIndex;
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__ */