Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: Source/web/WebSharedWorkerImpl.cpp

Issue 592183002: [WIP]Implement Blink side changes for navigator.language(s) support for workers. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Dedicated worker languagechange event added. Still WIP. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebSharedWorkerImpl.h ('k') | public/web/WebSharedWorker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebSharedWorkerImpl.cpp
diff --git a/Source/web/WebSharedWorkerImpl.cpp b/Source/web/WebSharedWorkerImpl.cpp
index 240b9108441811afba92ebce1ad30672d2611fa7..ef6dfedd6f74f8d68af305023aa7e16816cd64ce 100644
--- a/Source/web/WebSharedWorkerImpl.cpp
+++ b/Source/web/WebSharedWorkerImpl.cpp
@@ -34,6 +34,7 @@
#include "core/dom/CrossThreadTask.h"
#include "core/dom/Document.h"
#include "core/events/MessageEvent.h"
+#include "core/frame/Navigator.h"
#include "core/html/HTMLFormElement.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
@@ -47,6 +48,8 @@
#include "core/workers/WorkerClients.h"
#include "core/workers/WorkerGlobalScope.h"
#include "core/workers/WorkerInspectorProxy.h"
+#include "core/workers/WorkerLanguageTasks.h"
+#include "core/workers/WorkerNavigator.h"
#include "core/workers/WorkerScriptLoader.h"
#include "core/workers/WorkerThreadStartupData.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -310,8 +313,13 @@ void WebSharedWorkerImpl::workerGlobalScopeClosedOnMainThread()
stopWorkerThread();
}
-void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope*)
+void WebSharedWorkerImpl::workerGlobalScopeStarted(WorkerGlobalScope* workerGlobalScope)
{
+ WTF::Vector<WTF::String> languages;
+ String acceptLangsString = m_acceptLanguages;
+ acceptLangsString.split(',', languages);
+ // Get the navigator and set the user preferred langauges
+ workerGlobalScope->navigator()->setUserPreferredLanguagesForWorkers(languages);
}
void WebSharedWorkerImpl::workerThreadTerminated()
@@ -356,12 +364,13 @@ void WebSharedWorkerImpl::connectTask(ExecutionContext* context, PassOwnPtr<WebM
workerGlobalScope->dispatchEvent(createConnectEvent(port.release()));
}
-void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType)
+void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& contentSecurityPolicy, WebContentSecurityPolicyType policyType, const WebString& acceptLanguages)
{
m_url = url;
m_name = name;
m_contentSecurityPolicy = contentSecurityPolicy;
m_policyType = policyType;
+ m_acceptLanguages = acceptLanguages;
initializeLoader(url);
}
« no previous file with comments | « Source/web/WebSharedWorkerImpl.h ('k') | public/web/WebSharedWorker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698