summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 22:15:51 +0000
committerraymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 22:15:51 +0000
commitc9be98ebf8f22fef9d9fc71f625aae5d73b0cd0c (patch)
tree02a4bcb19ce4e7145cd4876eae3b968266500c57 /ppapi
parent7dcce17ae227d749d7684784fd212789a686b28a (diff)
downloadchromium_src-c9be98ebf8f22fef9d9fc71f625aae5d73b0cd0c.zip
chromium_src-c9be98ebf8f22fef9d9fc71f625aae5d73b0cd0c.tar.gz
chromium_src-c9be98ebf8f22fef9d9fc71f625aae5d73b0cd0c.tar.bz2
Change PPB_PDF to use PP_BrowserFont_Trusted_Description instead of PP_FontDescription_Dev.
This also changes the ppb_pdf_thunk (which is only used for the out of process case) to call directly into PPB_Flash_Font_File for font-related functions. BUG= Review URL: https://codereview.chromium.org/12893016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/private/ppb_pdf.h2
-rw-r--r--ppapi/cpp/private/pdf.cc24
-rw-r--r--ppapi/cpp/private/pdf.h8
-rw-r--r--ppapi/ppapi_shared.gypi1
-rw-r--r--ppapi/thunk/ppb_pdf_thunk.cc24
5 files changed, 51 insertions, 8 deletions
diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h
index e9a6d78..553eea8 100644
--- a/ppapi/c/private/ppb_pdf.h
+++ b/ppapi/c/private/ppb_pdf.h
@@ -102,7 +102,7 @@ struct PPB_PDF {
// Currently Linux-only.
PP_Resource (*GetFontFileWithFallback)(
PP_Instance instance,
- const struct PP_FontDescription_Dev* description,
+ const struct PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset);
// Given a resource previously returned by GetFontFileWithFallback, returns
diff --git a/ppapi/cpp/private/pdf.cc b/ppapi/cpp/private/pdf.cc
index e61cefc..753613c 100644
--- a/ppapi/cpp/private/pdf.cc
+++ b/ppapi/cpp/private/pdf.cc
@@ -4,6 +4,7 @@
#include "ppapi/cpp/private/pdf.h"
+#include "ppapi/c/trusted/ppb_browser_font_trusted.h"
#include "ppapi/cpp/image_data.h"
#include "ppapi/cpp/instance_handle.h"
#include "ppapi/cpp/module_impl.h"
@@ -52,6 +53,29 @@ PP_Resource PDF::GetFontFileWithFallback(
const PP_FontDescription_Dev* description,
PP_PrivateFontCharset charset) {
if (has_interface<PPB_PDF>()) {
+ PP_BrowserFont_Trusted_Description converted_desc;
+ converted_desc.face = description->face;
+ converted_desc.family = static_cast<PP_BrowserFont_Trusted_Family>(
+ description->family);
+ converted_desc.size = description->size;
+ converted_desc.weight = static_cast<PP_BrowserFont_Trusted_Weight>(
+ description->weight);
+ converted_desc.italic = description->italic;
+ converted_desc.small_caps = description->small_caps;
+ converted_desc.letter_spacing = description->letter_spacing;
+ converted_desc.word_spacing = description->word_spacing;
+ return get_interface<PPB_PDF>()->GetFontFileWithFallback(
+ instance.pp_instance(), &converted_desc, charset);
+ }
+ return 0;
+}
+
+// static
+PP_Resource PDF::GetFontFileWithFallback(
+ const InstanceHandle& instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset) {
+ if (has_interface<PPB_PDF>()) {
return get_interface<PPB_PDF>()->GetFontFileWithFallback(
instance.pp_instance(), description, charset);
}
diff --git a/ppapi/cpp/private/pdf.h b/ppapi/cpp/private/pdf.h
index 570c0e7..893f9e3 100644
--- a/ppapi/cpp/private/pdf.h
+++ b/ppapi/cpp/private/pdf.h
@@ -9,6 +9,8 @@
#include "ppapi/c/private/ppb_pdf.h"
+struct PP_BrowserFont_Trusted_Description;
+
namespace pp {
class ImageData;
@@ -24,10 +26,16 @@ class PDF {
PP_ResourceString string_id);
static ImageData GetResourceImage(const InstanceHandle& instance,
PP_ResourceImage image_id);
+ // TODO(raymes): Remove this version when the PDF code is changed to use
+ // PP_BrowserFont_Trusted_Description.
static PP_Resource GetFontFileWithFallback(
const InstanceHandle& instance,
const PP_FontDescription_Dev* description,
PP_PrivateFontCharset charset);
+ static PP_Resource GetFontFileWithFallback(
+ const InstanceHandle& instance,
+ const PP_BrowserFont_Trusted_Description* description,
+ PP_PrivateFontCharset charset);
static bool GetFontTableForPrivateFontFile(PP_Resource font_file,
uint32_t table,
void* output,
diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi
index 3b81c00..0d0521a 100644
--- a/ppapi/ppapi_shared.gypi
+++ b/ppapi/ppapi_shared.gypi
@@ -292,6 +292,7 @@
'thunk/ppb_gles_chromium_texture_mapping_thunk.cc',
'thunk/ppb_graphics_3d_trusted_thunk.cc',
'thunk/ppb_image_data_trusted_thunk.cc',
+ 'thunk/ppb_pdf_thunk.cc',
'thunk/ppb_scrollbar_thunk.cc',
'thunk/ppb_talk_private_thunk.cc',
'thunk/ppb_transport_thunk.cc',
diff --git a/ppapi/thunk/ppb_pdf_thunk.cc b/ppapi/thunk/ppb_pdf_thunk.cc
index 4216a2b..1d018dc 100644
--- a/ppapi/thunk/ppb_pdf_thunk.cc
+++ b/ppapi/thunk/ppb_pdf_thunk.cc
@@ -6,7 +6,9 @@
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_flash_font_file_api.h"
#include "ppapi/thunk/ppb_pdf_api.h"
+#include "ppapi/thunk/resource_creation_api.h"
#include "ppapi/thunk/thunk.h"
namespace ppapi {
@@ -31,20 +33,28 @@ PP_Resource GetResourceImage(PP_Instance instance,
PP_Resource GetFontFileWithFallback(
PP_Instance instance,
- const PP_FontDescription_Dev* description,
+ const PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
- // Not implemented out-of-process.
- NOTIMPLEMENTED();
- return 0;
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResourceCreation enter(instance);
+ if (enter.failed())
+ return 0;
+ return enter.functions()->CreateFlashFontFile(instance, description, charset);
}
bool GetFontTableForPrivateFontFile(PP_Resource font_file,
uint32_t table,
void* output,
uint32_t* output_length) {
- // Not implemented out-of-process.
- NOTIMPLEMENTED();
- return false;
+ // TODO(raymes): Eventually we should replace the use of this function with
+ // either PPB_Flash_Font_File or PPB_TrueType_Font directly in the PDF code.
+ // For now just call into PPB_Flash_Font_File which has the exact same API.
+ EnterResource<PPB_Flash_FontFile_API> enter(font_file, true);
+ if (enter.failed())
+ return PP_FALSE;
+ return PP_ToBool(enter.object()->GetFontTable(table, output, output_length));
}
void SearchString(PP_Instance instance,