Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / widget / windows / LegacyJumpListBuilder.h
blob1d96773c47a8219f4793544ac9d32fad6edc52c1
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 __LegacyJumpListBuilder_h__
7 #define __LegacyJumpListBuilder_h__
9 #include <windows.h>
11 // Needed for various com interfaces
12 #include <shobjidl.h>
13 #undef LogSeverity // SetupAPI.h #defines this as DWORD
15 #include "nsString.h"
17 #include "nsILegacyJumpListBuilder.h"
18 #include "nsILegacyJumpListItem.h"
19 #include "LegacyJumpListItem.h"
20 #include "nsIObserver.h"
21 #include "nsTArray.h"
22 #include "mozilla/Attributes.h"
23 #include "mozilla/LazyIdleThread.h"
24 #include "mozilla/mscom/AgileReference.h"
25 #include "mozilla/ReentrantMonitor.h"
27 namespace mozilla {
28 namespace widget {
30 namespace detail {
31 class DoneCommitListBuildCallback;
32 } // namespace detail
34 class LegacyJumpListBuilder : public nsILegacyJumpListBuilder,
35 public nsIObserver {
36 virtual ~LegacyJumpListBuilder();
38 public:
39 NS_DECL_THREADSAFE_ISUPPORTS
40 NS_DECL_NSILEGACYJUMPLISTBUILDER
41 NS_DECL_NSIOBSERVER
43 LegacyJumpListBuilder();
45 protected:
46 static Atomic<bool> sBuildingList;
48 private:
49 mscom::AgileReference<ICustomDestinationList> mJumpListMgr
50 MOZ_GUARDED_BY(mMonitor);
51 uint32_t mMaxItems MOZ_GUARDED_BY(mMonitor);
52 bool mHasCommit;
53 RefPtr<LazyIdleThread> mIOThread;
54 ReentrantMonitor mMonitor;
55 nsString mAppUserModelId;
57 bool IsSeparator(nsCOMPtr<nsILegacyJumpListItem>& item);
58 void RemoveIconCacheAndGetJumplistShortcutURIs(IObjectArray* aObjArray,
59 nsTArray<nsString>& aURISpecs);
60 void DeleteIconFromDisk(const nsAString& aPath);
61 nsresult RemoveIconCacheForAllItems();
62 void DoCommitListBuild(RefPtr<detail::DoneCommitListBuildCallback> aCallback);
63 void DoInitListBuild(RefPtr<dom::Promise>&& aPromise);
65 friend class WinTaskbar;
68 } // namespace widget
69 } // namespace mozilla
71 #endif /* __LegacyJumpListBuilder_h__ */