| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ | 5 #ifndef CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ |
| 6 #define CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ | 6 #define CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "cc/paint/paint_canvas.h" |
| 12 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
| 13 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
| 16 #include "ppapi/proxy/plugin_resource.h" | 17 #include "ppapi/proxy/plugin_resource.h" |
| 17 #include "ppapi/shared_impl/ppapi_preferences.h" | 18 #include "ppapi/shared_impl/ppapi_preferences.h" |
| 18 #include "ppapi/thunk/ppb_browser_font_trusted_api.h" | 19 #include "ppapi/thunk/ppb_browser_font_trusted_api.h" |
| 19 | 20 |
| 20 class SkCanvas; | |
| 21 | |
| 22 namespace blink { | 21 namespace blink { |
| 23 class WebFont; | 22 class WebFont; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 | 26 |
| 28 class BrowserFontResource_Trusted | 27 class BrowserFontResource_Trusted |
| 29 : public ppapi::proxy::PluginResource, | 28 : public ppapi::proxy::PluginResource, |
| 30 public ppapi::thunk::PPB_BrowserFont_Trusted_API { | 29 public ppapi::thunk::PPB_BrowserFont_Trusted_API { |
| 31 public: | 30 public: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 53 PP_Bool image_data_is_opaque) override; | 52 PP_Bool image_data_is_opaque) override; |
| 54 int32_t MeasureText(const PP_BrowserFont_Trusted_TextRun* text) override; | 53 int32_t MeasureText(const PP_BrowserFont_Trusted_TextRun* text) override; |
| 55 uint32_t CharacterOffsetForPixel(const PP_BrowserFont_Trusted_TextRun* text, | 54 uint32_t CharacterOffsetForPixel(const PP_BrowserFont_Trusted_TextRun* text, |
| 56 int32_t pixel_position) override; | 55 int32_t pixel_position) override; |
| 57 int32_t PixelOffsetForCharacter(const PP_BrowserFont_Trusted_TextRun* text, | 56 int32_t PixelOffsetForCharacter(const PP_BrowserFont_Trusted_TextRun* text, |
| 58 uint32_t char_offset) override; | 57 uint32_t char_offset) override; |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 ~BrowserFontResource_Trusted() override; | 60 ~BrowserFontResource_Trusted() override; |
| 62 | 61 |
| 63 // Internal version of DrawTextAt that takes a mapped PlatformCanvas. | 62 // Internal version of DrawTextAt that takes a mapped PaintCanvas. |
| 64 void DrawTextToCanvas(SkCanvas* destination, | 63 void DrawTextToCanvas(cc::PaintCanvas* destination, |
| 65 const PP_BrowserFont_Trusted_TextRun& text, | 64 const PP_BrowserFont_Trusted_TextRun& text, |
| 66 const PP_Point* position, | 65 const PP_Point* position, |
| 67 uint32_t color, | 66 uint32_t color, |
| 68 const PP_Rect* clip); | 67 const PP_Rect* clip); |
| 69 | 68 |
| 70 private: | 69 private: |
| 71 std::unique_ptr<blink::WebFont> font_; | 70 std::unique_ptr<blink::WebFont> font_; |
| 72 | 71 |
| 73 DISALLOW_COPY_AND_ASSIGN(BrowserFontResource_Trusted); | 72 DISALLOW_COPY_AND_ASSIGN(BrowserFontResource_Trusted); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace content | 75 } // namespace content |
| 77 | 76 |
| 78 #endif // CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ | 77 #endif // CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ |
| OLD | NEW |