mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add CefRequestHandler::OnQuotaRequest callback for handling webkitStorageInfo.requestQuota requests (issue #732).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@816 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
56
libcef_dll/cpptoc/quota_callback_cpptoc.cc
Normal file
56
libcef_dll/cpptoc/quota_callback_cpptoc.cc
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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/quota_callback_cpptoc.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK quota_callback_cont(struct _cef_quota_callback_t* self,
|
||||
int allow) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefQuotaCallbackCppToC::Get(self)->Continue(
|
||||
allow?true:false);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK quota_callback_cancel(struct _cef_quota_callback_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefQuotaCallbackCppToC::Get(self)->Cancel();
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefQuotaCallbackCppToC::CefQuotaCallbackCppToC(CefQuotaCallback* cls)
|
||||
: CefCppToC<CefQuotaCallbackCppToC, CefQuotaCallback, cef_quota_callback_t>(
|
||||
cls) {
|
||||
struct_.struct_.cont = quota_callback_cont;
|
||||
struct_.struct_.cancel = quota_callback_cancel;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefQuotaCallbackCppToC, CefQuotaCallback,
|
||||
cef_quota_callback_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
37
libcef_dll/cpptoc/quota_callback_cpptoc.h
Normal file
37
libcef_dll/cpptoc/quota_callback_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef BUILDING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||
#else // BUILDING_CEF_SHARED
|
||||
|
||||
#include "include/cef_request_handler.h"
|
||||
#include "include/capi/cef_request_handler_capi.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefQuotaCallbackCppToC
|
||||
: public CefCppToC<CefQuotaCallbackCppToC, CefQuotaCallback,
|
||||
cef_quota_callback_t> {
|
||||
public:
|
||||
explicit CefQuotaCallbackCppToC(CefQuotaCallback* cls);
|
||||
virtual ~CefQuotaCallbackCppToC() {}
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_QUOTA_CALLBACK_CPPTOC_H_
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/quota_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
|
||||
|
||||
@@ -167,6 +168,39 @@ int CEF_CALLBACK request_handler_get_auth_credentials(
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK request_handler_on_quota_request(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* origin_url, int64 new_size,
|
||||
cef_quota_callback_t* callback) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return 0;
|
||||
// Verify param: origin_url; type: string_byref_const
|
||||
DCHECK(origin_url);
|
||||
if (!origin_url)
|
||||
return 0;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefRequestHandlerCppToC::Get(self)->OnQuotaRequest(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(origin_url),
|
||||
new_size,
|
||||
CefQuotaCallbackCToCpp::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
cef_cookie_manager_t* CEF_CALLBACK request_handler_get_cookie_manager(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* main_url) {
|
||||
@@ -241,6 +275,7 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
||||
struct_.struct_.get_resource_handler = request_handler_get_resource_handler;
|
||||
struct_.struct_.on_resource_redirect = request_handler_on_resource_redirect;
|
||||
struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials;
|
||||
struct_.struct_.on_quota_request = request_handler_on_quota_request;
|
||||
struct_.struct_.get_cookie_manager = request_handler_get_cookie_manager;
|
||||
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
||||
}
|
||||
|
44
libcef_dll/ctocpp/quota_callback_ctocpp.cc
Normal file
44
libcef_dll/ctocpp/quota_callback_ctocpp.cc
Normal file
@@ -0,0 +1,44 @@
|
||||
// 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/ctocpp/quota_callback_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefQuotaCallbackCToCpp::Continue(bool allow) {
|
||||
if (CEF_MEMBER_MISSING(struct_, cont))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->cont(struct_,
|
||||
allow);
|
||||
}
|
||||
|
||||
void CefQuotaCallbackCToCpp::Cancel() {
|
||||
if (CEF_MEMBER_MISSING(struct_, cancel))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
struct_->cancel(struct_);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefQuotaCallbackCToCpp, CefQuotaCallback,
|
||||
cef_quota_callback_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
43
libcef_dll/ctocpp/quota_callback_ctocpp.h
Normal file
43
libcef_dll/ctocpp/quota_callback_ctocpp.h
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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_QUOTA_CALLBACK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_QUOTA_CALLBACK_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_request_handler.h"
|
||||
#include "include/capi/cef_request_handler_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 CefQuotaCallbackCToCpp
|
||||
: public CefCToCpp<CefQuotaCallbackCToCpp, CefQuotaCallback,
|
||||
cef_quota_callback_t> {
|
||||
public:
|
||||
explicit CefQuotaCallbackCToCpp(cef_quota_callback_t* str)
|
||||
: CefCToCpp<CefQuotaCallbackCToCpp, CefQuotaCallback,
|
||||
cef_quota_callback_t>(str) {}
|
||||
virtual ~CefQuotaCallbackCToCpp() {}
|
||||
|
||||
// CefQuotaCallback methods
|
||||
virtual void Continue(bool allow) OVERRIDE;
|
||||
virtual void Cancel() OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_QUOTA_CALLBACK_CTOCPP_H_
|
||||
|
@@ -14,6 +14,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/quota_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
|
||||
@@ -157,6 +158,38 @@ bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url, int64 new_size,
|
||||
CefRefPtr<CefQuotaCallback> callback) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_quota_request))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: origin_url; type: string_byref_const
|
||||
DCHECK(!origin_url.empty());
|
||||
if (origin_url.empty())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_quota_request(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
origin_url.GetStruct(),
|
||||
new_size,
|
||||
CefQuotaCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManager> CefRequestHandlerCToCpp::GetCookieManager(
|
||||
CefRefPtr<CefBrowser> browser, const CefString& main_url) {
|
||||
if (CEF_MEMBER_MISSING(struct_, get_cookie_manager))
|
||||
|
@@ -46,6 +46,9 @@ class CefRequestHandlerCToCpp
|
||||
CefRefPtr<CefFrame> frame, bool isProxy, const CefString& host, int port,
|
||||
const CefString& realm, const CefString& scheme,
|
||||
CefRefPtr<CefAuthCallback> callback) OVERRIDE;
|
||||
virtual bool OnQuotaRequest(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& origin_url, int64 new_size,
|
||||
CefRefPtr<CefQuotaCallback> callback) OVERRIDE;
|
||||
virtual CefRefPtr<CefCookieManager> GetCookieManager(
|
||||
CefRefPtr<CefBrowser> browser, const CefString& main_url) OVERRIDE;
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#include "libcef_dll/cpptoc/list_value_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/menu_model_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/quota_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/scheme_registrar_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/stream_writer_cpptoc.h"
|
||||
@@ -192,6 +193,7 @@ CEF_EXPORT void cef_shutdown() {
|
||||
DCHECK_EQ(CefMenuModelCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefProcessMessageCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefProxyHandlerCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefQuotaCallbackCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefReadHandlerCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefRenderProcessHandlerCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefRequestHandlerCToCpp::DebugObjCt, 0);
|
||||
|
@@ -78,6 +78,7 @@
|
||||
#include "libcef_dll/ctocpp/list_value_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/menu_model_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/quota_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/scheme_registrar_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/stream_writer_ctocpp.h"
|
||||
@@ -184,6 +185,7 @@ CEF_GLOBAL void CefShutdown() {
|
||||
DCHECK_EQ(CefMenuModelCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefProcessMessageCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefProxyHandlerCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefQuotaCallbackCToCpp::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefReadHandlerCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefRenderProcessHandlerCppToC::DebugObjCt, 0);
|
||||
DCHECK_EQ(CefRequestHandlerCppToC::DebugObjCt, 0);
|
||||
|
Reference in New Issue
Block a user