cuseragent.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (c) 2005 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: Declaration of the CUserAgent class.
  15. *
  16. */
  17. #ifndef __CUSERAGENT_H
  18. #define __CUSERAGENT_H
  19. // INCLUDES
  20. #include <centralrepository.h>
  21. #include <sysversioninfo.h>
  22. #include <versioninfo.h>
  23. // CLASS DECLARATION
  24. /**
  25. * CUserAgent class.
  26. *
  27. * @lib webutils.lib
  28. * @since 3.0
  29. */
  30. enum TUserAgentStringKeys
  31. {
  32. ESymbianOSVersion,
  33. ES60Version,
  34. EHardwareType,
  35. EMIDP_CLDCVersion,
  36. EDefaultUserAgentString,
  37. EDefaultMMSUserAgentString,
  38. EDummy1,
  39. EDummy2,
  40. EURLUAProfile,
  41. EURL3GUAProfile
  42. };
  43. class CUserAgent : public CBase
  44. {
  45. public: // functions
  46. /**
  47. * Destructor.
  48. */
  49. ~CUserAgent();
  50. /**
  51. * NewL
  52. */
  53. IMPORT_C static class CUserAgent* NewL();
  54. /**
  55. * Returns complete constructed user agent string.
  56. */
  57. IMPORT_C HBufC8* UserAgentL();
  58. /**
  59. * Returns fully contructed user agent string for MMS
  60. */
  61. IMPORT_C HBufC8* MMSUserAgentL();
  62. /**
  63. * Fetches the URL to user agent profile (2G and 3G)
  64. * @return void
  65. */
  66. IMPORT_C TInt URLToUserAgentProfileL(TDes8 &aUAProfURL, TDes8 &aUAProfURL3G);
  67. /**
  68. * Returns the Browser version
  69. */
  70. IMPORT_C HBufC* BrowserVersionL();
  71. /**
  72. * Returns the Browser name and version
  73. */
  74. IMPORT_C HBufC* BrowserNameAndVersionL();
  75. private: // functions
  76. /**
  77. * Symbian default constructor.
  78. */
  79. void ConstructL();
  80. /**
  81. * Default C++ constructor
  82. */
  83. CUserAgent();
  84. /**
  85. * Reads useragent strings from shareddata / central repository
  86. */
  87. void ReadUserAgentStringL();
  88. void ReadMMSUserAgentStringL();
  89. void ReadURLUserAgentProfileL();
  90. bool IsUAStringEmpty(const TPtr &aUAString);
  91. TInt GetCenRepFragment(TUserAgentStringKeys aFragmentType, TDes& fragmentValue);
  92. void GetFragmentsL();
  93. void GetMMSFragmentsL();
  94. void ReadAndCreateUAStringL(TPtr &aUAStringPtr);
  95. #ifdef BRDO_BROWSER_50_FF
  96. void GetFragmentsFromOSExtL();
  97. TInt GetOSExtFragment(TUserAgentStringKeys aFragmentType, TDes& fragmentValue, RFs& fs);
  98. /**
  99. * Gets the Version Values from osext layer / central repository
  100. */
  101. TInt GetOSVersion(TDes& aValue, RFs& aFs);
  102. TInt GetS60Version(TDes& aValue, RFs& aFs);
  103. TInt GetVersion(const SysVersionInfo::TVersionInfoType aType, TDes& aValue);
  104. TInt GetHardwareVersion(TDes& aHardwareType, RFs& aFs);
  105. #endif //#ifdef BRDO_BROWSER_50_FF
  106. void GetBrowserVersionL();
  107. void GetBrowserNameAndVersionL();
  108. private: //data
  109. CRepository* iRepository;
  110. TBool iUAStrQueried;
  111. TBool iMMSUAStrQueried;
  112. TBool iURLUAProfQueried;
  113. HBufC* iBrowserCenrepStr;
  114. HBufC* iMMSCenrepStr;
  115. HBufC* iUAProfURL;
  116. HBufC* iUAProfURL3G;
  117. TBuf<64> iSymbianVersion;
  118. TBuf<64> iS60Version;
  119. TBuf<64> iMIDPCLDCVersion;
  120. TBuf<64> iHardwareType;
  121. TBuf<64> iMMSS60Version;
  122. TBuf<64> iMMSMIDPVersion;
  123. TBuf<64> iMMSCLDCVersion;
  124. TBuf<64> iMMSHardwareType;
  125. HBufC* iBrowserVersionStr;
  126. HBufC* iBrowserNameAndVersionStr;
  127. };
  128. #endif // __CUSERAGENT_H
  129. // End of File