LCOV - code coverage report
Current view: directory - dom/src/jsurl - nsJSProtocolHandler.h (source / functions) Found Hit Coverage
Test: app.info Lines: 5 4 80.0 %
Date: 2012-06-02 Functions: 5 4 80.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 1998
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Emanuele Costa <emanuele.costa@gmail.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef nsJSProtocolHandler_h___
      40                 : #define nsJSProtocolHandler_h___
      41                 : 
      42                 : #include "nsIProtocolHandler.h"
      43                 : #include "nsITextToSubURI.h"
      44                 : #include "nsIURI.h"
      45                 : #include "nsIMutable.h"
      46                 : #include "nsISerializable.h"
      47                 : #include "nsIClassInfo.h"
      48                 : #include "nsSimpleURI.h"
      49                 : 
      50                 : #define NS_JSPROTOCOLHANDLER_CID                     \
      51                 : { /* bfc310d2-38a0-11d3-8cd3-0060b0fc14a3 */         \
      52                 :     0xbfc310d2,                                      \
      53                 :     0x38a0,                                          \
      54                 :     0x11d3,                                          \
      55                 :     {0x8c, 0xd3, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
      56                 : }
      57                 : 
      58                 : #define NS_JSURI_CID                                 \
      59                 : { /* 58f089ee-512a-42d2-a935-d0c874128930 */         \
      60                 :     0x58f089ee,                                      \
      61                 :     0x512a,                                          \
      62                 :     0x42d2,                                          \
      63                 :     {0xa9, 0x35, 0xd0, 0xc8, 0x74, 0x12, 0x89, 0x30} \
      64                 : }
      65                 : 
      66                 : #define NS_JSPROTOCOLHANDLER_CONTRACTID \
      67                 :     NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript"
      68                 : 
      69                 : 
      70                 : class nsJSProtocolHandler : public nsIProtocolHandler
      71                 : {
      72                 : public:
      73                 :     NS_DECL_ISUPPORTS
      74                 : 
      75                 :     // nsIProtocolHandler methods:
      76                 :     NS_DECL_NSIPROTOCOLHANDLER
      77                 : 
      78                 :     // nsJSProtocolHandler methods:
      79                 :     nsJSProtocolHandler();
      80                 :     virtual ~nsJSProtocolHandler();
      81                 : 
      82                 :     static nsresult
      83                 :     Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
      84                 : 
      85                 :     nsresult Init();
      86                 : 
      87                 : protected:
      88                 : 
      89                 :     nsresult EnsureUTF8Spec(const nsAFlatCString &aSpec, const char *aCharset, 
      90                 :                             nsACString &aUTF8Spec);
      91                 : 
      92                 :     nsCOMPtr<nsITextToSubURI>  mTextToSubURI;
      93                 : };
      94                 : 
      95                 : 
      96                 : class nsJSURI : public nsSimpleURI
      97             296 : {
      98                 : public:
      99                 : 
     100               0 :     nsJSURI() {}
     101                 : 
     102              74 :     nsJSURI(nsIURI* aBaseURI) : mBaseURI(aBaseURI) {}
     103                 : 
     104             230 :     nsIURI* GetBaseURI() const
     105                 :     {
     106             230 :         return mBaseURI;
     107                 :     }
     108                 : 
     109                 :     NS_DECL_ISUPPORTS_INHERITED
     110                 : 
     111                 :     // nsIURI overrides
     112                 :     virtual nsSimpleURI* StartClone(RefHandlingEnum refHandlingMode);
     113                 : 
     114                 :     // nsISerializable overrides
     115                 :     NS_IMETHOD Read(nsIObjectInputStream* aStream);
     116                 :     NS_IMETHOD Write(nsIObjectOutputStream* aStream);
     117                 : 
     118                 :     // Override the nsIClassInfo method GetClassIDNoAlloc to make sure our
     119                 :     // nsISerializable impl works right.
     120                 :     NS_IMETHOD GetClassIDNoAlloc(nsCID *aClassIDNoAlloc);
     121                 :     //NS_IMETHOD QueryInterface( const nsIID& aIID, void** aInstancePtr );
     122                 : 
     123                 : protected:
     124                 :     virtual nsresult EqualsInternal(nsIURI* other,
     125                 :                                     RefHandlingEnum refHandlingMode,
     126                 :                                     bool* result);
     127                 : private:
     128                 :     nsCOMPtr<nsIURI> mBaseURI;
     129                 : };
     130                 : 
     131                 : #endif /* nsJSProtocolHandler_h___ */

Generated by: LCOV version 1.7