author Ed Morley <>
Mon, 16 Jul 2012 11:31:28 +0100
changeset 102114 38812f58ea22baac2edb13406744d6315c036280
parent 99046 b7f3236f127b6f8d455efa6ad75f82a3a3c5f3d4
child 106112 a16372ce30b5f6b747246b01fcd215a4bf3b6342
permissions -rw-r--r--
Merge fx-team and mozilla-central

/* -*- 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 */

#ifndef mozilla_dom_sms_SmsRequest_h
#define mozilla_dom_sms_SmsRequest_h

#include "nsIDOMSmsRequest.h"
#include "nsDOMEventTargetHelper.h"

class nsIDOMMozSmsMessage;
class nsIDOMMozSmsCursor;

namespace mozilla {
namespace dom {
namespace sms {
class SmsManager;

class SmsRequest : public nsDOMEventTargetHelper
                 , public nsIDOMMozSmsRequest
  friend class SmsRequestManager;




  void Reset();

  SmsRequest() MOZ_DELETE;

  SmsRequest(SmsManager* aManager);

   * Root mResult (jsval) to prevent garbage collection.
  void RootResult();

   * Unroot mResult (jsval) to allow garbage collection.
  void UnrootResult();

   * Set the object in a success state with the result being aMessage.
  void SetSuccess(nsIDOMMozSmsMessage* aMessage);

   * Set the object in a success state with the result being a boolean.
  void SetSuccess(bool aResult);

   * Set the object in a success state with the result being a SmsCursor.
  void SetSuccess(nsIDOMMozSmsCursor* aCursor);

   * Set the object in an error state with the error type being aError.
  void SetError(PRInt32 aError);

   * Set the object in a success state with the result being the nsISupports
   * object in parameter.
   * @return whether setting the object was a success
  bool SetSuccessInternal(nsISupports* aObject);

   * Return the internal cursor that is saved when
   * SetSuccess(nsIDOMMozSmsCursor*) is used.
   * Returns null if this request isn't associated to an cursor.
  nsIDOMMozSmsCursor* GetCursor();

  jsval     mResult;
  bool      mResultRooted;
  bool      mDone;
  nsCOMPtr<nsIDOMDOMError> mError;
  nsCOMPtr<nsIDOMMozSmsCursor> mCursor;


inline nsIDOMMozSmsCursor*
  return mCursor;

} // namespace sms
} // namespace dom
} // namespace mozilla

#endif // mozilla_dom_sms_SmsRequest_h