summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent/ConnectionFromClient.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Services/WebContent/ConnectionFromClient.cpp')
-rw-r--r--Userland/Services/WebContent/ConnectionFromClient.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp
index 4798233a19..48db742020 100644
--- a/Userland/Services/WebContent/ConnectionFromClient.cpp
+++ b/Userland/Services/WebContent/ConnectionFromClient.cpp
@@ -7,6 +7,7 @@
#include <AK/Debug.h>
#include <AK/JsonObject.h>
+#include <AK/QuickSort.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/FontDatabase.h>
#include <LibGfx/SystemTheme.h>
@@ -24,6 +25,7 @@
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ContentFilter.h>
+#include <LibWeb/Loader/ProxyMappings.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/Painting/PaintableBox.h>
#include <LibWeb/Painting/StackingContext.h>
@@ -454,6 +456,22 @@ void ConnectionFromClient::set_content_filters(Vector<String> const& filters)
Web::ContentFilter::the().add_pattern(filter);
}
+void ConnectionFromClient::set_proxy_mappings(Vector<String> const& proxies, HashMap<String, size_t> const& mappings)
+{
+ auto keys = mappings.keys();
+ quick_sort(keys, [&](auto& a, auto& b) { return a.length() < b.length(); });
+
+ OrderedHashMap<String, size_t> sorted_mappings;
+ for (auto& key : keys) {
+ auto value = *mappings.get(key);
+ if (value >= proxies.size())
+ continue;
+ sorted_mappings.set(key, value);
+ }
+
+ Web::ProxyMappings::the().set_mappings(proxies, move(sorted_mappings));
+}
+
void ConnectionFromClient::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme)
{
m_page_host->set_preferred_color_scheme(color_scheme);