Add CefCookieManager interface and CefRequestHandler::GetCookieManager for custom cookie handling (issue #542).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@534 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-03-15 22:38:02 +00:00
parent 97d6924f7e
commit ef43df264a
24 changed files with 1324 additions and 576 deletions

View File

@@ -0,0 +1,152 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/cookie_visitor_cpptoc.h"
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
// STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager() {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_cookie_manager_t* _retval = cef_cookie_manager_get_global_manager();
// Return type: refptr_same
return CefCookieManagerCToCpp::Wrap(_retval);
}
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
const CefString& path) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: path
// Execute
cef_cookie_manager_t* _retval = cef_cookie_manager_create_manager(
path.GetStruct());
// Return type: refptr_same
return CefCookieManagerCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
bool CefCookieManagerCToCpp::VisitAllCookies(
CefRefPtr<CefCookieVisitor> visitor) {
if (CEF_MEMBER_MISSING(struct_, visit_all_cookies))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: visitor; type: refptr_diff
DCHECK(visitor.get());
if (!visitor.get())
return false;
// Execute
int _retval = struct_->visit_all_cookies(struct_,
CefCookieVisitorCppToC::Wrap(visitor));
// Return type: bool
return _retval?true:false;
}
bool CefCookieManagerCToCpp::VisitUrlCookies(const CefString& url,
bool includeHttpOnly, CefRefPtr<CefCookieVisitor> visitor) {
if (CEF_MEMBER_MISSING(struct_, visit_url_cookies))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: url; type: string_byref_const
DCHECK(!url.empty());
if (url.empty())
return false;
// Verify param: visitor; type: refptr_diff
DCHECK(visitor.get());
if (!visitor.get())
return false;
// Execute
int _retval = struct_->visit_url_cookies(struct_,
url.GetStruct(),
includeHttpOnly,
CefCookieVisitorCppToC::Wrap(visitor));
// Return type: bool
return _retval?true:false;
}
bool CefCookieManagerCToCpp::SetCookie(const CefString& url,
const CefCookie& cookie) {
if (CEF_MEMBER_MISSING(struct_, set_cookie))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: url; type: string_byref_const
DCHECK(!url.empty());
if (url.empty())
return false;
// Execute
int _retval = struct_->set_cookie(struct_,
url.GetStruct(),
&cookie);
// Return type: bool
return _retval?true:false;
}
bool CefCookieManagerCToCpp::DeleteCookies(const CefString& url,
const CefString& cookie_name) {
if (CEF_MEMBER_MISSING(struct_, delete_cookies))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: url, cookie_name
// Execute
int _retval = struct_->delete_cookies(struct_,
url.GetStruct(),
cookie_name.GetStruct());
// Return type: bool
return _retval?true:false;
}
bool CefCookieManagerCToCpp::SetStoragePath(const CefString& path) {
if (CEF_MEMBER_MISSING(struct_, set_storage_path))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Unverified params: path
// Execute
int _retval = struct_->set_storage_path(struct_,
path.GetStruct());
// Return type: bool
return _retval?true:false;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefCookieManagerCToCpp, CefCookieManager,
cef_cookie_manager_t>::DebugObjCt = 0;
#endif

View File

@@ -0,0 +1,49 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_COOKIE_MANAGER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_COOKIE_MANAGER_CTOCPP_H_
#pragma once
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef_cookie.h"
#include "include/capi/cef_cookie_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefCookieManagerCToCpp
: public CefCToCpp<CefCookieManagerCToCpp, CefCookieManager,
cef_cookie_manager_t> {
public:
explicit CefCookieManagerCToCpp(cef_cookie_manager_t* str)
: CefCToCpp<CefCookieManagerCToCpp, CefCookieManager,
cef_cookie_manager_t>(str) {}
virtual ~CefCookieManagerCToCpp() {}
// CefCookieManager methods
virtual bool VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor) OVERRIDE;
virtual bool VisitUrlCookies(const CefString& url, bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor) OVERRIDE;
virtual bool SetCookie(const CefString& url,
const CefCookie& cookie) OVERRIDE;
virtual bool DeleteCookies(const CefString& url,
const CefString& cookie_name) OVERRIDE;
virtual bool SetStoragePath(const CefString& path) OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // CEF_LIBCEF_DLL_CTOCPP_COOKIE_MANAGER_CTOCPP_H_

View File

@@ -11,6 +11,7 @@
//
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/cpptoc/response_cpptoc.h"
@@ -289,6 +290,26 @@ bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
return _retval?true:false;
}
CefRefPtr<CefCookieManager> CefRequestHandlerCToCpp::GetCookieManager(
CefRefPtr<CefBrowser> browser) {
if (CEF_MEMBER_MISSING(struct_, get_cookie_manager))
return NULL;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return NULL;
// Execute
cef_cookie_manager_t* _retval = struct_->get_cookie_manager(struct_,
CefBrowserCppToC::Wrap(browser));
// Return type: refptr_diff
return CefCookieManagerCppToC::Unwrap(_retval);
}
#ifndef NDEBUG
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,

View File

@@ -55,6 +55,8 @@ class CefRequestHandlerCToCpp
const CefString& host, int port, const CefString& realm,
const CefString& scheme, CefString& username,
CefString& password) OVERRIDE;
virtual CefRefPtr<CefCookieManager> GetCookieManager(
CefRefPtr<CefBrowser> browser) OVERRIDE;
};
#endif // BUILDING_CEF_SHARED