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:
Marshall Greenblatt
2012-09-27 22:52:15 +00:00
parent c4a2ee9b8d
commit 149ae3df88
16 changed files with 464 additions and 0 deletions

View 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

View 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_

View File

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