diff options
author | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:51:32 +0000 |
---|---|---|
committer | dpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:51:32 +0000 |
commit | 18ad677133507343592fab4682510e8d863911c9 (patch) | |
tree | bdf8e575acfc97f651f555c04238018f8cc5bbb7 /content/renderer | |
parent | ce9ca28e14bc8e02678c02df977bae0a85fba040 (diff) | |
download | chromium_src-18ad677133507343592fab4682510e8d863911c9.zip chromium_src-18ad677133507343592fab4682510e8d863911c9.tar.gz chromium_src-18ad677133507343592fab4682510e8d863911c9.tar.bz2 |
move webkit_glue::GetWebKitLocale to content.
Currently chrome code calls webkit_glue::GetWebKitLocale, which is just
a static callback into content. This exposes that callback out of
content directly to fix the dependency inversion.
It doesn't appear that anything in webkit_glue actually needs this function, so I'm a bit puzzled as to why it's here (except perhaps for pre-content legacy reasons).
R=jam@chromium.org
BUG=90442
TEST=none
Review URL: http://codereview.chromium.org/7917005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102030 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/render_thread.cc | 14 | ||||
-rw-r--r-- | content/renderer/render_thread.h | 3 | ||||
-rw-r--r-- | content/renderer/renderer_glue.cc | 13 | ||||
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 3 |
4 files changed, 18 insertions, 15 deletions
diff --git a/content/renderer/render_thread.cc b/content/renderer/render_thread.cc index db4d7b1..53332b9 100644 --- a/content/renderer/render_thread.cc +++ b/content/renderer/render_thread.cc @@ -65,6 +65,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" +#include "ui/base/ui_base_switches.h" #include "v8/include/v8.h" #include "webkit/extensions/v8/playback_extension.h" #include "webkit/glue/webkit_glue.h" @@ -256,6 +257,19 @@ RenderThread* RenderThread::current() { return lazy_tls.Pointer()->Get(); } +std::string RenderThread::GetLocale() { + // The browser process should have passed the locale to the renderer via the + // --lang command line flag. In single process mode, this will return the + // wrong value. TODO(tc): Fix this for single process mode. + const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); + const std::string& lang = + parsed_command_line.GetSwitchValueASCII(switches::kLang); + DCHECK(!lang.empty() || + (!parsed_command_line.HasSwitch(switches::kRendererProcess) && + !parsed_command_line.HasSwitch(switches::kPluginProcess))); + return lang; +} + int32 RenderThread::RoutingIDForCurrentContext() { int32 routing_id = MSG_ROUTING_CONTROL; if (v8::Context::InContext()) { diff --git a/content/renderer/render_thread.h b/content/renderer/render_thread.h index 8fb9e03..19863f0 100644 --- a/content/renderer/render_thread.h +++ b/content/renderer/render_thread.h @@ -141,6 +141,9 @@ class CONTENT_EXPORT RenderThread : public RenderThreadBase, // execution context (corresponding to WebFrame::frameForCurrentContext). static int32 RoutingIDForCurrentContext(); + // Returns the locale string to be used in WebKit. + static std::string GetLocale(); + // Overridden from RenderThreadBase. virtual bool Send(IPC::Message* msg); virtual void AddRoute(int32 routing_id, IPC::Channel::Listener* listener); diff --git a/content/renderer/renderer_glue.cc b/content/renderer/renderer_glue.cc index 0a92257..0bdb3d6 100644 --- a/content/renderer/renderer_glue.cc +++ b/content/renderer/renderer_glue.cc @@ -243,19 +243,6 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output, } #endif -std::string GetWebKitLocale() { - // The browser process should have passed the locale to the renderer via the - // --lang command line flag. In single process mode, this will return the - // wrong value. TODO(tc): Fix this for single process mode. - const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); - const std::string& lang = - parsed_command_line.GetSwitchValueASCII(switches::kLang); - DCHECK(!lang.empty() || - (!parsed_command_line.HasSwitch(switches::kRendererProcess) && - !parsed_command_line.HasSwitch(switches::kPluginProcess))); - return lang; -} - string16 GetLocalizedString(int message_id) { return content::GetContentClient()->GetLocalizedString(message_id); } diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index d5b6208..67ab3aa 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -258,8 +258,7 @@ void RendererWebKitPlatformSupportImpl::cacheMetadata( } WebString RendererWebKitPlatformSupportImpl::defaultLocale() { - // TODO(darin): Eliminate this webkit_glue call. - return ASCIIToUTF16(webkit_glue::GetWebKitLocale()); + return ASCIIToUTF16(RenderThread::GetLocale()); } void RendererWebKitPlatformSupportImpl::suddenTerminationChanged(bool enabled) { |