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/function_group_base.h" |
| 12 #include "ppapi/shared_impl/resource.h" |
11 #include "ppapi/shared_impl/webkit_forwarding.h" | 13 #include "ppapi/shared_impl/webkit_forwarding.h" |
12 #include "ppapi/thunk/ppb_font_api.h" | 14 #include "ppapi/thunk/ppb_font_api.h" |
13 #include "webkit/plugins/ppapi/resource.h" | |
14 | 15 |
15 namespace WebKit { | 16 namespace WebKit { |
16 class WebFont; | 17 class WebFont; |
17 } | 18 } |
18 | 19 |
19 namespace webkit { | 20 namespace webkit { |
20 namespace ppapi { | 21 namespace ppapi { |
21 | 22 |
22 class PluginInstance; | 23 class PluginInstance; |
23 | 24 |
24 class PPB_Font_Impl : public Resource, | 25 class PPB_Font_Impl : public ::ppapi::Resource, |
25 public ::ppapi::thunk::PPB_Font_API { | 26 public ::ppapi::thunk::PPB_Font_API { |
26 public: | 27 public: |
27 virtual ~PPB_Font_Impl(); | 28 virtual ~PPB_Font_Impl(); |
28 | 29 |
29 static PP_Resource Create(PluginInstance* instance, | 30 static PP_Resource Create(PP_Instance instance, |
30 const PP_FontDescription_Dev& description); | 31 const PP_FontDescription_Dev& description); |
31 | 32 |
32 // Resource. | 33 // Resource. |
33 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; | 34 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; |
34 | 35 |
35 // PPB_Font implementation. | 36 // PPB_Font implementation. |
36 virtual PP_Bool Describe(PP_FontDescription_Dev* description, | 37 virtual PP_Bool Describe(PP_FontDescription_Dev* description, |
37 PP_FontMetrics_Dev* metrics) OVERRIDE; | 38 PP_FontMetrics_Dev* metrics) OVERRIDE; |
38 virtual PP_Bool DrawTextAt(PP_Resource image_data, | 39 virtual PP_Bool DrawTextAt(PP_Resource image_data, |
39 const PP_TextRun_Dev* text, | 40 const PP_TextRun_Dev* text, |
40 const PP_Point* position, | 41 const PP_Point* position, |
41 uint32_t color, | 42 uint32_t color, |
42 const PP_Rect* clip, | 43 const PP_Rect* clip, |
43 PP_Bool image_data_is_opaque) OVERRIDE; | 44 PP_Bool image_data_is_opaque) OVERRIDE; |
44 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; | 45 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; |
45 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, | 46 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, |
46 int32_t pixel_position) OVERRIDE; | 47 int32_t pixel_position) OVERRIDE; |
47 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, | 48 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, |
48 uint32_t char_offset) OVERRIDE; | 49 uint32_t char_offset) OVERRIDE; |
49 | 50 |
50 private: | 51 private: |
51 PPB_Font_Impl(PluginInstance* instance, const PP_FontDescription_Dev& desc); | 52 PPB_Font_Impl(PP_Instance instance, const PP_FontDescription_Dev& desc); |
52 | 53 |
53 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_forwarding_; | 54 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_forwarding_; |
54 | 55 |
55 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); | 56 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Impl); |
56 }; | 57 }; |
57 | 58 |
58 class PPB_Font_FunctionImpl : public ::ppapi::FunctionGroupBase, | 59 class PPB_Font_FunctionImpl : public ::ppapi::FunctionGroupBase, |
59 public ::ppapi::thunk::PPB_Font_FunctionAPI { | 60 public ::ppapi::thunk::PPB_Font_FunctionAPI { |
60 public: | 61 public: |
61 PPB_Font_FunctionImpl(PluginInstance* instance); | 62 PPB_Font_FunctionImpl(PluginInstance* instance); |
62 virtual ~PPB_Font_FunctionImpl(); | 63 virtual ~PPB_Font_FunctionImpl(); |
63 | 64 |
64 // FunctionGroupBase overrides. | 65 // FunctionGroupBase overrides. |
65 virtual ::ppapi::thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI(); | 66 virtual ::ppapi::thunk::PPB_Font_FunctionAPI* AsFont_FunctionAPI(); |
66 | 67 |
67 // PPB_Font_FunctionAPI implementation. | 68 // PPB_Font_FunctionAPI implementation. |
68 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; | 69 virtual PP_Var GetFontFamilies(PP_Instance instance) OVERRIDE; |
69 | 70 |
70 private: | 71 private: |
71 PluginInstance* instance_; | 72 PluginInstance* instance_; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(PPB_Font_FunctionImpl); | 74 DISALLOW_COPY_AND_ASSIGN(PPB_Font_FunctionImpl); |
74 }; | 75 }; |
75 | 76 |
76 } // namespace ppapi | 77 } // namespace ppapi |
77 } // namespace webkit | 78 } // namespace webkit |
78 | 79 |
79 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ | 80 #endif // WEBKIT_PLUGINS_PPAPI_PPB_FONT_IMPL_H_ |
OLD | NEW |