当前位置: 首页>>代码示例>>C++>>正文


C++ Settings::setOfflineWebApplicationCacheEnabled方法代码示例

本文整理汇总了C++中webcore::Settings::setOfflineWebApplicationCacheEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ Settings::setOfflineWebApplicationCacheEnabled方法的具体用法?C++ Settings::setOfflineWebApplicationCacheEnabled怎么用?C++ Settings::setOfflineWebApplicationCacheEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webcore::Settings的用法示例。


在下文中一共展示了Settings::setOfflineWebApplicationCacheEnabled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: apply


//.........这里部分代码省略.........
        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::SpatialNavigationEnabled,
                                      global->attributes.value(QWebSettings::SpatialNavigationEnabled));
        settings->setSpatialNavigationEnabled(value);

        value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
                                      global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
        settings->setDOMPasteAllowed(value);
        settings->setJavaScriptCanAccessClipboard(value);

        value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
                                      global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
        settings->setDeveloperExtrasEnabled(value);

        value = attributes.value(QWebSettings::FrameFlatteningEnabled,
                                      global->attributes.value(QWebSettings::FrameFlatteningEnabled));
        settings->setFrameFlatteningEnabled(value);

        QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
        settings->setUserStyleSheetLocation(WebCore::KURL(location));

        QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
        settings->setDefaultTextEncodingName(encoding);

        QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
        settings->setLocalStorageDatabasePath(storagePath);

        if (mediaType.isEmpty())
            mediaType = global->mediaType;

        value = attributes.value(QWebSettings::PrintElementBackgrounds,
                                      global->attributes.value(QWebSettings::PrintElementBackgrounds));
        settings->setShouldPrintBackgrounds(value);

#if ENABLE(SQL_DATABASE)
        value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
                                      global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
        WebCore::DatabaseManager::manager().setIsAvailable(value);
#endif

        value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled,
                                      global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled));
        settings->setOfflineWebApplicationCacheEnabled(value);

        value = attributes.value(QWebSettings::LocalStorageEnabled,
                                      global->attributes.value(QWebSettings::LocalStorageEnabled));
        settings->setLocalStorageEnabled(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
        settings->setAllowUniversalAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessFileUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls));
        settings->setAllowFileAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::XSSAuditingEnabled,
                                      global->attributes.value(QWebSettings::XSSAuditingEnabled));
        settings->setXSSAuditorEnabled(value);

#if USE(TILED_BACKING_STORE)
        value = attributes.value(QWebSettings::TiledBackingStoreEnabled,
                                      global->attributes.value(QWebSettings::TiledBackingStoreEnabled));
        settings->setTiledBackingStoreEnabled(value);
#endif

#if ENABLE(SMOOTH_SCROLLING)
        value = attributes.value(QWebSettings::ScrollAnimatorEnabled,
                                      global->attributes.value(QWebSettings::ScrollAnimatorEnabled));
        settings->setScrollAnimatorEnabled(value);
#endif

        value = attributes.value(QWebSettings::CaretBrowsingEnabled,
                                      global->attributes.value(QWebSettings::CaretBrowsingEnabled));
        settings->setCaretBrowsingEnabled(value);

        value = attributes.value(QWebSettings::NotificationsEnabled,
                                      global->attributes.value(QWebSettings::NotificationsEnabled));
        settings->setNotificationsEnabled(value);

        value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled,
                                      global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled));
        settings->setNeedsSiteSpecificQuirks(value);

        settings->setUsesPageCache(WebCore::pageCache()->capacity());
    } else {
        QList<QWebSettingsPrivate*> settings = *::allSettings();
        for (int i = 0; i < settings.count(); ++i)
            settings[i]->apply();
    }
}
开发者ID:massa84,项目名称:phantomjs-webkit,代码行数:101,代码来源:qwebsettings.cpp

示例2: apply


//.........这里部分代码省略.........
        settings->setJavaScriptCanOpenWindowsAutomatically(value);

        value = attributes.value(QWebSettings::JavascriptCanCloseWindows,
                                      global->attributes.value(QWebSettings::JavascriptCanCloseWindows));
        settings->setAllowScriptsToCloseWindows(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::SpatialNavigationEnabled,
                                      global->attributes.value(QWebSettings::SpatialNavigationEnabled));
        settings->setSpatialNavigationEnabled(value);

        value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
                                      global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
        settings->setDOMPasteAllowed(value);
        settings->setJavaScriptCanAccessClipboard(value);

        value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
                                      global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
        settings->setDeveloperExtrasEnabled(value);

        value = attributes.value(QWebSettings::FrameFlatteningEnabled,
                                      global->attributes.value(QWebSettings::FrameFlatteningEnabled));
        settings->setFrameFlatteningEnabled(value);

        QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
        settings->setUserStyleSheetLocation(WebCore::KURL(location));

        QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
        settings->setDefaultTextEncodingName(encoding);

        QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
        settings->setLocalStorageDatabasePath(storagePath);

        QString path = !pluginSupplementalPath.isEmpty() ? pluginSupplementalPath : global->pluginSupplementalPath;
        settings->setPluginSupplementalPath(path);

        value = attributes.value(QWebSettings::PrintElementBackgrounds,
                                      global->attributes.value(QWebSettings::PrintElementBackgrounds));
        settings->setShouldPrintBackgrounds(value);

#if ENABLE(SQL_DATABASE)
        value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
                                      global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
        WebCore::AbstractDatabase::setIsAvailable(value);
#endif

        value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled,
                                      global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled));
        settings->setOfflineWebApplicationCacheEnabled(value);

        value = attributes.value(QWebSettings::LocalStorageEnabled,
                                      global->attributes.value(QWebSettings::LocalStorageEnabled));
        settings->setLocalStorageEnabled(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
        settings->setAllowUniversalAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessFileUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls));
        settings->setAllowFileAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::XSSAuditingEnabled,
                                      global->attributes.value(QWebSettings::XSSAuditingEnabled));
        settings->setXSSAuditorEnabled(value);

#if USE(TILED_BACKING_STORE)
        value = attributes.value(QWebSettings::TiledBackingStoreEnabled,
                                      global->attributes.value(QWebSettings::TiledBackingStoreEnabled));
        settings->setTiledBackingStoreEnabled(value);
#endif

        value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled,
                                      global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled));
        settings->setNeedsSiteSpecificQuirks(value);

        settings->setUsesPageCache(WebCore::pageCache()->capacity());

#if ENABLE(VIDEO) && USE(WEBOS_MULTIMEDIA)
        QString moptions = !mediaPipelineOptions.isEmpty() ? mediaPipelineOptions: global->mediaPipelineOptions;
        settings->setMediaPipelineOptions( moptions );
#endif

    } else {
        QList<QWebSettingsPrivate*> settings = *::allSettings();
        for (int i = 0; i < settings.count(); ++i)
            settings[i]->apply();
    }
}
开发者ID:ruizhang331,项目名称:WebKit,代码行数:101,代码来源:qwebsettings.cpp

示例3: Sync

    static void Sync(JNIEnv* env, jobject obj, jint frame)
    {
        WebCore::Frame* pFrame = (WebCore::Frame*)frame;
        LOG_ASSERT(pFrame, "%s must take a valid frame pointer!", __FUNCTION__);
        WebCore::Settings* s = pFrame->settings();
        if (!s)
            return;
        WebCore::DocLoader* docLoader = pFrame->document()->docLoader();

#ifdef ANDROID_LAYOUT
        jobject layout = env->GetObjectField(obj, gFieldIds->mLayoutAlgorithm);
        WebCore::Settings::LayoutAlgorithm l = (WebCore::Settings::LayoutAlgorithm)
                env->CallIntMethod(layout, gFieldIds->mOrdinal);
        if (s->layoutAlgorithm() != l) {
            s->setLayoutAlgorithm(l);
            if (pFrame->document()) {
                pFrame->document()->updateStyleSelector();
                if (pFrame->document()->renderer()) {
                    recursiveCleanupForFullLayout(pFrame->document()->renderer());
                    LOG_ASSERT(pFrame->view(), "No view for this frame when trying to relayout");
                    pFrame->view()->layout();
                    // FIXME: This call used to scroll the page to put the focus into view.
                    // It worked on the WebViewCore, but now scrolling is done outside of the
                    // WebViewCore, on the UI side, so there needs to be a new way to do this.
                    //pFrame->makeFocusVisible();
                }
            }
        }
#endif
        jobject textSize = env->GetObjectField(obj, gFieldIds->mTextSize);
        float zoomFactor = env->GetIntField(textSize, gFieldIds->mTextSizeValue) / 100.0f;
        if (pFrame->zoomFactor() != zoomFactor)
            pFrame->setZoomFactor(zoomFactor, /*isTextOnly*/true);

        jstring str = (jstring)env->GetObjectField(obj, gFieldIds->mStandardFontFamily);
        s->setStandardFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mFixedFontFamily);
        s->setFixedFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mSansSerifFontFamily);
        s->setSansSerifFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mSerifFontFamily);
        s->setSerifFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mCursiveFontFamily);
        s->setCursiveFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mFantasyFontFamily);
        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);

        // ON = 0
        // ON_DEMAND = 1
        // OFF = 2
        jobject pluginState = env->GetObjectField(obj, gFieldIds->mPluginState);
        int state = env->CallIntMethod(pluginState, gFieldIds->mOrdinal);
        s->setPluginsEnabled(state < 2);
#ifdef ANDROID_PLUGINS
        s->setPluginsOnDemand(state == 1);
#endif

#if ENABLE(OFFLINE_WEB_APPLICATIONS)
        flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
        s->setOfflineWebApplicationCacheEnabled(flag);
        str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
        if (str) {
//.........这里部分代码省略.........
开发者ID:3ig,项目名称:Xperia-2011-Official-Kernel-Sources,代码行数:101,代码来源:WebSettings.cpp

示例4: Sync


//.........这里部分代码省略.........
#endif

#if ENABLE(OFFLINE_WEB_APPLICATIONS)
        // We only enable AppCache if it's been enabled with a call to
        // setAppCacheEnabled() and if a valid path has been supplied to
        // setAppCachePath(). Note that the path is applied to all WebViews
        // whereas enabling is applied per WebView.

        // WebCore asserts that the path is only set once. Since the path is
        // shared between WebViews, we can't do the required checks to guard
        // against this in the Java WebSettings.
        bool isPathValid = false;
        if (cacheStorage().cacheDirectory().isNull()) {
            str = static_cast<jstring>(env->GetObjectField(obj, gFieldIds->mAppCachePath));
            // Check for non-null string as an optimization, as this is the common case.
            if (str) {
                String path = jstringToWtfString(env, str);
                ALOG_ASSERT(!path.empty(), "Java side should never send empty string for AppCache 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, permissionFlags660);
                if (fd >= 0) {
                    close(fd);
                    cacheStorage().setCacheDirectory(path);
                    isPathValid = true;
              }
            }
        } else
            isPathValid = true;

        flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
        s->setOfflineWebApplicationCacheEnabled(flag && isPathValid);

        jlong maxsize = env->GetLongField(obj, gFieldIds->mAppCacheMaxSize);
        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);
        jlong maxImage = env->GetLongField(obj, gFieldIds->mMaximumDecodedImageSize);
        // Since in ImageSourceAndroid.cpp, the image will always not exceed
        // MAX_SIZE_BEFORE_SUBSAMPLE, there's no need to pass the max value to
        // WebCore, which checks (image_width * image_height * 4) as an
        // estimation against the max value, which is done in CachedImage.cpp.
        // And there're cases where the decoded image size will not
        // exceed the max, but the WebCore estimation will.  So the following
        // code is commented out to fix those cases.
        // if (maxImage == 0)
        //    maxImage = computeMaxBitmapSizeForCache();
        s->setMaximumDecodedImageSize(maxImage);

        flag = env->GetBooleanField(obj, gFieldIds->mPrivateBrowsingEnabled);
开发者ID:,项目名称:,代码行数:67,代码来源:

示例5: apply


//.........这里部分代码省略.........
        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);

        value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled,
                                      global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled));
        settings->setOfflineWebApplicationCacheEnabled(value);

        value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled,
                                      global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled));
        settings->setLocalStorageEnabled(value);

        value = attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls,
                                      global->attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls));
        settings->setAllowUniversalAccessFromFileURLs(value);
    } else {
        QList<QWebSettingsPrivate *> settings = *::allSettings();
        for (int i = 0; i < settings.count(); ++i)
            settings[i]->apply();
    }
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:101,代码来源:qwebsettings.cpp

示例6: Sync


//.........这里部分代码省略.........
#endif

#if ENABLE(OFFLINE_WEB_APPLICATIONS)
        // We only enable AppCache if it's been enabled with a call to
        // setAppCacheEnabled() and if a valid path has been supplied to
        // setAppCachePath(). Note that the path is applied to all WebViews
        // whereas enabling is applied per WebView.

        // WebCore asserts that the path is only set once. Since the path is
        // shared between WebViews, we can't do the required checks to guard
        // against this in the Java WebSettings.
        bool isPathValid = false;
        if (cacheStorage().cacheDirectory().isNull()) {
            str = static_cast<jstring>(env->GetObjectField(obj, gFieldIds->mAppCachePath));
            // Check for non-null string as an optimization, as this is the common case.
            if (str) {
                String path = jstringToWtfString(env, str);
                ALOG_ASSERT(!path.empty(), "Java side should never send empty string for AppCache 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, permissionFlags660);
                if (fd >= 0) {
                    close(fd);
                    cacheStorage().setCacheDirectory(path);
                    isPathValid = true;
              }
            }
        } else
            isPathValid = true;

        flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
        s->setOfflineWebApplicationCacheEnabled(flag && isPathValid);

        jlong maxsize = env->GetLongField(obj, gFieldIds->mAppCacheMaxSize);
        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);
        jlong maxImage = env->GetLongField(obj, gFieldIds->mMaximumDecodedImageSize);
        // Since in ImageSourceAndroid.cpp, the image will always not exceed
        // MAX_SIZE_BEFORE_SUBSAMPLE, there's no need to pass the max value to
        // WebCore, which checks (image_width * image_height * 4) as an
        // estimation against the max value, which is done in CachedImage.cpp.
        // And there're cases where the decoded image size will not
        // exceed the max, but the WebCore estimation will.  So the following
        // code is commented out to fix those cases.
        // if (maxImage == 0)
        //    maxImage = computeMaxBitmapSizeForCache();
        s->setMaximumDecodedImageSize(maxImage);

        flag = env->GetBooleanField(obj, gFieldIds->mPrivateBrowsingEnabled);
开发者ID:a33g-dev,项目名称:platform_samsung,代码行数:67,代码来源:WebSettings.cpp

示例7: Sync

    static void Sync(JNIEnv* env, jobject obj, jint frame)
    {
        WebCore::Frame* pFrame = (WebCore::Frame*)frame;
        LOG_ASSERT(pFrame, "%s must take a valid frame pointer!", __FUNCTION__);
        WebCore::Settings* s = pFrame->settings();
        if (!s)
            return;
        WebCore::DocLoader* docLoader = pFrame->document()->docLoader();

#ifdef ANDROID_LAYOUT
        jobject layout = env->GetObjectField(obj, gFieldIds->mLayoutAlgorithm);
        WebCore::Settings::LayoutAlgorithm l = (WebCore::Settings::LayoutAlgorithm)
                                               env->CallIntMethod(layout, gFieldIds->mOrdinal);
        if (s->layoutAlgorithm() != l) {
            s->setLayoutAlgorithm(l);
            if (pFrame->document()) {
                pFrame->document()->updateStyleSelector();
                if (pFrame->document()->renderer()) {
                    recursiveCleanupForFullLayout(pFrame->document()->renderer());
                    LOG_ASSERT(pFrame->view(), "No view for this frame when trying to relayout");
                    pFrame->view()->layout();
                    // FIXME: This call used to scroll the page to put the focus into view.
                    // It worked on the WebViewCore, but now scrolling is done outside of the
                    // WebViewCore, on the UI side, so there needs to be a new way to do this.
                    //pFrame->makeFocusVisible();
                }
            }
        }
#endif
        jobject textSize = env->GetObjectField(obj, gFieldIds->mTextSize);
        float zoomFactor = env->GetIntField(textSize, gFieldIds->mTextSizeValue) / 100.0f;
        if (pFrame->zoomFactor() != zoomFactor)
            pFrame->setZoomFactor(zoomFactor, /*isTextOnly*/true);

        jstring str = (jstring)env->GetObjectField(obj, gFieldIds->mStandardFontFamily);
        s->setStandardFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mFixedFontFamily);
        s->setFixedFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mSansSerifFontFamily);
        s->setSansSerifFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mSerifFontFamily);
        s->setSerifFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mCursiveFontFamily);
        s->setCursiveFontFamily(to_string(env, str));

        str = (jstring)env->GetObjectField(obj, gFieldIds->mFantasyFontFamily);
        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);
//.........这里部分代码省略.........
开发者ID:Androtos,项目名称:toolchain_benchmark,代码行数:101,代码来源:WebSettings.cpp

示例8: apply

void WebSettingsPrivate::apply(int setting, bool global)
{
    if (isGlobal()) {
        // Cycle through the page settings and apply the defaults
        for (size_t i = 0; i < m_pageSettings.size(); ++i)
            m_pageSettings.at(i)->apply(setting, global);
    } else {
        // Apply the WebCore::Settings to this page's settings
        WebCoreSettingsState* webcoreSettingsState = global ? WebSettings::pageGroupSettings(m_webCoreSettingsState->pageGroupName)->d->m_webCoreSettingsState : m_webCoreSettingsState;

        WebCore::Settings* settings = getSettings(m_page);

        if (setting == AllSettings || setting == IsXSSAuditorEnabled)
            settings->setXSSAuditorEnabled(webcoreSettingsState->xssAuditorEnabled);

        if (setting == AllSettings || setting == LoadsImagesAutomatically)
            settings->setLoadsImagesAutomatically(webcoreSettingsState->loadsImagesAutomatically);

        if (setting == AllSettings || setting == ShouldDrawBorderWhileLoadingImages)
            settings->setShouldDrawBorderWhileLoadingImages(webcoreSettingsState->shouldDrawBorderWhileLoadingImages);

        if (setting == AllSettings || setting == IsJavaScriptEnabled)
            settings->setJavaScriptEnabled(webcoreSettingsState->isJavaScriptEnabled);

        if (setting == AllSettings || setting == DefaultFixedFontSize)
            settings->setDefaultFixedFontSize(webcoreSettingsState->defaultFixedFontSize);

        if (setting == AllSettings || setting == DefaultFontSize)
            settings->setDefaultFontSize(webcoreSettingsState->defaultFontSize);

        if (setting == AllSettings || setting == MinimumFontSize)
            settings->setMinimumFontSize(webcoreSettingsState->minimumFontSize);

        if (setting == AllSettings || setting == SerifFontFamily)
            settings->setSerifFontFamily(webcoreSettingsState->serifFontFamily);

        if (setting == AllSettings || setting == FixedFontFamily)
            settings->setFixedFontFamily(webcoreSettingsState->fixedFontFamily);

        if (setting == AllSettings || setting == SansSerifFontFamily)
            settings->setSansSerifFontFamily(webcoreSettingsState->sansSerifFontFamily);

        if (setting == AllSettings || setting == StandardFontFamily)
            settings->setStandardFontFamily(webcoreSettingsState->standardFontFamily);

        if (setting == AllSettings || setting == CanJavaScriptOpenWindowsAutomatically)
            settings->setJavaScriptCanOpenWindowsAutomatically(webcoreSettingsState->canJavaScriptOpenWindowsAutomatically);

        if (setting == AllSettings || setting == ArePluginsEnabled)
            settings->setPluginsEnabled(webcoreSettingsState->arePluginsEnabled);

        if (setting == AllSettings || setting == DefaultTextEncodingName)
            settings->setDefaultTextEncodingName(webcoreSettingsState->defaultTextEncodingName);

        if (setting == AllSettings || setting == UserStyleSheet)
            settings->setUserStyleSheetLocation(webcoreSettingsState->userStyleSheet);

        if (setting == AllSettings || setting == FirstScheduledLayoutDelay)
            settings->setFirstScheduledLayoutDelay(webcoreSettingsState->firstScheduledLayoutDelay);

        if (setting == AllSettings || setting == UseWebKitCache)
            settings->setUseCache(webcoreSettingsState->useWebKitCache);
#if ENABLE(DATABASE)
        if (setting == AllSettings || setting == LocalStoragePath)
            settings->setLocalStorageDatabasePath(webcoreSettingsState->localStoragePath);

        if (setting == AllSettings || setting == IsDatabasesEnabled) {
            WebCore::Database::setIsAvailable(webcoreSettingsState->isDatabasesEnabled);
            WebCore::DatabaseSync::setIsAvailable(webcoreSettingsState->isDatabasesEnabled);
        }

        if (setting == AllSettings || setting == IsLocalStorageEnabled)
            settings->setLocalStorageEnabled(webcoreSettingsState->isLocalStorageEnabled);

        if (setting == AllSettings || setting == IsOfflineWebApplicationCacheEnabled)
            settings->setOfflineWebApplicationCacheEnabled(webcoreSettingsState->isOfflineWebApplicationCacheEnabled);

        if (setting == AllSettings || setting == LocalStorageQuota)
            getGroupSettings(m_page)->setLocalStorageQuotaBytes(webcoreSettingsState->localStorageQuota);
        
        if (setting == AllSettings || setting == IsFrameFlatteningEnabled)
            settings->setFrameFlatteningEnabled(webcoreSettingsState->isFrameFlatteningEnabled);
#endif

        // These are *NOT* exposed via the API so just always set them if this
        // is global and we're setting all the settings...
        if (setting == AllSettings && global) {
            settings->setJavaEnabled(webcoreSettingsState->isJavaEnabled);
        }

        // Apply the Olympia settings to this page's settings
        OlympiaSettingsState* olympiaSettingsState = global ? WebSettings::pageGroupSettings(m_webCoreSettingsState->pageGroupName)->d->m_olympiaSettingsState : m_olympiaSettingsState;

        if (setting == AllSettings || setting == UserAgentString)
            m_olympiaSettingsState->userAgentString = olympiaSettingsState->userAgentString;

        if (setting == AllSettings || setting == IsZoomToFitOnLoad)
            m_olympiaSettingsState->isZoomToFitOnLoad = olympiaSettingsState->isZoomToFitOnLoad;

        if (setting == AllSettings || setting == IsScrollbarsEnabled)
//.........这里部分代码省略.........
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:101,代码来源:WebSettings.cpp

示例9: apply


//.........这里部分代码省略.........
#if ENABLE(3D_CANVAS)
        value = attributes.value(QWebSettings::WebGLEnabled,
                                 global->attributes.value(QWebSettings::WebGLEnabled));

        settings->setWebGLEnabled(value);
#endif
 
        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::SpatialNavigationEnabled,
                                      global->attributes.value(QWebSettings::SpatialNavigationEnabled));
        settings->setSpatialNavigationEnabled(value);

        value = attributes.value(QWebSettings::JavascriptCanAccessClipboard,
                                      global->attributes.value(QWebSettings::JavascriptCanAccessClipboard));
        settings->setDOMPasteAllowed(value);
        settings->setJavaScriptCanAccessClipboard(value);

        value = attributes.value(QWebSettings::DeveloperExtrasEnabled,
                                      global->attributes.value(QWebSettings::DeveloperExtrasEnabled));
        settings->setDeveloperExtrasEnabled(value);

        value = attributes.value(QWebSettings::FrameFlatteningEnabled,
                                      global->attributes.value(QWebSettings::FrameFlatteningEnabled));
        settings->setFrameFlatteningEnabled(value);

        QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
        settings->setUserStyleSheetLocation(WebCore::KURL(location));

        QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
        settings->setDefaultTextEncodingName(encoding);

        QString storagePath = !localStoragePath.isEmpty() ? localStoragePath : global->localStoragePath;
        settings->setLocalStorageDatabasePath(storagePath);

        value = attributes.value(QWebSettings::ZoomTextOnly,
                                 global->attributes.value(QWebSettings::ZoomTextOnly));
        settings->setZoomMode(value ? WebCore::ZoomTextOnly : WebCore::ZoomPage);

        value = attributes.value(QWebSettings::PrintElementBackgrounds,
                                      global->attributes.value(QWebSettings::PrintElementBackgrounds));
        settings->setShouldPrintBackgrounds(value);

#if ENABLE(DATABASE)
        value = attributes.value(QWebSettings::OfflineStorageDatabaseEnabled,
                                      global->attributes.value(QWebSettings::OfflineStorageDatabaseEnabled));
        WebCore::Database::setIsAvailable(value);
#endif

        value = attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled,
                                      global->attributes.value(QWebSettings::OfflineWebApplicationCacheEnabled));
        settings->setOfflineWebApplicationCacheEnabled(value);

        value = attributes.value(QWebSettings::LocalStorageEnabled,
                                      global->attributes.value(QWebSettings::LocalStorageEnabled));
        settings->setLocalStorageEnabled(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
        settings->setAllowUniversalAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::LocalContentCanAccessFileUrls,
                                      global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls));
        settings->setAllowFileAccessFromFileURLs(value);

        value = attributes.value(QWebSettings::XSSAuditingEnabled,
                                      global->attributes.value(QWebSettings::XSSAuditingEnabled));
        settings->setXSSAuditorEnabled(value);

#if ENABLE(TILED_BACKING_STORE)
        value = attributes.value(QWebSettings::TiledBackingStoreEnabled,
                                      global->attributes.value(QWebSettings::TiledBackingStoreEnabled));
        settings->setTiledBackingStoreEnabled(value);
#endif

        value = attributes.value(QWebSettings::SiteSpecificQuirksEnabled,
                                      global->attributes.value(QWebSettings::SiteSpecificQuirksEnabled));
        settings->setNeedsSiteSpecificQuirks(value);

        settings->setUsesPageCache(WebCore::pageCache()->capacity());
    } else {
        QList<QWebSettingsPrivate*> settings = *::allSettings();
        for (int i = 0; i < settings.count(); ++i)
            settings[i]->apply();
    }
}
开发者ID:Marforius,项目名称:qt,代码行数:101,代码来源:qwebsettings.cpp


注:本文中的webcore::Settings::setOfflineWebApplicationCacheEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。