| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ppapi/c/dev/ppb_font_dev.h" | 10 #include "ppapi/c/pp_instance.h" |
| 11 #include "ppapi/shared_impl/function_group_base.h" | 11 #include "ppapi/shared_impl/function_group_base.h" |
| 12 #include "ppapi/shared_impl/resource.h" | |
| 13 #include "ppapi/shared_impl/webkit_forwarding.h" | |
| 14 #include "ppapi/thunk/ppb_font_api.h" | 12 #include "ppapi/thunk/ppb_font_api.h" |
| 15 | 13 |
| 16 namespace webkit { | 14 namespace webkit { |
| 17 namespace ppapi { | 15 namespace ppapi { |
| 18 | 16 |
| 19 class PluginInstance; | 17 class PluginInstance; |
| 20 | 18 |
| 21 class PPB_Font_Impl : public ::ppapi::Resource, | |
| 22 public ::ppapi::thunk::PPB_Font_API { | |
| 23 public: | |
| 24 virtual ~PPB_Font_Impl(); | |
| 25 | |
| 26 static PP_Resource Create(PP_Instance instance, | |
| 27 const PP_FontDescription_Dev& description); | |
| 28 | |
| 29 // Resource. | |
| 30 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; | |
| 31 | |
| 32 // PPB_Font implementation. | |
| 33 virtual PP_Bool Describe(PP_FontDescription_Dev* description, | |
| 34 PP_FontMetrics_Dev* metrics) OVERRIDE; | |
| 35 virtual PP_Bool DrawTextAt(PP_Resource image_data, | |
| 36 const PP_TextRun_Dev* text, | |
| 37 const PP_Point* position, | |
| 38 uint32_t color, | |
| 39 const PP_Rect* clip, | |
| 40 PP_Bool image_data_is_opaque) OVERRIDE; | |
| 41 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; | |
| 42 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, | |
| 43 int32_t pixel_position) OVERRIDE; | |
| 44 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, | |
| 45 uint32_t char_offset) OVERRIDE; | |
| 46 | |
| 47 private: | |
| 48 PPB_Font_Impl(PP_Instance instance, const PP_FontDescription_Dev& desc); | |
| 49 | |
| 50 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_forwarding_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); | |
| 53 }; | |
| 54 | |
| 55 class PPB_Font_FunctionImpl : public ::ppapi::FunctionGroupBase, | 19 class PPB_Font_FunctionImpl : public ::ppapi::FunctionGroupBase, |
| 56 public ::ppapi::thunk::PPB_Font_FunctionAPI { | 20 public ::ppapi::thunk::PPB_Font_FunctionAPI { |
| 57 public: | 21 public: |
| 58 explicit PPB_Font_FunctionImpl(PluginInstance* instance); | 22 explicit PPB_Font_FunctionImpl(PluginInstance* instance); |
| 59 virtual ~PPB_Font_FunctionImpl(); | 23 virtual ~PPB_Font_FunctionImpl(); |
| 60 | 24 |
| 61 // FunctionGroupBase overrides. | 25 // FunctionGroupBase overrides. |
| 62 virtual ::ppapi::thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI(); | 26 virtual ::ppapi::thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI(); |
| 63 | 27 |
| 64 // PPB_Font_FunctionAPI implementation. | 28 // PPB_Font_FunctionAPI implementation. |
| 65 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; | 29 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; |
| 66 | 30 |
| 67 private: | 31 private: |
| 68 PluginInstance* instance_; | 32 PluginInstance* instance_; |
| 69 | 33 |
| 70 DISALLOW_COPY_AND_ASSIGN(PPB_Font_FunctionImpl); | 34 DISALLOW_COPY_AND_ASSIGN(PPB_Font_FunctionImpl); |
| 71 }; | 35 }; |
| 72 | 36 |
| 73 } // namespace ppapi | 37 } // namespace ppapi |
| 74 } // namespace webkit | 38 |
| 39 } // namespace webkit. |
| 75 | 40 |
| 76 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ | 41 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| OLD | NEW |