本文整理汇总了C++中COMPtr::detailsForDatabase方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPtr::detailsForDatabase方法的具体用法?C++ COMPtr::detailsForDatabase怎么用?C++ COMPtr::detailsForDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPtr
的用法示例。
在下文中一共展示了COMPtr::detailsForDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exceededDatabaseQuota
HRESULT STDMETHODCALLTYPE UIDelegate::exceededDatabaseQuota(
/* [in] */ IWebView *sender,
/* [in] */ IWebFrame *frame,
/* [in] */ IWebSecurityOrigin *origin,
/* [in] */ BSTR databaseIdentifier)
{
BSTR protocol;
BSTR host;
unsigned short port;
origin->protocol(&protocol);
origin->host(&host);
origin->port(&port);
if (!done && gTestRunner->dumpDatabaseCallbacks())
printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%S, %S, %i} database:%S\n", protocol, host, port, databaseIdentifier);
SysFreeString(protocol);
SysFreeString(host);
unsigned long long defaultQuota = 5 * 1024 * 1024;
double testDefaultQuota = gTestRunner->databaseDefaultQuota();
if (testDefaultQuota >= 0)
defaultQuota = testDefaultQuota;
COMPtr<IWebDatabaseManager> databaseManager;
COMPtr<IWebDatabaseManager> tmpDatabaseManager;
if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) {
origin->setQuota(defaultQuota);
return S_OK;
}
if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) {
origin->setQuota(defaultQuota);
return S_OK;
}
IPropertyBag* detailsBag;
if (FAILED(databaseManager->detailsForDatabase(databaseIdentifier, origin, &detailsBag))) {
origin->setQuota(defaultQuota);
return S_OK;
}
VARIANT var;
detailsBag->Read(WebDatabaseUsageKey, &var, 0);
unsigned long long expectedSize = V_UI8(&var);
unsigned long long newQuota = defaultQuota;
double maxQuota = gTestRunner->databaseMaxQuota();
if (maxQuota >= 0) {
if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
newQuota = expectedSize;
printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
}
}
origin->setQuota(newQuota);
return S_OK;
}
示例2: exceededDatabaseQuota
HRESULT UIDelegate::exceededDatabaseQuota(IWebView* sender, IWebFrame* frame, IWebSecurityOrigin* origin, BSTR databaseIdentifier)
{
_bstr_t protocol;
_bstr_t host;
unsigned short port;
origin->protocol(&protocol.GetBSTR());
origin->host(&host.GetBSTR());
origin->port(&port);
if (!done && gTestRunner->dumpDatabaseCallbacks())
printf("UI DELEGATE DATABASE CALLBACK: exceededDatabaseQuotaForSecurityOrigin:{%s, %s, %i} database:%S\n", static_cast<const char*>(protocol), static_cast<const char*>(host), port, databaseIdentifier);
unsigned long long defaultQuota = 5 * 1024 * 1024;
double testDefaultQuota = gTestRunner->databaseDefaultQuota();
if (testDefaultQuota >= 0)
defaultQuota = testDefaultQuota;
COMPtr<IWebDatabaseManager> databaseManager;
COMPtr<IWebDatabaseManager> tmpDatabaseManager;
if (FAILED(WebKitCreateInstance(CLSID_WebDatabaseManager, 0, IID_IWebDatabaseManager, (void**)&tmpDatabaseManager))) {
origin->setQuota(defaultQuota);
return S_OK;
}
if (FAILED(tmpDatabaseManager->sharedWebDatabaseManager(&databaseManager))) {
origin->setQuota(defaultQuota);
return S_OK;
}
IPropertyBag* detailsBag;
if (FAILED(databaseManager->detailsForDatabase(databaseIdentifier, origin, &detailsBag))) {
origin->setQuota(defaultQuota);
return S_OK;
}
_variant_t var;
detailsBag->Read(WebDatabaseUsageKey, &var.GetVARIANT(), nullptr);
unsigned long long expectedSize = V_UI8(&var);
unsigned long long newQuota = defaultQuota;
double maxQuota = gTestRunner->databaseMaxQuota();
if (maxQuota >= 0) {
if (defaultQuota < expectedSize && expectedSize <= maxQuota) {
newQuota = expectedSize;
printf("UI DELEGATE DATABASE CALLBACK: increased quota to %llu\n", newQuota);
}
}
origin->setQuota(newQuota);
return S_OK;
}