diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 15:38:33 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-23 15:38:33 +0000 |
commit | ef7511d1b5cfa9645970a16ff5636827121f15b8 (patch) | |
tree | 08218a5a05c2c53787e9bca3457bd969987b933d | |
parent | a17710f5cf04f0c6505fba73e58e668c71f8c2fa (diff) | |
download | chromium_src-ef7511d1b5cfa9645970a16ff5636827121f15b8.zip chromium_src-ef7511d1b5cfa9645970a16ff5636827121f15b8.tar.gz chromium_src-ef7511d1b5cfa9645970a16ff5636827121f15b8.tar.bz2 |
Implement GetDefaultCharSet for Pepper and pull the corresponding PPAPI change.
BUG=52865
TEST=none
Review URL: http://codereview.chromium.org/3432021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60292 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.cc | 8 | ||||
-rw-r--r-- | chrome/renderer/pepper_plugin_delegate_impl.h | 2 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_char_set.cc | 17 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_delegate.h | 5 |
5 files changed, 29 insertions, 5 deletions
@@ -167,7 +167,7 @@ deps = { Var("libvpx_revision"), "src/third_party/ppapi": - (Var("googlecode_url") % "ppapi") + "/trunk@259", + (Var("googlecode_url") % "ppapi") + "/trunk@261", "src/third_party/libjingle/source": (Var("googlecode_url") % "libjingle") + "/branches/nextsnap@" + diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc index 511b284..3a866af 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.cc +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc @@ -4,6 +4,7 @@ #include "chrome/renderer/pepper_plugin_delegate_impl.h" +#include "app/l10n_util.h" #include "app/surface/transport_dib.h" #include "base/file_path.h" #include "base/logging.h" @@ -16,6 +17,7 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" #include "chrome/renderer/webplugin_delegate_proxy.h" +#include "grit/locale_settings.h" #include "third_party/ppapi/c/dev/pp_video_dev.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" @@ -647,3 +649,9 @@ PepperPluginDelegateImpl::CreateFullscreenContainer( pepper::PluginInstance* instance) { return render_view_->CreatePepperFullscreenContainer(instance); } + +std::string PepperPluginDelegateImpl::GetDefaultEncoding() { + // TODO(brettw) bug 56615: Somehow get the preference for the default + // encoding here rather than using the global default for the UI language. + return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING); +} diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h index 180ce43..19f08b1c 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.h +++ b/chrome/renderer/pepper_plugin_delegate_impl.h @@ -7,6 +7,7 @@ #pragma once #include <set> +#include <string> #include "base/basictypes.h" #include "base/id_map.h" @@ -69,6 +70,7 @@ class PepperPluginDelegateImpl virtual scoped_refptr<base::MessageLoopProxy> GetFileThreadMessageLoopProxy(); virtual pepper::FullscreenContainer* CreateFullscreenContainer( pepper::PluginInstance* instance); + virtual std::string GetDefaultEncoding(); private: // Pointer to the RenderView that owns us. diff --git a/webkit/glue/plugins/pepper_char_set.cc b/webkit/glue/plugins/pepper_char_set.cc index 3e6a0b2..1e5fc0a 100644 --- a/webkit/glue/plugins/pepper_char_set.cc +++ b/webkit/glue/plugins/pepper_char_set.cc @@ -12,6 +12,10 @@ #include "unicode/ucnv_cb.h" #include "unicode/ucnv_err.h" #include "unicode/ustring.h" +#include "webkit/glue/plugins/pepper_plugin_delegate.h" +#include "webkit/glue/plugins/pepper_plugin_instance.h" +#include "webkit/glue/plugins/pepper_plugin_module.h" +#include "webkit/glue/plugins/pepper_var.h" namespace pepper { @@ -136,15 +140,20 @@ uint16_t* CharSetToUTF16(const char* input, uint32_t input_len, return ret_buf; } -PP_Var GetDefaultCodePageForUILanguage() { - // TODO(brettw) bug 52865: Implement this function. - return PP_MakeVoid(); +PP_Var GetDefaultCharSet(PP_Module pp_module) { + PluginModule* module = PluginModule::FromPPModule(pp_module); + if (!module) + return PP_MakeVoid(); + + std::string encoding = + module->GetSomeInstance()->delegate()->GetDefaultEncoding(); + return StringVar::StringToPPVar(module, encoding); } const PPB_CharSet_Dev ppb_charset = { &UTF16ToCharSet, &CharSetToUTF16, - &GetDefaultCodePageForUILanguage + &GetDefaultCharSet }; } // namespace diff --git a/webkit/glue/plugins/pepper_plugin_delegate.h b/webkit/glue/plugins/pepper_plugin_delegate.h index 3393ba0..d650fa9 100644 --- a/webkit/glue/plugins/pepper_plugin_delegate.h +++ b/webkit/glue/plugins/pepper_plugin_delegate.h @@ -5,6 +5,8 @@ #ifndef WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_DELEGATE_H_ #define WEBKIT_GLUE_PLUGINS_PEPPER_PLUGIN_DELEGATE_H_ +#include <string> + #include "base/callback.h" #include "base/platform_file.h" #include "base/ref_counted.h" @@ -173,6 +175,9 @@ class PluginDelegate { // switches the plugin to fullscreen. virtual FullscreenContainer* CreateFullscreenContainer( PluginInstance* instance) = 0; + + // Returns a string with the name of the default 8-bit char encoding. + virtual std::string GetDefaultEncoding() = 0; }; } // namespace pepper |