Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Unified Diff: ppapi/cpp/private/flash_font_file.cc

Issue 1416643002: Enable pp::flash::FontFile support on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Based generated thunk files Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/private/flash_font_file.cc
diff --git a/ppapi/cpp/private/flash_font_file.cc b/ppapi/cpp/private/flash_font_file.cc
index df11f57d741c7dec9403a1a1cf9d0b2609c773eb..26b33a9d3ad4a6ea15fccd48ecf2d9de095be24c 100644
--- a/ppapi/cpp/private/flash_font_file.cc
+++ b/ppapi/cpp/private/flash_font_file.cc
@@ -18,6 +18,10 @@ template <> const char* interface_name<PPB_Flash_FontFile_0_1>() {
return PPB_FLASH_FONTFILE_INTERFACE_0_1;
}
+template <> const char* interface_name<PPB_Flash_FontFile_0_2>() {
+ return PPB_FLASH_FONTFILE_INTERFACE_0_2;
+}
+
} // namespace
namespace flash {
@@ -28,7 +32,11 @@ FontFile::FontFile() {
FontFile::FontFile(const InstanceHandle& instance,
const PP_BrowserFont_Trusted_Description* description,
PP_PrivateFontCharset charset) {
- if (has_interface<PPB_Flash_FontFile_0_1>()) {
+ if (has_interface<PPB_Flash_FontFile_0_2>()) {
+ PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_2>()->Create(
+ instance.pp_instance(), description, charset));
+ }
+ else if (has_interface<PPB_Flash_FontFile_0_1>()) {
PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_1>()->Create(
instance.pp_instance(), description, charset));
}
@@ -39,13 +47,24 @@ FontFile::~FontFile() {
// static
bool FontFile::IsAvailable() {
- return has_interface<PPB_Flash_FontFile_0_1>();
+ return (has_interface<PPB_Flash_FontFile_0_2>() ||
+ has_interface<PPB_Flash_FontFile_0_1>());
+}
+
+bool FontFile::IsSupportedForWindows() {
+ if (has_interface<PPB_Flash_FontFile_0_2>())
+ return !!get_interface<PPB_Flash_FontFile_0_2>()->IsSupportedForWindows();
+ return false;
}
bool FontFile::GetFontTable(uint32_t table,
void* output,
uint32_t* output_length) {
- if (has_interface<PPB_Flash_FontFile_0_1>()) {
+ if (has_interface<PPB_Flash_FontFile_0_2>()) {
+ return !!get_interface<PPB_Flash_FontFile_0_2>()->
+ GetFontTable(pp_resource(), table, output, output_length);
+ }
+ else if (has_interface<PPB_Flash_FontFile_0_1>()) {
return !!get_interface<PPB_Flash_FontFile_0_1>()->
GetFontTable(pp_resource(), table, output, output_length);
}

Powered by Google App Engine
This is Rietveld 408576698