Provide access to user's list of preferred languages
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2012 21:45:15 +0000 (21:45 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jan 2012 21:45:15 +0000 (21:45 +0000)
commitd98f23bd548a01345eb3fde4f0e5ff178bb66c1f
treeadef111441fd5b7e75f490158bfff039155c5a4d
parent5392ed5391526cb04f1ae39e595f312e93917519
Provide access to user's list of preferred languages
https://bugs.webkit.org/show_bug.cgi?id=76138

Reviewed by Alexey Proskuryakov.

.:

* Source/autotools/symbols.filter: List the new functions.

Source/WebCore:

Test: fast/harness/user-preferred-language.html

* WebCore.exp.in: Export the new functions.
* WebCore.order: Ditto.

* Target.pri: Include new files.
* WebCore.gypi: Ditto.
* WebCore.vcproj/WebCoreTestSupport.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.

* platform/Language.cpp:
(WebCore::defaultLanguage): Return userPreferredLanguages[0].
(WebCore::preferredLanguagesOverride): New, return the languages override.
(WebCore::overrideUserPreferredLanguages): New, set the languages override.
(WebCore::userPreferredLanguages): New, return the languages array.
* platform/Language.h:

* platform/blackberry/LocalizedStringsBlackBerry.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* platform/chromium/LanguageChromium.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* platform/efl/LanguageEfl.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* platform/gtk/LanguageGtk.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* platform/mac/Language.mm:
(+[WebLanguageChangeObserver _webkit_languagePreferencesDidChange]): Flag the user languages
    as invalid.
(WebCore::platformLanguage): Removed.
(WebCore::platformUserPreferredLanguages): New, return the list of user preferred languages.

* platform/qt/LanguageQt.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* platform/win/LanguageWin.cpp:
(WebCore::platformLanguage): Renamed from platformDefaultLanguage, now static.
(WebCore::platformUserPreferredLanguages): New.

* testing/Internals.cpp:
(WebCore::Internals::userPreferredLanguages): New, return the platform's user preferred languages.
(WebCore::Internals::setUserPreferredLanguages): New, override the user's preferred languages.
* testing/Internals.h:
* testing/Internals.idl: Add userPreferredLanguages.

* testing/js/JSInternalsCustom.cpp:
(WebCore::JSInternals::userPreferredLanguages): New.
(WebCore::JSInternals::setUserPreferredLanguages): New.

* testing/v8/V8InternalsCustom.cpp:
(WebCore::V8Internals::userPreferredLanguagesAccessorGetter): New.
(WebCore::V8Internals::userPreferredLanguagesAccessorSetter): New.

Source/WebKit2:

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode): Encode the languages array.
(WebKit::WebProcessCreationParameters::decode): Decode the languages array.
* Shared/WebProcessCreationParameters.h:

* UIProcess/WebContext.cpp:
(WebKit::WebContext::languageChanged): Override the WebProcess userPreferredLanguages.
(WebKit::WebContext::ensureWebProcess): Initialize parameters.languages.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess): Override user languages array.
(WebKit::WebProcess::userPreferredLanguagesChanged): Ditto.
* WebProcess/WebProcess.h:
* WebProcess/WebProcess.messages.in: Define UserPreferredLanguagesChanged.

* win/WebKit2.def: Export the new functions.
* win/WebKit2CFLite.def: Ditto.

Tools:

* GNUmakefile.am: Add JSInternalsCustom.cpp.

LayoutTests:

* fast/harness/user-preferred-language-expected.txt: Added.
* fast/harness/user-preferred-language.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@105315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/harness/user-preferred-language-expected.txt [new file with mode: 0644]
LayoutTests/fast/harness/user-preferred-language.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.order
Source/WebCore/WebCore.vcproj/WebCoreTestSupport.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/Language.cpp
Source/WebCore/platform/Language.h
Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp
Source/WebCore/platform/chromium/LanguageChromium.cpp
Source/WebCore/platform/efl/LanguageEfl.cpp
Source/WebCore/platform/gtk/LanguageGtk.cpp
Source/WebCore/platform/mac/Language.mm
Source/WebCore/platform/qt/LanguageQt.cpp
Source/WebCore/platform/win/LanguageWin.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/testing/js/JSInternalsCustom.cpp [new file with mode: 0644]
Source/WebCore/testing/v8/V8InternalsCustom.cpp [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter
Tools/ChangeLog
Tools/GNUmakefile.am