gecko/widget/nsIClipboardHelper.idl
Ehsan Akhgari a95b6edeea Bug 722872 - Part 1: Add nsITransferable::Init(nsILoadContext*), enforce that it's called in debug builds, and add nsIDOMDocument* arguments to nsIClipboardHelper methods; r=roc
This patch does the following:

* It adds nsITransferable::Init(nsILoadContext*).  The load context
  might be null, which means that the transferable is non-private, but
  if it's non-null, we extract the boolean value for the privacy mode
  and store it in the transferable.
* It adds checks in debug builds to make sure that Init is always
  called, in form of fatal assertions.
* It adds nsIDOMDocument* agruments to nsIClipboardHelper methods which
  represent the document that the string is coming from.
  nsIClipboardHelper implementation internally gets the nsILoadContext
  from that and passes it on to the transferable upon creation.  The
  reason that I did this was that nsIClipboardHelper is supposed to be a
  high-level helper, and in most of its call sites, we have easy access
  to a document object.
* It modifies all of the call sites of the above interfaces according to
  this change.
* It adds a GetLoadContext helper to nsIDocument to help with changing
  the call sites.
2012-04-16 22:14:01 -04:00

43 lines
1.3 KiB
Plaintext

/* -*- Mode: IDL; 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/. */
#include "nsISupports.idl"
#include "nsIClipboard.idl"
%{ C++
#include "nsString.h" // needed for AString -> nsAString, unfortunately
%}
interface nsIDOMDocument;
/**
* helper service for common uses of nsIClipboard.
*/
[scriptable, uuid(836316a9-6834-45e7-92af-5a4b9bd01a31)]
interface nsIClipboardHelper : nsISupports
{
/**
* copy string to given clipboard
*
* @param aString, the string to copy to the clipboard
* @param aDoc, the source document for the string, if available
* @param aClipboardID, the ID of the clipboard to copy to
* (eg. kSelectionClipboard -- see nsIClipboard.idl)
*/
void copyStringToClipboard(in AString aString, [optional] in nsIDOMDocument aDoc, in long aClipboardID);
/**
* copy string to (default) clipboard
*
* @param aString, the string to copy to the clipboard
* @param aDoc, the source document for the string, if available
*/
void copyString(in AString aString, [optional] in nsIDOMDocument aDoc);
};