本文整理汇总了C++中webcore::Settings::setDatabasesEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ Settings::setDatabasesEnabled方法的具体用法?C++ Settings::setDatabasesEnabled怎么用?C++ Settings::setDatabasesEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webcore::Settings
的用法示例。
在下文中一共展示了Settings::setDatabasesEnabled方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Create
bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position,
const wxSize& size, long style, const wxString& name)
{
if ( (style & wxBORDER_MASK) == 0)
style |= wxBORDER_NONE;
if (!wxWindow::Create(parent, id, position, size, style, name))
return false;
WTF::initializeThreading();
// This is necessary because we are using SharedTimerWin.cpp on Windows,
// due to a problem with exceptions getting eaten when using the callback
// approach to timers (which wx itself uses).
#if __WXMSW__
WebCore::Page::setInstanceHandle(wxGetInstance());
#endif
// this helps reduce flicker on platforms like MSW
SetBackgroundStyle(wxBG_STYLE_CUSTOM);
m_impl = new WebViewPrivate();
WebCore::InitializeLoggingChannelsIfNecessary();
WebCore::HTMLFrameOwnerElement* parentFrame = 0;
WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx();
m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx(), 0, 0);
editorClient->setPage(m_impl->page);
m_mainFrame = new wxWebFrame(this);
// Default settings - we should have wxWebViewSettings class for this
// eventually
WebCore::Settings* settings = m_impl->page->settings();
settings->setLoadsImagesAutomatically(true);
settings->setDefaultFixedFontSize(13);
settings->setDefaultFontSize(16);
settings->setSerifFontFamily("Times New Roman");
settings->setFixedFontFamily("Courier New");
settings->setSansSerifFontFamily("Arial");
settings->setStandardFontFamily("Times New Roman");
settings->setJavaScriptEnabled(true);
#if ENABLE(DATABASE)
settings->setDatabasesEnabled(true);
#endif
m_isInitialized = true;
return true;
}
示例2: Sync
//.........这里部分代码省略.........
str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
if (str) {
WebCore::String path = to_string(env, str);
if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) {
WebCore::cacheStorage().setCacheDirectory(path);
// This database is created on the first load. If the file
// doesn't exist, we create it and set its permissions. The
// filename must match that in ApplicationCacheStorage.cpp.
String filename = pathByAppendingComponent(path, "ApplicationCache.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
}
jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize);
WebCore::cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
#if ENABLE(DATABASE)
flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
s->setDatabasesEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mDatabasePathHasBeenSet);
if (flag) {
// If the user has set the database path, sync it to the DatabaseTracker.
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
String path = to_string(env, str);
WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(path);
// This database is created when the first HTML5 Database object is
// instantiated. If the file doesn't exist, we create it and set its
// permissions. The filename must match that in
// DatabaseTracker.cpp.
String filename = SQLiteFileSystem::appendDatabaseFileNameToPath(path, "Databases.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
}
#endif
#if ENABLE(DOM_STORAGE)
flag = env->GetBooleanField(obj, gFieldIds->mDomStorageEnabled);
s->setLocalStorageEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
WebCore::String localStorageDatabasePath = to_string(env,str);
if (localStorageDatabasePath.length()) {
localStorageDatabasePath = WebCore::pathByAppendingComponent(
localStorageDatabasePath, "localstorage");
// We need 770 for folders
mkdir(localStorageDatabasePath.utf8().data(),
permissionFlags660 | S_IXUSR | S_IXGRP);
s->setLocalStorageDatabasePath(localStorageDatabasePath);
}
}
#endif
flag = env->GetBooleanField(obj, gFieldIds->mGeolocationEnabled);
GeolocationPermissions::setAlwaysDeny(!flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mGeolocationDatabasePath);
if (str) {
WebCore::String path = to_string(env, str);
GeolocationPermissions::setDatabasePath(path);
WebCore::GeolocationPositionCache::setDatabasePath(path);
// This database is created when the first Geolocation object is
// instantiated. If the file doesn't exist, we create it and set its
// permissions. The filename must match that in
// GeolocationPositionCache.cpp.
WebCore::String filename = WebCore::SQLiteFileSystem::appendDatabaseFileNameToPath(
path, "CachedGeoposition.db");
int fd = open(filename.utf8().data(), O_CREAT | O_EXCL, permissionFlags660);
if (fd >= 0)
close(fd);
}
size = env->GetIntField(obj, gFieldIds->mPageCacheCapacity);
if (size > 0) {
s->setUsesPageCache(true);
WebCore::pageCache()->setCapacity(size);
} else
s->setUsesPageCache(false);
#if ENABLE(WEBGL)
s->setWebGLEnabled(true);
#endif
}
示例3: apply
void QWebSettingsPrivate::apply()
{
if (settings) {
settings->setTextAreasAreResizable(true);
QWebSettingsPrivate *global = QWebSettings::globalSettings()->d;
QString family = fontFamilies.value(QWebSettings::StandardFont,
global->fontFamilies.value(QWebSettings::StandardFont));
settings->setStandardFontFamily(family);
family = fontFamilies.value(QWebSettings::FixedFont,
global->fontFamilies.value(QWebSettings::FixedFont));
settings->setFixedFontFamily(family);
family = fontFamilies.value(QWebSettings::SerifFont,
global->fontFamilies.value(QWebSettings::SerifFont));
settings->setSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::SansSerifFont,
global->fontFamilies.value(QWebSettings::SansSerifFont));
settings->setSansSerifFontFamily(family);
family = fontFamilies.value(QWebSettings::CursiveFont,
global->fontFamilies.value(QWebSettings::CursiveFont));
settings->setCursiveFontFamily(family);
family = fontFamilies.value(QWebSettings::FantasyFont,
global->fontFamilies.value(QWebSettings::FantasyFont));
settings->setFantasyFontFamily(family);
int size = fontSizes.value(QWebSettings::MinimumFontSize,
global->fontSizes.value(QWebSettings::MinimumFontSize));
settings->setMinimumFontSize(size);
size = fontSizes.value(QWebSettings::MinimumLogicalFontSize,
global->fontSizes.value(QWebSettings::MinimumLogicalFontSize));
settings->setMinimumLogicalFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFontSize,
global->fontSizes.value(QWebSettings::DefaultFontSize));
settings->setDefaultFontSize(size);
size = fontSizes.value(QWebSettings::DefaultFixedFontSize,
global->fontSizes.value(QWebSettings::DefaultFixedFontSize));
settings->setDefaultFixedFontSize(size);
bool value = attributes.value(QWebSettings::AutoLoadImages,
global->attributes.value(QWebSettings::AutoLoadImages));
settings->setLoadsImagesAutomatically(value);
value = attributes.value(QWebSettings::JavascriptEnabled,
global->attributes.value(QWebSettings::JavascriptEnabled));
settings->setJavaScriptEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanOpenWindows,
global->attributes.value(QWebSettings::JavascriptCanOpenWindows));
settings->setJavaScriptCanOpenWindowsAutomatically(value);
value = attributes.value(QWebSettings::JavaEnabled,
global->attributes.value(QWebSettings::JavaEnabled));
settings->setJavaEnabled(value);
value = attributes.value(QWebSettings::PluginsEnabled,
global->attributes.value(QWebSettings::PluginsEnabled));
settings->setPluginsEnabled(value);
value = attributes.value(QWebSettings::PrivateBrowsingEnabled,
global->attributes.value(QWebSettings::PrivateBrowsingEnabled));
settings->setPrivateBrowsingEnabled(value);
value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
settings->setDOMPasteAllowed(value);
value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
settings->setDeveloperExtrasEnabled(value);
QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
settings->setUserStyleSheetLocation(WebCore::KURL(location));
QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
settings->setDefaultTextEncodingName(encoding);
QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath;
settings->setLocalStorageDatabasePath(localStoragePath);
value = attributes.value(QWebSettings::ZoomTextOnly,
global->attributes.value(QWebSettings::ZoomTextOnly));
settings->setZoomsTextOnly(value);
value = attributes.value(QWebSettings::PrintElementBackgrounds,
global->attributes.value(QWebSettings::PrintElementBackgrounds));
settings->setShouldPrintBackgrounds(value);
value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
settings->setDatabasesEnabled(value);
//.........这里部分代码省略.........
示例4: Sync
//.........这里部分代码省略.........
s->setFantasyFontFamily(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mDefaultTextEncoding);
s->setDefaultTextEncodingName(to_string(env, str));
str = (jstring)env->GetObjectField(obj, gFieldIds->mUserAgent);
WebFrame::getWebFrame(pFrame)->setUserAgent(to_string(env, str));
jint size = env->GetIntField(obj, gFieldIds->mMinimumFontSize);
s->setMinimumFontSize(size);
size = env->GetIntField(obj, gFieldIds->mMinimumLogicalFontSize);
s->setMinimumLogicalFontSize(size);
size = env->GetIntField(obj, gFieldIds->mDefaultFontSize);
s->setDefaultFontSize(size);
size = env->GetIntField(obj, gFieldIds->mDefaultFixedFontSize);
s->setDefaultFixedFontSize(size);
jboolean flag = env->GetBooleanField(obj, gFieldIds->mLoadsImagesAutomatically);
s->setLoadsImagesAutomatically(flag);
if (flag)
docLoader->setAutoLoadImages(true);
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
flag = env->GetBooleanField(obj, gFieldIds->mBlockNetworkImage);
s->setBlockNetworkImage(flag);
if(!flag)
docLoader->setBlockNetworkImage(false);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptEnabled);
s->setJavaScriptEnabled(flag);
flag = env->GetBooleanField(obj, gFieldIds->mPluginsEnabled);
s->setPluginsEnabled(flag);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
if (str) {
WebCore::String path = to_string(env, str);
if (path.length() && WebCore::cacheStorage().cacheDirectory().isNull()) {
WebCore::cacheStorage().setCacheDirectory(path);
}
}
jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize);
WebCore::cacheStorage().setMaximumSize(maxsize);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
#ifdef ANDROID_LAYOUT
flag = env->GetBooleanField(obj, gFieldIds->mUseWideViewport);
s->setUseWideViewport(flag);
#endif
#ifdef ANDROID_MULTIPLE_WINDOWS
flag = env->GetBooleanField(obj, gFieldIds->mSupportMultipleWindows);
s->setSupportMultipleWindows(flag);
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
#if ENABLE(DATABASE)
flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
s->setDatabasesEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str && WebCore::DatabaseTracker::tracker().databaseDirectoryPath().isNull())
WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(to_string(env, str));
#endif
#if ENABLE(DOM_STORAGE)
flag = env->GetBooleanField(obj, gFieldIds->mDomStorageEnabled);
s->setLocalStorageEnabled(flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
if (str) {
WebCore::String localStorageDatabasePath = to_string(env,str);
if (localStorageDatabasePath.length()) {
s->setLocalStorageDatabasePath(localStorageDatabasePath);
}
}
#endif
flag = env->GetBooleanField(obj, gFieldIds->mGeolocationEnabled);
GeolocationPermissions::setAlwaysDeny(!flag);
str = (jstring)env->GetObjectField(obj, gFieldIds->mGeolocationDatabasePath);
if (str) {
GeolocationPermissions::setDatabasePath(to_string(env,str));
WebCore::Geolocation::setDatabasePath(to_string(env,str));
}
size = env->GetIntField(obj, gFieldIds->mPageCacheCapacity);
if (size > 0) {
s->setUsesPageCache(true);
WebCore::pageCache()->setCapacity(size);
} else
s->setUsesPageCache(false);
}