Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
nsXFormsUploadElement.cpp File Reference
#include "nsIXFormsUploadElement.h"
#include "nsIXFormsUploadUIElement.h"
#include "nsXFormsUtils.h"
#include "nsIContent.h"
#include "nsNetUtil.h"
#include "nsXFormsDelegateStub.h"
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
#include "plbase64.h"
#include "nsIFilePicker.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsIDOMWindowInternal.h"
#include "nsIAttribute.h"
#include "nsIStringBundle.h"
#include "nsAutoBuffer.h"
#include "nsIEventStateManager.h"
#include "prmem.h"
#include "nsISchema.h"

Go to the source code of this file.

Classes

class  nsXFormsUploadElement
 Implementation of the <upload> element. More...

Defines

#define NS_HTMLFORM_BUNDLE_URL   "chrome://global/locale/layout/HtmlForm.properties"

Typedefs

typedef nsAutoBuffer< char, 256 > nsAutoCharBuffer

Functions

 NS_IMPL_ISUPPORTS_INHERITED1 (nsXFormsUploadElement, nsXFormsDelegateStub, nsIXFormsUploadElement) NS_IMETHODIMP nsXFormsUploadElement
static void ReleaseObject (void *aObject, nsIAtom *aPropertyName, void *aPropertyValue, void *aData)
static void ReportEncodingMemoryError (nsIDOMElement *aElement, nsIFile *aFile, PRUint32 aFailedSize)
static PRUnichar ToHexChar (PRInt16 aValue)
 NS_NewXFormsUploadElement (nsIXTFElement **aResult)

Define Documentation

#define NS_HTMLFORM_BUNDLE_URL   "chrome://global/locale/layout/HtmlForm.properties"

Definition at line 60 of file nsXFormsUploadElement.cpp.


Typedef Documentation

typedef nsAutoBuffer<char, 256> nsAutoCharBuffer

Definition at line 445 of file nsXFormsUploadElement.cpp.


Function Documentation

Definition at line 102 of file nsXFormsUploadElement.cpp.

{
  NS_ENSURE_ARG_POINTER(aRestriction);
  NS_ENSURE_ARG_POINTER(aIsAllowed);
  *aRestriction = eTypes_Inclusive;
  *aIsAllowed = PR_FALSE;

  // If it is not bound to 'anyURI', 'base64Binary', 'hexBinary', or an
  // extension or derivation of one of these three types, then put an error in
  // the console.  CSS and XBL will make sure that the control won't appear in
  // the form.

  if (aType == nsISchemaBuiltinType::BUILTIN_TYPE_HEXBINARY ||
      aType == nsISchemaBuiltinType::BUILTIN_TYPE_BASE64BINARY ||
      aType == nsISchemaBuiltinType::BUILTIN_TYPE_ANYURI) {

    *aIsAllowed = PR_TRUE;
    return NS_OK;
  }

  // build the string of types that upload can bind to
  aAllowedTypes.AssignLiteral("xsd:anyURI xsd:base64Binary xsd:hexBinary");
  return NS_OK;
}

Definition at line 550 of file nsXFormsUploadElement.cpp.

{
  *aResult = new nsXFormsUploadElement();
  if (!*aResult)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(*aResult);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void ReleaseObject ( void aObject,
nsIAtom aPropertyName,
void aPropertyValue,
void aData 
) [static]

Definition at line 135 of file nsXFormsUploadElement.cpp.

{
  NS_STATIC_CAST(nsISupports *, aPropertyValue)->Release();
}

Here is the caller graph for this function:

static void ReportEncodingMemoryError ( nsIDOMElement aElement,
nsIFile aFile,
PRUint32  aFailedSize 
) [static]

Definition at line 448 of file nsXFormsUploadElement.cpp.

{
  nsAutoString filename;
  if (NS_FAILED(aFile->GetLeafName(filename))) {
    return;
  }

  nsAutoString size;
  size.AppendInt((PRInt64)aFailedSize);
  const PRUnichar *strings[] = { filename.get(), size.get() };
  nsXFormsUtils::ReportError(NS_LITERAL_STRING("encodingMemoryError"),
                             strings, 2, aElement, aElement);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRUnichar ToHexChar ( PRInt16  aValue) [inline, static]

Definition at line 530 of file nsXFormsUploadElement.cpp.

{
  if (aValue < 10)
    return (PRUnichar) aValue + '0';
  else
    return (PRUnichar) aValue - 10 + 'A';
}

Here is the caller graph for this function: