Skip to content

Commit bc8f4ca

Browse files
CzarekCzarek
authored andcommitted
Added CookieManager class.
Added CookieVisitor class. Added RequestHandler.GetCookieManager() callback. Added cookie tests to the wxpython.py script on Linux. Minor refactoring in client_handler.
1 parent 2b9d8ac commit bc8f4ca

30 files changed

Lines changed: 618 additions & 211 deletions
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// d:\cefpython\src\setup/cefpython.h(22) : warning C4190: 'RequestHandler_GetCookieManager'
2+
// has C-linkage specified, but returns UDT 'CefRefPtr<T>' which is incompatible with C
3+
#if defined(OS_WIN)
4+
#pragma warning(disable:4190)
5+
#endif
6+
7+
// All the imports that are required when including "cefpython.h".
8+
#include "include/cef_client.h"
9+
#include "include/cef_web_urlrequest.h"
10+
#include "include/cef_cookie.h"
11+
#include "util.h"
12+
13+
// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
14+
#include "Python.h"
15+
16+
// Python 3.2 fix - DL_IMPORT is not defined in Python.h
17+
#ifndef DL_IMPORT /* declarations for DLL import/export */
18+
#define DL_IMPORT(RTYPE) RTYPE
19+
#endif
20+
#ifndef DL_EXPORT /* declarations for DLL import/export */
21+
#define DL_EXPORT(RTYPE) RTYPE
22+
#endif
23+
24+
#if defined(OS_WIN)
25+
#include "windows/setup/cefpython.h"
26+
#endif
27+
28+
#if defined(OS_LINUX)
29+
#include "linux/setup/cefpython.h"
30+
#endif

cefpython/cef1/client_handler/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
CC = g++
22
CCFLAGS = -g
33

4-
SRC = client_handler.cpp web_request_client.cpp content_filter_handler.cpp
4+
SRC = client_handler.cpp web_request_client.cpp content_filter_handler.cpp cookie_visitor.cpp
55
OBJ = $(SRC:.cpp=.o)
66
OUT = libclient_handler.a
77

cefpython/cef1/client_handler/client_handler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
2+
// License: New BSD License.
3+
// Website: http://code.google.com/p/cefpython/
4+
15
#include "client_handler.h"
26
#include <stdio.h>
37

4-
// Cython doesn't know nothing about 'const' so we need to remove it,
5-
// otherwise you get compile error.
8+
// The const_cast<> were required in Cython <= 0.17.4,
9+
// todo: get rid of it.
610

711
//
812
// CefLoadHandler

cefpython/cef1/client_handler/client_handler.h

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,7 @@
44

55
#pragma once
66

7-
// d:\cefpython\src\setup/cefpython.h(22) : warning C4190: 'RequestHandler_GetCookieManager'
8-
// has C-linkage specified, but returns UDT 'CefRefPtr<T>' which is incompatible with C
9-
#if defined(OS_WIN)
10-
#pragma warning(disable:4190)
11-
#endif
12-
13-
#include "include/cef_client.h"
14-
#include "util.h"
15-
16-
// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
17-
#include "Python.h"
18-
19-
// Python 3.2 fix - DL_IMPORT is not defined in Python.h
20-
#ifndef DL_IMPORT /* declarations for DLL import/export */
21-
#define DL_IMPORT(RTYPE) RTYPE
22-
#endif
23-
#ifndef DL_EXPORT /* declarations for DLL import/export */
24-
#define DL_EXPORT(RTYPE) RTYPE
25-
#endif
26-
27-
#if defined(OS_WIN)
28-
#include "windows/setup/cefpython.h"
29-
#endif
30-
31-
#if defined(OS_LINUX)
32-
#include "linux/setup/cefpython.h"
33-
#endif
7+
#include "cefpython_public_api.h"
348

359
class ClientHandler : public CefClient,
3610
public CefLoadHandler,

cefpython/cef1/client_handler/content_filter_handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2012-2013 CefPython Authors. All rights reserved.
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
22
// License: New BSD License.
33
// Website: http://code.google.com/p/cefpython/
44

cefpython/cef1/client_handler/content_filter_handler.h

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,10 @@
1-
// Copyright (c) 2012-2013 CefPython Authors. All rights reserved.
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
22
// License: New BSD License.
33
// Website: http://code.google.com/p/cefpython/
44

55
#pragma once
66

7-
// d:\cefpython\src\setup/cefpython.h(22) : warning C4190: 'RequestHandler_GetCookieManager'
8-
// has C-linkage specified, but returns UDT 'CefRefPtr<T>' which is incompatible with C
9-
#if defined(OS_WIN)
10-
#pragma warning(disable:4190)
11-
#endif
12-
13-
// "cef_client.h" will import CefBrowser and others that
14-
// are required when including "cefpython.h", CefWebURLRequest
15-
// is also declared in "cefpython.h".
16-
#include "include/cef_client.h"
17-
#include "include/cef_web_urlrequest.h"
18-
#include "util.h"
19-
20-
// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
21-
#include "Python.h"
22-
23-
// Python 3.2 fix - DL_IMPORT is not defined in Python.h
24-
#ifndef DL_IMPORT /* declarations for DLL import/export */
25-
#define DL_IMPORT(RTYPE) RTYPE
26-
#endif
27-
#ifndef DL_EXPORT /* declarations for DLL import/export */
28-
#define DL_EXPORT(RTYPE) RTYPE
29-
#endif
30-
31-
#if defined(OS_WIN)
32-
#include "windows/setup/cefpython.h"
33-
#endif
34-
35-
#if defined(OS_LINUX)
36-
#include "linux/setup/cefpython.h"
37-
#endif
7+
#include "cefpython_public_api.h"
388

399
class ContentFilterHandler : public CefContentFilter
4010
{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
2+
// License: New BSD License.
3+
// Website: http://code.google.com/p/cefpython/
4+
5+
#include "cookie_visitor.h"
6+
#include <stdio.h>
7+
8+
bool CookieVisitor::Visit(
9+
const CefCookie& cookie,
10+
int count,
11+
int total,
12+
bool& deleteCookie
13+
) {
14+
REQUIRE_IO_THREAD();
15+
CookieVisitor_Visit(cookieVisitorId_, cookie, count, total, deleteCookie);
16+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
2+
// License: New BSD License.
3+
// Website: http://code.google.com/p/cefpython/
4+
5+
#pragma once
6+
7+
#include "cefpython_public_api.h"
8+
9+
class CookieVisitor : public CefCookieVisitor
10+
{
11+
public:
12+
int cookieVisitorId_;
13+
public:
14+
CookieVisitor(int cookieVisitorId)
15+
: cookieVisitorId_(cookieVisitorId) {
16+
}
17+
18+
virtual bool Visit(
19+
const CefCookie& cookie,
20+
int count,
21+
int total,
22+
bool& deleteCookie
23+
) OVERRIDE;
24+
25+
protected:
26+
27+
// Include the default reference counting implementation.
28+
IMPLEMENT_REFCOUNTING(CookieVisitor);
29+
30+
// Include the default locking implementation.
31+
IMPLEMENT_LOCKING(CookieVisitor);
32+
33+
};

cefpython/cef1/client_handler/web_request_client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2012-2013 CefPython Authors. All rights reserved.
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
22
// License: New BSD License.
33
// Website: http://code.google.com/p/cefpython/
44

cefpython/cef1/client_handler/web_request_client.h

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
// Copyright (c) 2012-2013 CefPython Authors. All rights reserved.
1+
// Copyright (c) 2012-2013 The CEF Python authors. All rights reserved.
22
// License: New BSD License.
33
// Website: http://code.google.com/p/cefpython/
44

55
#pragma once
66

7-
// d:\cefpython\src\setup/cefpython.h(22) : warning C4190: 'RequestHandler_GetCookieManager'
8-
// has C-linkage specified, but returns UDT 'CefRefPtr<T>' which is incompatible with C
9-
#if defined(OS_WIN)
10-
#pragma warning(disable:4190)
11-
#endif
12-
13-
// "cef_client.h" will import CefBrowser and others that
14-
// are required when including "cefpython.h"
15-
#include "include/cef_client.h"
16-
#include "include/cef_web_urlrequest.h"
17-
#include "util.h"
18-
19-
// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
20-
#include "Python.h"
21-
22-
// Python 3.2 fix - DL_IMPORT is not defined in Python.h
23-
#ifndef DL_IMPORT /* declarations for DLL import/export */
24-
#define DL_IMPORT(RTYPE) RTYPE
25-
#endif
26-
#ifndef DL_EXPORT /* declarations for DLL import/export */
27-
#define DL_EXPORT(RTYPE) RTYPE
28-
#endif
29-
30-
#if defined(OS_WIN)
31-
#include "windows/setup/cefpython.h"
32-
#endif
33-
34-
#if defined(OS_LINUX)
35-
#include "linux/setup/cefpython.h"
36-
#endif
7+
#include "cefpython_public_api.h"
378

389
class WebRequestClient : public CefWebURLRequestClient
3910
{

0 commit comments

Comments
 (0)