WebKit2: Safari shouldn't auto-activate plug-ins in background tabs.
authorbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Nov 2010 01:11:27 +0000 (01:11 +0000)
committerbweinstein@apple.com <bweinstein@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Nov 2010 01:11:27 +0000 (01:11 +0000)
 https://bugs.webkit.org/show_bug.cgi?id=49770
 <rdar://problem/8482424>

Reviewed by Adam Roben.

 Add an API on Windows to call setIsInWindow, which calls through to WebPage::setIsInWindow.
 Remove the !PLATFORM(WIN) check in WebPage, so we don't automatically start plugins that are
 loaded in background tabs.

* UIProcess/API/C/win/WKView.cpp:
(WKViewSetIsInWindow): Call through to WebView::setIsInWindow.
* UIProcess/API/C/win/WKView.h:
* UIProcess/win/WebView.cpp:
(WebKit::WebView::setIsInWindow): Call through to WebPage::setIsInWindow.
* UIProcess/win/WebView.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Remove the !PLATFORM(WIN) check and update the comment.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72352 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit2/ChangeLog
WebKit2/UIProcess/API/C/win/WKView.cpp
WebKit2/UIProcess/API/C/win/WKView.h
WebKit2/UIProcess/win/WebView.cpp
WebKit2/UIProcess/win/WebView.h
WebKit2/WebProcess/WebPage/WebPage.cpp

index a225e41..d59a143 100644 (file)
@@ -1,3 +1,24 @@
+2010-11-18  Brian Weinstein  <bweinstein@apple.com>
+
+        Reviewed by Adam Roben.
+
+         WebKit2: Safari shouldn't auto-activate plug-ins in background tabs.
+         https://bugs.webkit.org/show_bug.cgi?id=49770
+         <rdar://problem/8482424>
+         
+         Add an API on Windows to call setIsInWindow, which calls through to WebPage::setIsInWindow.
+         Remove the !PLATFORM(WIN) check in WebPage, so we don't automatically start plugins that are
+         loaded in background tabs.
+
+        * UIProcess/API/C/win/WKView.cpp:
+        (WKViewSetIsInWindow): Call through to WebView::setIsInWindow.
+        * UIProcess/API/C/win/WKView.h:
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::setIsInWindow): Call through to WebPage::setIsInWindow.
+        * UIProcess/win/WebView.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Remove the !PLATFORM(WIN) check and update the comment.
+
 2010-11-18  Darin Adler  <darin@apple.com>
 
         * WebProcess/WebPage/WebPage.cpp: Fix build by rolling out a change.
index 95df964..947ea77 100644 (file)
@@ -60,3 +60,8 @@ void WKViewWindowAncestryDidChange(WKViewRef viewRef)
 {
     toImpl(viewRef)->windowAncestryDidChange();
 }
+
+void WKViewSetIsInWindow(WKViewRef viewRef, bool isInWindow)
+{
+    toImpl(viewRef)->setIsInWindow(isInWindow);
+}
index 817cc4c..043f486 100644 (file)
@@ -43,6 +43,7 @@ WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
 
 WK_EXPORT void WKViewSetParentWindow(WKViewRef view, HWND parentWindow);
 WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view);
+WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow);
 
 #ifdef __cplusplus
 }
index c26eeed..fa6d37c 100644 (file)
@@ -643,7 +643,13 @@ void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
     // FIXME: Implement.
 }
 
+void WebView::setIsInWindow(bool isInWindow)
+{
+    m_page->setIsInWindow(isInWindow);
+}
+
 #if USE(ACCELERATED_COMPOSITING)
+
 void WebView::pageDidEnterAcceleratedCompositing()
 {
     switchToDrawingAreaTypeIfNecessary(DrawingAreaProxy::LayerBackedDrawingAreaType);
index ae5a833..ca76779 100644 (file)
@@ -57,6 +57,7 @@ public:
     HWND window() const { return m_window; }
     void setParentWindow(HWND);
     void windowAncestryDidChange();
+    void setIsInWindow(bool);
     void setOverrideCursor(HCURSOR overrideCursor);
 
     WebPageProxy* page() const { return m_page.get(); }
index 03ff299..146df97 100644 (file)
@@ -131,11 +131,11 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     pageClients.backForwardClient = WebBackForwardListProxy::create(this);
     m_page = adoptPtr(new Page(pageClients));
 
-    // Windows and Qt do not yet call setIsInWindow. Until they do, just leave
+    // Qt does not yet call setIsInWindow. Until it does, just leave
     // this line out so plug-ins and video will work. Eventually all platforms
     // should call setIsInWindow and this comment and #if should be removed,
     // leaving behind the setCanStartMedia call.
-#if !PLATFORM(WIN) && !PLATFORM(QT)
+#if !PLATFORM(QT)
     m_page->setCanStartMedia(false);
 #endif