00001 #include "epoc-httpurl.hpp" 00002 00003 /* 00004 Implements **URL observing**. Should work on S60 v3.0-5.2 at least, and maybe even older systems. The [AHLE API http://wiki.forum.nokia.com/index.php/Adaptive_History_List_API_for_5th_Edition] now appears to be intended only for use internally by apps, and not to access Web history. Writing an [HTTP filter plugin http://wiki.forum.nokia.com/index.php/Writing_an_HTTP_filter_plugin] apparently does the trick and does it better (should be able to get all URLs, even ones in other applications that use ``RHTTPSession``), [on older devices at least http://discussion.forum.nokia.com/forum/showthread.php?128548-How-to-monitor-S60-browser-to-get-the-details-of-URLs-visited-by-the-user]. Requires the ``NetworkControl`` capability, meaning that only publishers can sign. 00005 */ 00006 00007 #if __HTTPURL_ENABLED__ 00008 00009 #include "er_errors.h" 00010 #include "ld_logging.h" 00011 #include "sa_sensor_list_log_db.h" 00012 #include "utils_cl2.h" 00013 00014 #include "cl2webfilter.h" 00015 00016 #include "common/utilities.h" 00017 00018 // ------------------------------------------------------------------- 00019 // the sensor object implementation... 00020 00021 CSensor_httpurl* CSensor_httpurl::NewLC(ac_AppContext* aAppContext) 00022 { 00023 CSensor_httpurl* obj = new (ELeave) CSensor_httpurl(aAppContext); 00024 CleanupStack::PushL(obj); 00025 obj->ConstructL(); 00026 return obj; 00027 } 00028 00029 CSensor_httpurl* CSensor_httpurl::NewL(ac_AppContext* aAppContext) 00030 { 00031 CSensor_httpurl* obj = CSensor_httpurl::NewLC(aAppContext); 00032 CleanupStack::Pop(obj); 00033 return obj; 00034 } 00035 00036 CSensor_httpurl::~CSensor_httpurl() 00037 { 00038 Cancel(); 00039 SESSION_CLOSE_IF_OPEN(iProperty); 00040 } 00041 00042 CSensor_httpurl::CSensor_httpurl(ac_AppContext* aAppContext) : 00043 CActive(CActive::EPriorityStandard), 00044 iAppContext(aAppContext) 00045 { 00046 CActiveScheduler::Add(this); 00047 } 00048 00049 void CSensor_httpurl::ConstructL() 00050 { 00051 // We have both the "server" and "client" try to define the key. We 00052 // do open a session to the property, after all, and than cannot be 00053 // done unless the property exists. 00054 TInt errCode = RProperty::Define(TUid::Uid(KCl2WebFilterCat), 00055 KCl2WebFilterKey, 00056 RProperty::EByteArray, 00057 256); 00058 if (errCode != KErrNone && errCode != KErrAlreadyExists) 00059 User::Leave(errCode); 00060 00061 LEAVE_IF_ERROR_OR_SET_SESSION_OPEN(iProperty, iProperty.Attach(TUid::Uid(KCl2WebFilterCat), KCl2WebFilterKey, EOwnerThread)); 00062 MakeRequest(); 00063 } 00064 00065 void CSensor_httpurl::MakeRequest() 00066 { 00067 iProperty.Subscribe(iStatus); 00068 SetActive(); 00069 } 00070 00071 void CSensor_httpurl::DoCancel() 00072 { 00073 assert(IS_SESSION_OPEN(iProperty)); 00074 iProperty.Cancel(); 00075 } 00076 00077 TInt CSensor_httpurl::RunError(TInt errCode) 00078 { 00079 er_log_symbian(0, errCode, "INACTIVATE: leave in httpurl sensor event handler"); 00080 return 0; 00081 } 00082 00083 void CSensor_httpurl::RunL() 00084 { 00085 TInt errCode = iStatus.Int(); 00086 if (errCode) { 00087 er_log_symbian(0, errCode, "INACTIVATE: httpurl sensor request error"); 00088 return; 00089 } 00090 00091 TBuf8<RProperty::KMaxPropertySize + 1> buf; 00092 errCode = iProperty.Get(buf); 00093 if (errCode) { 00094 er_log_symbian(0, errCode, "INACTIVATE: httpurl data fetch error"); 00095 return; 00096 } 00097 00098 MakeRequest(); 00099 00100 const char* url = (const char*)(buf.PtrZ()); 00101 guilogf("httpurl: '%s'", url); 00102 log_db_log_httpurl(GetLogDb(), url, NULL); 00103 } 00104 00105 #endif // __HTTPURL_ENABLED__ 00106 00107 /** 00108 00109 epoc-httpurl.cpp 00110 00111 Copyright 2009-2010 Helsinki Institute for Information Technology 00112 (HIIT) and the authors. All rights reserved. 00113 00114 Authors: Tero Hasu <tero.hasu@hut.fi> 00115 00116 Permission is hereby granted, free of charge, to any person 00117 obtaining a copy of this software and associated documentation files 00118 (the "Software"), to deal in the Software without restriction, 00119 including without limitation the rights to use, copy, modify, merge, 00120 publish, distribute, sublicense, and/or sell copies of the Software, 00121 and to permit persons to whom the Software is furnished to do so, 00122 subject to the following conditions: 00123 00124 The above copyright notice and this permission notice shall be 00125 included in all copies or substantial portions of the Software. 00126 00127 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00128 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00129 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00130 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00131 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00132 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00133 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00134 SOFTWARE. 00135 00136 **/
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:52 2011 by Doxygen 1.6.1