| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 BrowserFontResource_Trusted(ppapi::proxy::Connection connection, | 32 BrowserFontResource_Trusted(ppapi::proxy::Connection connection, |
| 33 PP_Instance instance, | 33 PP_Instance instance, |
| 34 const PP_BrowserFont_Trusted_Description& desc, | 34 const PP_BrowserFont_Trusted_Description& desc, |
| 35 const ppapi::Preferences& prefs); | 35 const ppapi::Preferences& prefs); |
| 36 | 36 |
| 37 // Validates the parameters in thee description. Can be called on any thread. | 37 // Validates the parameters in thee description. Can be called on any thread. |
| 38 static bool IsPPFontDescriptionValid( | 38 static bool IsPPFontDescriptionValid( |
| 39 const PP_BrowserFont_Trusted_Description& desc); | 39 const PP_BrowserFont_Trusted_Description& desc); |
| 40 | 40 |
| 41 // Resource override. | 41 // Resource override. |
| 42 virtual ::ppapi::thunk::PPB_BrowserFont_Trusted_API* | 42 ::ppapi::thunk::PPB_BrowserFont_Trusted_API* AsPPB_BrowserFont_Trusted_API() |
| 43 AsPPB_BrowserFont_Trusted_API() override; | 43 override; |
| 44 | 44 |
| 45 // PPB_BrowserFont_Trusted_API implementation. | 45 // PPB_BrowserFont_Trusted_API implementation. |
| 46 virtual PP_Bool Describe(PP_BrowserFont_Trusted_Description* description, | 46 PP_Bool Describe(PP_BrowserFont_Trusted_Description* description, |
| 47 PP_BrowserFont_Trusted_Metrics* metrics) override; | 47 PP_BrowserFont_Trusted_Metrics* metrics) override; |
| 48 virtual PP_Bool DrawTextAt(PP_Resource image_data, | 48 PP_Bool DrawTextAt(PP_Resource image_data, |
| 49 const PP_BrowserFont_Trusted_TextRun* text, | 49 const PP_BrowserFont_Trusted_TextRun* text, |
| 50 const PP_Point* position, | 50 const PP_Point* position, |
| 51 uint32_t color, | 51 uint32_t color, |
| 52 const PP_Rect* clip, | 52 const PP_Rect* clip, |
| 53 PP_Bool image_data_is_opaque) override; | 53 PP_Bool image_data_is_opaque) override; |
| 54 virtual int32_t MeasureText( | 54 int32_t MeasureText(const PP_BrowserFont_Trusted_TextRun* text) override; |
| 55 const PP_BrowserFont_Trusted_TextRun* text) override; | 55 uint32_t CharacterOffsetForPixel(const PP_BrowserFont_Trusted_TextRun* text, |
| 56 virtual uint32_t CharacterOffsetForPixel( | 56 int32_t pixel_position) override; |
| 57 const PP_BrowserFont_Trusted_TextRun* text, | 57 int32_t PixelOffsetForCharacter(const PP_BrowserFont_Trusted_TextRun* text, |
| 58 int32_t pixel_position) override; | 58 uint32_t char_offset) override; |
| 59 virtual int32_t PixelOffsetForCharacter( | |
| 60 const PP_BrowserFont_Trusted_TextRun* text, | |
| 61 uint32_t char_offset) override; | |
| 62 | 59 |
| 63 private: | 60 private: |
| 64 virtual ~BrowserFontResource_Trusted(); | 61 ~BrowserFontResource_Trusted() override; |
| 65 | 62 |
| 66 // Internal version of DrawTextAt that takes a mapped PlatformCanvas. | 63 // Internal version of DrawTextAt that takes a mapped PlatformCanvas. |
| 67 void DrawTextToCanvas(SkCanvas* destination, | 64 void DrawTextToCanvas(SkCanvas* destination, |
| 68 const PP_BrowserFont_Trusted_TextRun& text, | 65 const PP_BrowserFont_Trusted_TextRun& text, |
| 69 const PP_Point* position, | 66 const PP_Point* position, |
| 70 uint32_t color, | 67 uint32_t color, |
| 71 const PP_Rect* clip, | 68 const PP_Rect* clip, |
| 72 PP_Bool image_data_is_opaque); | 69 PP_Bool image_data_is_opaque); |
| 73 | 70 |
| 74 private: | 71 private: |
| 75 scoped_ptr<blink::WebFont> font_; | 72 scoped_ptr<blink::WebFont> font_; |
| 76 | 73 |
| 77 DISALLOW_COPY_AND_ASSIGN(BrowserFontResource_Trusted); | 74 DISALLOW_COPY_AND_ASSIGN(BrowserFontResource_Trusted); |
| 78 }; | 75 }; |
| 79 | 76 |
| 80 } // namespace content | 77 } // namespace content |
| 81 | 78 |
| 82 #endif // CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ | 79 #endif // CONTENT_CHILD_BROWSER_FONT_RESOURCE_TRUSTED_H_ |
| OLD | NEW |