S60 3rd Edition SDK for Symbian OS
Example Applications Guide

BrCtlSampleAppLinkResolver.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : BrCtlSampleAppLinkResolver.h
00004 *  Part of     : BrCtlSampleApp
00005 *  Interface   : Browser Control API
00006 *  Description : Observer interface which handles resolving embedded links
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2005-2006 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef BRCTLSAMPLEAPPLINKRESOLVER_H
00018 #define BRCTLSAMPLEAPPLINKRESOLVER_H
00019 
00020 // INCLUDES
00021 #include <BrCtlLinkResolver.h>
00022 #include <BrCtlInterface.h>
00023 
00024 // CLASS DECLARATION
00025 
00026 /**
00027 * CBrCtlSampleAppLinkResolver class. 
00028 * This class inherits from the MBrCtlLinkResolver interface.
00029 * This class is used to provide a callback mechanism for receiving the content of an embedded 
00030 * link or the content of a user-initiated load request.
00031 */
00032 class CBrCtlSampleAppLinkResolver : public CBase, public MBrCtlLinkResolver
00033     {
00034     public:  // Constructors and destructor
00035 
00036         /**
00037         * Two-phased constructor.
00038         */
00039         static CBrCtlSampleAppLinkResolver* NewL();
00040 
00041         /**
00042         * Destructor.
00043         */
00044         ~CBrCtlSampleAppLinkResolver();
00045 
00046         /**
00047         * Browser plug-in calls this method when embedded link is found. Used with ECapabilityClientResolveEmbeddedURL
00048         * @since 2.8
00049         * @param aEmbeddedUrl The url of the embedded content
00050         * @param aCurrentUrl The url of the current page
00051         * @param aLoadContentType The expected type of the embedded content
00052         * @param aEmbeddedLinkContent A callback interface to return the embedded content
00053         * @return EFalse, if the browser will resolve the link
00054         */
00055         TBool ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl,
00056                                        const TDesC& aCurrentUrl,
00057                                        TBrCtlLoadContentType aLoadContentType, 
00058                                        MBrCtlLinkContent& aEmbeddedLinkContent) ; 
00059                 
00060         /**
00061         * Browser plug-in calls this method when the user requests to load content via selecting a link, or any other way. Used with ECapabilityClientNotifyURL 
00062         * @since 2.8
00063         * @param aUrl The requested url
00064         * @param aCurrentUrl The url of the current page
00065         * @param aBrCtlLinkContent A callback interface to return the embedded content
00066         * @return EFalse, if the browser will resolve the link
00067         */
00068         TBool ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl,
00069                            MBrCtlLinkContent& aBrCtlLinkContent) ;
00070 
00071                 /**
00072                 * Cancel all outstanding resolving operations
00073         * @since 2.8
00074         * @return void
00075         */
00076         void CancelAll() ;
00077 
00078     private:
00079             /**
00080         * By default Symbian 2nd phase constructor is private.
00081         */
00082         void ConstructL();
00083 
00084             /**
00085         * Find if the scheme if file://
00086         */
00087         TBool IsFileScheme(const TDesC& aFileName);
00088 
00089             /**
00090         * Read the file.
00091         */
00092         HBufC8* ReadFileLC(const TDesC& aFileName);
00093 
00094             /**
00095         * Rcognize the mime type.
00096         */
00097         HBufC* RecognizeLC(const TDesC& aFileName, const TDesC8& aData);
00098 
00099             /**
00100         * Translate the file name from a URL to a valid file name in the system..
00101         */
00102         TBool GetFileNameL(const TDesC& aFileName);
00103 
00104     private:   // data
00105         // The loaded file's name. This is different from the URL. It does not contain the scheme.
00106         HBufC* iFileName;
00107     };
00108 
00109 #endif      // BRCTLSAMPLEAPPLINKRESOLVER_H
00110             
00111 // End of File
00112 

© Nokia 2006

Back to top