summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/Plugins/Netscape
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-09-18 15:53:33 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-09-18 15:53:33 +0200
commit6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (patch)
treed9c68d1cca0b3e352f1e438561f3e504e641a08f /Source/WebKit2/WebProcess/Plugins/Netscape
parentd0424a769059c84ae20beb3c217812792ea6726b (diff)
downloadqtwebkit-6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2.tar.gz
Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886)
New snapshot with various build fixes
Diffstat (limited to 'Source/WebKit2/WebProcess/Plugins/Netscape')
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp18
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h6
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h3
-rw-r--r--Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm21
4 files changed, 41 insertions, 7 deletions
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
index 01238cbc1..d67ac9511 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp
@@ -946,8 +946,24 @@ void NetscapePlugin::contentsScaleFactorChanged(float scaleFactor)
#endif
}
+void NetscapePlugin::storageBlockingStateChanged(bool storageBlockingEnabled)
+{
+ if (m_storageBlockingState != storageBlockingEnabled) {
+ m_storageBlockingState = storageBlockingEnabled;
+ updateNPNPrivateMode();
+ }
+}
+
void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled)
{
+ if (m_privateBrowsingState != privateBrowsingEnabled) {
+ m_privateBrowsingState = privateBrowsingEnabled;
+ updateNPNPrivateMode();
+ }
+}
+
+void NetscapePlugin::updateNPNPrivateMode()
+{
ASSERT(m_isStarted);
// From https://wiki.mozilla.org/Plugins:PrivateMode
@@ -955,7 +971,7 @@ void NetscapePlugin::privateBrowsingStateChanged(bool privateBrowsingEnabled)
// (assigned enum value 18) with a pointer to an NPBool value on all applicable instances.
// Plugins should check the boolean value pointed to, not the pointer itself.
// The value will be true when private mode is on.
- NPBool value = privateBrowsingEnabled;
+ NPBool value = m_privateBrowsingState || m_storageBlockingState;
NPP_SetValue(NPNVprivateModeBool, &value);
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
index 2c290c76b..61e2bb798 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.h
@@ -221,6 +221,7 @@ private:
#endif
virtual void contentsScaleFactorChanged(float);
+ virtual void storageBlockingStateChanged(bool);
virtual void privateBrowsingStateChanged(bool);
virtual bool getFormValue(String& formValue);
virtual bool handleScroll(WebCore::ScrollDirection, WebCore::ScrollGranularity);
@@ -236,6 +237,8 @@ private:
// converted (if the transformation matrix isn't invertible).
bool convertFromRootView(const WebCore::IntPoint& pointInRootViewCoordinates, WebCore::IntPoint& pointInPluginCoordinates);
+ void updateNPNPrivateMode();
+
#if PLUGIN_ARCHITECTURE(WIN)
static BOOL WINAPI hookedTrackPopupMenu(HMENU, UINT uFlags, int x, int y, int nReserved, HWND, const RECT*);
void scheduleWindowedGeometryUpdate();
@@ -312,6 +315,9 @@ private:
TimerMap m_timers;
unsigned m_nextTimerID;
+ bool m_privateBrowsingState;
+ bool m_storageBlockingState;
+
#if PLUGIN_ARCHITECTURE(MAC)
NPDrawingModel m_drawingModel;
NPEventModel m_eventModel;
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h
index d58924368..0956cc636 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.h
@@ -51,7 +51,10 @@ typedef struct _WKNSandboxFunctions {
WKN_FileStopAccessingProcPtr fileStopAccessing;
} WKNSandboxFunctions;
+// FIXME: This header is mostly "API", except for the following two functions. We should
+// move the declarations to a seperate header.
WKNSandboxFunctions* netscapeSandboxFunctions();
+NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[]);
#ifdef __cplusplus
}
diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
index afcc6456c..07cd2e708 100644
--- a/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/mac/NetscapeSandboxFunctions.mm
@@ -94,15 +94,11 @@ static CString readSandboxProfile()
return result;
}
-NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths[])
+NPError enterSandbox(const char* sandboxProfile, const char* readOnlyPaths[], const char* readWritePaths[])
{
if (enteredSandbox)
return NPERR_GENERIC_ERROR;
- CString profile = readSandboxProfile();
- if (profile.isNull())
- exit(EX_NOPERM);
-
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
// Use private temporary and cache directories.
String systemDirectorySuffix = "com.apple.WebKit.PluginProcess+" + PluginProcess::shared().netscapePluginModule()->module()->bundleIdentifier();
@@ -157,7 +153,7 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths
exit(EX_NOPERM);
const char* sandboxParameters[] = { "HOME_DIR", homeDirectory, 0, 0 };
- if (!WKEnterPluginSandbox(profile.data(), sandboxParameters, extendedReadOnlyPaths.data(), extendedReadWritePaths.data())) {
+ if (!WKEnterPluginSandbox(sandboxProfile, sandboxParameters, extendedReadOnlyPaths.data(), extendedReadWritePaths.data())) {
WTFLogAlways("Couldn't initialize sandbox profile\n");
exit(EX_NOPERM);
}
@@ -169,9 +165,22 @@ NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths
free(homeDirectory);
enteredSandbox = true;
+
+ RetainPtr<NSDictionary> defaults = adoptNS([[NSDictionary alloc] initWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"NSUseRemoteSavePanel", nil]);
+ [[NSUserDefaults standardUserDefaults] registerDefaults:defaults.get()];
+
return NPERR_NO_ERROR;
}
+NPError WKN_EnterSandbox(const char* readOnlyPaths[], const char* readWritePaths[])
+{
+ CString profile = readSandboxProfile();
+ if (profile.isNull())
+ exit(EX_NOPERM);
+
+ return enterSandbox(profile.data(), readOnlyPaths, readWritePaths);
+}
+
NPError WKN_FileStopAccessing(const char* path)
{
if (!enteredSandbox)