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 #include "ppapi/proxy/ppb_font_proxy.h" | 5 #include "ppapi/proxy/ppb_font_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ppapi/c/dev/ppb_font_dev.h" | 9 #include "ppapi/c/dev/ppb_font_dev.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 if (!dispatcher) | 58 if (!dispatcher) |
59 return PP_MakeUndefined(); | 59 return PP_MakeUndefined(); |
60 | 60 |
61 // Assume the font families don't change, so we can cache the result globally. | 61 // Assume the font families don't change, so we can cache the result globally. |
62 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); | 62 CR_DEFINE_STATIC_LOCAL(std::string, families, ()); |
63 if (families.empty()) { | 63 if (families.empty()) { |
64 dispatcher->SendToBrowser( | 64 dispatcher->SendToBrowser( |
65 new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); | 65 new PpapiHostMsg_PPBFont_GetFontFamilies(&families)); |
66 } | 66 } |
67 | 67 |
68 return StringVar::StringToPPVar(0, families); | 68 return StringVar::StringToPPVar(families); |
69 } | 69 } |
70 | 70 |
71 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { | 71 bool PPB_Font_Proxy::OnMessageReceived(const IPC::Message& msg) { |
72 // There aren't any font messages. | 72 // There aren't any font messages. |
73 NOTREACHED(); | 73 NOTREACHED(); |
74 return false; | 74 return false; |
75 } | 75 } |
76 | 76 |
77 Font::Font(const HostResource& resource, | 77 Font::Font(const HostResource& resource, |
78 const PP_FontDescription_Dev& desc) | 78 const PP_FontDescription_Dev& desc) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 PP_Bool result = PP_FALSE; | 114 PP_Bool result = PP_FALSE; |
115 if (font_forwarding_) { | 115 if (font_forwarding_) { |
116 RunOnWebKitThread(true, | 116 RunOnWebKitThread(true, |
117 base::Bind(&WebKitForwarding::Font::Describe, | 117 base::Bind(&WebKitForwarding::Font::Describe, |
118 base::Unretained(font_forwarding_), | 118 base::Unretained(font_forwarding_), |
119 &webkit_event_, description, &face, metrics, | 119 &webkit_event_, description, &face, metrics, |
120 &result)); | 120 &result)); |
121 } | 121 } |
122 | 122 |
123 if (PP_ToBool(result)) | 123 if (PP_ToBool(result)) |
124 description->face = StringVar::StringToPPVar(0, face); | 124 description->face = StringVar::StringToPPVar(face); |
125 else | 125 else |
126 description->face = PP_MakeUndefined(); | 126 description->face = PP_MakeUndefined(); |
127 return result; | 127 return result; |
128 } | 128 } |
129 | 129 |
130 PP_Bool Font::DrawTextAt(PP_Resource pp_image_data, | 130 PP_Bool Font::DrawTextAt(PP_Resource pp_image_data, |
131 const PP_TextRun_Dev* text, | 131 const PP_TextRun_Dev* text, |
132 const PP_Point* position, | 132 const PP_Point* position, |
133 uint32_t color, | 133 uint32_t color, |
134 const PP_Rect* clip, | 134 const PP_Rect* clip, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 webkit_event_.Wait(); | 219 webkit_event_.Wait(); |
220 } | 220 } |
221 | 221 |
222 // static | 222 // static |
223 void Font::DeleteFontForwarding(WebKitForwarding::Font* font_forwarding) { | 223 void Font::DeleteFontForwarding(WebKitForwarding::Font* font_forwarding) { |
224 delete font_forwarding; | 224 delete font_forwarding; |
225 } | 225 } |
226 | 226 |
227 } // namespace proxy | 227 } // namespace proxy |
228 } // namespace ppapi | 228 } // namespace ppapi |
OLD | NEW |