| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_GLUE_PLUGINS_PEPPER_FONT_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| 6 #define WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" |
| 8 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 9 #include "ppapi/c/dev/ppb_font_dev.h" | 10 #include "ppapi/c/dev/ppb_font_dev.h" |
| 10 #include "webkit/glue/plugins/pepper_resource.h" | 11 #include "webkit/plugins/ppapi/resource.h" |
| 11 | 12 |
| 12 namespace WebKit { | 13 namespace WebKit { |
| 13 class WebFont; | 14 class WebFont; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace pepper { | 17 namespace webkit { |
| 18 namespace plugins { |
| 19 namespace ppapi { |
| 17 | 20 |
| 18 class PluginInstance; | 21 class PluginInstance; |
| 19 | 22 |
| 20 class Font : public Resource { | 23 class PPB_Font_Impl : public Resource { |
| 21 public: | 24 public: |
| 22 Font(PluginModule* module, const PP_FontDescription_Dev& desc); | 25 PPB_Font_Impl(PluginModule* module, const PP_FontDescription_Dev& desc); |
| 23 virtual ~Font(); | 26 virtual ~PPB_Font_Impl(); |
| 24 | 27 |
| 25 // Returns a pointer to the interface implementing PPB_Font that is exposed to | 28 // Returns a pointer to the interface implementing PPB_Font that is exposed to |
| 26 // the plugin. | 29 // the plugin. |
| 27 static const PPB_Font_Dev* GetInterface(); | 30 static const PPB_Font_Dev* GetInterface(); |
| 28 | 31 |
| 29 // Resource overrides. | 32 // Resource overrides. |
| 30 virtual Font* AsFont(); | 33 virtual PPB_Font_Impl* AsFont(); |
| 31 | 34 |
| 32 // PPB_Font implementation. | 35 // PPB_Font implementation. |
| 33 bool Describe(PP_FontDescription_Dev* description, | 36 bool Describe(PP_FontDescription_Dev* description, |
| 34 PP_FontMetrics_Dev* metrics); | 37 PP_FontMetrics_Dev* metrics); |
| 35 bool DrawTextAt(PP_Resource image_data, | 38 bool DrawTextAt(PP_Resource image_data, |
| 36 const PP_TextRun_Dev* text, | 39 const PP_TextRun_Dev* text, |
| 37 const PP_Point* position, | 40 const PP_Point* position, |
| 38 uint32_t color, | 41 uint32_t color, |
| 39 const PP_Rect* clip, | 42 const PP_Rect* clip, |
| 40 bool image_data_is_opaque); | 43 bool image_data_is_opaque); |
| 41 int32_t MeasureText(const PP_TextRun_Dev* text); | 44 int32_t MeasureText(const PP_TextRun_Dev* text); |
| 42 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, | 45 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, |
| 43 int32_t pixel_position); | 46 int32_t pixel_position); |
| 44 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, | 47 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, |
| 45 uint32_t char_offset); | 48 uint32_t char_offset); |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 scoped_ptr<WebKit::WebFont> font_; | 51 scoped_ptr<WebKit::WebFont> font_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); |
| 49 }; | 54 }; |
| 50 | 55 |
| 51 } // namespace pepper | 56 } // namespace ppapi |
| 57 } // namespace plugins |
| 58 } // namespace webkit |
| 52 | 59 |
| 53 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 60 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
| OLD | NEW |