2009-10-07 01:42:45 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-10-07 01:42:45 +04:00
|
|
|
|
|
|
|
#ifndef __JumpListItem_h__
|
|
|
|
#define __JumpListItem_h__
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include <shobjidl.h>
|
2013-12-16 04:00:54 +04:00
|
|
|
#undef LogSeverity // SetupAPI.h #defines this as DWORD
|
2009-10-07 01:42:45 +04:00
|
|
|
|
2016-04-19 23:51:25 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2009-10-07 01:42:45 +04:00
|
|
|
#include "nsIJumpListItem.h" // defines nsIJumpListItem
|
|
|
|
#include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
|
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsIMutableArray.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsICryptoHash.h"
|
|
|
|
#include "nsString.h"
|
2010-03-18 13:59:10 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2009-10-07 01:42:45 +04:00
|
|
|
|
2011-09-06 23:11:28 +04:00
|
|
|
class nsIThread;
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
class JumpListItemBase : public nsIJumpListItem
|
2009-10-07 01:42:45 +04:00
|
|
|
{
|
|
|
|
public:
|
2016-12-13 10:56:34 +03:00
|
|
|
JumpListItemBase() :
|
2009-10-07 01:42:45 +04:00
|
|
|
mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY)
|
|
|
|
{}
|
|
|
|
|
2016-12-16 11:00:43 +03:00
|
|
|
explicit JumpListItemBase(int32_t type) :
|
2009-10-07 01:42:45 +04:00
|
|
|
mItemType(type)
|
|
|
|
{}
|
|
|
|
|
|
|
|
NS_DECL_NSIJUMPLISTITEM
|
|
|
|
|
2011-09-06 23:11:28 +04:00
|
|
|
static const char kJumpListCacheDir[];
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
protected:
|
2016-12-13 10:56:34 +03:00
|
|
|
virtual ~JumpListItemBase()
|
2014-07-15 22:56:36 +04:00
|
|
|
{}
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
short Type() { return mItemType; }
|
|
|
|
short mItemType;
|
2011-09-06 23:11:28 +04:00
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
};
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
class JumpListItem : public JumpListItemBase
|
|
|
|
{
|
|
|
|
~JumpListItem() {}
|
|
|
|
|
|
|
|
public:
|
|
|
|
using JumpListItemBase::JumpListItemBase;
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
};
|
|
|
|
|
|
|
|
class JumpListSeparator : public JumpListItemBase, public nsIJumpListSeparator
|
2009-10-07 01:42:45 +04:00
|
|
|
{
|
2014-07-16 00:39:45 +04:00
|
|
|
~JumpListSeparator() {}
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
public:
|
|
|
|
JumpListSeparator() :
|
2016-12-13 10:56:34 +03:00
|
|
|
JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR)
|
2009-10-07 01:42:45 +04:00
|
|
|
{}
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_FORWARD_NSIJUMPLISTITEM(JumpListItemBase::)
|
2009-10-07 01:42:45 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
static nsresult GetSeparator(RefPtr<IShellLinkW>& aShellLink);
|
2009-10-07 01:42:45 +04:00
|
|
|
};
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
class JumpListLink : public JumpListItemBase, public nsIJumpListLink
|
2009-10-07 01:42:45 +04:00
|
|
|
{
|
2014-07-16 00:39:22 +04:00
|
|
|
~JumpListLink() {}
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
public:
|
|
|
|
JumpListLink() :
|
2016-12-13 10:56:34 +03:00
|
|
|
JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_LINK)
|
2009-10-07 01:42:45 +04:00
|
|
|
{}
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_IMETHOD GetType(int16_t *aType) override { return JumpListItemBase::GetType(aType); }
|
2015-12-16 19:58:46 +03:00
|
|
|
NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override;
|
2009-10-07 01:42:45 +04:00
|
|
|
NS_DECL_NSIJUMPLISTLINK
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
static nsresult GetShellItem(nsCOMPtr<nsIJumpListItem>& item, RefPtr<IShellItem2>& aShellItem);
|
2009-10-07 01:42:45 +04:00
|
|
|
static nsresult GetJumpListLink(IShellItem *pItem, nsCOMPtr<nsIJumpListLink>& aLink);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsString mUriTitle;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
nsCOMPtr<nsICryptoHash> mCryptoHash;
|
|
|
|
};
|
|
|
|
|
2016-12-13 10:56:34 +03:00
|
|
|
class JumpListShortcut : public JumpListItemBase, public nsIJumpListShortcut
|
2009-10-07 01:42:45 +04:00
|
|
|
{
|
2014-07-16 00:41:28 +04:00
|
|
|
~JumpListShortcut() {}
|
|
|
|
|
2009-10-07 01:42:45 +04:00
|
|
|
public:
|
|
|
|
JumpListShortcut() :
|
2016-12-13 10:56:34 +03:00
|
|
|
JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT)
|
2009-10-07 01:42:45 +04:00
|
|
|
{}
|
|
|
|
|
2010-03-18 13:59:10 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2016-12-13 10:56:34 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItemBase)
|
|
|
|
NS_IMETHOD GetType(int16_t *aType) override { return JumpListItemBase::GetType(aType); }
|
2015-12-16 19:58:46 +03:00
|
|
|
NS_IMETHOD Equals(nsIJumpListItem *item, bool *_retval) override;
|
2009-10-07 01:42:45 +04:00
|
|
|
NS_DECL_NSIJUMPLISTSHORTCUT
|
|
|
|
|
2016-07-22 11:56:13 +03:00
|
|
|
static nsresult GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
|
|
|
|
RefPtr<IShellLinkW>& aShellLink,
|
2011-09-06 23:11:28 +04:00
|
|
|
nsCOMPtr<nsIThread> &aIOThread);
|
2009-10-07 01:42:45 +04:00
|
|
|
static nsresult GetJumpListShortcut(IShellLinkW *pLink, nsCOMPtr<nsIJumpListShortcut>& aShortcut);
|
2016-07-22 11:56:13 +03:00
|
|
|
static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI,
|
2011-09-06 23:11:28 +04:00
|
|
|
nsCOMPtr<nsIFile> &aICOFile);
|
2009-10-07 01:42:45 +04:00
|
|
|
|
|
|
|
protected:
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mIconIndex;
|
2011-09-06 23:11:28 +04:00
|
|
|
nsCOMPtr<nsIURI> mFaviconPageURI;
|
2009-10-07 01:42:45 +04:00
|
|
|
nsCOMPtr<nsILocalHandlerApp> mHandlerApp;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp);
|
2016-07-22 11:56:13 +03:00
|
|
|
static nsresult ObtainCachedIconFile(nsCOMPtr<nsIURI> aFaviconPageURI,
|
2011-09-06 23:11:28 +04:00
|
|
|
nsString &aICOFilePath,
|
|
|
|
nsCOMPtr<nsIThread> &aIOThread);
|
2016-07-22 11:56:13 +03:00
|
|
|
static nsresult CacheIconFileFromFaviconURIAsync(nsCOMPtr<nsIURI> aFaviconPageURI,
|
2011-09-06 23:11:28 +04:00
|
|
|
nsCOMPtr<nsIFile> aICOFile,
|
|
|
|
nsCOMPtr<nsIThread> &aIOThread);
|
2009-10-07 01:42:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif /* __JumpListItem_h__ */
|