Bug 1861709 replace AudioCallbackDriver::ThreadRunning() assertions that mean to...
[gecko.git] / widget / windows / JumpListItem.h
blobb02fc7ebfd8575f6b6f6a86a0c096e9c692a1060
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 "mozilla/RefPtr.h"
14 #include "mozilla/LazyIdleThread.h"
15 #include "nsIJumpListItem.h" // defines nsIJumpListItem
16 #include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
17 #include "nsTArray.h"
18 #include "nsCOMPtr.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 JumpListItemBase : public nsIJumpListItem {
30 public:
31 JumpListItemBase() : mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY) {}
33 explicit JumpListItemBase(int32_t type) : mItemType(type) {}
35 NS_DECL_NSIJUMPLISTITEM
37 static const char kJumpListCacheDir[];
39 protected:
40 virtual ~JumpListItemBase() {}
42 short Type() { return mItemType; }
43 short mItemType;
46 class JumpListItem : public JumpListItemBase {
47 ~JumpListItem() {}
49 public:
50 using JumpListItemBase::JumpListItemBase;
52 NS_DECL_ISUPPORTS
55 class JumpListSeparator : public JumpListItemBase, public nsIJumpListSeparator {
56 ~JumpListSeparator() {}
58 public:
59 JumpListSeparator()
60 : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR) {}
62 NS_DECL_ISUPPORTS
63 NS_FORWARD_NSIJUMPLISTITEM(JumpListItemBase::)
65 static nsresult GetSeparator(RefPtr<IShellLinkW>& aShellLink);
68 class JumpListLink : public JumpListItemBase, public nsIJumpListLink {
69 ~JumpListLink() {}
71 public:
72 JumpListLink() : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_LINK) {}
74 NS_DECL_ISUPPORTS
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);
86 protected:
87 nsString mUriTitle;
88 nsCOMPtr<nsIURI> mURI;
89 nsCOMPtr<nsICryptoHash> mCryptoHash;
92 class JumpListShortcut : public JumpListItemBase, public nsIJumpListShortcut {
93 ~JumpListShortcut() {}
95 public:
96 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);
115 protected:
116 int32_t mIconIndex;
117 nsCOMPtr<nsIURI> mFaviconPageURI;
118 nsCOMPtr<nsILocalHandlerApp> mHandlerApp;
120 bool ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp);
123 } // namespace widget
124 } // namespace mozilla
126 #endif /* __JumpListItem_h__ */