| 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/memory/scoped_ptr.h" |
| 10 #include "ppapi/c/dev/ppb_font_dev.h" | 10 #include "ppapi/c/dev/ppb_font_dev.h" |
| 11 #include "ppapi/shared_impl/webkit_forwarding.h" |
| 12 #include "ppapi/thunk/ppb_font_api.h" |
| 11 #include "webkit/plugins/ppapi/resource.h" | 13 #include "webkit/plugins/ppapi/resource.h" |
| 12 | 14 |
| 13 namespace WebKit { | 15 namespace WebKit { |
| 14 class WebFont; | 16 class WebFont; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace webkit { | 19 namespace webkit { |
| 18 namespace ppapi { | 20 namespace ppapi { |
| 19 | 21 |
| 20 class PluginInstance; | 22 class PluginInstance; |
| 21 | 23 |
| 22 class PPB_Font_Impl : public Resource { | 24 class PPB_Font_Impl : public Resource, |
| 25 public ::ppapi::thunk::PPB_Font_API { |
| 23 public: | 26 public: |
| 24 PPB_Font_Impl(PluginInstance* instance, const PP_FontDescription_Dev& desc); | 27 PPB_Font_Impl(PluginInstance* instance, const PP_FontDescription_Dev& desc); |
| 25 virtual ~PPB_Font_Impl(); | 28 virtual ~PPB_Font_Impl(); |
| 26 | 29 |
| 27 // Returns a pointer to the interface implementing PPB_Font that is exposed to | 30 // Returns a pointer to the interface implementing PPB_Font that is exposed to |
| 28 // the plugin. | 31 // the plugin. |
| 29 static const PPB_Font_Dev* GetInterface(); | 32 static const PPB_Font_Dev* GetInterface(); |
| 30 | 33 |
| 34 // ResourceObjectBase. |
| 35 virtual ::ppapi::thunk::PPB_Font_API* AsFont_API() OVERRIDE; |
| 36 |
| 31 // Resource overrides. | 37 // Resource overrides. |
| 32 virtual PPB_Font_Impl* AsPPB_Font_Impl(); | 38 virtual PPB_Font_Impl* AsPPB_Font_Impl() OVERRIDE; |
| 33 | 39 |
| 34 // PPB_Font implementation. | 40 // PPB_Font implementation. |
| 35 bool Describe(PP_FontDescription_Dev* description, | 41 PP_Bool Describe(PP_FontDescription_Dev* description, |
| 36 PP_FontMetrics_Dev* metrics); | 42 PP_FontMetrics_Dev* metrics) OVERRIDE; |
| 37 bool DrawTextAt(PP_Resource image_data, | 43 PP_Bool DrawTextAt(PP_Resource image_data, |
| 38 const PP_TextRun_Dev* text, | 44 const PP_TextRun_Dev* text, |
| 39 const PP_Point* position, | 45 const PP_Point* position, |
| 40 uint32_t color, | 46 uint32_t color, |
| 41 const PP_Rect* clip, | 47 const PP_Rect* clip, |
| 42 bool image_data_is_opaque); | 48 PP_Bool image_data_is_opaque) OVERRIDE; |
| 43 int32_t MeasureText(const PP_TextRun_Dev* text); | 49 int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; |
| 44 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, | 50 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, |
| 45 int32_t pixel_position); | 51 int32_t pixel_position) OVERRIDE; |
| 46 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, | 52 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, |
| 47 uint32_t char_offset); | 53 uint32_t char_offset) OVERRIDE; |
| 48 | 54 |
| 49 private: | 55 private: |
| 50 scoped_ptr<WebKit::WebFont> font_; | 56 scoped_ptr<pp::shared_impl::WebKitForwarding::Font> font_forwarding_; |
| 51 | 57 |
| 52 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); | 58 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); |
| 53 }; | 59 }; |
| 54 | 60 |
| 55 } // namespace ppapi | 61 } // namespace ppapi |
| 56 } // namespace webkit | 62 } // namespace webkit |
| 57 | 63 |
| 58 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ | 64 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| OLD | NEW |