/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is mozilla.org code.
 *
 * The Initial Developer of the Original Code is Netscape
 * Communications Corporation.  Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s): 
 */

/*

  This file contains an interface to the Cookie Service.

 */

#include "nsISupports.idl"
#include "nsIURI.idl"
#include "nsIPrompt.idl"

[scriptable, uuid(AB397774-12D3-11d3-8AD1-00105A1B8860)]
interface nsICookieService : nsISupports
{
  /*
   * Get the complete cookie string associated with the URL
   *
   * @param aURL The URL for which to get the cookie string
   * @param aCookie The string object which will hold the result
   * @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
   */
  string getCookieString(in nsIURI aURL);

  /*
   * Get the complete cookie string associated with the URL
   *
   * @param aURL The URL for which to get the cookie string
   * @param aFirstURL The URL which the user typed in or clicked on
   * @param aCookie The string object which will hold the result
   * @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
   */
  string getCookieStringFromHttp(in nsIURI aURL, in nsIURI aFirstURL);

  /*
   * Set the cookie string associated with the URL
   *
   * @param aURL The URL for which to set the cookie string
   * @param aCookie The string to set
   * @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
   */
  void setCookieString(in nsIURI aURL, in nsIPrompt aPrompt, in string aCookie);

  /*
   * Set the cookie string and expires associated with the URL
   *
   * @param aURL The URL for which to set the cookie string
   * @param aFirstURL The URL which the user typed in or clicked on
   * @param aPrompter The nsIPrompt implementation to use. If null, a default
   *                  will be used.
   * @param aCookie The char * string to set
   * @param aExpires The expiry information of the cookie
   * @return Returns NS_OK if successful, or NS_FALSE if an error occurred.
   */
  void setCookieStringFromHttp(in nsIURI aURL, in nsIURI aFirstURL, in nsIPrompt aPrompter, in string aCookie, in string aExpires);

};

%{ C++
// {AB397774-12D3-11d3-8AD1-00105A1B8860}
#define NS_COOKIESERVICE_CID \
{ 0xab397774, 0x12d3, 0x11d3, { 0x8a, 0xd1, 0x0, 0x10, 0x5a, 0x1b, 0x88, 0x60 } }
#define NS_COOKIESERVICE_CONTRACTID "@mozilla.org/cookieService;1"
%}
