зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1529276 - Rename the old Windows jump list mechanism to LegacyJumpListBuilder. r=mhowell,bhearsum,win-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D181674
This commit is contained in:
Родитель
41f7486e5f
Коммит
fb7f92f4a0
|
@ -387,9 +387,9 @@ var Builder = class {
|
|||
handlerApp.detailedDescription = description;
|
||||
handlerApp.appendParameter(args);
|
||||
|
||||
var item = Cc["@mozilla.org/windows-jumplistshortcut;1"].createInstance(
|
||||
Ci.nsIJumpListShortcut
|
||||
);
|
||||
var item = Cc[
|
||||
"@mozilla.org/windows-legacyjumplistshortcut;1"
|
||||
].createInstance(Ci.nsILegacyJumpListShortcut);
|
||||
item.app = handlerApp;
|
||||
item.iconIndex = iconIndex;
|
||||
item.faviconPageUri = faviconPageUri;
|
||||
|
@ -533,8 +533,8 @@ export var WinTaskbarJumpList = {
|
|||
*/
|
||||
|
||||
_initTaskbar: function WTBJL__initTaskbar() {
|
||||
var builder = lazy._taskbarService.createJumpListBuilder(false);
|
||||
var pbBuilder = lazy._taskbarService.createJumpListBuilder(true);
|
||||
var builder = lazy._taskbarService.createLegacyJumpListBuilder(false);
|
||||
var pbBuilder = lazy._taskbarService.createLegacyJumpListBuilder(true);
|
||||
if (!builder || !builder.available || !pbBuilder || !pbBuilder.available) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -79,8 +79,8 @@ elif toolkit == "gtk":
|
|||
]
|
||||
elif toolkit == "windows":
|
||||
XPIDL_SOURCES += [
|
||||
"nsIJumpListBuilder.idl",
|
||||
"nsIJumpListItem.idl",
|
||||
"nsILegacyJumpListBuilder.idl",
|
||||
"nsILegacyJumpListItem.idl",
|
||||
"nsIPrintSettingsWin.idl",
|
||||
"nsITaskbarOverlayIconController.idl",
|
||||
"nsITaskbarPreview.idl",
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
interface nsIArray;
|
||||
|
||||
[scriptable, function, uuid(5131a62a-e99f-4631-9138-751f8aad1ae4)]
|
||||
interface nsIJumpListCommittedCallback : nsISupports
|
||||
interface nsILegacyJumpListCommittedCallback : nsISupports
|
||||
{
|
||||
void done(in boolean result);
|
||||
};
|
||||
|
||||
[scriptable, uuid(1FE6A9CD-2B18-4dd5-A176-C2B32FA4F683)]
|
||||
interface nsIJumpListBuilder : nsISupports
|
||||
interface nsILegacyJumpListBuilder : nsISupports
|
||||
{
|
||||
/**
|
||||
* JumpLists
|
||||
|
@ -33,13 +33,13 @@ interface nsIJumpListBuilder : nsISupports
|
|||
*
|
||||
* Users may remove items from jump lists after they are commited. The system
|
||||
* tracks removed items between commits. A list of these items is returned by
|
||||
* a call to initListBuild. nsIJumpListBuilder does not filter entries added that
|
||||
* a call to initListBuild. nsILegacyJumpListBuilder does not filter entries added that
|
||||
* have been removed since the last commit. To prevent repeatedly adding entries
|
||||
* users have removed, applications are encoraged to track removed items
|
||||
* internally.
|
||||
*
|
||||
* Each list is made up of an array of nsIJumpListItem representing items
|
||||
* such as shortcuts, links, and separators. See nsIJumpListItem for information
|
||||
* Each list is made up of an array of nsILegacyJumpListItem representing items
|
||||
* such as shortcuts, links, and separators. See nsILegacyJumpListItem for information
|
||||
* on adding additional jump list types.
|
||||
*/
|
||||
|
||||
|
@ -119,7 +119,7 @@ interface nsIJumpListBuilder : nsISupports
|
|||
* @param aCatType
|
||||
* The type of list to add.
|
||||
* @param items
|
||||
* An array of nsIJumpListItem items to add to the list.
|
||||
* An array of nsILegacyJumpListItem items to add to the list.
|
||||
* @param catName
|
||||
* For custom lists, the title of the list.
|
||||
*
|
||||
|
@ -145,7 +145,7 @@ interface nsIJumpListBuilder : nsISupports
|
|||
* Receives one argument, which is true if the operation completed
|
||||
* successfully, otherwise it is false.
|
||||
*/
|
||||
void commitListBuild([optional] in nsIJumpListCommittedCallback callback);
|
||||
void commitListBuild([optional] in nsILegacyJumpListCommittedCallback callback);
|
||||
|
||||
/**
|
||||
* Deletes any currently applied taskbar jump list for this application.
|
|
@ -20,7 +20,7 @@ interface nsIMutableArray;
|
|||
*/
|
||||
|
||||
[scriptable, uuid(ACB8FB3C-E1B0-4044-8A50-E52C3E7C1057)]
|
||||
interface nsIJumpListItem : nsISupports
|
||||
interface nsILegacyJumpListItem : nsISupports
|
||||
{
|
||||
const short JUMPLIST_ITEM_EMPTY = 0; // Empty list item
|
||||
const short JUMPLIST_ITEM_SEPARATOR = 1; // Separator
|
||||
|
@ -42,7 +42,7 @@ interface nsIJumpListItem : nsISupports
|
|||
* link: type, uri, title
|
||||
* shortcut: type, handler app
|
||||
*/
|
||||
boolean equals(in nsIJumpListItem item);
|
||||
boolean equals(in nsILegacyJumpListItem item);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -50,7 +50,7 @@ interface nsIJumpListItem : nsISupports
|
|||
*/
|
||||
|
||||
[scriptable, uuid(69A2D5C5-14DC-47da-925D-869E0BD64D27)]
|
||||
interface nsIJumpListSeparator : nsIJumpListItem
|
||||
interface nsILegacyJumpListSeparator : nsILegacyJumpListItem
|
||||
{
|
||||
/* nothing needed here */
|
||||
};
|
||||
|
@ -63,7 +63,7 @@ interface nsIJumpListSeparator : nsIJumpListItem
|
|||
*/
|
||||
|
||||
[scriptable, uuid(76EA47B1-C797-49b3-9F18-5E740A688524)]
|
||||
interface nsIJumpListLink : nsIJumpListItem
|
||||
interface nsILegacyJumpListLink : nsILegacyJumpListItem
|
||||
{
|
||||
/**
|
||||
* Set or get the uri for this link item.
|
||||
|
@ -97,7 +97,7 @@ interface nsIJumpListLink : nsIJumpListItem
|
|||
*/
|
||||
|
||||
[scriptable, uuid(CBE3A37C-BCE1-4fec-80A5-5FFBC7F33EEA)]
|
||||
interface nsIJumpListShortcut : nsIJumpListItem
|
||||
interface nsILegacyJumpListShortcut : nsILegacyJumpListItem
|
||||
{
|
||||
/**
|
||||
* Set or get the handler app for this shortcut item.
|
|
@ -14,7 +14,7 @@ interface nsITaskbarWindowPreview;
|
|||
interface nsITaskbarPreviewController;
|
||||
interface nsITaskbarProgress;
|
||||
interface nsITaskbarOverlayIconController;
|
||||
interface nsIJumpListBuilder;
|
||||
interface nsILegacyJumpListBuilder;
|
||||
interface mozIDOMWindow;
|
||||
|
||||
/*
|
||||
|
@ -46,7 +46,7 @@ interface mozIDOMWindow;
|
|||
* http://msdn.microsoft.com/en-us/library/dd391697%28VS.85%29.aspx
|
||||
*
|
||||
* Applications may also define custom taskbar jump lists on application shortcuts.
|
||||
* See nsIJumpListBuilder for more information.
|
||||
* See nsILegacyJumpListBuilder for more information.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(11751471-9246-4c72-a80f-0c7df765d640)]
|
||||
|
@ -120,16 +120,17 @@ interface nsIWinTaskbar : nsISupports
|
|||
*/
|
||||
|
||||
/**
|
||||
* Retrieve a taskbar jump list builder
|
||||
* Retrieve a legacy taskbar jump list builder. This jump list builder backend
|
||||
* is in the process of being phased out.
|
||||
*
|
||||
* Fails if a jump list build operation has already been initiated, developers
|
||||
* should make use of a single instance of nsIJumpListBuilder for building lists
|
||||
* should make use of a single instance of nsILegacyJumpListBuilder for building lists
|
||||
* within an application.
|
||||
*
|
||||
* @throw NS_ERROR_ALREADY_INITIALIZED if an nsIJumpListBuilder instance is
|
||||
* @throws NS_ERROR_ALREADY_INITIALIZED if an nsILegacyJumpListBuilder instance is
|
||||
* currently building a list.
|
||||
*/
|
||||
nsIJumpListBuilder createJumpListBuilder(in boolean aPrivateBrowsing);
|
||||
nsILegacyJumpListBuilder createLegacyJumpListBuilder(in boolean aPrivateBrowsing);
|
||||
|
||||
/**
|
||||
* Application window taskbar group settings
|
||||
|
|
|
@ -231,7 +231,7 @@
|
|||
}
|
||||
|
||||
// {73A5946F-608D-454f-9D33-0B8F8C7294B6}
|
||||
#define NS_WIN_JUMPLISTBUILDER_CID \
|
||||
#define NS_WIN_LEGACYJUMPLISTBUILDER_CID \
|
||||
{ \
|
||||
0x73a5946f, 0x608d, 0x454f, { \
|
||||
0x9d, 0x33, 0xb, 0x8f, 0x8c, 0x72, 0x94, 0xb6 \
|
||||
|
@ -239,7 +239,7 @@
|
|||
}
|
||||
|
||||
// {2B9A1F2C-27CE-45b6-8D4E-755D0E34F8DB}
|
||||
#define NS_WIN_JUMPLISTITEM_CID \
|
||||
#define NS_WIN_LEGACYJUMPLISTITEM_CID \
|
||||
{ \
|
||||
0x2b9a1f2c, 0x27ce, 0x45b6, { \
|
||||
0x8d, 0x4e, 0x75, 0x5d, 0x0e, 0x34, 0xf8, 0xdb \
|
||||
|
@ -247,7 +247,7 @@
|
|||
}
|
||||
|
||||
// {21F1F13B-F75A-42ad-867A-D91AD694447E}
|
||||
#define NS_WIN_JUMPLISTSEPARATOR_CID \
|
||||
#define NS_WIN_LEGACYJUMPLISTSEPARATOR_CID \
|
||||
{ \
|
||||
0x21f1f13b, 0xf75a, 0x42ad, { \
|
||||
0x86, 0x7a, 0xd9, 0x1a, 0xd6, 0x94, 0x44, 0x7e \
|
||||
|
@ -255,7 +255,7 @@
|
|||
}
|
||||
|
||||
// {F72C5DC4-5A12-47be-BE28-AB105F33B08F}
|
||||
#define NS_WIN_JUMPLISTLINK_CID \
|
||||
#define NS_WIN_LEGACYJUMPLISTLINK_CID \
|
||||
{ \
|
||||
0xf72c5dc4, 0x5a12, 0x47be, { \
|
||||
0xbe, 0x28, 0xab, 0x10, 0x5f, 0x33, 0xb0, 0x8f \
|
||||
|
@ -263,7 +263,7 @@
|
|||
}
|
||||
|
||||
// {B16656B2-5187-498f-ABF4-56346126BFDB}
|
||||
#define NS_WIN_JUMPLISTSHORTCUT_CID \
|
||||
#define NS_WIN_LEGACYJUMPLISTSHORTCUT_CID \
|
||||
{ \
|
||||
0xb16656b2, 0x5187, 0x498f, { \
|
||||
0xab, 0xf4, 0x56, 0x34, 0x61, 0x26, 0xbf, 0xdb \
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
// This tests taskbar jump list functionality available on win7 and up.
|
||||
|
||||
function test_basics() {
|
||||
var item = Cc["@mozilla.org/windows-jumplistitem;1"].createInstance(
|
||||
Ci.nsIJumpListItem
|
||||
var item = Cc["@mozilla.org/windows-legacyjumplistitem;1"].createInstance(
|
||||
Ci.nsILegacyJumpListItem
|
||||
);
|
||||
|
||||
var sep = Cc["@mozilla.org/windows-jumplistseparator;1"].createInstance(
|
||||
Ci.nsIJumpListSeparator
|
||||
var sep = Cc["@mozilla.org/windows-legacyjumplistseparator;1"].createInstance(
|
||||
Ci.nsILegacyJumpListSeparator
|
||||
);
|
||||
|
||||
var shortcut = Cc["@mozilla.org/windows-jumplistshortcut;1"].createInstance(
|
||||
Ci.nsIJumpListShortcut
|
||||
);
|
||||
var shortcut = Cc[
|
||||
"@mozilla.org/windows-legacyjumplistshortcut;1"
|
||||
].createInstance(Ci.nsILegacyJumpListShortcut);
|
||||
|
||||
var link = Cc["@mozilla.org/windows-jumplistlink;1"].createInstance(
|
||||
Ci.nsIJumpListLink
|
||||
var link = Cc["@mozilla.org/windows-legacyjumplistlink;1"].createInstance(
|
||||
Ci.nsILegacyJumpListLink
|
||||
);
|
||||
|
||||
Assert.ok(!item.equals(sep));
|
||||
|
@ -47,16 +47,16 @@ function test_basics() {
|
|||
function test_separator() {
|
||||
// separators:
|
||||
|
||||
var item = Cc["@mozilla.org/windows-jumplistseparator;1"].createInstance(
|
||||
Ci.nsIJumpListSeparator
|
||||
);
|
||||
var item = Cc[
|
||||
"@mozilla.org/windows-legacyjumplistseparator;1"
|
||||
].createInstance(Ci.nsILegacyJumpListSeparator);
|
||||
|
||||
Assert.ok(item.type == Ci.nsIJumpListItem.JUMPLIST_ITEM_SEPARATOR);
|
||||
Assert.ok(item.type == Ci.nsILegacyJumpListItem.JUMPLIST_ITEM_SEPARATOR);
|
||||
}
|
||||
|
||||
function test_hashes() {
|
||||
var link = Cc["@mozilla.org/windows-jumplistlink;1"].createInstance(
|
||||
Ci.nsIJumpListLink
|
||||
var link = Cc["@mozilla.org/windows-legacyjumplistlink;1"].createInstance(
|
||||
Ci.nsILegacyJumpListLink
|
||||
);
|
||||
var uri1 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
|
@ -108,11 +108,11 @@ function test_hashes() {
|
|||
|
||||
function test_links() {
|
||||
// links:
|
||||
var link1 = Cc["@mozilla.org/windows-jumplistlink;1"].createInstance(
|
||||
Ci.nsIJumpListLink
|
||||
var link1 = Cc["@mozilla.org/windows-legacyjumplistlink;1"].createInstance(
|
||||
Ci.nsILegacyJumpListLink
|
||||
);
|
||||
var link2 = Cc["@mozilla.org/windows-jumplistlink;1"].createInstance(
|
||||
Ci.nsIJumpListLink
|
||||
var link2 = Cc["@mozilla.org/windows-legacyjumplistlink;1"].createInstance(
|
||||
Ci.nsILegacyJumpListLink
|
||||
);
|
||||
|
||||
var uri1 = Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
|
@ -144,8 +144,8 @@ function test_links() {
|
|||
|
||||
function test_shortcuts() {
|
||||
// shortcuts:
|
||||
var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"].createInstance(
|
||||
Ci.nsIJumpListShortcut
|
||||
var sc = Cc["@mozilla.org/windows-legacyjumplistshortcut;1"].createInstance(
|
||||
Ci.nsILegacyJumpListShortcut
|
||||
);
|
||||
|
||||
var handlerApp = Cc[
|
||||
|
@ -178,7 +178,7 @@ function test_shortcuts() {
|
|||
}
|
||||
}
|
||||
|
||||
async function test_jumplist() {
|
||||
async function test_legacyjumplist() {
|
||||
// Jump lists can't register links unless the application is the default
|
||||
// protocol handler for the protocol of the link, so we skip off testing
|
||||
// those in these tests. We'll init the jump list for the xpc shell harness,
|
||||
|
@ -196,7 +196,7 @@ async function test_jumplist() {
|
|||
// Since we're only testing the general functionality of the JumpListBuilder
|
||||
// et. al, we can just test the non-private browsing version.
|
||||
// (The only difference between the two at this level is the App User Model ID.)
|
||||
var builder = taskbar.createJumpListBuilder(false);
|
||||
var builder = taskbar.createLegacyJumpListBuilder(false);
|
||||
|
||||
Assert.notEqual(builder, null);
|
||||
|
||||
|
@ -215,8 +215,8 @@ async function test_jumplist() {
|
|||
|
||||
var items = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
|
||||
var sc = Cc["@mozilla.org/windows-jumplistshortcut;1"].createInstance(
|
||||
Ci.nsIJumpListShortcut
|
||||
var sc = Cc["@mozilla.org/windows-legacyjumplistshortcut;1"].createInstance(
|
||||
Ci.nsILegacyJumpListShortcut
|
||||
);
|
||||
|
||||
var handlerApp = Cc[
|
||||
|
@ -279,4 +279,4 @@ function run_test() {
|
|||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(test_jumplist);
|
||||
add_task(test_legacyjumplist);
|
|
@ -1,7 +1,7 @@
|
|||
[DEFAULT]
|
||||
head =
|
||||
|
||||
[test_taskbar_jumplistitems.js]
|
||||
[test_taskbar_legacyjumplistitems.js]
|
||||
skip-if =
|
||||
os == "win"
|
||||
[test_macsharingservice.js]
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __JumpListItem_h__
|
||||
#define __JumpListItem_h__
|
||||
|
||||
#include <windows.h>
|
||||
#include <shobjidl.h>
|
||||
#undef LogSeverity // SetupAPI.h #defines this as DWORD
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "nsIJumpListItem.h" // defines nsIJumpListItem
|
||||
#include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsICryptoHash.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsIThread;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class JumpListItemBase : public nsIJumpListItem {
|
||||
public:
|
||||
JumpListItemBase() : mItemType(nsIJumpListItem::JUMPLIST_ITEM_EMPTY) {}
|
||||
|
||||
explicit JumpListItemBase(int32_t type) : mItemType(type) {}
|
||||
|
||||
NS_DECL_NSIJUMPLISTITEM
|
||||
|
||||
static const char kJumpListCacheDir[];
|
||||
|
||||
protected:
|
||||
virtual ~JumpListItemBase() {}
|
||||
|
||||
short Type() { return mItemType; }
|
||||
short mItemType;
|
||||
};
|
||||
|
||||
class JumpListItem : public JumpListItemBase {
|
||||
~JumpListItem() {}
|
||||
|
||||
public:
|
||||
using JumpListItemBase::JumpListItemBase;
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
|
||||
class JumpListSeparator : public JumpListItemBase, public nsIJumpListSeparator {
|
||||
~JumpListSeparator() {}
|
||||
|
||||
public:
|
||||
JumpListSeparator()
|
||||
: JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_NSIJUMPLISTITEM(JumpListItemBase::)
|
||||
|
||||
static nsresult GetSeparator(RefPtr<IShellLinkW>& aShellLink);
|
||||
};
|
||||
|
||||
class JumpListLink : public JumpListItemBase, public nsIJumpListLink {
|
||||
~JumpListLink() {}
|
||||
|
||||
public:
|
||||
JumpListLink() : JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_LINK) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD GetType(int16_t* aType) override {
|
||||
return JumpListItemBase::GetType(aType);
|
||||
}
|
||||
NS_IMETHOD Equals(nsIJumpListItem* item, bool* _retval) override;
|
||||
NS_DECL_NSIJUMPLISTLINK
|
||||
|
||||
static nsresult GetShellItem(nsCOMPtr<nsIJumpListItem>& item,
|
||||
RefPtr<IShellItem2>& aShellItem);
|
||||
static nsresult GetJumpListLink(IShellItem* pItem,
|
||||
nsCOMPtr<nsIJumpListLink>& aLink);
|
||||
|
||||
protected:
|
||||
nsString mUriTitle;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsICryptoHash> mCryptoHash;
|
||||
};
|
||||
|
||||
class JumpListShortcut : public JumpListItemBase, public nsIJumpListShortcut {
|
||||
~JumpListShortcut() {}
|
||||
|
||||
public:
|
||||
JumpListShortcut()
|
||||
: JumpListItemBase(nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT) {}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(JumpListShortcut, JumpListItemBase)
|
||||
NS_IMETHOD GetType(int16_t* aType) override {
|
||||
return JumpListItemBase::GetType(aType);
|
||||
}
|
||||
NS_IMETHOD Equals(nsIJumpListItem* item, bool* _retval) override;
|
||||
NS_DECL_NSIJUMPLISTSHORTCUT
|
||||
|
||||
static nsresult GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
|
||||
RefPtr<IShellLinkW>& aShellLink,
|
||||
RefPtr<LazyIdleThread>& aIOThread);
|
||||
static nsresult GetJumpListShortcut(IShellLinkW* pLink,
|
||||
nsCOMPtr<nsIJumpListShortcut>& aShortcut);
|
||||
static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI,
|
||||
nsCOMPtr<nsIFile>& aICOFile);
|
||||
|
||||
protected:
|
||||
int32_t mIconIndex;
|
||||
nsCOMPtr<nsIURI> mFaviconPageURI;
|
||||
nsCOMPtr<nsILocalHandlerApp> mHandlerApp;
|
||||
|
||||
bool ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp);
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* __JumpListItem_h__ */
|
|
@ -3,7 +3,7 @@
|
|||
* 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/. */
|
||||
|
||||
#include "JumpListBuilder.h"
|
||||
#include "LegacyJumpListBuilder.h"
|
||||
|
||||
#include "nsError.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -39,10 +39,10 @@ namespace widget {
|
|||
// defined in WinTaskbar.cpp
|
||||
extern const wchar_t* gMozillaJumpListIDGeneric;
|
||||
|
||||
Atomic<bool> JumpListBuilder::sBuildingList(false);
|
||||
Atomic<bool> LegacyJumpListBuilder::sBuildingList(false);
|
||||
const char kPrefTaskbarEnabled[] = "browser.taskbar.lists.enabled";
|
||||
|
||||
NS_IMPL_ISUPPORTS(JumpListBuilder, nsIJumpListBuilder, nsIObserver)
|
||||
NS_IMPL_ISUPPORTS(LegacyJumpListBuilder, nsILegacyJumpListBuilder, nsIObserver)
|
||||
#define TOPIC_PROFILE_BEFORE_CHANGE "profile-before-change"
|
||||
#define TOPIC_CLEAR_PRIVATE_DATA "clear-private-data"
|
||||
|
||||
|
@ -52,8 +52,8 @@ class DoneCommitListBuildCallback final : public nsIRunnable {
|
|||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
public:
|
||||
DoneCommitListBuildCallback(nsIJumpListCommittedCallback* aCallback,
|
||||
JumpListBuilder* aBuilder)
|
||||
DoneCommitListBuildCallback(nsILegacyJumpListCommittedCallback* aCallback,
|
||||
LegacyJumpListBuilder* aBuilder)
|
||||
: mCallback(aCallback), mBuilder(aBuilder), mResult(false) {}
|
||||
|
||||
NS_IMETHOD Run() override {
|
||||
|
@ -82,8 +82,8 @@ class DoneCommitListBuildCallback final : public nsIRunnable {
|
|||
}
|
||||
|
||||
// These two references MUST be released on the main thread.
|
||||
RefPtr<nsIJumpListCommittedCallback> mCallback;
|
||||
RefPtr<JumpListBuilder> mBuilder;
|
||||
RefPtr<nsILegacyJumpListCommittedCallback> mCallback;
|
||||
RefPtr<LegacyJumpListBuilder> mBuilder;
|
||||
bool mResult;
|
||||
};
|
||||
|
||||
|
@ -91,8 +91,10 @@ NS_IMPL_ISUPPORTS(DoneCommitListBuildCallback, nsIRunnable);
|
|||
|
||||
} // namespace detail
|
||||
|
||||
JumpListBuilder::JumpListBuilder()
|
||||
: mMaxItems(0), mHasCommit(false), mMonitor("JumpListBuilderMonitor") {
|
||||
LegacyJumpListBuilder::LegacyJumpListBuilder()
|
||||
: mMaxItems(0),
|
||||
mHasCommit(false),
|
||||
mMonitor("LegacyJumpListBuilderMonitor") {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Instantiate mJumpListMgr in the multithreaded apartment so that proxied
|
||||
|
@ -135,11 +137,11 @@ JumpListBuilder::JumpListBuilder()
|
|||
}
|
||||
}
|
||||
|
||||
JumpListBuilder::~JumpListBuilder() {
|
||||
LegacyJumpListBuilder::~LegacyJumpListBuilder() {
|
||||
Preferences::RemoveObserver(this, kPrefTaskbarEnabled);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::SetAppUserModelID(
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::SetAppUserModelID(
|
||||
const nsAString& aAppUserModelId) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -159,7 +161,7 @@ NS_IMETHODIMP JumpListBuilder::SetAppUserModelID(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::GetAvailable(int16_t* aAvailable) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::GetAvailable(int16_t* aAvailable) {
|
||||
*aAvailable = false;
|
||||
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
@ -168,13 +170,13 @@ NS_IMETHODIMP JumpListBuilder::GetAvailable(int16_t* aAvailable) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::GetIsListCommitted(bool* aCommit) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::GetIsListCommitted(bool* aCommit) {
|
||||
*aCommit = mHasCommit;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::GetMaxListItems(int16_t* aMaxItems) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::GetMaxListItems(int16_t* aMaxItems) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
@ -202,8 +204,8 @@ NS_IMETHODIMP JumpListBuilder::GetMaxListItems(int16_t* aMaxItems) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
||||
Promise** aPromise) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::InitListBuild(JSContext* aCx,
|
||||
Promise** aPromise) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!mJumpListMgr) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
@ -222,7 +224,8 @@ NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
|||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NewRunnableMethod<StoreCopyPassByRRef<RefPtr<Promise>>>(
|
||||
"InitListBuild", this, &JumpListBuilder::DoInitListBuild, promise);
|
||||
"InitListBuild", this, &LegacyJumpListBuilder::DoInitListBuild,
|
||||
promise);
|
||||
nsresult rv = mIOThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -232,7 +235,7 @@ NS_IMETHODIMP JumpListBuilder::InitListBuild(JSContext* aCx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void JumpListBuilder::DoInitListBuild(RefPtr<Promise>&& aPromise) {
|
||||
void LegacyJumpListBuilder::DoInitListBuild(RefPtr<Promise>&& aPromise) {
|
||||
// Since we're invoking COM interfaces to talk to the shell on a background
|
||||
// thread, we need to be running inside a multithreaded apartment.
|
||||
mscom::MTARegion mta;
|
||||
|
@ -285,7 +288,7 @@ void JumpListBuilder::DoInitListBuild(RefPtr<Promise>&& aPromise) {
|
|||
}
|
||||
|
||||
// Ensures that we have no old ICO files left in the jump list cache
|
||||
nsresult JumpListBuilder::RemoveIconCacheForAllItems() {
|
||||
nsresult LegacyJumpListBuilder::RemoveIconCacheForAllItems() {
|
||||
// Construct the path of our jump list cache
|
||||
nsCOMPtr<nsIFile> jumpListCacheDir;
|
||||
nsresult rv =
|
||||
|
@ -321,9 +324,10 @@ nsresult JumpListBuilder::RemoveIconCacheForAllItems() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
||||
const nsAString& catName,
|
||||
bool* _retval) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::AddListToBuild(int16_t aCatType,
|
||||
nsIArray* items,
|
||||
const nsAString& catName,
|
||||
bool* _retval) {
|
||||
nsresult rv;
|
||||
|
||||
*_retval = false;
|
||||
|
@ -337,7 +341,7 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
|||
}
|
||||
|
||||
switch (aCatType) {
|
||||
case nsIJumpListBuilder::JUMPLIST_CATEGORY_TASKS: {
|
||||
case nsILegacyJumpListBuilder::JUMPLIST_CATEGORY_TASKS: {
|
||||
NS_ENSURE_ARG_POINTER(items);
|
||||
|
||||
HRESULT hr;
|
||||
|
@ -351,19 +355,19 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
|||
uint32_t length;
|
||||
items->GetLength(&length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i);
|
||||
nsCOMPtr<nsILegacyJumpListItem> item = do_QueryElementAt(items, i);
|
||||
if (!item) continue;
|
||||
// Check for separators
|
||||
if (IsSeparator(item)) {
|
||||
RefPtr<IShellLinkW> link;
|
||||
rv = JumpListSeparator::GetSeparator(link);
|
||||
rv = LegacyJumpListSeparator::GetSeparator(link);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
collection->AddObject(link);
|
||||
continue;
|
||||
}
|
||||
// These should all be ShellLinks
|
||||
RefPtr<IShellLinkW> link;
|
||||
rv = JumpListShortcut::GetShellLink(item, link, mIOThread);
|
||||
rv = LegacyJumpListShortcut::GetShellLink(item, link, mIOThread);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
collection->AddObject(link);
|
||||
}
|
||||
|
@ -378,17 +382,17 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
|||
if (SUCCEEDED(hr)) *_retval = true;
|
||||
return NS_OK;
|
||||
} break;
|
||||
case nsIJumpListBuilder::JUMPLIST_CATEGORY_RECENT: {
|
||||
case nsILegacyJumpListBuilder::JUMPLIST_CATEGORY_RECENT: {
|
||||
if (SUCCEEDED(jumpListMgr->AppendKnownCategory(KDC_RECENT)))
|
||||
*_retval = true;
|
||||
return NS_OK;
|
||||
} break;
|
||||
case nsIJumpListBuilder::JUMPLIST_CATEGORY_FREQUENT: {
|
||||
case nsILegacyJumpListBuilder::JUMPLIST_CATEGORY_FREQUENT: {
|
||||
if (SUCCEEDED(jumpListMgr->AppendKnownCategory(KDC_FREQUENT)))
|
||||
*_retval = true;
|
||||
return NS_OK;
|
||||
} break;
|
||||
case nsIJumpListBuilder::JUMPLIST_CATEGORY_CUSTOMLIST: {
|
||||
case nsILegacyJumpListBuilder::JUMPLIST_CATEGORY_CUSTOMLIST: {
|
||||
NS_ENSURE_ARG_POINTER(items);
|
||||
|
||||
if (catName.IsEmpty()) return NS_ERROR_INVALID_ARG;
|
||||
|
@ -403,26 +407,27 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
|||
uint32_t length;
|
||||
items->GetLength(&length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsCOMPtr<nsIJumpListItem> item = do_QueryElementAt(items, i);
|
||||
nsCOMPtr<nsILegacyJumpListItem> item = do_QueryElementAt(items, i);
|
||||
if (!item) continue;
|
||||
int16_t type;
|
||||
if (NS_FAILED(item->GetType(&type))) continue;
|
||||
switch (type) {
|
||||
case nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR: {
|
||||
case nsILegacyJumpListItem::JUMPLIST_ITEM_SEPARATOR: {
|
||||
RefPtr<IShellLinkW> shellItem;
|
||||
rv = JumpListSeparator::GetSeparator(shellItem);
|
||||
rv = LegacyJumpListSeparator::GetSeparator(shellItem);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
collection->AddObject(shellItem);
|
||||
} break;
|
||||
case nsIJumpListItem::JUMPLIST_ITEM_LINK: {
|
||||
case nsILegacyJumpListItem::JUMPLIST_ITEM_LINK: {
|
||||
RefPtr<IShellItem2> shellItem;
|
||||
rv = JumpListLink::GetShellItem(item, shellItem);
|
||||
rv = LegacyJumpListLink::GetShellItem(item, shellItem);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
collection->AddObject(shellItem);
|
||||
} break;
|
||||
case nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT: {
|
||||
case nsILegacyJumpListItem::JUMPLIST_ITEM_SHORTCUT: {
|
||||
RefPtr<IShellLinkW> shellItem;
|
||||
rv = JumpListShortcut::GetShellLink(item, shellItem, mIOThread);
|
||||
rv = LegacyJumpListShortcut::GetShellLink(item, shellItem,
|
||||
mIOThread);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
collection->AddObject(shellItem);
|
||||
} break;
|
||||
|
@ -450,7 +455,7 @@ NS_IMETHODIMP JumpListBuilder::AddListToBuild(int16_t aCatType, nsIArray* items,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::AbortListBuild() {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::AbortListBuild() {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
@ -465,8 +470,8 @@ NS_IMETHODIMP JumpListBuilder::AbortListBuild() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::CommitListBuild(
|
||||
nsIJumpListCommittedCallback* aCallback) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::CommitListBuild(
|
||||
nsILegacyJumpListCommittedCallback* aCallback) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!mJumpListMgr) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
@ -478,14 +483,14 @@ NS_IMETHODIMP JumpListBuilder::CommitListBuild(
|
|||
// need to do it for this runnable again.
|
||||
RefPtr<nsIRunnable> event =
|
||||
NewNonOwningRunnableMethod<RefPtr<detail::DoneCommitListBuildCallback>>(
|
||||
"JumpListBuilder::DoCommitListBuild", this,
|
||||
&JumpListBuilder::DoCommitListBuild, std::move(callback));
|
||||
"LegacyJumpListBuilder::DoCommitListBuild", this,
|
||||
&LegacyJumpListBuilder::DoCommitListBuild, std::move(callback));
|
||||
Unused << mIOThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void JumpListBuilder::DoCommitListBuild(
|
||||
void LegacyJumpListBuilder::DoCommitListBuild(
|
||||
RefPtr<detail::DoneCommitListBuildCallback> aCallback) {
|
||||
// Since we're invoking COM interfaces to talk to the shell on a background
|
||||
// thread, we need to be running inside a multithreaded apartment.
|
||||
|
@ -516,7 +521,7 @@ void JumpListBuilder::DoCommitListBuild(
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::DeleteActiveList(bool* _retval) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::DeleteActiveList(bool* _retval) {
|
||||
*_retval = false;
|
||||
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
@ -540,12 +545,12 @@ NS_IMETHODIMP JumpListBuilder::DeleteActiveList(bool* _retval) {
|
|||
|
||||
/* internal */
|
||||
|
||||
bool JumpListBuilder::IsSeparator(nsCOMPtr<nsIJumpListItem>& item) {
|
||||
bool LegacyJumpListBuilder::IsSeparator(nsCOMPtr<nsILegacyJumpListItem>& item) {
|
||||
int16_t type;
|
||||
item->GetType(&type);
|
||||
if (NS_FAILED(item->GetType(&type))) return false;
|
||||
|
||||
if (type == nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR) return true;
|
||||
if (type == nsILegacyJumpListItem::JUMPLIST_ITEM_SEPARATOR) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -553,7 +558,7 @@ bool JumpListBuilder::IsSeparator(nsCOMPtr<nsIJumpListItem>& item) {
|
|||
// avoid unnecessary extra XPCOM incantations. For each object in the input
|
||||
// array, if it's an IShellLinkW, this deletes the cached icon and adds the
|
||||
// url param to a list of URLs to be removed from the places database.
|
||||
void JumpListBuilder::RemoveIconCacheAndGetJumplistShortcutURIs(
|
||||
void LegacyJumpListBuilder::RemoveIconCacheAndGetJumplistShortcutURIs(
|
||||
IObjectArray* aObjArray, nsTArray<nsString>& aURISpecs) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
|
@ -596,7 +601,7 @@ void JumpListBuilder::RemoveIconCacheAndGetJumplistShortcutURIs(
|
|||
}
|
||||
}
|
||||
|
||||
void JumpListBuilder::DeleteIconFromDisk(const nsAString& aPath) {
|
||||
void LegacyJumpListBuilder::DeleteIconFromDisk(const nsAString& aPath) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
// Check that we aren't deleting some arbitrary file that is not an icon
|
||||
|
@ -612,9 +617,9 @@ void JumpListBuilder::DeleteIconFromDisk(const nsAString& aPath) {
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListBuilder::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData) {
|
||||
NS_IMETHODIMP LegacyJumpListBuilder::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData) {
|
||||
NS_ENSURE_ARG_POINTER(aTopic);
|
||||
if (strcmp(aTopic, TOPIC_PROFILE_BEFORE_CHANGE) == 0) {
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
|
@ -3,8 +3,8 @@
|
|||
* 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/. */
|
||||
|
||||
#ifndef __JumpListBuilder_h__
|
||||
#define __JumpListBuilder_h__
|
||||
#ifndef __LegacyJumpListBuilder_h__
|
||||
#define __LegacyJumpListBuilder_h__
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -14,9 +14,9 @@
|
|||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIJumpListBuilder.h"
|
||||
#include "nsIJumpListItem.h"
|
||||
#include "JumpListItem.h"
|
||||
#include "nsILegacyJumpListBuilder.h"
|
||||
#include "nsILegacyJumpListItem.h"
|
||||
#include "LegacyJumpListItem.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
@ -31,15 +31,16 @@ namespace detail {
|
|||
class DoneCommitListBuildCallback;
|
||||
} // namespace detail
|
||||
|
||||
class JumpListBuilder : public nsIJumpListBuilder, public nsIObserver {
|
||||
virtual ~JumpListBuilder();
|
||||
class LegacyJumpListBuilder : public nsILegacyJumpListBuilder,
|
||||
public nsIObserver {
|
||||
virtual ~LegacyJumpListBuilder();
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIJUMPLISTBUILDER
|
||||
NS_DECL_NSILEGACYJUMPLISTBUILDER
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
JumpListBuilder();
|
||||
LegacyJumpListBuilder();
|
||||
|
||||
protected:
|
||||
static Atomic<bool> sBuildingList;
|
||||
|
@ -52,7 +53,7 @@ class JumpListBuilder : public nsIJumpListBuilder, public nsIObserver {
|
|||
ReentrantMonitor mMonitor;
|
||||
nsString mAppUserModelId;
|
||||
|
||||
bool IsSeparator(nsCOMPtr<nsIJumpListItem>& item);
|
||||
bool IsSeparator(nsCOMPtr<nsILegacyJumpListItem>& item);
|
||||
void RemoveIconCacheAndGetJumplistShortcutURIs(IObjectArray* aObjArray,
|
||||
nsTArray<nsString>& aURISpecs);
|
||||
void DeleteIconFromDisk(const nsAString& aPath);
|
||||
|
@ -66,4 +67,4 @@ class JumpListBuilder : public nsIJumpListBuilder, public nsIObserver {
|
|||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* __JumpListBuilder_h__ */
|
||||
#endif /* __LegacyJumpListBuilder_h__ */
|
|
@ -3,7 +3,7 @@
|
|||
* 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/. */
|
||||
|
||||
#include "JumpListItem.h"
|
||||
#include "LegacyJumpListItem.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <propvarutil.h>
|
||||
|
@ -17,41 +17,44 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "JumpListBuilder.h"
|
||||
#include "LegacyJumpListBuilder.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
// ISUPPORTS Impl's
|
||||
NS_IMPL_ISUPPORTS(JumpListItem, nsIJumpListItem)
|
||||
NS_IMPL_ISUPPORTS(LegacyJumpListItem, nsILegacyJumpListItem)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(JumpListSeparator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJumpListSeparator)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, JumpListItemBase)
|
||||
NS_INTERFACE_MAP_BEGIN(LegacyJumpListSeparator)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILegacyJumpListSeparator)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsILegacyJumpListItem,
|
||||
LegacyJumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, LegacyJumpListItemBase)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_ADDREF(JumpListSeparator)
|
||||
NS_IMPL_RELEASE(JumpListSeparator)
|
||||
NS_IMPL_ADDREF(LegacyJumpListSeparator)
|
||||
NS_IMPL_RELEASE(LegacyJumpListSeparator)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(JumpListLink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJumpListLink)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, JumpListItemBase)
|
||||
NS_INTERFACE_MAP_BEGIN(LegacyJumpListLink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILegacyJumpListLink)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsILegacyJumpListItem,
|
||||
LegacyJumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, LegacyJumpListItemBase)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_ADDREF(JumpListLink)
|
||||
NS_IMPL_RELEASE(JumpListLink)
|
||||
NS_IMPL_ADDREF(LegacyJumpListLink)
|
||||
NS_IMPL_RELEASE(LegacyJumpListLink)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(JumpListShortcut)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJumpListShortcut)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIJumpListItem, JumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJumpListShortcut)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(LegacyJumpListShortcut)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILegacyJumpListShortcut)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsILegacyJumpListItem,
|
||||
LegacyJumpListItemBase)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsILegacyJumpListShortcut)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(JumpListShortcut)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(JumpListShortcut)
|
||||
NS_IMPL_CYCLE_COLLECTION(JumpListShortcut, mHandlerApp)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(LegacyJumpListShortcut)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(LegacyJumpListShortcut)
|
||||
NS_IMPL_CYCLE_COLLECTION(LegacyJumpListShortcut, mHandlerApp)
|
||||
|
||||
NS_IMETHODIMP JumpListItemBase::GetType(int16_t* aType) {
|
||||
NS_IMETHODIMP LegacyJumpListItemBase::GetType(int16_t* aType) {
|
||||
NS_ENSURE_ARG_POINTER(aType);
|
||||
|
||||
*aType = mItemType;
|
||||
|
@ -59,12 +62,13 @@ NS_IMETHODIMP JumpListItemBase::GetType(int16_t* aType) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListItemBase::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
||||
NS_IMETHODIMP LegacyJumpListItemBase::Equals(nsILegacyJumpListItem* aItem,
|
||||
bool* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aItem);
|
||||
|
||||
*aResult = false;
|
||||
|
||||
int16_t theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
int16_t theType = nsILegacyJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
if (NS_FAILED(aItem->GetType(&theType))) return NS_OK;
|
||||
|
||||
// Make sure the types match.
|
||||
|
@ -77,37 +81,37 @@ NS_IMETHODIMP JumpListItemBase::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
|||
|
||||
/* link impl. */
|
||||
|
||||
NS_IMETHODIMP JumpListLink::GetUri(nsIURI** aURI) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::GetUri(nsIURI** aURI) {
|
||||
NS_IF_ADDREF(*aURI = mURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::SetUri(nsIURI* aURI) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::SetUri(nsIURI* aURI) {
|
||||
mURI = aURI;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::SetUriTitle(const nsAString& aUriTitle) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::SetUriTitle(const nsAString& aUriTitle) {
|
||||
mUriTitle.Assign(aUriTitle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::GetUriTitle(nsAString& aUriTitle) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::GetUriTitle(nsAString& aUriTitle) {
|
||||
aUriTitle.Assign(mUriTitle);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::GetUriHash(nsACString& aUriHash) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::GetUriHash(nsACString& aUriHash) {
|
||||
if (!mURI) return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
return mozilla::widget::FaviconHelper::HashURI(mCryptoHash, mURI, aUriHash);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::CompareHash(nsIURI* aUri, bool* aResult) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::CompareHash(nsIURI* aUri, bool* aResult) {
|
||||
nsresult rv;
|
||||
|
||||
if (!mURI) {
|
||||
|
@ -129,20 +133,21 @@ NS_IMETHODIMP JumpListLink::CompareHash(nsIURI* aUri, bool* aResult) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListLink::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
||||
NS_IMETHODIMP LegacyJumpListLink::Equals(nsILegacyJumpListItem* aItem,
|
||||
bool* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aItem);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
*aResult = false;
|
||||
|
||||
int16_t theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
int16_t theType = nsILegacyJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
if (NS_FAILED(aItem->GetType(&theType))) return NS_OK;
|
||||
|
||||
// Make sure the types match.
|
||||
if (Type() != theType) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIJumpListLink> link = do_QueryInterface(aItem, &rv);
|
||||
nsCOMPtr<nsILegacyJumpListLink> link = do_QueryInterface(aItem, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Check the titles
|
||||
|
@ -168,54 +173,57 @@ NS_IMETHODIMP JumpListLink::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
|||
|
||||
/* shortcut impl. */
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::GetApp(nsILocalHandlerApp** aApp) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::GetApp(nsILocalHandlerApp** aApp) {
|
||||
NS_IF_ADDREF(*aApp = mHandlerApp);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::SetApp(nsILocalHandlerApp* aApp) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::SetApp(nsILocalHandlerApp* aApp) {
|
||||
mHandlerApp = aApp;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::GetIconIndex(int32_t* aIconIndex) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::GetIconIndex(int32_t* aIconIndex) {
|
||||
NS_ENSURE_ARG_POINTER(aIconIndex);
|
||||
|
||||
*aIconIndex = mIconIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::SetIconIndex(int32_t aIconIndex) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::SetIconIndex(int32_t aIconIndex) {
|
||||
mIconIndex = aIconIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::GetFaviconPageUri(nsIURI** aFaviconPageURI) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::GetFaviconPageUri(
|
||||
nsIURI** aFaviconPageURI) {
|
||||
NS_IF_ADDREF(*aFaviconPageURI = mFaviconPageURI);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::SetFaviconPageUri(nsIURI* aFaviconPageURI) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::SetFaviconPageUri(
|
||||
nsIURI* aFaviconPageURI) {
|
||||
mFaviconPageURI = aFaviconPageURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP JumpListShortcut::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
||||
NS_IMETHODIMP LegacyJumpListShortcut::Equals(nsILegacyJumpListItem* aItem,
|
||||
bool* aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aItem);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
*aResult = false;
|
||||
|
||||
int16_t theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
int16_t theType = nsILegacyJumpListItem::JUMPLIST_ITEM_EMPTY;
|
||||
if (NS_FAILED(aItem->GetType(&theType))) return NS_OK;
|
||||
|
||||
// Make sure the types match.
|
||||
if (Type() != theType) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIJumpListShortcut> shortcut = do_QueryInterface(aItem, &rv);
|
||||
nsCOMPtr<nsILegacyJumpListShortcut> shortcut = do_QueryInterface(aItem, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Check the icon index
|
||||
|
@ -244,7 +252,8 @@ NS_IMETHODIMP JumpListShortcut::Equals(nsIJumpListItem* aItem, bool* aResult) {
|
|||
/* internal helpers */
|
||||
|
||||
// (static) Creates a ShellLink that encapsulate a separator.
|
||||
nsresult JumpListSeparator::GetSeparator(RefPtr<IShellLinkW>& aShellLink) {
|
||||
nsresult LegacyJumpListSeparator::GetSeparator(
|
||||
RefPtr<IShellLinkW>& aShellLink) {
|
||||
HRESULT hr;
|
||||
IShellLinkW* psl;
|
||||
|
||||
|
@ -272,9 +281,9 @@ nsresult JumpListSeparator::GetSeparator(RefPtr<IShellLinkW>& aShellLink) {
|
|||
}
|
||||
|
||||
// (static) Creates a ShellLink that encapsulate a shortcut to local apps.
|
||||
nsresult JumpListShortcut::GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
|
||||
RefPtr<IShellLinkW>& aShellLink,
|
||||
RefPtr<LazyIdleThread>& aIOThread) {
|
||||
nsresult LegacyJumpListShortcut::GetShellLink(
|
||||
nsCOMPtr<nsILegacyJumpListItem>& item, RefPtr<IShellLinkW>& aShellLink,
|
||||
RefPtr<LazyIdleThread>& aIOThread) {
|
||||
HRESULT hr;
|
||||
IShellLinkW* psl;
|
||||
nsresult rv;
|
||||
|
@ -286,10 +295,10 @@ nsresult JumpListShortcut::GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
|
|||
int16_t type;
|
||||
if (NS_FAILED(item->GetType(&type))) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (type != nsIJumpListItem::JUMPLIST_ITEM_SHORTCUT)
|
||||
if (type != nsILegacyJumpListItem::JUMPLIST_ITEM_SHORTCUT)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIJumpListShortcut> shortcut = do_QueryInterface(item, &rv);
|
||||
nsCOMPtr<nsILegacyJumpListShortcut> shortcut = do_QueryInterface(item, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsILocalHandlerApp> handlerApp;
|
||||
|
@ -381,8 +390,9 @@ nsresult JumpListShortcut::GetShellLink(nsCOMPtr<nsIJumpListItem>& item,
|
|||
|
||||
// If successful fills in the aSame parameter
|
||||
// aSame will be true if the path is in our icon cache
|
||||
static nsresult IsPathInOurIconCache(nsCOMPtr<nsIJumpListShortcut>& aShortcut,
|
||||
wchar_t* aPath, bool* aSame) {
|
||||
static nsresult IsPathInOurIconCache(
|
||||
nsCOMPtr<nsILegacyJumpListShortcut>& aShortcut, wchar_t* aPath,
|
||||
bool* aSame) {
|
||||
NS_ENSURE_ARG_POINTER(aPath);
|
||||
NS_ENSURE_ARG_POINTER(aSame);
|
||||
|
||||
|
@ -417,9 +427,9 @@ static nsresult IsPathInOurIconCache(nsCOMPtr<nsIJumpListShortcut>& aShortcut,
|
|||
}
|
||||
|
||||
// (static) For a given IShellLink, create and return a populated
|
||||
// nsIJumpListShortcut.
|
||||
nsresult JumpListShortcut::GetJumpListShortcut(
|
||||
IShellLinkW* pLink, nsCOMPtr<nsIJumpListShortcut>& aShortcut) {
|
||||
// nsILegacyJumpListShortcut.
|
||||
nsresult LegacyJumpListShortcut::GetJumpListShortcut(
|
||||
IShellLinkW* pLink, nsCOMPtr<nsILegacyJumpListShortcut>& aShortcut) {
|
||||
NS_ENSURE_ARG_POINTER(pLink);
|
||||
|
||||
nsresult rv;
|
||||
|
@ -495,17 +505,18 @@ nsresult JumpListShortcut::GetJumpListShortcut(
|
|||
// (static) ShellItems are used to encapsulate links to things. We currently
|
||||
// only support URI links, but more support could be added, such as local file
|
||||
// and directory links.
|
||||
nsresult JumpListLink::GetShellItem(nsCOMPtr<nsIJumpListItem>& item,
|
||||
RefPtr<IShellItem2>& aShellItem) {
|
||||
nsresult LegacyJumpListLink::GetShellItem(nsCOMPtr<nsILegacyJumpListItem>& item,
|
||||
RefPtr<IShellItem2>& aShellItem) {
|
||||
IShellItem2* psi = nullptr;
|
||||
nsresult rv;
|
||||
|
||||
int16_t type;
|
||||
if (NS_FAILED(item->GetType(&type))) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (type != nsIJumpListItem::JUMPLIST_ITEM_LINK) return NS_ERROR_INVALID_ARG;
|
||||
if (type != nsILegacyJumpListItem::JUMPLIST_ITEM_LINK)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIJumpListLink> link = do_QueryInterface(item, &rv);
|
||||
nsCOMPtr<nsILegacyJumpListLink> link = do_QueryInterface(item, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -547,9 +558,9 @@ nsresult JumpListLink::GetShellItem(nsCOMPtr<nsIJumpListItem>& item,
|
|||
}
|
||||
|
||||
// (static) For a given IShellItem, create and return a populated
|
||||
// nsIJumpListLink.
|
||||
nsresult JumpListLink::GetJumpListLink(IShellItem* pItem,
|
||||
nsCOMPtr<nsIJumpListLink>& aLink) {
|
||||
// nsILegacyJumpListLink.
|
||||
nsresult LegacyJumpListLink::GetJumpListLink(
|
||||
IShellItem* pItem, nsCOMPtr<nsILegacyJumpListLink>& aLink) {
|
||||
NS_ENSURE_ARG_POINTER(pItem);
|
||||
|
||||
// We assume for now these are URI links, but through properties we could
|
|
@ -0,0 +1,133 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __LegacyJumpListItem_h__
|
||||
#define __LegacyJumpListItem_h__
|
||||
|
||||
#include <windows.h>
|
||||
#include <shobjidl.h>
|
||||
#undef LogSeverity // SetupAPI.h #defines this as DWORD
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
#include "nsILegacyJumpListItem.h" // defines nsILegacyJumpListItem
|
||||
#include "nsIMIMEInfo.h" // defines nsILocalHandlerApp
|
||||
#include "nsTArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsICryptoHash.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsIThread;
|
||||
|
||||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
class LegacyJumpListItemBase : public nsILegacyJumpListItem {
|
||||
public:
|
||||
LegacyJumpListItemBase()
|
||||
: mItemType(nsILegacyJumpListItem::JUMPLIST_ITEM_EMPTY) {}
|
||||
|
||||
explicit LegacyJumpListItemBase(int32_t type) : mItemType(type) {}
|
||||
|
||||
NS_DECL_NSILEGACYJUMPLISTITEM
|
||||
|
||||
static const char kJumpListCacheDir[];
|
||||
|
||||
protected:
|
||||
virtual ~LegacyJumpListItemBase() {}
|
||||
|
||||
short Type() { return mItemType; }
|
||||
short mItemType;
|
||||
};
|
||||
|
||||
class LegacyJumpListItem : public LegacyJumpListItemBase {
|
||||
~LegacyJumpListItem() {}
|
||||
|
||||
public:
|
||||
using LegacyJumpListItemBase::LegacyJumpListItemBase;
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
};
|
||||
|
||||
class LegacyJumpListSeparator : public LegacyJumpListItemBase,
|
||||
public nsILegacyJumpListSeparator {
|
||||
~LegacyJumpListSeparator() {}
|
||||
|
||||
public:
|
||||
LegacyJumpListSeparator()
|
||||
: LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_SEPARATOR) {
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_FORWARD_NSILEGACYJUMPLISTITEM(LegacyJumpListItemBase::)
|
||||
|
||||
static nsresult GetSeparator(RefPtr<IShellLinkW>& aShellLink);
|
||||
};
|
||||
|
||||
class LegacyJumpListLink : public LegacyJumpListItemBase,
|
||||
public nsILegacyJumpListLink {
|
||||
~LegacyJumpListLink() {}
|
||||
|
||||
public:
|
||||
LegacyJumpListLink()
|
||||
: LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_LINK) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_IMETHOD GetType(int16_t* aType) override {
|
||||
return LegacyJumpListItemBase::GetType(aType);
|
||||
}
|
||||
NS_IMETHOD Equals(nsILegacyJumpListItem* item, bool* _retval) override;
|
||||
NS_DECL_NSILEGACYJUMPLISTLINK
|
||||
|
||||
static nsresult GetShellItem(nsCOMPtr<nsILegacyJumpListItem>& item,
|
||||
RefPtr<IShellItem2>& aShellItem);
|
||||
static nsresult GetJumpListLink(IShellItem* pItem,
|
||||
nsCOMPtr<nsILegacyJumpListLink>& aLink);
|
||||
|
||||
protected:
|
||||
nsString mUriTitle;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsICryptoHash> mCryptoHash;
|
||||
};
|
||||
|
||||
class LegacyJumpListShortcut : public LegacyJumpListItemBase,
|
||||
public nsILegacyJumpListShortcut {
|
||||
~LegacyJumpListShortcut() {}
|
||||
|
||||
public:
|
||||
LegacyJumpListShortcut()
|
||||
: LegacyJumpListItemBase(nsILegacyJumpListItem::JUMPLIST_ITEM_SHORTCUT) {}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(LegacyJumpListShortcut,
|
||||
LegacyJumpListItemBase)
|
||||
NS_IMETHOD GetType(int16_t* aType) override {
|
||||
return LegacyJumpListItemBase::GetType(aType);
|
||||
}
|
||||
NS_IMETHOD Equals(nsILegacyJumpListItem* item, bool* _retval) override;
|
||||
NS_DECL_NSILEGACYJUMPLISTSHORTCUT
|
||||
|
||||
static nsresult GetShellLink(nsCOMPtr<nsILegacyJumpListItem>& item,
|
||||
RefPtr<IShellLinkW>& aShellLink,
|
||||
RefPtr<LazyIdleThread>& aIOThread);
|
||||
static nsresult GetJumpListShortcut(
|
||||
IShellLinkW* pLink, nsCOMPtr<nsILegacyJumpListShortcut>& aShortcut);
|
||||
static nsresult GetOutputIconPath(nsCOMPtr<nsIURI> aFaviconPageURI,
|
||||
nsCOMPtr<nsIFile>& aICOFile);
|
||||
|
||||
protected:
|
||||
int32_t mIconIndex;
|
||||
nsCOMPtr<nsIURI> mFaviconPageURI;
|
||||
nsCOMPtr<nsILocalHandlerApp> mHandlerApp;
|
||||
|
||||
bool ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp);
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* __LegacyJumpListItem_h__ */
|
|
@ -17,13 +17,13 @@
|
|||
#include <nsIBaseWindow.h>
|
||||
#include <nsServiceManagerUtils.h>
|
||||
#include "nsIXULAppInfo.h"
|
||||
#include "nsIJumpListBuilder.h"
|
||||
#include "nsILegacyJumpListBuilder.h"
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsWindow.h"
|
||||
#include "WinUtils.h"
|
||||
#include "TaskbarTabPreview.h"
|
||||
#include "TaskbarWindowPreview.h"
|
||||
#include "JumpListBuilder.h"
|
||||
#include "LegacyJumpListBuilder.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
@ -36,7 +36,7 @@
|
|||
#include <propkey.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
static NS_DEFINE_CID(kJumpListBuilderCID, NS_WIN_JUMPLISTBUILDER_CID);
|
||||
static NS_DEFINE_CID(kLegacyJumpListBuilderCID, NS_WIN_LEGACYJUMPLISTBUILDER_CID);
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -404,14 +404,14 @@ WinTaskbar::GetOverlayIconController(
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
WinTaskbar::CreateJumpListBuilder(bool aPrivateBrowsing,
|
||||
nsIJumpListBuilder** aJumpListBuilder) {
|
||||
WinTaskbar::CreateLegacyJumpListBuilder(bool aPrivateBrowsing,
|
||||
nsILegacyJumpListBuilder** aJumpListBuilder) {
|
||||
nsresult rv;
|
||||
|
||||
if (JumpListBuilder::sBuildingList) return NS_ERROR_ALREADY_INITIALIZED;
|
||||
if (LegacyJumpListBuilder::sBuildingList) return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIJumpListBuilder> builder =
|
||||
do_CreateInstance(kJumpListBuilderCID, &rv);
|
||||
nsCOMPtr<nsILegacyJumpListBuilder> builder =
|
||||
do_CreateInstance(kLegacyJumpListBuilderCID, &rv);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_UNEXPECTED;
|
||||
|
||||
NS_IF_ADDREF(*aJumpListBuilder = builder);
|
||||
|
|
|
@ -59,33 +59,33 @@ Classes = [
|
|||
},
|
||||
{
|
||||
'cid': '{73a5946f-608d-454f-9d33-0b8f8c7294b6}',
|
||||
'contract_ids': ['@mozilla.org/windows-jumplistbuilder;1'],
|
||||
'type': 'mozilla::widget::JumpListBuilder',
|
||||
'headers': ['/widget/windows/JumpListBuilder.h'],
|
||||
'contract_ids': ['@mozilla.org/windows-legacyjumplistbuilder;1'],
|
||||
'type': 'mozilla::widget::LegacyJumpListBuilder',
|
||||
'headers': ['/widget/windows/LegacyJumpListBuilder.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{2b9a1f2c-27ce-45b6-8d4e-755d0e34f8db}',
|
||||
'contract_ids': ['@mozilla.org/windows-jumplistitem;1'],
|
||||
'type': 'mozilla::widget::JumpListItem',
|
||||
'headers': ['/widget/windows/JumpListItem.h'],
|
||||
'contract_ids': ['@mozilla.org/windows-legacyjumplistitem;1'],
|
||||
'type': 'mozilla::widget::LegacyJumpListItem',
|
||||
'headers': ['/widget/windows/LegacyJumpListItem.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{21f1f13b-f75a-42ad-867a-d91ad694447e}',
|
||||
'contract_ids': ['@mozilla.org/windows-jumplistseparator;1'],
|
||||
'type': 'mozilla::widget::JumpListSeparator',
|
||||
'headers': ['/widget/windows/JumpListItem.h'],
|
||||
'contract_ids': ['@mozilla.org/windows-legacyjumplistseparator;1'],
|
||||
'type': 'mozilla::widget::LegacyJumpListSeparator',
|
||||
'headers': ['/widget/windows/LegacyJumpListItem.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{f72c5dc4-5a12-47be-be28-ab105f33b08f}',
|
||||
'contract_ids': ['@mozilla.org/windows-jumplistlink;1'],
|
||||
'type': 'mozilla::widget::JumpListLink',
|
||||
'headers': ['/widget/windows/JumpListItem.h'],
|
||||
'contract_ids': ['@mozilla.org/windows-legacyjumplistlink;1'],
|
||||
'type': 'mozilla::widget::LegacyJumpListLink',
|
||||
'headers': ['/widget/windows/LegacyJumpListItem.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{b16656b2-5187-498f-abf4-56346126bfdb}',
|
||||
'contract_ids': ['@mozilla.org/windows-jumplistshortcut;1'],
|
||||
'type': 'mozilla::widget::JumpListShortcut',
|
||||
'headers': ['/widget/windows/JumpListItem.h'],
|
||||
'contract_ids': ['@mozilla.org/windows-legacyjumplistshortcut;1'],
|
||||
'type': 'mozilla::widget::LegacyJumpListShortcut',
|
||||
'headers': ['/widget/windows/LegacyJumpListItem.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{e04a55e8-fee3-4ea2-a98b-41d2621adc3c}',
|
||||
|
|
|
@ -72,8 +72,8 @@ UNIFIED_SOURCES += [
|
|||
"GfxInfo.cpp",
|
||||
"IEnumFE.cpp",
|
||||
"IMMHandler.cpp",
|
||||
"JumpListItem.cpp",
|
||||
"KeyboardLayout.cpp",
|
||||
"LegacyJumpListItem.cpp",
|
||||
"LSPAnnotator.cpp",
|
||||
"nsAppShell.cpp",
|
||||
"nsClipboard.cpp",
|
||||
|
@ -122,7 +122,7 @@ UNIFIED_SOURCES += [
|
|||
SOURCES += [
|
||||
"CompositorWidgetParent.cpp",
|
||||
"InProcessWinCompositorWidget.cpp",
|
||||
"JumpListBuilder.cpp",
|
||||
"LegacyJumpListBuilder.cpp",
|
||||
"MediaKeysEventSourceFactory.cpp",
|
||||
"nsBidiKeyboard.cpp",
|
||||
"nsFilePicker.cpp",
|
||||
|
|
Загрузка…
Ссылка в новой задаче