diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_plugin_module.cc | 4 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_private.cc | 38 | ||||
-rw-r--r-- | webkit/glue/plugins/pepper_private.h | 23 | ||||
-rw-r--r-- | webkit/glue/plugins/ppb_private.h | 21 | ||||
-rw-r--r-- | webkit/glue/webkit_glue.gypi | 3 | ||||
-rw-r--r-- | webkit/glue/webkit_strings.grd | 4 |
7 files changed, 93 insertions, 4 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 3fce4ad..8a4f58d 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8788,10 +8788,6 @@ Keep your key file in a safe place. You will need it to create new versions of y </message> </if> - <message name="IDS_PDF_NEED_PASSWORD" desc="A message asking the user for a password to open a PDF file."> - This document is password protected. Please enter a password. - </message> - <if expr="os == 'darwin'"> <message name="IDS_SELECT_FOLDER_BUTTON_TITLE" desc="The name of the Select button in the folder selection dialog."> Select diff --git a/webkit/glue/plugins/pepper_plugin_module.cc b/webkit/glue/plugins/pepper_plugin_module.cc index ff73f89..e748e56 100644 --- a/webkit/glue/plugins/pepper_plugin_module.cc +++ b/webkit/glue/plugins/pepper_plugin_module.cc @@ -43,6 +43,7 @@ #include "webkit/glue/plugins/pepper_font.h" #include "webkit/glue/plugins/pepper_image_data.h" #include "webkit/glue/plugins/pepper_plugin_instance.h" +#include "webkit/glue/plugins/pepper_private.h" #include "webkit/glue/plugins/pepper_resource_tracker.h" #include "webkit/glue/plugins/pepper_scrollbar.h" #include "webkit/glue/plugins/pepper_url_loader.h" @@ -50,6 +51,7 @@ #include "webkit/glue/plugins/pepper_url_response_info.h" #include "webkit/glue/plugins/pepper_var.h" #include "webkit/glue/plugins/pepper_widget.h" +#include "webkit/glue/plugins/ppb_private.h" namespace pepper { @@ -188,6 +190,8 @@ const void* GetInterface(const char* name) { return Font::GetInterface(); if (strcmp(name, PPB_FIND_INTERFACE) == 0) return PluginInstance::GetFindInterface(); + if (strcmp(name, PPB_PRIVATE_INTERFACE) == 0) + return Private::GetInterface(); // Only support the testing interface when the command line switch is // specified. This allows us to prevent people from (ab)using this interface diff --git a/webkit/glue/plugins/pepper_private.cc b/webkit/glue/plugins/pepper_private.cc new file mode 100644 index 0000000..579d1f4 --- /dev/null +++ b/webkit/glue/plugins/pepper_private.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2010 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. + +#include "build/build_config.h" + +#include "webkit/glue/plugins/pepper_private.h" + +#include "base/utf_string_conversions.h" +#include "grit/webkit_strings.h" +#include "webkit/glue/webkit_glue.h" +#include "webkit/glue/plugins/pepper_var.h" +#include "webkit/glue/plugins/ppb_private.h" + +namespace pepper { + +namespace { + +PP_Var GetLocalizedString(PP_ResourceString string_id) { + std::string rv; + if (string_id == PPB_RESOURCE_STRING_PDF_GET_PASSWORD) + rv = UTF16ToUTF8(webkit_glue::GetLocalizedString(IDS_PDF_NEED_PASSWORD)); + + return StringToPPVar(rv); +} + +const PPB_Private ppb_private = { + &GetLocalizedString, +}; + +} // namespace + +// static +const PPB_Private* Private::GetInterface() { + return &ppb_private; +} + +} // namespace pepper diff --git a/webkit/glue/plugins/pepper_private.h b/webkit/glue/plugins/pepper_private.h new file mode 100644 index 0000000..fda75a7 --- /dev/null +++ b/webkit/glue/plugins/pepper_private.h @@ -0,0 +1,23 @@ +// Copyright (c) 2010 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. + +#ifndef WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE_H_ +#define WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE_H_ + +#include "webkit/glue/plugins/pepper_resource.h" + +typedef struct _ppb_Private PPB_Private; + +namespace pepper { + +class Private { + public: + // Returns a pointer to the interface implementing PPB_Private that is exposed + // to the plugin. + static const PPB_Private* GetInterface(); +}; + +} // namespace pepper + +#endif // WEBKIT_GLUE_PLUGINS_PEPPER_PRIVATE_H_ diff --git a/webkit/glue/plugins/ppb_private.h b/webkit/glue/plugins/ppb_private.h new file mode 100644 index 0000000..e9adca1 --- /dev/null +++ b/webkit/glue/plugins/ppb_private.h @@ -0,0 +1,21 @@ +// Copyright (c) 2010 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. + +#ifndef WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ +#define WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ + +#include "ppapi/c/pp_var.h" + +#define PPB_PRIVATE_INTERFACE "PPB_Private;1" + +typedef enum _ppb_ResourceString { + PPB_RESOURCE_STRING_PDF_GET_PASSWORD = 0, +} PP_ResourceString; + +typedef struct _ppb_Private { + // Returns a localized string. + PP_Var (*GetLocalizedString)(PP_ResourceString string_id); +} PPB_Private; + +#endif // WEBKIT_GLUE_PLUGINS_PPB_PRIVATE_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index 3c4b3e3..72927bf 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -189,6 +189,8 @@ 'plugins/pepper_plugin_instance.h', 'plugins/pepper_plugin_module.cc', 'plugins/pepper_plugin_module.h', + 'plugins/pepper_private.cc', + 'plugins/pepper_private.h', 'plugins/pepper_resource_tracker.cc', 'plugins/pepper_resource_tracker.h', 'plugins/pepper_resource.cc', @@ -236,6 +238,7 @@ 'plugins/plugin_switches.h', 'plugins/plugin_web_event_converter_mac.h', 'plugins/plugin_web_event_converter_mac.mm', + 'plugins/ppb_private.h', 'plugins/quickdraw_drawing_manager_mac.h', 'plugins/quickdraw_drawing_manager_mac.cc', 'plugins/webplugin.cc', diff --git a/webkit/glue/webkit_strings.grd b/webkit/glue/webkit_strings.grd index 8b2c57d..cbb1c7f 100644 --- a/webkit/glue/webkit_strings.grd +++ b/webkit/glue/webkit_strings.grd @@ -355,6 +355,10 @@ below: <message name="IDS_DEFAULT_PLUGIN_INSTALLATION_FAILED_MSG" desc="Message displayed by the default plugin when installation is failed."> Plug-in installation failed </message> + + <message name="IDS_PDF_NEED_PASSWORD" desc="A message asking the user for a password to open a PDF file."> + This document is password protected. Please enter a password. + </message> </messages> </release> </grit> |