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 ppapi { |
17 | 19 |
18 class PluginInstance; | 20 class PluginInstance; |
19 | 21 |
20 class Font : public Resource { | 22 class PPB_Font_Impl : public Resource { |
21 public: | 23 public: |
22 Font(PluginModule* module, const PP_FontDescription_Dev& desc); | 24 PPB_Font_Impl(PluginModule* module, const PP_FontDescription_Dev& desc); |
23 virtual ~Font(); | 25 virtual ~PPB_Font_Impl(); |
24 | 26 |
25 // Returns a pointer to the interface implementing PPB_Font that is exposed to | 27 // Returns a pointer to the interface implementing PPB_Font that is exposed to |
26 // the plugin. | 28 // the plugin. |
27 static const PPB_Font_Dev* GetInterface(); | 29 static const PPB_Font_Dev* GetInterface(); |
28 | 30 |
29 // Resource overrides. | 31 // Resource overrides. |
30 virtual Font* AsFont(); | 32 virtual PPB_Font_Impl* AsPPB_Font_Impl(); |
31 | 33 |
32 // PPB_Font implementation. | 34 // PPB_Font implementation. |
33 bool Describe(PP_FontDescription_Dev* description, | 35 bool Describe(PP_FontDescription_Dev* description, |
34 PP_FontMetrics_Dev* metrics); | 36 PP_FontMetrics_Dev* metrics); |
35 bool DrawTextAt(PP_Resource image_data, | 37 bool DrawTextAt(PP_Resource image_data, |
36 const PP_TextRun_Dev* text, | 38 const PP_TextRun_Dev* text, |
37 const PP_Point* position, | 39 const PP_Point* position, |
38 uint32_t color, | 40 uint32_t color, |
39 const PP_Rect* clip, | 41 const PP_Rect* clip, |
40 bool image_data_is_opaque); | 42 bool image_data_is_opaque); |
41 int32_t MeasureText(const PP_TextRun_Dev* text); | 43 int32_t MeasureText(const PP_TextRun_Dev* text); |
42 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, | 44 uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, |
43 int32_t pixel_position); | 45 int32_t pixel_position); |
44 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, | 46 int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, |
45 uint32_t char_offset); | 47 uint32_t char_offset); |
46 | 48 |
47 private: | 49 private: |
48 scoped_ptr<WebKit::WebFont> font_; | 50 scoped_ptr<WebKit::WebFont> font_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); |
49 }; | 53 }; |
50 | 54 |
51 } // namespace pepper | 55 } // namespace ppapi |
| 56 } // namespace webkit |
52 | 57 |
53 #endif // WEBKIT_GLUE_PLUGINS_PEPPER_FONT_H_ | 58 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
OLD | NEW |