49
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 "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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "javauseragent.h"
|
|
19 |
#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
|
|
20 |
#else
|
|
21 |
#include <cuseragent.h>
|
|
22 |
#endif
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
HBufC* JavaUserAgent::GetUserAgentL()
|
|
27 |
{
|
|
28 |
#ifdef RD_JAVA_S60_RELEASE_10_1_ONWARDS
|
50
|
29 |
|
49
|
30 |
_LIT(KString,"null");
|
|
31 |
HBufC* agent = HBufC::NewLC(5);
|
|
32 |
*agent = KString;
|
|
33 |
CleanupStack::Pop(agent);
|
|
34 |
return agent;
|
|
35 |
|
|
36 |
#else
|
|
37 |
|
|
38 |
CUserAgent* userAgent = CUserAgent::NewL();
|
|
39 |
CleanupStack::PushL(userAgent);
|
|
40 |
|
|
41 |
HBufC8* agent8 = userAgent->UserAgentL();
|
|
42 |
CleanupStack::PushL(agent8);
|
|
43 |
|
|
44 |
HBufC* agent = HBufC::NewMaxLC(agent8->Length());
|
|
45 |
agent->Des().Copy(*agent8);
|
|
46 |
|
|
47 |
CleanupStack::Pop(agent);
|
|
48 |
CleanupStack::PopAndDestroy(agent8);
|
|
49 |
CleanupStack::PopAndDestroy(userAgent);
|
|
50 |
return agent;
|
|
51 |
#endif
|
|
52 |
}
|