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:
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,
|
||||
|
Reference in New Issue
Block a user