| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_SHARED_IMPL_WEBKIT_FORWARDING_H_ | |
| 6 #define PPAPI_SHARED_IMPL_WEBKIT_FORWARDING_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "ppapi/c/pp_bool.h" | |
| 11 #include "ppapi/c/pp_stdint.h" | |
| 12 #include "ppapi/shared_impl/ppapi_shared_export.h" | |
| 13 | |
| 14 struct PP_FontDescription_Dev; | |
| 15 struct PP_FontMetrics_Dev; | |
| 16 struct PP_Point; | |
| 17 struct PP_Rect; | |
| 18 | |
| 19 namespace skia { | |
| 20 class PlatformCanvas; | |
| 21 } | |
| 22 | |
| 23 namespace ppapi { | |
| 24 | |
| 25 struct Preferences; | |
| 26 | |
| 27 class PPAPI_SHARED_EXPORT WebKitForwarding { | |
| 28 public: | |
| 29 class PPAPI_SHARED_EXPORT Font { | |
| 30 public: | |
| 31 // C++ version of PP_TextRun_Dev. Since the functions below will be called | |
| 32 // on an alternate thread in the proxy, and since there are different | |
| 33 // methods of converting PP_Var -> strings in the plugin and the proxy, we | |
| 34 // can't use PP_Vars in the Do* functions below. | |
| 35 struct TextRun { | |
| 36 std::string text; | |
| 37 bool rtl; | |
| 38 bool override_direction; | |
| 39 }; | |
| 40 | |
| 41 // DoDrawText takes too many arguments to be used with base::Bind, so we | |
| 42 // use this struct to hold them. | |
| 43 struct PPAPI_SHARED_EXPORT DrawTextParams { | |
| 44 DrawTextParams(skia::PlatformCanvas* destination_arg, | |
| 45 const TextRun& text_arg, | |
| 46 const PP_Point* position_arg, | |
| 47 uint32_t color_arg, | |
| 48 const PP_Rect* clip_arg, | |
| 49 PP_Bool image_data_is_opaque_arg); | |
| 50 ~DrawTextParams(); | |
| 51 | |
| 52 skia::PlatformCanvas* destination; | |
| 53 const TextRun& text; | |
| 54 const PP_Point* position; | |
| 55 uint32_t color; | |
| 56 const PP_Rect* clip; | |
| 57 PP_Bool image_data_is_opaque; | |
| 58 }; | |
| 59 | |
| 60 virtual ~Font(); | |
| 61 | |
| 62 // The face name in the description is not filled in to avoid a dependency | |
| 63 // on creating vars. Instead, the face name is placed into the given | |
| 64 // string. See class description for waitable_event documentation. If | |
| 65 // non-null, the given event will be set on completion. | |
| 66 virtual void Describe(PP_FontDescription_Dev* description, | |
| 67 std::string* face, | |
| 68 PP_FontMetrics_Dev* metrics, | |
| 69 PP_Bool* result) = 0; | |
| 70 virtual void DrawTextAt(const DrawTextParams& params) = 0; | |
| 71 virtual void MeasureText(const TextRun& text, | |
| 72 int32_t* result) = 0; | |
| 73 virtual void CharacterOffsetForPixel(const TextRun& text, | |
| 74 int32_t pixel_position, | |
| 75 uint32_t* result) = 0; | |
| 76 virtual void PixelOffsetForCharacter(const TextRun& text, | |
| 77 uint32_t char_offset, | |
| 78 int32_t* result) = 0; | |
| 79 }; | |
| 80 | |
| 81 virtual ~WebKitForwarding(); | |
| 82 }; | |
| 83 | |
| 84 } // namespace ppapi | |
| 85 | |
| 86 #endif // PPAPI_SHARED_IMPL_WEBKIT_FORWARDING_H_ | |
| OLD | NEW |