Commit 72ea36f7 authored by mkosiba's avatar mkosiba Committed by Commit bot

[android_webview] Hardcode the default text encoding to UTF-8.

The WebView will use a fixed default value for the text encoding instead
of getting it from the platform. This is in attempt to unify behavior
between devices.

BUG=422366

Review URL: https://codereview.chromium.org/639113004

Cr-Commit-Position: refs/heads/master@{#299287}
parent 068e72c6
......@@ -479,7 +479,7 @@ deps_os = {
# Whenever you roll this please also change frameworks/webview in
# src/android_webview/buildbot/aosp_manifest.xml to point to the same revision.
'src/third_party/android_webview_glue/src':
Var('chromium_git') + '/external/android_webview_glue.git' + '@' + '6ec46f2bd3243d042d9641d7f87863bc20f8c745',
Var('chromium_git') + '/external/android_webview_glue.git' + '@' + '7d62eab4ca242beacac4471c002e998ef5c218b8',
'src/third_party/android_tools':
Var('chromium_git') + '/android_tools.git' + '@' + 'd2b86205ff973a3844020feacb35ca6b1d82efbe',
......
......@@ -8,7 +8,7 @@
<!-- Whenever you roll this please also change frameworks/webview in DEPS to point to the
same revision. -->
<project name="platform/frameworks/webview" path="frameworks/webview" revision="6ec46f2bd3243d042d9641d7f87863bc20f8c745"/>
<project name="platform/frameworks/webview" path="frameworks/webview" revision="7d62eab4ca242beacac4471c002e998ef5c218b8"/>
<project groups="device,flo" name="device/asus/deb" revision="0ce3a783d549d023ddc553a04fed717ffb2ff533"/>
<project groups="device,flo" name="device/asus/flo" revision="55ea79b11f9f82b2aa03f44a3429112fc5c06d07"/>
......
......@@ -14,7 +14,6 @@ namespace AwResource {
std::string GetLoadErrorPageContent();
std::string GetNoDomainPageContent();
std::string GetDefaultTextEncoding();
} // namespace AwResource
} // namsespace android_webview
......
......@@ -32,9 +32,6 @@ public class AwResource {
// a generic load error. (It's called NO_DOMAIN for legacy reasons).
private static int sRawNoDomain;
// String resource ID for the default text encoding to use.
private static int sStringDefaultTextEncoding;
// Array resource ID for the configuration of platform specific key-systems.
private static int sStringArrayConfigKeySystemUUIDMapping;
......@@ -58,19 +55,10 @@ public class AwResource {
sRawNoDomain = nodomain;
}
public static void setDefaultTextEncoding(int encoding) {
sStringDefaultTextEncoding = encoding;
}
public static void setConfigKeySystemUuidMapping(int config) {
sStringArrayConfigKeySystemUUIDMapping = config;
}
@CalledByNative
public static String getDefaultTextEncoding() {
return getResource(sStringDefaultTextEncoding, TYPE_STRING);
}
@CalledByNative
public static String getNoDomainPageContent() {
return getResource(sRawNoDomain, TYPE_RAW);
......
......@@ -68,7 +68,7 @@ public class AwSettings {
private String mSerifFontFamily = "serif";
private String mCursiveFontFamily = "cursive";
private String mFantasyFontFamily = "fantasy";
private String mDefaultTextEncoding;
private String mDefaultTextEncoding = "UTF-8";
private String mUserAgent;
private int mMinimumFontSize = 8;
private int mMinimumLogicalFontSize = 8;
......@@ -227,7 +227,6 @@ public class AwSettings {
mAllowFileAccessFromFileURLs = true;
}
mDefaultTextEncoding = AwResource.getDefaultTextEncoding();
mUserAgent = LazyDefaultUserAgent.sInstance;
// Best-guess a sensible initial value based on the features supported on the device.
......
......@@ -434,12 +434,12 @@ public class AwSettingsTest extends AwTestBase {
@Override
protected String getAlteredValue() {
return "utf-8";
return "Latin-1";
}
@Override
protected String getInitialValue() {
return "Latin-1";
return "UTF-8";
}
@Override
......
......@@ -30,13 +30,6 @@ std::string GetNoDomainPageContent() {
return base::android::ConvertJavaStringToUTF8(content);
}
std::string GetDefaultTextEncoding() {
JNIEnv* env = base::android::AttachCurrentThread();
ScopedJavaLocalRef<jstring> encoding =
Java_AwResource_getDefaultTextEncoding(env);
return base::android::ConvertJavaStringToUTF8(encoding);
}
bool RegisterAwResource(JNIEnv* env) {
return RegisterNativesImpl(env);
}
......
......@@ -147,10 +147,6 @@ void AwContentRendererClient::RenderViewCreated(
new autofill::AutofillAgent(render_view, password_autofill_agent, NULL);
}
std::string AwContentRendererClient::GetDefaultEncoding() {
return AwResource::GetDefaultTextEncoding();
}
bool AwContentRendererClient::HasErrorPage(int http_status_code,
std::string* error_domain) {
return http_status_code >= 400;
......
......@@ -25,7 +25,6 @@ class AwContentRendererClient : public content::ContentRendererClient {
virtual void RenderThreadStarted() override;
virtual void RenderFrameCreated(content::RenderFrame* render_frame) override;
virtual void RenderViewCreated(content::RenderView* render_view) override;
virtual std::string GetDefaultEncoding() override;
virtual bool HasErrorPage(int http_status_code,
std::string* error_domain) override;
virtual void GetNavigationErrorStrings(
......
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2012 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<resources>
<string name="default_encoding">Latin-1</string>
</resources>
......@@ -23,8 +23,6 @@ public class AwShellResourceProvider {
AwResource.setErrorPageResources(R.raw.error, R.raw.blank_html);
AwResource.setDefaultTextEncoding(R.string.default_encoding);
AwResource.setConfigKeySystemUuidMapping(R.array.config_key_system_uuid_mapping);
sInitialized = true;
......
......@@ -536,10 +536,6 @@ SkBitmap* ChromeContentRendererClient::GetSadWebViewBitmap() {
GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap());
}
std::string ChromeContentRendererClient::GetDefaultEncoding() {
return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING);
}
#if defined(ENABLE_EXTENSIONS)
const Extension* ChromeContentRendererClient::GetExtensionByOrigin(
const WebSecurityOrigin& origin) const {
......
......@@ -81,7 +81,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient {
virtual void SetNumberOfViews(int number_of_views) override;
virtual SkBitmap* GetSadPluginBitmap() override;
virtual SkBitmap* GetSadWebViewBitmap() override;
virtual std::string GetDefaultEncoding() override;
virtual bool OverrideCreatePlugin(
content::RenderFrame* render_frame,
blink::WebLocalFrame* frame,
......
......@@ -14,10 +14,6 @@ SkBitmap* ContentRendererClient::GetSadWebViewBitmap() {
return NULL;
}
std::string ContentRendererClient::GetDefaultEncoding() {
return std::string();
}
bool ContentRendererClient::OverrideCreatePlugin(
RenderFrame* render_frame,
blink::WebLocalFrame* frame,
......
......@@ -84,9 +84,6 @@ class CONTENT_EXPORT ContentRendererClient {
// none.
virtual SkBitmap* GetSadWebViewBitmap();
// Returns the default text encoding.
virtual std::string GetDefaultEncoding();
// Allows the embedder to override creating a plugin. If it returns true, then
// |plugin| will contain the created plugin, although it could be NULL. If it
// returns false, the content layer will create the plugin.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment