diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp | |
parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp index 1e8310729..2e7c83c1b 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp @@ -32,6 +32,7 @@ #include "InjectedBundleScriptWorld.h" #include "InjectedBundleUserMessageCoders.h" #include "LayerTreeHost.h" +#include "NotificationPermissionRequestManager.h" #include "WKAPICast.h" #include "WKBundleAPICast.h" #include "WebApplicationCacheManager.h" @@ -53,6 +54,7 @@ #include <WebCore/GeolocationController.h> #include <WebCore/GeolocationPosition.h> #include <WebCore/JSDOMWindow.h> +#include <WebCore/JSNotification.h> #include <WebCore/Page.h> #include <WebCore/PageGroup.h> #include <WebCore/PageVisibilityState.h> @@ -129,7 +131,13 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page { const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); - // FIXME: Need an explicit way to set "WebKitTabToLinksPreferenceKey" directly in WebPage. + if (preference == "WebKitTabToLinksPreferenceKey") { + WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::tabsToLinksKey(), enabled); + for (HashSet<Page*>::iterator i = pages.begin(); i != pages.end(); ++i) { + WebPage* webPage = static_cast<WebFrameLoaderClient*>((*i)->mainFrame()->loader()->client())->webFrame()->page(); + webPage->setTabToLinksEnabled(enabled); + } + } if (preference == "WebKit2AsynchronousPluginInitializationEnabled") { WebPreferencesStore::overrideBoolValueForKey(WebPreferencesKey::asynchronousPluginInitializationEnabledKey(), enabled); @@ -171,7 +179,8 @@ void InjectedBundle::overrideBoolPreferenceForTestRunner(WebPageGroupProxy* page macro(WebKitWebAudioEnabled, WebAudioEnabled, webAudioEnabled) \ macro(WebKitWebGLEnabled, WebGLEnabled, webGLEnabled) \ macro(WebKitXSSAuditorEnabled, XSSAuditorEnabled, xssAuditorEnabled) \ - macro(WebKitShouldRespectImageOrientation, ShouldRespectImageOrientation, shouldRespectImageOrientation) + macro(WebKitShouldRespectImageOrientation, ShouldRespectImageOrientation, shouldRespectImageOrientation) \ + macro(WebKitEnableCaretBrowsing, CaretBrowsingEnabled, caretBrowsingEnabled) if (preference == "WebKitAcceleratedCompositingEnabled") enabled = enabled && LayerTreeHost::supportsAcceleratedCompositing(); @@ -215,6 +224,13 @@ void InjectedBundle::setAllowFileAccessFromFileURLs(WebPageGroupProxy* pageGroup (*iter)->settings()->setAllowFileAccessFromFileURLs(enabled); } +void InjectedBundle::setMinimumLogicalFontSize(WebPageGroupProxy* pageGroup, int size) +{ + const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); + for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter) + (*iter)->settings()->setMinimumLogicalFontSize(size); +} + void InjectedBundle::setFrameFlatteningEnabled(WebPageGroupProxy* pageGroup, bool enabled) { const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages(); @@ -534,4 +550,36 @@ void InjectedBundle::setUserStyleSheetLocation(WebPageGroupProxy* pageGroup, con (*iter)->settings()->setUserStyleSheetLocation(KURL(KURL(), location)); } +void InjectedBundle::setWebNotificationPermission(WebPage* page, const String& originString, bool allowed) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + page->notificationPermissionRequestManager()->setPermissionLevelForTesting(originString, allowed); +#else + UNUSED_PARAM(page); + UNUSED_PARAM(originString); + UNUSED_PARAM(allowed); +#endif +} + +void InjectedBundle::removeAllWebNotificationPermissions(WebPage* page) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + page->notificationPermissionRequestManager()->removeAllPermissionsForTesting(); +#else + UNUSED_PARAM(page); +#endif +} + +uint64_t InjectedBundle::webNotificationID(JSContextRef jsContext, JSValueRef jsNotification) +{ +#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) + WebCore::Notification* notification = toNotification(toJS(toJS(jsContext), jsNotification)); + if (!notification) + return 0; + return WebProcess::shared().notificationManager().notificationIDForTesting(notification); +#else + return 0; +#endif +} + } // namespace WebKit |