[WTF] Add makeUnique<T>, which ensures T is fast-allocated, makeUnique / makeUniqueWi...
[WebKit-https.git] / Source / WebCore / page / PageGroup.cpp
index a2e7c33..128c18f 100644 (file)
 #include "config.h"
 #include "PageGroup.h"
 
-#include "Chrome.h"
-#include "ChromeClient.h"
 #include "DOMWrapperWorld.h"
 #include "Document.h"
-#include "MainFrame.h"
+#include "Frame.h"
 #include "Page.h"
 #include "PageCache.h"
-#include "SecurityOrigin.h"
-#include "Settings.h"
 #include "StorageNamespace.h"
-#include <runtime/StructureInlines.h>
+#include <JavaScriptCore/HeapInlines.h>
+#include <JavaScriptCore/StructureInlines.h>
 #include <wtf/StdLibExtras.h>
 
 #if ENABLE(VIDEO_TRACK)
@@ -69,9 +66,7 @@ PageGroup::PageGroup(Page& page)
     addPage(page);
 }
 
-PageGroup::~PageGroup()
-{
-}
+PageGroup::~PageGroup() = default;
 
 typedef HashMap<String, PageGroup*> PageGroupMap;
 static PageGroupMap* pageGroups = nullptr;
@@ -98,6 +93,9 @@ void PageGroup::addPage(Page& page)
 {
     ASSERT(!m_pages.contains(&page));
     m_pages.add(&page);
+    
+    if (m_isLegacyPrivateBrowsingEnabledForTesting)
+        page.enableLegacyPrivateBrowsing(true);
 }
 
 void PageGroup::removePage(Page& page)
@@ -118,9 +116,9 @@ CaptionUserPreferences& PageGroup::captionPreferences()
 {
     if (!m_captionPreferences) {
 #if PLATFORM(MAC) || HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-        m_captionPreferences = std::make_unique<CaptionUserPreferencesMediaAF>(*this);
+        m_captionPreferences = makeUnique<CaptionUserPreferencesMediaAF>(*this);
 #else
-        m_captionPreferences = std::make_unique<CaptionUserPreferences>(*this);
+        m_captionPreferences = makeUnique<CaptionUserPreferences>(*this);
 #endif
     }
 
@@ -128,4 +126,15 @@ CaptionUserPreferences& PageGroup::captionPreferences()
 }
 #endif
 
+void PageGroup::enableLegacyPrivateBrowsingForTesting(bool enabled)
+{
+    if (m_isLegacyPrivateBrowsingEnabledForTesting == enabled)
+        return;
+
+    m_isLegacyPrivateBrowsingEnabledForTesting = enabled;
+    
+    for (auto* page : m_pages)
+        page->enableLegacyPrivateBrowsing(enabled);
+}
+
 } // namespace WebCore