WebCore/ChangeLog

 12010-11-05 John Reck <jreck@google.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Implements navigator.language for Android
 6 https://bugs.webkit.org/show_bug.cgi?id=49099
 7
 8 Android was previously hardcoding the value for WebCore::platformDefaultLanguage().
 9 This patch removes the hardcoding and calls into the PlatformBridge to get the
 10 correct language based off of the user's settings.
 11
 12 No new tests needed, this is already covered
 13
 14 * Android.mk:
 15 * platform/android/LanguageAndroid.cpp: Added.
 16 (WebCore::platformDefaultLanguage):
 17 * platform/android/PlatformBridge.h:
 18 * platform/android/TemporaryLinkStubs.cpp:
 19
1202010-11-05 Chris Marrin <cmarrin@apple.com>
221
322 Reviewed by Simon Fraser.
71451

WebCore/Android.mk

@@LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
483483 platform/android/GeolocationServiceAndroid.cpp \
484484 platform/android/GeolocationServiceBridge.cpp \
485485 platform/android/KeyEventAndroid.cpp \
 486 platform/android/LanguageAndroid.cpp \
486487 platform/android/LocalizedStringsAndroid.cpp \
487488 platform/android/PlatformTouchEventAndroid.cpp \
488489 platform/android/PlatformTouchPointAndroid.cpp \
71423

WebCore/platform/android/LanguageAndroid.cpp

 1/*
 2 * Copyright 2010, The Android Open Source Project
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 * * Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * * Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26#include "config.h"
 27#include "Language.h"
 28
 29#include "PlatformBridge.h"
 30#include "PlatformString.h"
 31
 32namespace WebCore {
 33
 34// This function is used by Javascript to find out what the default language
 35// the user has selected. It is used by the JS object Navigator.language
 36// I guess this information should be mapped with the Accept-Language: HTTP header.
 37String platformDefaultLanguage()
 38{
 39 return PlatformBridge::computeDefaultLanguage();
 40}
 41
 42} // namespace WebCore
0

WebCore/platform/android/PlatformBridge.h

@@public:
104104 static bool cookiesEnabled();
105105 // Plugin
106106 static NPObject* pluginScriptableObject(Widget*);
 107 // Language
 108 static String computeDefaultLanguage();
107109};
108110
109111}
71353

WebCore/platform/android/TemporaryLinkStubs.cpp

@@using namespace WebCore;
9393/* Completely empty stubs (mostly to allow DRT to run): */
9494/********************************************************/
9595
96 // This function is used by Javascript to find out what the default language
97 // the user has selected. It is used by the JS object Navigator.language
98 // I guess this information should be mapped with the Accept-Language: HTTP header.
99 String WebCore::defaultLanguage()
100 {
101  verifiedOk();
102  return "en";
103 }
104 
10596namespace WebCore {
10697
10798// This function tells the bridge that a resource was loaded from the cache and thus
71353