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

Unified Diff: content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc

Issue 13913006: Add Pepper TrueType font API call to enumerate fonts in a given family. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows build. Created 7 years, 8 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: content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc
diff --git a/content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc b/content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc
index e3a74d94b7d9131babbad4c4c7fe954aa74de548..1b2aa668f043a2d5264541160e20caab041a68e9 100644
--- a/content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc
+++ b/content/browser/renderer_host/pepper/pepper_truetype_font_list_host.cc
@@ -36,8 +36,10 @@ class FontMessageFilter : public ppapi::host::ResourceMessageFilter {
private:
virtual ~FontMessageFilter();
- // Message handler.
+ // Message handlers.
int32_t OnHostMsgGetFontFamilies(ppapi::host::HostMessageContext* context);
+ int32_t OnHostMsgGetFontsInFamily(ppapi::host::HostMessageContext* context,
+ const std::string& family);
DISALLOW_COPY_AND_ASSIGN(FontMessageFilter);
};
@@ -65,6 +67,9 @@ int32_t FontMessageFilter::OnResourceMessageReceived(
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
PpapiHostMsg_TrueTypeFontSingleton_GetFontFamilies,
OnHostMsgGetFontFamilies)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(
+ PpapiHostMsg_TrueTypeFontSingleton_GetFontsInFamily,
+ OnHostMsgGetFontsInFamily)
IPC_END_MESSAGE_MAP()
return PP_ERROR_FAILED;
}
@@ -86,6 +91,23 @@ int32_t FontMessageFilter::OnHostMsgGetFontFamilies(
return result;
}
+int32_t FontMessageFilter::OnHostMsgGetFontsInFamily(
+ ppapi::host::HostMessageContext* context,
+ const std::string& family) {
+ // OK to use "slow blocking" version since we're on the blocking pool.
+ std::vector<ppapi::proxy::SerializedTrueTypeFontDesc> fonts_in_family;
+ GetFontsInFamily_SlowBlocking(family, &fonts_in_family);
+
+ int32_t result = base::checked_numeric_cast<int32_t>(fonts_in_family.size());
+ ppapi::host::ReplyMessageContext reply_context =
+ context->MakeReplyMessageContext();
+ reply_context.params.set_result(result);
+ context->reply_msg =
+ PpapiPluginMsg_TrueTypeFontSingleton_GetFontsInFamilyReply(
+ fonts_in_family);
+ return result;
+}
+
} // namespace
PepperTrueTypeFontListHost::PepperTrueTypeFontListHost(

Powered by Google App Engine
This is Rietveld 408576698