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