bug 113143, cookie module to call compact-policy parser, r=sgehani,harishd, sr=jag

This commit is contained in:
morse%netscape.com 2002-02-15 03:01:32 +00:00
Родитель 2e9769a204
Коммит 4aee3920d6
10 изменённых файлов: 21 добавлений и 103 удалений

Просмотреть файл

@ -3,3 +3,4 @@ nsICookieManager.idl
nsIImgManager.idl nsIImgManager.idl
nsIPermission.idl nsIPermission.idl
nsIPermissionManager.idl nsIPermissionManager.idl
nsICookieConsent.idl

Просмотреть файл

@ -64,6 +64,7 @@ CPPSRCS = \
XPIDLSRCS = \ XPIDLSRCS = \
nsICookieManager.idl \ nsICookieManager.idl \
nsICookieConsent.idl \
nsIImgManager.idl \ nsIImgManager.idl \
nsIPermissionManager.idl \ nsIPermissionManager.idl \
nsICookie.idl \ nsICookie.idl \

Просмотреть файл

@ -40,6 +40,7 @@ REQUIRES = xpcom \
EXPORTS = nsCookieHTTPNotify.h EXPORTS = nsCookieHTTPNotify.h
XPIDLSRCS= .\nsICookieManager.idl \ XPIDLSRCS= .\nsICookieManager.idl \
.\nsICookieConsent.idl \
.\nsIImgManager.idl \ .\nsIImgManager.idl \
.\nsIPermissionManager.idl \ .\nsIPermissionManager.idl \
.\nsICookie.idl \ .\nsICookie.idl \

Просмотреть файл

@ -52,7 +52,7 @@
#include "nsTextFormatter.h" #include "nsTextFormatter.h"
#include "nsAppDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
//!!!!!#include "nsIP3PService.h" #include "nsICookieConsent.h"
#define MAX_NUMBER_OF_COOKIES 300 #define MAX_NUMBER_OF_COOKIES 300
#define MAX_COOKIES_PER_SERVER 20 #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 * The following defines are used to refer to these character positions and values
*/ */
#define P3P_UnknownPolicy -1
#define P3P_NoPolicy 0 #define P3P_NoPolicy 0
#define P3P_NoConsent 2 #define P3P_NoConsent 2
#define P3P_ImplicitConsent 4 #define P3P_ImplicitConsent 4
@ -404,12 +405,6 @@ cookie_BehaviorPrefChanged(const char * newpref, void * data) {
n = PERMISSION_Accept; n = PERMISSION_Accept;
} }
if (n == PERMISSION_P3P) {
// load p3p dll
//!!!!! nsCOMPtr<nsIP3PService> p3p(do_GetService(NS_P3PSERVICE_CONTRACTID));
//!!!!! if (!p3p) return 0;
}
cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n); cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n);
return 0; return 0;
} }
@ -516,12 +511,6 @@ COOKIE_RegisterPrefCallbacks(void) {
n = PERMISSION_Accept; n = PERMISSION_Accept;
} }
if (n == PERMISSION_P3P) {
// load p3p dll
//!!!!! nsCOMPtr<nsIP3PService> p3p(do_GetService(NS_P3PSERVICE_CONTRACTID));
//!!!!! if (!p3p) return;
}
cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n); cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n);
prefs->RegisterCallback(cookie_behaviorPref, cookie_BehaviorPrefChanged, nsnull); prefs->RegisterCallback(cookie_behaviorPref, cookie_BehaviorPrefChanged, nsnull);
@ -856,7 +845,7 @@ cookie_GetPolicy(int policy) {
case P3P_NoIdentInfo: case P3P_NoIdentInfo:
return nsICookie::POLICY_NO_II; return nsICookie::POLICY_NO_II;
} }
return nsICookie::POLICY_NONE; return nsICookie::POLICY_UNKNOWN;
} }
/* /*
@ -865,11 +854,13 @@ cookie_GetPolicy(int policy) {
*/ */
int int
P3P_SitePolicy(char * curURL, nsIHttpChannel* aHttpChannel) { P3P_SitePolicy(char * curURL, nsIHttpChannel* aHttpChannel) {
int consent = P3P_NoPolicy; int consent = P3P_UnknownPolicy;
//!!!!! nsCOMPtr<nsIP3PService> p3p(do_GetService(NS_P3PSERVICE_CONTRACTID)); if (cookie_GetBehaviorPref() == PERMISSION_P3P) {
//!!!!! if (p3p) { nsCOMPtr<nsICookieConsent> p3p(do_GetService(NS_COOKIECONSENT_CONTRACTID));
//!!!!! p3p->GetConsent(curURL,aHttpChannel,&consent); if (p3p) {
//!!!!! } p3p->GetConsent(curURL,aHttpChannel,&consent);
}
}
return consent; return consent;
} }

Просмотреть файл

Просмотреть файл

@ -37,6 +37,7 @@ REQUIRES = xpcom \
string \ string \
necko \ necko \
pref \ pref \
cookie \
$(NULL) $(NULL)
CPPSRCS = \ CPPSRCS = \

Просмотреть файл

@ -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>

Просмотреть файл

@ -51,7 +51,7 @@ static nsModuleComponentInfo gP3PComponents[] =
{ {
{"P3P Service", {"P3P Service",
NS_P3PSERVICE_CID, NS_P3PSERVICE_CID,
NS_P3PSERVICE_CONTRACTID, NS_COOKIECONSENT_CONTRACTID,
nsP3PServiceConstructor, nsP3PServiceConstructor,
} }
}; };

Просмотреть файл

@ -83,7 +83,7 @@ StopListeningToHeaders(nsP3PService* aService) {
***********************************/ ***********************************/
NS_IMPL_ISUPPORTS3(nsP3PService, NS_IMPL_ISUPPORTS3(nsP3PService,
nsIP3PService, nsICookieConsent,
nsIHttpNotify, nsIHttpNotify,
nsINetNotify); nsINetNotify);

Просмотреть файл

@ -39,14 +39,14 @@
#ifndef NS_P3PSERVICE_H__ #ifndef NS_P3PSERVICE_H__
#define NS_P3PSERVICE_H__ #define NS_P3PSERVICE_H__
#include "nsIP3PService.h" #include "nsICookieConsent.h"
#include "nsIHttpNotify.h" #include "nsIHttpNotify.h"
#include "nsCompactPolicy.h" #include "nsCompactPolicy.h"
#include "nsIObserver.h" #include "nsIObserver.h"
class nsIPrefBranch; class nsIPrefBranch;
class nsP3PService : public nsIP3PService, class nsP3PService : public nsICookieConsent,
public nsIHttpNotify, public nsIHttpNotify,
public nsIObserver public nsIObserver
{ {
@ -55,15 +55,15 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// nsIHttpNotify // nsIHttpNotify
NS_DECL_NSIHTTPNOTIFY NS_DECL_NSIHTTPNOTIFY
// nsIP3PService // nsICookieConsent
NS_DECL_NSIP3PSERVICE NS_DECL_NSICOOKIECONSENT
// nsIObserver // nsIObserver
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
nsP3PService( ); nsP3PService( );
virtual ~nsP3PService( ); virtual ~nsP3PService( );
// nsP3PService // P3PService
nsresult Init(); nsresult Init();
protected: protected:
nsresult ProcessResponseHeader(nsIHttpChannel* aHttpChannel); nsresult ProcessResponseHeader(nsIHttpChannel* aHttpChannel);