williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@2
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@2
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
*
|
williamr@2
|
16 |
*/
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
/**
|
williamr@2
|
22 |
@file
|
williamr@2
|
23 |
@publishedPartner
|
williamr@2
|
24 |
@released
|
williamr@2
|
25 |
*/
|
williamr@2
|
26 |
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#ifndef __SUPPLIER_H__
|
williamr@2
|
29 |
#define __SUPPLIER_H__
|
williamr@2
|
30 |
|
williamr@2
|
31 |
#include <e32base.h>
|
williamr@2
|
32 |
#include <e32std.h>
|
williamr@2
|
33 |
#include <caf/caftypes.h>
|
williamr@2
|
34 |
|
williamr@2
|
35 |
class RHTTPHeaders;
|
williamr@2
|
36 |
class RStringPool;
|
williamr@2
|
37 |
|
williamr@2
|
38 |
namespace ContentAccess
|
williamr@2
|
39 |
{
|
williamr@2
|
40 |
class CImportFile;
|
williamr@2
|
41 |
class CMetaDataArray;
|
williamr@2
|
42 |
class CAgentResolver;
|
williamr@2
|
43 |
class MFileHandleProvider;
|
williamr@2
|
44 |
|
williamr@2
|
45 |
#ifndef REMOVE_CAF1
|
williamr@2
|
46 |
class CCafMimeHeader;
|
williamr@2
|
47 |
#endif
|
williamr@2
|
48 |
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
Used to import files using a content access agent. In the case of some
|
williamr@2
|
51 |
DRM agents the import will be a transformation from an unprotected content type
|
williamr@2
|
52 |
to a protected content type.
|
williamr@2
|
53 |
|
williamr@2
|
54 |
It creates CImportFile objects to import files into a Content Access
|
williamr@2
|
55 |
Agent. CSupplier uses it's CAgentResolver to determine which agent should receive
|
williamr@2
|
56 |
the file based upon the mime type of the file.
|
williamr@2
|
57 |
|
williamr@2
|
58 |
Clients can check if a mime type is supported by by calling the
|
williamr@2
|
59 |
CSupplier::IsImportSupported() function.
|
williamr@2
|
60 |
|
williamr@2
|
61 |
The CSupplier does not dynamically update it's list of agents so applications
|
williamr@2
|
62 |
should not use a long term persistent instance of CSupplier.
|
williamr@2
|
63 |
|
williamr@2
|
64 |
@publishedPartner
|
williamr@2
|
65 |
@released
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
class CSupplier : public CBase
|
williamr@2
|
68 |
{
|
williamr@2
|
69 |
public:
|
williamr@2
|
70 |
/** Create a new CSupplier
|
williamr@2
|
71 |
@return a CSupplier object
|
williamr@2
|
72 |
*/
|
williamr@2
|
73 |
IMPORT_C static CSupplier* NewL();
|
williamr@2
|
74 |
|
williamr@2
|
75 |
/** Create a new CSupplier
|
williamr@2
|
76 |
@return a CSupplier object
|
williamr@2
|
77 |
*/
|
williamr@2
|
78 |
IMPORT_C static CSupplier* NewLC();
|
williamr@2
|
79 |
|
williamr@2
|
80 |
/** destructor */
|
williamr@2
|
81 |
virtual ~CSupplier();
|
williamr@2
|
82 |
|
williamr@2
|
83 |
/** Sets the output directory for any files generated by the CAF.
|
williamr@2
|
84 |
|
williamr@2
|
85 |
@param aOutputDirectory The preferred location to store any output files
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
IMPORT_C void SetOutputDirectoryL(const TDesC& aOutputDirectory);
|
williamr@2
|
88 |
|
williamr@2
|
89 |
/** Determines whether one of the CAF agents wants to import
|
williamr@2
|
90 |
a file with the given mimetype
|
williamr@2
|
91 |
|
williamr@2
|
92 |
If this function returns ETrue the application should use the CSupplier to
|
williamr@2
|
93 |
create a ContentAccess::CImportFile session and import the file into CAF.
|
williamr@2
|
94 |
|
williamr@2
|
95 |
@param aMimeType The mime type of the file determined by an Apparc recognition or transmission header information.
|
williamr@2
|
96 |
@return ETrue if the mimetype is recognized by one of the CAF agents, EFalse otherwise.
|
williamr@2
|
97 |
*/
|
williamr@2
|
98 |
IMPORT_C TBool IsImportSupported(const TDesC8& aMimeType);
|
williamr@2
|
99 |
|
williamr@2
|
100 |
|
williamr@2
|
101 |
/** Get HTTP download headers from the agents
|
williamr@2
|
102 |
|
williamr@2
|
103 |
Some DRM schemes require specific headers to be present in the HTTP request
|
williamr@2
|
104 |
header. This function allows a client to retrieve these headers from the
|
williamr@2
|
105 |
agents so any download request will satisfy the criteria required by
|
williamr@2
|
106 |
the HTTP server.
|
williamr@2
|
107 |
|
williamr@2
|
108 |
@param aStringPool The string pool used by the HTTP session
|
williamr@2
|
109 |
@param aRequestHeaders The agents will add any required fields to the headers
|
williamr@2
|
110 |
*/
|
williamr@2
|
111 |
IMPORT_C void PrepareHTTPRequestHeaders(RStringPool& aStringPool, RHTTPHeaders& aRequestHeaders) const;
|
williamr@2
|
112 |
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/** Creates a new CImportFile object and allow the agent to generate the output files
|
williamr@2
|
115 |
|
williamr@2
|
116 |
@param aMimeType This should be one of the mime types supported by CAF, IsImportSupported() can be used to check this.
|
williamr@2
|
117 |
@param aImportMetaData Any additional information that may be useful for the agent performing the import.
|
williamr@2
|
118 |
Ideally this will include the mime headers for the file about to be passed into CAF.
|
williamr@2
|
119 |
@param aSuggestedFileName Suggested filename for the CAF agent to use when
|
williamr@2
|
120 |
creating the output files, Details of the output files produced can be obtained using
|
williamr@2
|
121 |
CImportFile::OutputFileL().
|
williamr@2
|
122 |
@return A CImportFile object to import the file.
|
williamr@2
|
123 |
|
williamr@2
|
124 |
@leave KErrCANoAgent No agent supports the mime type supplied in aMimeType
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
IMPORT_C CImportFile* ImportFileL(const TDesC8& aMimeType, const CMetaDataArray& aImportMetaData, const TDesC& aSuggestedFileName);
|
williamr@2
|
127 |
|
williamr@2
|
128 |
/** Creates a new CImportFile object where the caller must provide file handles to store output files.
|
williamr@2
|
129 |
|
williamr@2
|
130 |
This allows a server to store the output files within its own private directory. The CAF agent will write to the private directory
|
williamr@2
|
131 |
using the file handle provided by the server.
|
williamr@2
|
132 |
|
williamr@2
|
133 |
If the agent requires a new output file it will return KErrCANewFileHandleRequired from CImportFile::Write() or CImportFile::WriteComplete()
|
williamr@2
|
134 |
The application performing the supply should provide the agent with a new file handle using CImportFile::ContinueWithNewOutputFile();
|
williamr@2
|
135 |
|
williamr@2
|
136 |
@param aMimeType This should be one of the mime types supported a CAF agent, IsImportSupported() can be used to check this.
|
williamr@2
|
137 |
@param aImportMetaData Any additional information that may be useful for the agent performing the import.
|
williamr@2
|
138 |
Ideally this will include the mime headers for the file about to be passed into CAF.
|
williamr@2
|
139 |
@return A CImportFile object to import the file.
|
williamr@2
|
140 |
|
williamr@2
|
141 |
@leave KErrCANoAgent No agent supports the mime type supplied in aMimeType
|
williamr@2
|
142 |
*/
|
williamr@2
|
143 |
IMPORT_C CImportFile* ImportFileL(const TDesC8& aMimeType, const CMetaDataArray& aImportMetaData);
|
williamr@2
|
144 |
|
williamr@2
|
145 |
#ifndef REMOVE_CAF1
|
williamr@2
|
146 |
/** Import a file
|
williamr@2
|
147 |
@param aMimeHeader Mime headers associated with the file to import
|
williamr@2
|
148 |
@param aSuggestedFileName The application supplied name for any output file created by the agent
|
williamr@2
|
149 |
@deprecated
|
williamr@2
|
150 |
*/
|
williamr@2
|
151 |
IMPORT_C CImportFile* ImportFileL(CCafMimeHeader &aMimeHeader, const TDesC &aSuggestedFileName);
|
williamr@2
|
152 |
#endif
|
williamr@2
|
153 |
|
williamr@2
|
154 |
private:
|
williamr@2
|
155 |
CSupplier();
|
williamr@2
|
156 |
void ConstructL();
|
williamr@2
|
157 |
|
williamr@2
|
158 |
// Resolver used to figure out which CA agent is responsible for importing a particular file
|
williamr@2
|
159 |
CAgentResolver* iAgentResolver;
|
williamr@2
|
160 |
HBufC* iOutputDirectory;
|
williamr@2
|
161 |
};
|
williamr@2
|
162 |
}
|
williamr@2
|
163 |
|
williamr@2
|
164 |
#endif
|