web_pub/browser_control_api/inc/BrCtlLinkResolver.h
changeset 0 dd21522fd290
child 25 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Handle links and embedded content that are not fetched from the network
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef BRCTLLINKRESOLVER_H
       
    20 #define BRCTLLINKRESOLVER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 /**
       
    28 * The browser guesses the expected content type from 
       
    29 * the HTML element in which the content was defined.
       
    30 */
       
    31 enum TBrCtlLoadContentType
       
    32     {
       
    33     ELoadContentTypeAny, ///< The content type is unknown
       
    34     /**
       
    35     * The content is one of the following:
       
    36     * HTML, XHTML, WML
       
    37     */
       
    38     ELoadContentTypeMarkup,
       
    39     ELoadContentTypeImage, ///< The content is an image
       
    40     ELoadContentTypeCss, ///< The content is a cascading style sheet
       
    41     ELoadContentTypeJavascript, ///< The content is Javascript
       
    42     ELoadContentTypePlugin, ///< The content is data for a Netscape plug-in
       
    43     /**
       
    44     * The content is data for SoundStart. SoundStart is an attribute 
       
    45     * that is added to an anchor <a> tag to play audio when an anchor 
       
    46     * is in focus or selected.
       
    47     */
       
    48     ELoadContentTypeSound
       
    49     };
       
    50 
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 class MBrCtlLinkContent;
       
    54 
       
    55 /**
       
    56 * The MBrCtlLinkResolver class provides the content of an embedded link 
       
    57 * or the content of a load request that was initiated by the user. 
       
    58 * This class is used when the host application stores markup text or 
       
    59 * other information in a private store. For example, this class could be 
       
    60 * used for e-mail applications.
       
    61 *
       
    62 * Usage:
       
    63 *
       
    64 * @code
       
    65 *  #include <BrCtlLinkResolver.h>
       
    66 *
       
    67 *  
       
    68 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
    69 * @lib BrowserEngine.lib
       
    70 * @file BrCtlLinkResolver.h
       
    71 * @endcode     *
       
    72 */
       
    73 class MBrCtlLinkResolver
       
    74     {
       
    75     public: // New functions
       
    76         
       
    77       /**
       
    78       * Browser plug-in calls this method when embedded link is found. 
       
    79         * Used with ECapabilityClientResolveEmbeddedURL
       
    80         * @since 2.8
       
    81       * @param aEmbeddedUrl The url of the embedded content
       
    82       * @param aCurrentUrl The url of the current page
       
    83       * @param aLoadContentType Type of the embedded content
       
    84         * Values: One of the following:
       
    85         * ELoadContentTypeAny, ELoadContentTypeMarkup, ELoadContentTypeImage
       
    86         * ELoadContentTypeCss, ELoadContentTypeJavascript, ELoadContentTypePlug-in
       
    87       * @param aEmbeddedLinkContent a callback interface to return the embedded content
       
    88       * @return ETrue if the host application resolves the link.  
       
    89         * EFalse if the host application does not resolve the link. 
       
    90         * @attention The host application makes this request by setting 
       
    91         * the ECapabilityClientResolveEmbeddedURL function.
       
    92       */
       
    93         virtual TBool ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl,
       
    94                                        const TDesC& aCurrentUrl,
       
    95                                          TBrCtlLoadContentType aLoadContentType, 
       
    96                                          MBrCtlLinkContent& aEmbeddedLinkContent) = 0; 
       
    97     
       
    98       /**
       
    99       * Browser plug-in calls this method when the user requests to load content via selecting a link, or any other way. Used with ECapabilityClientNotifyURL 
       
   100         * @since 2.8
       
   101       * @param aUrl The requested url
       
   102       * @param aCurrentUrl The url of the current page
       
   103       * @param aBrCtlLinkContent a callback interface to return the embedded content
       
   104       * @return ETrue if the host application resolves the link.
       
   105         * EFalse if the host application does not resolve the link. 
       
   106         * @attention The host application requests that the browser plug-in call 
       
   107         * this function to load new content by setting the ECapabilityClientNotifyURL function.
       
   108       */
       
   109         virtual TBool ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl,
       
   110                                    MBrCtlLinkContent& aBrCtlLinkContent) = 0;
       
   111 
       
   112     /**
       
   113     * Cancel all outstanding resolving operations
       
   114         * @since 2.8
       
   115       * @return void
       
   116       */
       
   117         virtual void CancelAll() = 0;
       
   118     };
       
   119 
       
   120 
       
   121 /**
       
   122 * The MBrCtlLinkContent class is an interface that loads the resolved content. 
       
   123 *
       
   124 * Usage:
       
   125 *
       
   126 * @code
       
   127 *  #include <BrCtlLinkResolver.h>
       
   128 *
       
   129 *  
       
   130 * @see S60 Platform: Browser Control API Developer's Guide Version 2.0
       
   131 * @lib BrowserEngine.lib
       
   132 * @file BrCtlLinkResolver.h
       
   133 * @endcode     *
       
   134 */
       
   135 class MBrCtlLinkContent
       
   136     {
       
   137     public: // New functions
       
   138         /**
       
   139       * Resolver calls this method when content is resolved.
       
   140       * @param aContentType The content type of the response
       
   141       * @param aCharset The charset of the response. May be empty in case of image
       
   142       * @param aContentBuf content data. Ownership is not transfered
       
   143       * @return void
       
   144       */
       
   145         virtual void HandleResolveComplete(const TDesC& aContentType,
       
   146                                            const TDesC& aCharset,
       
   147                                            const HBufC8* aContentBuf) = 0;
       
   148 
       
   149     /**
       
   150       * This method is called if there is some error while resolving the content
       
   151       * @param aError system wide error code.
       
   152       * @return void
       
   153       */
       
   154         virtual void HandleResolveError(TInt aError) = 0;
       
   155     };
       
   156 
       
   157 
       
   158 
       
   159 #endif      // BRCTLLINKRESOLVER_H
       
   160             
       
   161 // End of File