mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:25:44 +00:00
4ac9bef80d
- Bug 936092, initial DnD support for e10s, r=enndeakin,karlt (3cde556cf) - Bug 1152066 - Remove ugly dynamic loading code now that we can assume this symbol exists. r=roc (04813dd18) - Bug 966395 - Correctly propagate the input language's direction on OSX. r=masayuki/mrbkap (14a21fa0c) - Bug 1158791 - Try harder to avoid Gtk-Critical errors in xpcshell tests. r=karlt (f6cec3b99) - Bug 1153922 - Add a SandboxOptions option for creating the sandbox in a fresh JS::Zone. r=mrbkap (f99b17726) - Bug 968520 - Always use fallible allocator with nsTArray_base::ShrinkCapacity. r=froydnj (b7cf63063) - Bug 1160027 - Move ResourceQueue implementation from header file - r=cpearce (5fabd8c8f) - Bug 1119277 - Remove the process CPU priority parameter and simplify all the associated code. r=khuey, r=dhylands (32d2b0df2) - Goanna -> Gecko (2b16bec4c) - Bug 892371 - Adjust oom_score_adj values for foreground processes according to an LRU policy. r=dhylands, r=khuey (61cdfc3db) - Bug 892371 - Add mochitests covering LRU priority adjustments for both foreground and background processes. r=khuey (46676e34f) - Bug 1164297 - tweaks to logging modules of MediaDecoderStateMachine to remove accessing to env vars. r=cpearce. (e9dc910da) - Bug 1150539: log getUserMedia constraints used in MediaManager:5. r=jesup (161853b66) - Bug 1139027 - Permit running of camera mochitests on B2G desktop. r=mikeh (8bb265db2) - Bug 1145403 - Don't open MediaManager on shutdown. r=jesup (9338eef82) - Bug 1046245 - enumerateDevices w/non-blocking e10s, nsICryptoHMAC, clear cookies, lambdas. r=keeler, florian, billm, jesup (ce9d684a0) - remove StopWebRtcLoc() to be readded in Bug 1219339 - Part2 (7a0c901fc) - Bug 1046245 - IO on STS thread + cleanup BackgroundChild on shutdown r=jesup (e85dd7716) - Bug 579517 follow-up: Remove NSPR types that crept in (35aee15a6) - Bug 1152443 - Fix broken validation which prevented reading of enumerate_devices.txt. r=jesup (4e135355b) - Bug 1143562 - use /data/b2g/mozilla/gmp as the gmp storage folder on B2G. r=cpearce. (ddc07f09a) - Bug 1143562. Part2 - only init |mStorageBaseDir| in the chrome process. r=cpearce (3039a4f44) - remove specific hack, this code is going away anyway (34aed4d6b) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 0 - Make mozIGeckoMediaPluginService::GetPluginVersionForAPI return whether we even have the plugin. r=cpearce. (e6ac61630) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 1 - split GeckoMediaPluginService into a part for chrome and a part for both content and chrome. r=jwwang. (09f8c4a83) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 2 - support asynchronous GMP API getters. r=jwwang,rjesup. (e33266976) - Bug 1143532 - Include pid in the log messages of GMPParent. r=edwin (8486ebc50) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 3 - split the GMP IPDL actors in 2 parts (and use opens to open the second in non-e10s). r=billm. (d17fa36ff) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 4 - make GetNodeId asynchronous. r=jwwang. (db7a21e4a) - Bug 1150049 - tidy up nsImageBoxFrame::Init a little bit; r=dholbert (41c258a71) - Bug 1150266 - fix IPDL thinko for never-inline method declarations; r=bent (445d3420b) - Bug 1150207 - Convert a focus() call to use SpecialPowers to avoid out-of-order focusing behaviour. r=mwargers (4d134848c) - Bug 1148641 - Guard against null parameters to SendSetTargetAPZCNotification. r=botond (8c5f4bb6d) - Bug 1096172 - Fix position reporting of bad charrefs in RCDATA. r=hsivonen. (77100d26d) - Bug 1149971 Part 2: Cet rid of kCurrentProcessId as it makes lots of static initializers. r=dvander (3efaefdba) - remove android widgets (0c2565418) - Bug 1129991 - Remove QuotaManager::SetCurrentWindow(); r=bent (7ccabf88c) - Bug 1133748 - Fix ipdl code for bridged protocols that are also opened. r=billm. (402751d09) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Part 5 - use bridging for GMP in e10s. r=billm. (e45a87c5f) - Bug 1057908 followup: Add missing 'override' annotation on GMPServiceParent::ActorDestroy method decl. rs=ehsan (48f53b28a) - Bug 1057908 - GeckoMediaPluginService needs to be proxied from Content processes to parent process. Add nsServiceManagerUtils.h include to WMFDecoderModule.cpp. (67cddb4da) - kill android widgets better (bec243c8d)
304 lines
10 KiB
C++
304 lines
10 KiB
C++
/* -*- 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 mozilla_dom_DataTransfer_h
|
|
#define mozilla_dom_DataTransfer_h
|
|
|
|
#include "nsString.h"
|
|
#include "nsTArray.h"
|
|
#include "nsIVariant.h"
|
|
#include "nsIPrincipal.h"
|
|
#include "nsIDOMDataTransfer.h"
|
|
#include "nsIDOMElement.h"
|
|
#include "nsIDragService.h"
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include "mozilla/dom/File.h"
|
|
|
|
class nsINode;
|
|
class nsITransferable;
|
|
class nsISupportsArray;
|
|
class nsILoadContext;
|
|
|
|
namespace mozilla {
|
|
|
|
class EventStateManager;
|
|
|
|
namespace dom {
|
|
|
|
class DOMStringList;
|
|
class Element;
|
|
template<typename T> class Optional;
|
|
|
|
/**
|
|
* TransferItem is used to hold data for a particular format. Each piece of
|
|
* data has a principal set from the caller which added it. This allows a
|
|
* caller that wishes to retrieve the data to only be able to access the data
|
|
* it is allowed to, yet still allow a chrome caller to retrieve any of the
|
|
* data.
|
|
*/
|
|
struct TransferItem {
|
|
nsString mFormat;
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
nsCOMPtr<nsIVariant> mData;
|
|
};
|
|
|
|
#define NS_DATATRANSFER_IID \
|
|
{ 0x43ee0327, 0xde5d, 0x463d, \
|
|
{ 0x9b, 0xd0, 0xf1, 0x79, 0x09, 0x69, 0xf2, 0xfb } }
|
|
|
|
class DataTransfer final : public nsIDOMDataTransfer,
|
|
public nsWrapperCache
|
|
{
|
|
public:
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DATATRANSFER_IID)
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
NS_DECL_NSIDOMDATATRANSFER
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DataTransfer)
|
|
|
|
friend class mozilla::EventStateManager;
|
|
|
|
protected:
|
|
|
|
// hide the default constructor
|
|
DataTransfer();
|
|
|
|
// this constructor is used only by the Clone method to copy the fields as
|
|
// needed to a new data transfer.
|
|
DataTransfer(nsISupports* aParent,
|
|
uint32_t aEventType,
|
|
const uint32_t aEffectAllowed,
|
|
bool aCursorState,
|
|
bool aIsExternal,
|
|
bool aUserCancelled,
|
|
bool aIsCrossDomainSubFrameDrop,
|
|
int32_t aClipboardType,
|
|
nsTArray<nsTArray<TransferItem> >& aItems,
|
|
Element* aDragImage,
|
|
uint32_t aDragImageX,
|
|
uint32_t aDragImageY);
|
|
|
|
~DataTransfer();
|
|
|
|
static const char sEffects[8][9];
|
|
|
|
public:
|
|
|
|
// Constructor for DataTransfer.
|
|
//
|
|
// aEventType is an event constant (such as NS_DRAGDROP_START)
|
|
//
|
|
// aIsExternal must only be true when used to create a dataTransfer for a
|
|
// paste or a drag that was started without using a data transfer. The
|
|
// latter will occur when an external drag occurs, that is, a drag where the
|
|
// source is another application, or a drag is started by calling the drag
|
|
// service directly. For clipboard operations, aClipboardType indicates
|
|
// which clipboard to use, from nsIClipboard, or -1 for non-clipboard operations,
|
|
// or if access to the system clipboard should not be allowed.
|
|
DataTransfer(nsISupports* aParent, uint32_t aEventType, bool aIsExternal,
|
|
int32_t aClipboardType);
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
|
nsISupports* GetParentObject()
|
|
{
|
|
return mParent;
|
|
}
|
|
|
|
void SetParentObject(nsISupports* aNewParent)
|
|
{
|
|
MOZ_ASSERT(aNewParent);
|
|
// Setting the parent after we've been wrapped is pointless, so
|
|
// make sure we aren't wrapped yet.
|
|
MOZ_ASSERT(!GetWrapperPreserveColor());
|
|
mParent = aNewParent;
|
|
}
|
|
|
|
static already_AddRefed<DataTransfer>
|
|
Constructor(const GlobalObject& aGlobal, const nsAString& aEventType,
|
|
bool aIsExternal, ErrorResult& aRv);
|
|
|
|
void GetDropEffect(nsString& aDropEffect)
|
|
{
|
|
aDropEffect.AssignASCII(sEffects[mDropEffect]);
|
|
}
|
|
void GetEffectAllowed(nsString& aEffectAllowed)
|
|
{
|
|
if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
|
|
aEffectAllowed.AssignLiteral("uninitialized");
|
|
} else {
|
|
aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
|
|
}
|
|
}
|
|
void SetDragImage(Element& aElement, int32_t aX, int32_t aY,
|
|
ErrorResult& aRv);
|
|
already_AddRefed<DOMStringList> Types();
|
|
void GetData(const nsAString& aFormat, nsAString& aData, ErrorResult& aRv);
|
|
void SetData(const nsAString& aFormat, const nsAString& aData,
|
|
ErrorResult& aRv);
|
|
void ClearData(const mozilla::dom::Optional<nsAString>& aFormat,
|
|
mozilla::ErrorResult& aRv);
|
|
FileList* GetFiles(mozilla::ErrorResult& aRv);
|
|
void AddElement(Element& aElement, mozilla::ErrorResult& aRv);
|
|
uint32_t MozItemCount()
|
|
{
|
|
return mItems.Length();
|
|
}
|
|
void GetMozCursor(nsString& aCursor)
|
|
{
|
|
if (mCursorState) {
|
|
aCursor.AssignLiteral("default");
|
|
} else {
|
|
aCursor.AssignLiteral("auto");
|
|
}
|
|
}
|
|
already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
|
|
mozilla::ErrorResult& aRv) const;
|
|
void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
|
|
mozilla::ErrorResult& aRv);
|
|
void MozSetDataAt(JSContext* aCx, const nsAString& aFormat,
|
|
JS::Handle<JS::Value> aData, uint32_t aIndex,
|
|
mozilla::ErrorResult& aRv);
|
|
void MozGetDataAt(JSContext* aCx, const nsAString& aFormat,
|
|
uint32_t aIndex, JS::MutableHandle<JS::Value> aRetval,
|
|
mozilla::ErrorResult& aRv);
|
|
bool MozUserCancelled()
|
|
{
|
|
return mUserCancelled;
|
|
}
|
|
already_AddRefed<nsINode> GetMozSourceNode();
|
|
|
|
mozilla::dom::Element* GetDragTarget()
|
|
{
|
|
return mDragTarget;
|
|
}
|
|
|
|
// a readonly dataTransfer cannot have new data added or existing data removed.
|
|
// Only the dropEffect and effectAllowed may be modified.
|
|
void SetReadOnly() { mReadOnly = true; }
|
|
|
|
// converts the data into an array of nsITransferable objects to be used for
|
|
// drag and drop or clipboard operations.
|
|
already_AddRefed<nsISupportsArray> GetTransferables(nsIDOMNode* aDragTarget);
|
|
already_AddRefed<nsISupportsArray> GetTransferables(nsILoadContext* aLoadContext);
|
|
|
|
// converts the data for a single item at aIndex into an nsITransferable object.
|
|
already_AddRefed<nsITransferable> GetTransferable(uint32_t aIndex,
|
|
nsILoadContext* aLoadContext);
|
|
|
|
// converts the data in the variant to an nsISupportString if possible or
|
|
// an nsISupports or null otherwise.
|
|
bool ConvertFromVariant(nsIVariant* aVariant,
|
|
nsISupports** aSupports,
|
|
uint32_t* aLength);
|
|
|
|
// clears all of the data
|
|
void ClearAll();
|
|
|
|
// Similar to SetData except also specifies the principal to store.
|
|
// aData may be null when called from CacheExternalDragFormats or
|
|
// CacheExternalClipboardFormats.
|
|
nsresult SetDataWithPrincipal(const nsAString& aFormat,
|
|
nsIVariant* aData,
|
|
uint32_t aIndex,
|
|
nsIPrincipal* aPrincipal);
|
|
|
|
// returns a weak reference to the drag image
|
|
Element* GetDragImage(int32_t* aX, int32_t* aY)
|
|
{
|
|
*aX = mDragImageX;
|
|
*aY = mDragImageY;
|
|
return mDragImage;
|
|
}
|
|
|
|
nsresult Clone(nsISupports* aParent, uint32_t aEventType, bool aUserCancelled,
|
|
bool aIsCrossDomainSubFrameDrop, DataTransfer** aResult);
|
|
|
|
protected:
|
|
|
|
// converts some formats used for compatibility in aInFormat into aOutFormat.
|
|
// Text and text/unicode become text/plain, and URL becomes text/uri-list
|
|
void GetRealFormat(const nsAString& aInFormat, nsAString& aOutFormat);
|
|
|
|
// caches text and uri-list data formats that exist in the drag service or
|
|
// clipboard for retrieval later.
|
|
void CacheExternalData(const char* aFormat, uint32_t aIndex, nsIPrincipal* aPrincipal);
|
|
|
|
// caches the formats that exist in the drag service that were added by an
|
|
// external drag
|
|
void CacheExternalDragFormats();
|
|
|
|
// caches the formats that exist in the clipboard
|
|
void CacheExternalClipboardFormats();
|
|
|
|
// fills in the data field of aItem with the data from the drag service or
|
|
// clipboard for a given index.
|
|
void FillInExternalData(TransferItem& aItem, uint32_t aIndex);
|
|
|
|
friend class ContentParent;
|
|
void FillAllExternalData();
|
|
|
|
void MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
|
|
mozilla::ErrorResult& aRv);
|
|
|
|
nsCOMPtr<nsISupports> mParent;
|
|
|
|
// the event type this data transfer is for. This will correspond to an
|
|
// event->message value.
|
|
uint32_t mEventType;
|
|
|
|
// the drop effect and effect allowed
|
|
uint32_t mDropEffect;
|
|
uint32_t mEffectAllowed;
|
|
|
|
// Indicates the behavior of the cursor during drag operations
|
|
bool mCursorState;
|
|
|
|
// readonly data transfers may not be modified except the drop effect and
|
|
// effect allowed.
|
|
bool mReadOnly;
|
|
|
|
// true for drags started without a data transfer, for example, those from
|
|
// another application.
|
|
bool mIsExternal;
|
|
|
|
// true if the user cancelled the drag. Used only for the dragend event.
|
|
bool mUserCancelled;
|
|
|
|
// true if this is a cross-domain drop from a subframe where access to the
|
|
// data should be prevented
|
|
bool mIsCrossDomainSubFrameDrop;
|
|
|
|
// Indicates which clipboard type to use for clipboard operations. Ignored for
|
|
// drag and drop.
|
|
int32_t mClipboardType;
|
|
|
|
// array of items, each containing an array of format->data pairs
|
|
nsTArray<nsTArray<TransferItem> > mItems;
|
|
|
|
// array of files, containing only the files present in the dataTransfer
|
|
nsRefPtr<FileList> mFiles;
|
|
|
|
// the target of the drag. The drag and dragend events will fire at this.
|
|
nsCOMPtr<mozilla::dom::Element> mDragTarget;
|
|
|
|
// the custom drag image and coordinates within the image. If mDragImage is
|
|
// null, the default image is created from the drag target.
|
|
nsCOMPtr<mozilla::dom::Element> mDragImage;
|
|
uint32_t mDragImageX;
|
|
uint32_t mDragImageY;
|
|
};
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(DataTransfer, NS_DATATRANSFER_IID)
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif /* mozilla_dom_DataTransfer_h */
|
|
|