• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "ppapi/cpp/private/flash_font_file.h"
6 
7 #include "ppapi/c/dev/ppb_font_dev.h"
8 #include "ppapi/c/private/ppb_flash_font_file.h"
9 #include "ppapi/c/trusted/ppb_browser_font_trusted.h"
10 #include "ppapi/cpp/instance_handle.h"
11 #include "ppapi/cpp/module_impl.h"
12 
13 namespace pp {
14 
15 namespace {
16 
interface_name()17 template <> const char* interface_name<PPB_Flash_FontFile_0_1>() {
18   return PPB_FLASH_FONTFILE_INTERFACE_0_1;
19 }
20 
21 }  // namespace
22 
23 namespace flash {
24 
FontFile()25 FontFile::FontFile() {
26 }
27 
FontFile(const InstanceHandle & instance,const PP_BrowserFont_Trusted_Description * description,PP_PrivateFontCharset charset)28 FontFile::FontFile(const InstanceHandle& instance,
29                    const PP_BrowserFont_Trusted_Description* description,
30                    PP_PrivateFontCharset charset) {
31   if (has_interface<PPB_Flash_FontFile_0_1>()) {
32     PassRefFromConstructor(get_interface<PPB_Flash_FontFile_0_1>()->Create(
33         instance.pp_instance(), description, charset));
34   }
35 }
36 
~FontFile()37 FontFile::~FontFile() {
38 }
39 
40 // static
IsAvailable()41 bool FontFile::IsAvailable() {
42   return has_interface<PPB_Flash_FontFile_0_1>();
43 }
44 
GetFontTable(uint32_t table,void * output,uint32_t * output_length)45 bool FontFile::GetFontTable(uint32_t table,
46                             void* output,
47                             uint32_t* output_length) {
48   if (has_interface<PPB_Flash_FontFile_0_1>()) {
49     return !!get_interface<PPB_Flash_FontFile_0_1>()->
50         GetFontTable(pp_resource(), table, output, output_length);
51   }
52   return false;
53 }
54 
55 }  // namespace flash
56 }  // namespace pp
57