| 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 PPAPI_SHARED_IMPL_PPB_FONT_SHARED_H_ | 5 #ifndef PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ |
| 6 #define PPAPI_SHARED_IMPL_PPB_FONT_SHARED_H_ | 6 #define PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
| 14 #include "ppapi/c/pp_instance.h" |
| 15 #include "ppapi/c/pp_resource.h" |
| 14 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 17 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 15 #include "ppapi/shared_impl/ppapi_shared_export.h" | 18 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 19 #include "ppapi/shared_impl/resource.h" |
| 20 #include "ppapi/shared_impl/webkit_forwarding.h" |
| 21 #include "ppapi/thunk/ppb_font_api.h" |
| 16 | 22 |
| 17 struct PP_FontDescription_Dev; | 23 struct PP_FontDescription_Dev; |
| 18 | 24 |
| 19 namespace ppapi { | 25 namespace ppapi { |
| 20 | 26 |
| 21 class PPAPI_SHARED_EXPORT PPB_Font_Shared { | 27 class PPAPI_SHARED_EXPORT PPB_Font_Shared |
| 28 : public ::ppapi::Resource, |
| 29 public ::ppapi::thunk::PPB_Font_API { |
| 22 public: | 30 public: |
| 23 // Validates the parameters in thee description. Can be called on any thread. | 31 // Validates the parameters in thee description. Can be called on any thread. |
| 24 static bool IsPPFontDescriptionValid(const PP_FontDescription_Dev& desc); | 32 static bool IsPPFontDescriptionValid(const PP_FontDescription_Dev& desc); |
| 25 | 33 |
| 34 virtual ~PPB_Font_Shared(); |
| 35 |
| 36 static PP_Resource CreateAsImpl(PP_Instance instance, |
| 37 const PP_FontDescription_Dev& description, |
| 38 const ::ppapi::Preferences& prefs); |
| 39 static PP_Resource CreateAsProxy(PP_Instance instance, |
| 40 const PP_FontDescription_Dev& description, |
| 41 const ::ppapi::Preferences& prefs); |
| 42 |
| 43 // Resource. |
| 44 virtual ::ppapi::thunk::PPB_Font_API* AsPPB_Font_API() OVERRIDE; |
| 45 |
| 46 // PPB_Font implementation. |
| 47 virtual PP_Bool Describe(PP_FontDescription_Dev* description, |
| 48 PP_FontMetrics_Dev* metrics) OVERRIDE; |
| 49 virtual PP_Bool DrawTextAt(PP_Resource image_data, |
| 50 const PP_TextRun_Dev* text, |
| 51 const PP_Point* position, |
| 52 uint32_t color, |
| 53 const PP_Rect* clip, |
| 54 PP_Bool image_data_is_opaque) OVERRIDE; |
| 55 virtual int32_t MeasureText(const PP_TextRun_Dev* text) OVERRIDE; |
| 56 virtual uint32_t CharacterOffsetForPixel(const PP_TextRun_Dev* text, |
| 57 int32_t pixel_position) OVERRIDE; |
| 58 virtual int32_t PixelOffsetForCharacter(const PP_TextRun_Dev* text, |
| 59 uint32_t char_offset) OVERRIDE; |
| 60 |
| 26 private: | 61 private: |
| 62 PPB_Font_Shared(PP_Instance instance, const PP_FontDescription_Dev& desc, |
| 63 const ::ppapi::Preferences& prefs); |
| 64 |
| 65 scoped_ptr< ::ppapi::WebKitForwarding::Font> font_impl_; |
| 66 |
| 27 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Shared); | 67 DISALLOW_COPY_AND_ASSIGN(PPB_Font_Shared); |
| 28 }; | 68 }; |
| 29 | 69 |
| 30 } // namespace ppapi | 70 } // namespace ppapi |
| 31 | 71 |
| 32 #endif // PPAPI_SHARED_IMPL_PPB_FONT_SHARED_H_ | 72 #endif // PPAPI_SHARED_IMPL_PRIVATE_PPB_FONT_SHARED_H_ |
| OLD | NEW |