diff --git a/extensions/cookie/MANIFEST_IDL b/extensions/cookie/MANIFEST_IDL index cc67ca8f09a..2a1bb17a075 100644 --- a/extensions/cookie/MANIFEST_IDL +++ b/extensions/cookie/MANIFEST_IDL @@ -3,3 +3,4 @@ nsICookieManager.idl nsIImgManager.idl nsIPermission.idl nsIPermissionManager.idl +nsICookieConsent.idl diff --git a/extensions/cookie/Makefile.in b/extensions/cookie/Makefile.in index e3ea52c044c..544f3c5ab62 100644 --- a/extensions/cookie/Makefile.in +++ b/extensions/cookie/Makefile.in @@ -64,6 +64,7 @@ CPPSRCS = \ XPIDLSRCS = \ nsICookieManager.idl \ + nsICookieConsent.idl \ nsIImgManager.idl \ nsIPermissionManager.idl \ nsICookie.idl \ diff --git a/extensions/cookie/makefile.win b/extensions/cookie/makefile.win index c4f3ff7e7a2..c08ab215199 100644 --- a/extensions/cookie/makefile.win +++ b/extensions/cookie/makefile.win @@ -40,6 +40,7 @@ REQUIRES = xpcom \ EXPORTS = nsCookieHTTPNotify.h XPIDLSRCS= .\nsICookieManager.idl \ + .\nsICookieConsent.idl \ .\nsIImgManager.idl \ .\nsIPermissionManager.idl \ .\nsICookie.idl \ diff --git a/extensions/cookie/nsCookies.cpp b/extensions/cookie/nsCookies.cpp index 5a7ac1bd94c..27200dff37f 100644 --- a/extensions/cookie/nsCookies.cpp +++ b/extensions/cookie/nsCookies.cpp @@ -52,7 +52,7 @@ #include "nsTextFormatter.h" #include "nsAppDirectoryServiceDefs.h" #include "nsIObserverService.h" -//!!!!!#include "nsIP3PService.h" +#include "nsICookieConsent.h" #define MAX_NUMBER_OF_COOKIES 300 #define MAX_COOKIES_PER_SERVER 20 @@ -131,6 +131,7 @@ PRIVATE char* cookie_P3P = nsnull; * The following defines are used to refer to these character positions and values */ +#define P3P_UnknownPolicy -1 #define P3P_NoPolicy 0 #define P3P_NoConsent 2 #define P3P_ImplicitConsent 4 @@ -404,12 +405,6 @@ cookie_BehaviorPrefChanged(const char * newpref, void * data) { n = PERMISSION_Accept; } - if (n == PERMISSION_P3P) { - // load p3p dll -//!!!!! nsCOMPtr p3p(do_GetService(NS_P3PSERVICE_CONTRACTID)); -//!!!!! if (!p3p) return 0; - } - cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n); return 0; } @@ -516,12 +511,6 @@ COOKIE_RegisterPrefCallbacks(void) { n = PERMISSION_Accept; } - if (n == PERMISSION_P3P) { - // load p3p dll -//!!!!! nsCOMPtr p3p(do_GetService(NS_P3PSERVICE_CONTRACTID)); -//!!!!! if (!p3p) return; - } - cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n); prefs->RegisterCallback(cookie_behaviorPref, cookie_BehaviorPrefChanged, nsnull); @@ -856,7 +845,7 @@ cookie_GetPolicy(int policy) { case P3P_NoIdentInfo: return nsICookie::POLICY_NO_II; } - return nsICookie::POLICY_NONE; + return nsICookie::POLICY_UNKNOWN; } /* @@ -865,11 +854,13 @@ cookie_GetPolicy(int policy) { */ int P3P_SitePolicy(char * curURL, nsIHttpChannel* aHttpChannel) { - int consent = P3P_NoPolicy; -//!!!!! nsCOMPtr p3p(do_GetService(NS_P3PSERVICE_CONTRACTID)); -//!!!!! if (p3p) { -//!!!!! p3p->GetConsent(curURL,aHttpChannel,&consent); -//!!!!! } + int consent = P3P_UnknownPolicy; + if (cookie_GetBehaviorPref() == PERMISSION_P3P) { + nsCOMPtr p3p(do_GetService(NS_COOKIECONSENT_CONTRACTID)); + if (p3p) { + p3p->GetConsent(curURL,aHttpChannel,&consent); + } + } return consent; } diff --git a/extensions/cookie/nsICookieConsent.idl b/extensions/cookie/nsICookieConsent.idl new file mode 100644 index 00000000000..e69de29bb2d diff --git a/extensions/p3p/src/Makefile.in b/extensions/p3p/src/Makefile.in index fd4aa330fe4..decd737b1f9 100644 --- a/extensions/p3p/src/Makefile.in +++ b/extensions/p3p/src/Makefile.in @@ -37,6 +37,7 @@ REQUIRES = xpcom \ string \ necko \ pref \ + cookie \ $(NULL) CPPSRCS = \ diff --git a/extensions/p3p/src/makefile.win b/extensions/p3p/src/makefile.win index bfa9021cf0e..e69de29bb2d 100644 --- a/extensions/p3p/src/makefile.win +++ b/extensions/p3p/src/makefile.win @@ -1,77 +0,0 @@ -# !nmake -# ***** BEGIN LICENSE BLOCK ***** -# Version: NPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Netscape Public License -# Version 1.1 (the "License"); you may not use this file except in -# compliance with the License. You may obtain a copy of the License at -# http://www.mozilla.org/NPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the NPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the NPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** */ - -DEPTH=..\..\.. - -MODULE = p3p -LIBRARY_NAME = p3p -MODULE_NAME = nsP3PModule - -REQUIRES = xpcom \ - string \ - necko \ - pref \ - $(NULL) - -include <$(DEPTH)\config\config.mak> - -CPPSRCS = \ - nsP3PService.cpp \ - nsCompactPolicy.cpp \ - nsP3PModule.cpp \ - $(NULL) - -CPP_OBJS = \ - .\$(OBJDIR)\nsP3PService.obj \ - .\$(OBJDIR)\nsCompactPolicy.obj \ - .\$(OBJDIR)\nsP3PModule.obj \ - $(NULL) - -LCFLAGS = \ - $(LCFLAGS) \ - $(DEFINES) \ - $(NULL) - -LLIBS = \ - $(LLIBS) \ - $(LIBNSPR) \ - $(DIST)\lib\xpcom.lib \ - $(DIST)\lib\js3250.lib \ - $(NULL) - -include <$(DEPTH)\config\rules.mak> \ No newline at end of file diff --git a/extensions/p3p/src/nsP3PModule.cpp b/extensions/p3p/src/nsP3PModule.cpp index 1aa7f3f65b0..323eed77079 100644 --- a/extensions/p3p/src/nsP3PModule.cpp +++ b/extensions/p3p/src/nsP3PModule.cpp @@ -51,7 +51,7 @@ static nsModuleComponentInfo gP3PComponents[] = { {"P3P Service", NS_P3PSERVICE_CID, - NS_P3PSERVICE_CONTRACTID, + NS_COOKIECONSENT_CONTRACTID, nsP3PServiceConstructor, } }; diff --git a/extensions/p3p/src/nsP3PService.cpp b/extensions/p3p/src/nsP3PService.cpp index fae9c771096..3a18656bec6 100644 --- a/extensions/p3p/src/nsP3PService.cpp +++ b/extensions/p3p/src/nsP3PService.cpp @@ -83,7 +83,7 @@ StopListeningToHeaders(nsP3PService* aService) { ***********************************/ NS_IMPL_ISUPPORTS3(nsP3PService, - nsIP3PService, + nsICookieConsent, nsIHttpNotify, nsINetNotify); diff --git a/extensions/p3p/src/nsP3PService.h b/extensions/p3p/src/nsP3PService.h index a07ac2b068b..895ed57f995 100644 --- a/extensions/p3p/src/nsP3PService.h +++ b/extensions/p3p/src/nsP3PService.h @@ -39,14 +39,14 @@ #ifndef NS_P3PSERVICE_H__ #define NS_P3PSERVICE_H__ -#include "nsIP3PService.h" +#include "nsICookieConsent.h" #include "nsIHttpNotify.h" #include "nsCompactPolicy.h" #include "nsIObserver.h" class nsIPrefBranch; -class nsP3PService : public nsIP3PService, +class nsP3PService : public nsICookieConsent, public nsIHttpNotify, public nsIObserver { @@ -55,15 +55,15 @@ public: NS_DECL_ISUPPORTS // nsIHttpNotify NS_DECL_NSIHTTPNOTIFY - // nsIP3PService - NS_DECL_NSIP3PSERVICE + // nsICookieConsent + NS_DECL_NSICOOKIECONSENT // nsIObserver NS_DECL_NSIOBSERVER nsP3PService( ); virtual ~nsP3PService( ); - // nsP3PService + // P3PService nsresult Init(); protected: nsresult ProcessResponseHeader(nsIHttpChannel* aHttpChannel);