summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 18:10:37 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-11 18:10:37 +0000
commit2306303ade2ec3f85354623a55015ac674f0f947 (patch)
treee24d7b482009168e4ed67b14239a76ec7954aabc
parent6b55aecf5481ebb66f6b93d8f34cca5a44197473 (diff)
downloadchromium_src-2306303ade2ec3f85354623a55015ac674f0f947.zip
chromium_src-2306303ade2ec3f85354623a55015ac674f0f947.tar.gz
chromium_src-2306303ade2ec3f85354623a55015ac674f0f947.tar.bz2
Propogate the UI language on the command line and expose to Flash.
This is just like the NPAPI plugin process and many of the other child processes we have. I wire the command line parameter up to a new Flash setting. TEST=manual BUG=none Review URL: https://chromiumcodereview.appspot.com/10541088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141434 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/ppapi_plugin_process_host.cc9
-rw-r--r--content/content_ppapi_plugin.gypi1
-rw-r--r--content/ppapi_plugin/ppapi_thread.cc6
-rw-r--r--content/ppapi_plugin/ppapi_thread.h1
-rw-r--r--ppapi/api/private/ppb_flash.idl11
-rw-r--r--ppapi/c/private/ppb_flash.h12
-rw-r--r--ppapi/proxy/plugin_proxy_delegate.h5
-rw-r--r--ppapi/proxy/ppapi_proxy_test.cc4
-rw-r--r--ppapi/proxy/ppapi_proxy_test.h1
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc4
10 files changed, 50 insertions, 4 deletions
diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc
index de2770a..92d7e4e 100644
--- a/content/browser/ppapi_plugin_process_host.cc
+++ b/content/browser/ppapi_plugin_process_host.cc
@@ -16,12 +16,14 @@
#include "content/browser/renderer_host/render_message_filter.h"
#include "content/common/child_process_host_impl.h"
#include "content/common/child_process_messages.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/pepper_plugin_info.h"
#include "content/public/common/process_type.h"
#include "ipc/ipc_switches.h"
#include "net/base/network_change_notifier.h"
#include "ppapi/proxy/ppapi_messages.h"
+#include "ui/base/ui_base_switches.h"
#include "webkit/plugins/plugin_switches.h"
using content::ChildProcessHost;
@@ -189,6 +191,13 @@ bool PpapiPluginProcessHost::Init(const content::PepperPluginInfo& info) {
arraysize(kPluginForwardSwitches));
}
+ std::string locale =
+ content::GetContentClient()->browser()->GetApplicationLocale();
+ if (!locale.empty()) {
+ // Pass on the locale so the plugin will know what language we're using.
+ cmd_line->AppendSwitchASCII(switches::kLang, locale);
+ }
+
if (!plugin_launcher.empty())
cmd_line->PrependWrapper(plugin_launcher);
diff --git a/content/content_ppapi_plugin.gypi b/content/content_ppapi_plugin.gypi
index c5a2543..2a7da33 100644
--- a/content/content_ppapi_plugin.gypi
+++ b/content/content_ppapi_plugin.gypi
@@ -6,6 +6,7 @@
'dependencies': [
'../base/base.gyp:base',
'../ppapi/ppapi_internal.gyp:ppapi_proxy',
+ '../ui/ui.gyp:ui',
],
'sources': [
'ppapi_plugin/broker_process_dispatcher.cc',
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index e5ae210..e106571 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -28,6 +28,7 @@
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/interface_list.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
+#include "ui/base/ui_base_switches.h"
#include "webkit/plugins/plugin_switches.h"
#if defined(OS_WIN)
@@ -161,6 +162,11 @@ bool PpapiThread::SendToBrowser(IPC::Message* msg) {
return sync_message_filter()->Send(msg);
}
+std::string PpapiThread::GetUILanguage() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ return command_line->GetSwitchValueASCII(switches::kLang);
+}
+
void PpapiThread::PreCacheFont(const void* logfontw) {
#if defined(OS_WIN)
Send(new ChildProcessHostMsg_PreCacheFont(
diff --git a/content/ppapi_plugin/ppapi_thread.h b/content/ppapi_plugin/ppapi_thread.h
index 352650b..a7c6a3e 100644
--- a/content/ppapi_plugin/ppapi_thread.h
+++ b/content/ppapi_plugin/ppapi_thread.h
@@ -62,6 +62,7 @@ class PpapiThread : public ChildThread,
// SendToBrowser() is intended to be safe to use on another thread so
// long as the main PpapiThread outlives it.
virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
+ virtual std::string GetUILanguage() OVERRIDE;
virtual void PreCacheFont(const void* logfontw) OVERRIDE;
// Message handlers.
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
index 8ce45ef..0befda7 100644
--- a/ppapi/api/private/ppb_flash.idl
+++ b/ppapi/api/private/ppb_flash.idl
@@ -47,7 +47,16 @@ enum PP_FlashSetting {
*
* This should only be enabled if PP_FLASHSETTING_3DENABLED is true.
*/
- PP_FLASHSETTING_STAGE3DENABLED = 3
+ PP_FLASHSETTING_STAGE3DENABLED = 3,
+
+ /**
+ * Specifies the string for the language code of the UI of the browser.
+ *
+ * For example: "en-US" or "de".
+ *
+ * Returns an undefined PP_Var on invalid instance.
+ */
+ PP_FLASHSETTING_LANGUAGE = 4
};
/**
diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h
index 9a3ed11..1bde87b 100644
--- a/ppapi/c/private/ppb_flash.h
+++ b/ppapi/c/private/ppb_flash.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_flash.idl modified Thu Jun 7 12:41:56 2012. */
+/* From private/ppb_flash.idl modified Fri Jun 8 15:55:46 2012. */
#ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
#define PPAPI_C_PRIVATE_PPB_FLASH_H_
@@ -67,7 +67,15 @@ typedef enum {
*
* This should only be enabled if PP_FLASHSETTING_3DENABLED is true.
*/
- PP_FLASHSETTING_STAGE3DENABLED = 3
+ PP_FLASHSETTING_STAGE3DENABLED = 3,
+ /**
+ * Specifies the string for the language code of the UI of the browser.
+ *
+ * For example: "en-US" or "de".
+ *
+ * Returns an undefined PP_Var on invalid instance.
+ */
+ PP_FLASHSETTING_LANGUAGE = 4
} PP_FlashSetting;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
/**
diff --git a/ppapi/proxy/plugin_proxy_delegate.h b/ppapi/proxy/plugin_proxy_delegate.h
index 5045ba7..0d1807a 100644
--- a/ppapi/proxy/plugin_proxy_delegate.h
+++ b/ppapi/proxy/plugin_proxy_delegate.h
@@ -5,6 +5,8 @@
#ifndef PPAPI_PROXY_PLUGIN_PROXY_DELEGATE_H_
#define PPAPI_PROXY_PLUGIN_PROXY_DELEGATE_H_
+#include <string>
+
namespace ppapi {
namespace proxy {
@@ -16,6 +18,9 @@ class PPAPI_PROXY_EXPORT PluginProxyDelegate {
// IPC::Message::Sender interface.
virtual bool SendToBrowser(IPC::Message* msg) = 0;
+ // Returns the language code of the current UI language.
+ virtual std::string GetUILanguage() = 0;
+
// Performs Windows-specific font caching in the browser for the given
// LOGFONTW. Does nothing on non-Windows platforms.
virtual void PreCacheFont(const void* logfontw) = 0;
diff --git a/ppapi/proxy/ppapi_proxy_test.cc b/ppapi/proxy/ppapi_proxy_test.cc
index 445f84b..ac5b535 100644
--- a/ppapi/proxy/ppapi_proxy_test.cc
+++ b/ppapi/proxy/ppapi_proxy_test.cc
@@ -229,6 +229,10 @@ bool PluginProxyTestHarness::PluginDelegateMock::SendToBrowser(
return false;
}
+std::string PluginProxyTestHarness::PluginDelegateMock::GetUILanguage() {
+ return std::string("en-US");
+}
+
void PluginProxyTestHarness::PluginDelegateMock::PreCacheFont(
const void* logfontw) {
}
diff --git a/ppapi/proxy/ppapi_proxy_test.h b/ppapi/proxy/ppapi_proxy_test.h
index 59a5671..1de0809 100644
--- a/ppapi/proxy/ppapi_proxy_test.h
+++ b/ppapi/proxy/ppapi_proxy_test.h
@@ -126,6 +126,7 @@ class PluginProxyTestHarness : public ProxyTestHarnessBase {
// PluginPepperDelegate implementation.
virtual bool SendToBrowser(IPC::Message* msg) OVERRIDE;
+ virtual std::string GetUILanguage() OVERRIDE;
virtual void PreCacheFont(const void* logfontw) OVERRIDE;
private:
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index f2da43a..a6b7e62 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -287,7 +287,6 @@ int32_t PPB_Flash_Proxy::GetSettingInt(PP_Instance instance,
PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance,
PP_FlashSetting setting) {
- ReceiveSerializedVarReturnValue result;
PluginDispatcher* plugin_dispatcher =
static_cast<PluginDispatcher*>(dispatcher());
switch (setting) {
@@ -299,6 +298,9 @@ PP_Var PPB_Flash_Proxy::GetSetting(PP_Instance instance,
case PP_FLASHSETTING_STAGE3DENABLED:
return PP_MakeBool(PP_FromBool(
plugin_dispatcher->preferences().is_stage3d_supported));
+ case PP_FLASHSETTING_LANGUAGE:
+ return StringVar::StringToPPVar(
+ PluginGlobals::Get()->plugin_proxy_delegate()->GetUILanguage());
}
return PP_MakeUndefined();
}